-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgalois.vhd
36 lines (30 loc) · 914 Bytes
/
galois.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
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.all;
USE IEEE.STD_LOGIC_ARITH.all;
USE IEEE.STD_LOGIC_SIGNED.all;
entity galois is
port
(
clk : in std_logic;
reset : in std_logic;
output : out std_logic_vector(8 downto 0)
--enable : in STD_LOGIC
);
end galois;
architecture behaviour of galois is
signal rand: STD_LOGIC_VECTOR(7 downto 0) := "01010101";
begin
process(clk, reset)
variable temp : STD_LOGIC := '0';
begin
if (rising_edge(clk)) then
if (reset = '1') then
rand <= "10101010";
else -- elsif(enable = '1')
temp := rand(6) XOR rand(4) XOR rand(3) XOR rand(2) XOR rand(0);
rand <= temp & rand(7 downto 1);
end if;
end if;
end process;
output <= ('0' & rand) + CONV_STD_LOGIC_VECTOR(100, 9);
end behaviour;