forked from MingChen91/CS305_Flappybird
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LSFR.vhd
38 lines (34 loc) · 775 Bytes
/
LSFR.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity lsfr is
port (
clk : in std_logic;
q: out std_logic_vector (7 downto 0)
);
end entity lsfr;
architecture behaviour of lsfr is
constant seed : std_logic_vector (7 downto 0) := "00111000";
signal q0 : std_logic := seed(0);
signal q1 : std_logic := seed(1);
signal q2 : std_logic := seed(2);
signal q3 : std_logic := seed(3);
signal q4 : std_logic := seed(4);
signal q5 : std_logic := seed(5);
signal q6 : std_logic := seed(6);
signal q7 : std_logic := seed(7);
begin
process
begin
wait until clk'event and clk='1';
q0<=q7;
q1<=q0;
q2<=q1 xor q7;
q3<=q2 xor q7;
q4<=q3 xor q7;
q5<=q4;
q6<=q5;
q7<=q6;
end process;
q<=q7&q6&q5&q4&q3&q2&q1&q0;
end architecture;