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 |
|
|
library IEEE;
|
18 |
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
19 |
|
|
|
20 |
|
|
entity shift_xor_128 is
|
21 |
|
|
port(clk : in std_logic;
|
22 |
|
|
a : in std_logic_vector(162 downto 0);
|
23 |
|
|
m : in std_logic_vector(162 downto 0);
|
24 |
|
|
c : out std_logic_vector(162 downto 0));
|
25 |
|
|
end shift_xor_128;
|
26 |
|
|
|
27 |
|
|
architecture Behavioral of shift_xor_128 is
|
28 |
|
|
|
29 |
|
|
component dsp_xor is
|
30 |
|
|
port (clk : in std_logic;
|
31 |
|
|
op_1 : in std_logic_vector(47 downto 0);
|
32 |
|
|
op_2 : in std_logic_vector(47 downto 0);
|
33 |
|
|
op_3 : out std_logic_vector(47 downto 0));
|
34 |
|
|
end component;
|
35 |
|
|
|
36 |
|
|
signal op_1_s : std_logic_vector(162 downto 0);
|
37 |
|
|
|
38 |
|
|
signal r_0_s : std_logic_vector(47 downto 0);
|
39 |
|
|
signal r_1_s : std_logic_vector(47 downto 0);
|
40 |
|
|
signal r_2_s : std_logic_vector(47 downto 0);
|
41 |
|
|
signal r_3_s : std_logic_vector(47 downto 0);
|
42 |
|
|
|
43 |
|
|
signal xor_in_aux_0_s : std_logic_vector(47 downto 0);
|
44 |
|
|
signal xor_in_aux_1_s : std_logic_vector(47 downto 0);
|
45 |
|
|
signal xor_out_aux_s : std_logic_vector(47 downto 0);
|
46 |
|
|
|
47 |
|
|
begin
|
48 |
|
|
|
49 |
|
|
process(a, m, op_1_s, r_3_s, r_2_s, r_1_s, r_0_s)
|
50 |
|
|
begin
|
51 |
|
|
if a(162) = '1' then
|
52 |
|
|
c <= r_3_s(47 downto 29) & r_2_s & r_1_s & r_0_s;
|
53 |
|
|
else
|
54 |
|
|
c <= op_1_s;
|
55 |
|
|
end if;
|
56 |
|
|
end process;
|
57 |
|
|
|
58 |
|
|
op_1_s <= a(161 downto 0) & '0';
|
59 |
|
|
|
60 |
|
|
DSP_XOR_0 : dsp_xor port map (clk, op_1_s(47 downto 0), m(47 downto 0), r_0_s);
|
61 |
|
|
DSP_XOR_1 : dsp_xor port map (clk, op_1_s(95 downto 48), m(95 downto 48), r_1_s);
|
62 |
|
|
DSP_XOR_2 : dsp_xor port map (clk, op_1_s(143 downto 96), m(143 downto 96), r_2_s);
|
63 |
|
|
|
64 |
|
|
xor_in_aux_0_s <= op_1_s(162 downto 134) & "0000000000000000000";
|
65 |
|
|
xor_in_aux_1_s <= m(162 downto 134) & "0000000000000000000";
|
66 |
|
|
|
67 |
|
|
DSP_XOR_3 : dsp_xor port map (clk, xor_in_aux_0_s, xor_in_aux_1_s, r_3_s);
|
68 |
|
|
|
69 |
|
|
end Behavioral;
|
70 |
|
|
|