OpenCores
URL https://opencores.org/ocsvn/camellia-vhdl/camellia-vhdl/trunk

Subversion Repositories camellia-vhdl

[/] [camellia-vhdl/] [trunk/] [looping/] [camellia.vhd] - Blame information for rev 6

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 pfulgoni
 
2
--------------------------------------------------------------------------------
3
-- Designer:      Paolo Fulgoni <pfulgoni@opencores.org>
4
--
5
-- Create Date:   02/01/2008
6 4 pfulgoni
-- Last Update:   03/28/2008
7 3 pfulgoni
-- Project Name:  camellia-vhdl
8
-- Description:   Looping version of Camellia
9
--
10
-- Copyright (C) 2008  Paolo Fulgoni
11
-- This file is part of camellia-vhdl.
12
-- camellia-vhdl is free software; you can redistribute it and/or modify
13
-- it under the terms of the GNU General Public License as published by
14
-- the Free Software Foundation; either version 3 of the License, or
15
-- (at your option) any later version.
16
-- camellia-vhdl is distributed in the hope that it will be useful,
17
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
18
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
-- GNU General Public License for more details.
20
-- You should have received a copy of the GNU General Public License
21
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
--
23
-- The Camellia cipher algorithm is 128 bit cipher developed by NTT and
24
-- Mitsubishi Electric researchers.
25
-- http://info.isl.ntt.co.jp/crypt/eng/camellia/
26
--------------------------------------------------------------------------------
27
library IEEE;
28
use IEEE.std_logic_1164.all;
29
 
30
entity camellia is
31
    port    (
32
            clk        : in  STD_LOGIC;
33
            reset      : in  STD_LOGIC;
34 4 pfulgoni
 
35 3 pfulgoni
            data_in    : in  STD_LOGIC_VECTOR (0 to 127);
36 4 pfulgoni
            enc_dec    : in  STD_LOGIC;
37
            data_rdy   : in  STD_LOGIC;
38
            data_acq   : out STD_LOGIC;
39
 
40 3 pfulgoni
            key        : in  STD_LOGIC_VECTOR (0 to 255);
41
            k_len      : in  STD_LOGIC_VECTOR (0 to 1);
42 4 pfulgoni
            key_rdy    : in  STD_LOGIC;
43
            key_acq    : out STD_LOGIC;
44
 
45
            data_out   : out STD_LOGIC_VECTOR (0 to 127);
46
            output_rdy : out STD_LOGIC
47 6 pfulgoni
 
48
            -- post-synthesis debug
49
 
50
 
51 3 pfulgoni
            );
52
end camellia;
53
 
54
architecture RTL of camellia is
55 4 pfulgoni
 
56
    signal s_clk        : STD_LOGIC;
57
    signal s_reset      : STD_LOGIC;
58
    signal s_data_in    : STD_LOGIC_VECTOR (0 to 127);
59
    signal s_enc_dec    : STD_LOGIC;
60
    signal s_data_rdy   : STD_LOGIC;
61
    signal s_data_acq   : STD_LOGIC;
62
    signal s_key_in     : STD_LOGIC_VECTOR (0 to 255);
63
    signal s_k_len      : STD_LOGIC_VECTOR (0 to 1);
64
    signal s_key_rdy    : STD_LOGIC;
65
    signal s_key_acq    : STD_LOGIC;
66
    signal s_data_to    : STD_LOGIC_VECTOR (0 to 127);
67
    signal s_output_rdy : STD_LOGIC;
68
    signal s_k1         : STD_LOGIC_VECTOR (0 to 63);
69
    signal s_k2         : STD_LOGIC_VECTOR (0 to 63);
70
    signal s_newdata    : STD_LOGIC;
71
    signal s_sel        : STD_LOGIC;
72
    signal s_pre_xor    : STD_LOGIC_VECTOR (0 to 127);
73
    signal s_post_xor   : STD_LOGIC_VECTOR (0 to 127);
74
    signal s_data_from  : STD_LOGIC_VECTOR (0 to 127);
75 3 pfulgoni
 
76
    component datapath is
