A
Aji
Guest
Hi,
I first started innocently with :
library IEEE;
use IEEE.Std_Logic_1164.all;
architecture LFSR of BitGen is
begin
process
variable R : Std_logic_Vector(31 downto 0):= X"00000001";
variable X : Std_logic;
begin
end if;
wait until Clk='1' and not Clk'stable;
X := (R(31) xor R(6) xor R(5) xor R(2) xor R(0));
R := R(30 downto 0) & X ;
b <= X;
end process;
end LFSR;
Then I realized that my register with initialized with 0 instead of 1. So I
changed it with :
library IEEE;
use IEEE.Std_Logic_1164.all;
architecture LFSR of BitGen is
begin
process
variable R : Std_logic_Vector(31 downto 0):= Seed;
variable X : Std_logic;
begin
if R=X"00000000" then
R := X"00000001";
end if;
wait until Clk='1' and not Clk'stable;
X := (R(31) xor R(6) xor R(5) xor R(2) xor R(0));
R := R(30 downto 0) & X ;
b <= X;
end process;
end LFSR;
Is it a common way to initialize registers ? what about using a reset signal
and a read into memory ? Are there common practices or it just depends on
the design requirements (memory and logic available) ?
I first started innocently with :
library IEEE;
use IEEE.Std_Logic_1164.all;
architecture LFSR of BitGen is
begin
process
variable R : Std_logic_Vector(31 downto 0):= X"00000001";
variable X : Std_logic;
begin
end if;
wait until Clk='1' and not Clk'stable;
X := (R(31) xor R(6) xor R(5) xor R(2) xor R(0));
R := R(30 downto 0) & X ;
b <= X;
end process;
end LFSR;
Then I realized that my register with initialized with 0 instead of 1. So I
changed it with :
library IEEE;
use IEEE.Std_Logic_1164.all;
architecture LFSR of BitGen is
begin
process
variable R : Std_logic_Vector(31 downto 0):= Seed;
variable X : Std_logic;
begin
if R=X"00000000" then
R := X"00000001";
end if;
wait until Clk='1' and not Clk'stable;
X := (R(31) xor R(6) xor R(5) xor R(2) xor R(0));
R := R(30 downto 0) & X ;
b <= X;
end process;
end LFSR;
Is it a common way to initialize registers ? what about using a reset signal
and a read into memory ? Are there common practices or it just depends on
the design requirements (memory and logic available) ?