-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathkeccak_nonlinear.vhd
75 lines (42 loc) · 1.4 KB
/
keccak_nonlinear.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
--
-- Copyright (c) 2018 Allmine Inc
--
library work;
use work.keccak_globals.all;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
entity keccak_nonlinear is
port (
state_in : in k_state_type;
state_out : out k_state_type);
end keccak_nonlinear;
architecture rtl of keccak_nonlinear is
----------------------------------------------------------------------------
-- Internal signal declarations
----------------------------------------------------------------------------
signal chi_in,chi_out,iota_in,iota_out : k_state_type;
begin -- Rtl
--connecitons
--order theta, pi, rho, chi, iota
chi_in<=state_in;
state_out<=chi_out;
--chi
i0000: for y in 0 to 4 generate
i0001: for x in 0 to 2 generate
i0002: for i in 0 to 63 generate
chi_out(y)(x)(i)<=chi_in(y)(x)(i) xor ( not(chi_in (y)(x+1)(i))and chi_in (y)(x+2)(i));
end generate;
end generate;
end generate;
i0011: for y in 0 to 4 generate
i0021: for i in 0 to 63 generate
chi_out(y)(3)(i)<=chi_in(y)(3)(i) xor ( not(chi_in (y)(4)(i))and chi_in (y)(0)(i));
end generate;
end generate;
i0012: for y in 0 to 4 generate
i0022: for i in 0 to 63 generate
chi_out(y)(4)(i)<=chi_in(y)(4)(i) xor ( not(chi_in (y)(0)(i))and chi_in (y)(1)(i));
end generate;
end generate;
end rtl;