77
        port    (
78
                clk      : in STD_LOGIC;
79
                reset    : in STD_LOGIC;
80
                data_in  : in STD_LOGIC_VECTOR (0 to 127);
81
                k1       : in STD_LOGIC_VECTOR (0 to 63);
82
                k2       : in STD_LOGIC_VECTOR (0 to 63);
83
                newdata  : in STD_LOGIC;
84
                sel      : in STD_LOGIC;
85
                pre_xor  : in STD_LOGIC_VECTOR (0 to 127);
86
                post_xor : in STD_LOGIC_VECTOR (0 to 127);
87
                data_out : out STD_LOGIC_VECTOR (0 to 127)
88
                );
89
    end component;
90
 
91
    component control is
92
        port    (
93
                clk        : in  STD_LOGIC;
94
                reset      : in  STD_LOGIC;
95
                data_in    : in  STD_LOGIC_VECTOR (0 to 127);
96 4 pfulgoni
                enc_dec    : in  STD_LOGIC;
97
                data_rdy   : in  STD_LOGIC;
98
                data_acq   : out STD_LOGIC;
99 3 pfulgoni
                key_in     : in  STD_LOGIC_VECTOR (0 to 255);
100
                k_len      : in  STD_LOGIC_VECTOR (0 to 1);
101 4 pfulgoni
                key_rdy    : in  STD_LOGIC;
102
                key_acq    : out STD_LOGIC;
103 3 pfulgoni
                data_to    : out STD_LOGIC_VECTOR (0 to 127);
104 4 pfulgoni
                output_rdy : out STD_LOGIC;
105 3 pfulgoni
                k1         : out STD_LOGIC_VECTOR (0 to 63);
106
                k2         : out STD_LOGIC_VECTOR (0 to 63);
107
                newdata    : out STD_LOGIC;
108
                sel        : out STD_LOGIC;
109
                pre_xor    : out STD_LOGIC_VECTOR (0 to 127);
110
                post_xor   : out STD_LOGIC_VECTOR (0 to 127);
111
                data_from  : in  STD_LOGIC_VECTOR (0 to 127)
112
                );
113
    end component;
114
 
115
begin
116
 
117
    DP   : datapath
118
        port map(
119
                clk      => s_clk,
120
                reset    => s_reset,
121
                data_in  => s_data_to,
122
                k1       => s_k1,
123
                k2       => s_k2,
124
                newdata  => s_newdata,
125
                sel      => s_sel,
126
                pre_xor  => s_pre_xor,
127
                post_xor => s_post_xor,
128
                data_out => s_data_from
129
        );
130
 
131
    CTRL : control
132
        port map(
133
                clk        => s_clk,
134
                reset      => s_reset,
135
                data_in    => s_data_in,
136 4 pfulgoni
                enc_dec    => s_enc_dec,
137
                data_rdy   => s_data_rdy,
138
                data_acq   => s_data_acq,
139 3 pfulgoni
                key_in     => s_key_in,
140
                k_len      => s_k_len,
141 4 pfulgoni
                key_rdy    => s_key_rdy,
142
                key_acq    => s_key_acq,
143 3 pfulgoni
                data_to    => s_data_to,
144 4 pfulgoni
                output_rdy => s_output_rdy,
145 3 pfulgoni
                k1         => s_k1,
146
                k2         => s_k2,
147
                newdata    => s_newdata,
148
                sel        => s_sel,
149
                pre_xor    => s_pre_xor,
150
                post_xor   => s_post_xor,
151
                data_from  => s_data_from
152
        );
153
 
154
    s_clk       <= clk;
155
    s_reset     <= reset;
156
    s_data_in   <= data_in;
157 4 pfulgoni
    s_enc_dec   <= enc_dec;
158
    s_data_rdy  <= data_rdy;
159 3 pfulgoni
    s_key_in    <= key;
160
    s_k_len     <= k_len;
161 4 pfulgoni
    s_key_rdy   <= key_rdy;
162
 
163
    data_acq    <= s_data_acq;
164
    key_acq     <= s_key_acq;
165 3 pfulgoni
    data_out    <= s_data_from(64 to 127) & s_data_from(0 to 63);
166 4 pfulgoni
    output_rdy  <= s_output_rdy;
167 3 pfulgoni
 
168
end RTL;

powered by: WebSVN 2.1.0

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