OpenCores
URL https://opencores.org/ocsvn/noekeoncore/noekeoncore/trunk

Subversion Repositories noekeoncore

[/] [noekeoncore/] [trunk/] [rtl/] [theta.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
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 theta is
21
        port(clk : in std_logic;
22
 
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
             k_0_in : in std_logic_vector(31 downto 0);
29
             k_1_in : in std_logic_vector(31 downto 0);
30
             k_2_in : in std_logic_vector(31 downto 0);
31
             k_3_in : in std_logic_vector(31 downto 0);
32
 
33
             a_0_out : out std_logic_vector(31 downto 0);
34
             a_1_out : out std_logic_vector(31 downto 0);
35
             a_2_out : out std_logic_vector(31 downto 0);
36
             a_3_out : out std_logic_vector(31 downto 0));
37
end theta;
38
 
39
architecture Behavioral of theta is
40
 
41
        component t_m_1 is
42
        port(clk : in std_logic;
43
                  a_0_in : in std_logic_vector(31 downto 0);
44
                  a_1_in : in std_logic_vector(31 downto 0);
45
                  a_2_in : in std_logic_vector(31 downto 0);
46
                  a_3_in : in std_logic_vector(31 downto 0);
47
                  a_1_out : out std_logic_vector(31 downto 0);
48
                  a_3_out : out std_logic_vector(31 downto 0));
49
        end component;
50
 
51
        component t_m_2 is
52
        port(clk : in std_logic;
53
                  a_0_in : in std_logic_vector(31 downto 0);
54
                  a_1_in : in std_logic_vector(31 downto 0);
55
             a_2_in : in std_logic_vector(31 downto 0);
56
                  a_3_in : in std_logic_vector(31 downto 0);
57
                  k_0_in : in std_logic_vector(31 downto 0);
58
                  k_1_in : in std_logic_vector(31 downto 0);
59
             k_2_in : in std_logic_vector(31 downto 0);
60
                  k_3_in : in std_logic_vector(31 downto 0);
61
                  a_0_out : out std_logic_vector(31 downto 0);
62
                  a_1_out : out std_logic_vector(31 downto 0);
63
             a_2_out : out std_logic_vector(31 downto 0);
64
                  a_3_out : out std_logic_vector(31 downto 0));
65
        end component;
66
 
67
        component t_m_3 is
68
        port(clk : in std_logic;
69
                  a_0_in : in std_logic_vector(31 downto 0);
70
                  a_1_in : in std_logic_vector(31 downto 0);
71
                  a_2_in : in std_logic_vector(31 downto 0);
72
                  a_3_in : in std_logic_vector(31 downto 0);
73
                  a_0_out : out std_logic_vector(31 downto 0);
74
                  a_2_out : out std_logic_vector(31 downto 0));
75
        end component;
76
 
77
        signal a_1_0_s : std_logic_vector(31 downto 0);
78
        signal a_3_0_s : std_logic_vector(31 downto 0);
79
 
80
        signal tmp_0_s : std_logic_vector(31 downto 0);
81
        signal tmp_1_s : std_logic_vector(31 downto 0);
82
        signal tmp_2_s : std_logic_vector(31 downto 0);
83
        signal tmp_3_s : std_logic_vector(31 downto 0);
84
 
85
begin
86
 
87
        T_M_1_0 : t_m_1 port map (clk, a_0_in, a_1_in, a_2_in, a_3_in, a_1_0_s, a_3_0_s);
88
        T_M_2_0 : t_m_2 port map (clk, a_0_in, a_1_0_s, a_2_in, a_3_0_s, k_0_in, k_1_in, k_2_in, k_3_in, tmp_0_s, tmp_1_s, tmp_2_s, tmp_3_s);
89
        T_M_1_1 : t_m_3 port map (clk, tmp_0_s, tmp_1_s, tmp_2_s, tmp_3_s, a_0_out, a_2_out);
90
 
91
        a_1_out <= tmp_1_s;
92
        a_3_out <= tmp_3_s;
93
 
94
--Theta(k,a){
95
        -- temp = a[0]^a[2];                            tmp_0_s
96
        -- temp ^= temp>>>8 ^ temp<<<8;         tmp_1_s
97
        -- a[1] ^= temp;                                                tmp_2_s
98
        -- a[3] ^= temp;                                                tmp_3_s
99
 
100
        -- a[0] ^= k[0];                                                tmp_4_s
101
        -- a[1] ^= k[1];                                                tmp_5_s
102
        -- a[2] ^= k[2];                                                tmp_6_s
103
        -- a[3] ^= k[3];                                                tmp_7_s
104
 
105
        -- temp = a[1]^a[3]; 
106
        -- temp ^= temp>>>8 ^ temp<<<8;
107
 
108
        -- a[0] ^= temp;
109
        -- a[2] ^= temp;
110
--}
111
 
112
end Behavioral;
113
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.