1 |
2 |
entactogen |
|
2 |
|
|
-- Copyright (c) 2013 Antonio de la Piedra
|
3 |
|
|
|
4 |
|
|
-- This program is free software: you can redistribute it and/or modify
|
5 |
|
|
-- it under the terms of the GNU General Public License as published by
|
6 |
|
|
-- the Free Software Foundation, either version 3 of the License, or
|
7 |
|
|
-- (at your option) any later version.
|
8 |
|
|
|
9 |
|
|
-- This program is distributed in the hope that it will be useful,
|
10 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
|
|
-- GNU General Public License for more details.
|
13 |
|
|
|
14 |
|
|
-- You should have received a copy of the GNU General Public License
|
15 |
|
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
library IEEE;
|
19 |
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
20 |
|
|
|
21 |
|
|
entity gamma is
|
22 |
|
|
port(clk : in std_logic;
|
23 |
|
|
a_0_in : in std_logic_vector(31 downto 0);
|
24 |
|
|
a_1_in : in std_logic_vector(31 downto 0);
|
25 |
|
|
a_2_in : in std_logic_vector(31 downto 0);
|
26 |
|
|
a_3_in : in std_logic_vector(31 downto 0);
|
27 |
|
|
|
28 |
|
|
a_0_out : out std_logic_vector(31 downto 0);
|
29 |
|
|
a_1_out : out std_logic_vector(31 downto 0);
|
30 |
|
|
a_2_out : out std_logic_vector(31 downto 0);
|
31 |
|
|
a_3_out : out std_logic_vector(31 downto 0));
|
32 |
|
|
end gamma;
|
33 |
|
|
|
34 |
|
|
architecture Behavioral of gamma is
|
35 |
|
|
|
36 |
|
|
signal a_0_tmp_s : std_logic_vector(31 downto 0);
|
37 |
|
|
signal a_1_tmp_s : std_logic_vector(31 downto 0);
|
38 |
|
|
signal a_2_tmp_s : std_logic_vector(31 downto 0);
|
39 |
|
|
signal a_3_tmp_s : std_logic_vector(31 downto 0);
|
40 |
|
|
signal a_1_1_tmp_s : std_logic_vector(31 downto 0);
|
41 |
|
|
signal a_0_1_tmp_s : std_logic_vector(31 downto 0);
|
42 |
|
|
signal a_0_2_tmp_s : std_logic_vector(31 downto 0);
|
43 |
|
|
|
44 |
|
|
component g_m_1 is
|
45 |
|
|
port(clk : in std_logic;
|
46 |
|
|
a_1_in : in std_logic_vector(31 downto 0);
|
47 |
|
|
a_2_in : in std_logic_vector(31 downto 0);
|
48 |
|
|
a_3_in : in std_logic_vector(31 downto 0);
|
49 |
|
|
a_1_out : out std_logic_vector(31 downto 0));
|
50 |
|
|
end component;
|
51 |
|
|
|
52 |
|
|
component g_m_2 is
|
53 |
|
|
port(clk : in std_logic;
|
54 |
|
|
a_0_in : in std_logic_vector(31 downto 0);
|
55 |
|
|
a_1_in : in std_logic_vector(31 downto 0);
|
56 |
|
|
a_2_in : in std_logic_vector(31 downto 0);
|
57 |
|
|
a_0_out : out std_logic_vector(31 downto 0));
|
58 |
|
|
end component;
|
59 |
|
|
|
60 |
|
|
component g_m_3 is
|
61 |
|
|
port(clk : in std_logic;
|
62 |
|
|
a_0_in : in std_logic_vector(31 downto 0);
|
63 |
|
|
a_3_in : in std_logic_vector(31 downto 0);
|
64 |
|
|
a_0_out : out std_logic_vector(31 downto 0);
|
65 |
|
|
a_3_out : out std_logic_vector(31 downto 0));
|
66 |
|
|
end component;
|
67 |
|
|
|
68 |
|
|
component g_m_4 is
|
69 |
|
|
port(clk : in std_logic;
|
70 |
|
|
a_0_in : in std_logic_vector(31 downto 0);
|
71 |
|
|
a_1_in : in std_logic_vector(31 downto 0);
|
72 |
|
|
a_2_in : in std_logic_vector(31 downto 0);
|
73 |
|
|
a_3_in : in std_logic_vector(31 downto 0);
|
74 |
|
|
a_2_out : out std_logic_vector(31 downto 0));
|
75 |
|
|
end component;
|
76 |
|
|
|
77 |
|
|
component g_m_5 is
|
78 |
|
|
port(clk : in std_logic;
|
79 |
|
|
a_1_in : in std_logic_vector(31 downto 0);
|
80 |
|
|
a_2_in : in std_logic_vector(31 downto 0);
|
81 |
|
|
a_3_in : in std_logic_vector(31 downto 0);
|
82 |
|
|
a_1_out : out std_logic_vector(31 downto 0));
|
83 |
|
|
end component;
|
84 |
|
|
|
85 |
|
|
component g_m_6 is
|
86 |
|
|
port(clk : in std_logic;
|
87 |
|
|
a_0_in : in std_logic_vector(31 downto 0);
|
88 |
|
|
a_1_in : in std_logic_vector(31 downto 0);
|
89 |
|
|
a_2_in : in std_logic_vector(31 downto 0);
|
90 |
|
|
a_0_out : out std_logic_vector(31 downto 0));
|
91 |
|
|
end component;
|
92 |
|
|
|
93 |
|
|
begin
|
94 |
|
|
|
95 |
|
|
G_M_1_0 : g_m_1 port map (clk, a_1_in, a_2_in, a_3_in, a_1_tmp_s);
|
96 |
|
|
G_M_2_0 : g_m_2 port map (clk, a_0_in, a_1_tmp_s, a_2_in, a_0_tmp_s);
|
97 |
|
|
G_M_3_0 : g_m_3 port map (clk, a_0_tmp_s, a_3_in, a_0_1_tmp_s, a_3_tmp_s);
|
98 |
|
|
G_M_4_0 : g_m_4 port map (clk, a_0_1_tmp_s, a_1_tmp_s, a_2_in, a_3_tmp_s, a_2_tmp_s);
|
99 |
|
|
G_M_5_0 : g_m_5 port map (clk, a_1_tmp_s, a_2_tmp_s, a_3_tmp_s, a_1_1_tmp_s);
|
100 |
|
|
G_M_6_0 : g_m_6 port map (clk, a_0_1_tmp_s, a_1_1_tmp_s, a_2_tmp_s, a_0_2_tmp_s);
|
101 |
|
|
|
102 |
|
|
a_3_out <= a_3_tmp_s;
|
103 |
|
|
a_2_out <= a_2_tmp_s;
|
104 |
|
|
a_1_out <= a_1_1_tmp_s;
|
105 |
|
|
a_0_out <= a_0_2_tmp_s;
|
106 |
|
|
|
107 |
|
|
--Gamma(a){
|
108 |
|
|
--a[1] ^= ~a[3]&~a[2];
|
109 |
|
|
--a[0] ^= a[2]& a[1];
|
110 |
|
|
--tmp = a[3];
|
111 |
|
|
--a[3] = a[0];
|
112 |
|
|
--a[0] = tmp;
|
113 |
|
|
--a[2] ^= a[0]^a[1]^a[3];
|
114 |
|
|
--a[1] ^= ~a[3]&~a[2];
|
115 |
|
|
--a[0] ^= a[2]& a[1];
|
116 |
|
|
--}
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
end Behavioral;
|
120 |
|
|
|