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 4

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 3 pfulgoni
            );
48
end camellia;
49
 
50
architecture RTL of camellia is
51 4 pfulgoni
 
52
    signal s_clk        : STD_LOGIC;
53
    signal s_reset      : STD_LOGIC;
54
    signal s_data_in    : STD_LOGIC_VECTOR (0 to 127);
55
    signal s_enc_dec    : STD_LOGIC;
56
    signal s_data_rdy   : STD_LOGIC;
57
    signal s_data_acq   : STD_LOGIC;
58
    signal s_key_in     : STD_LOGIC_VECTOR (0 to 255);
59
    signal s_k_len      : STD_LOGIC_VECTOR (0 to 1);
60
    signal s_key_rdy    : STD_LOGIC;
61
    signal s_key_acq    : STD_LOGIC;
62
    signal s_data_to    : STD_LOGIC_VECTOR (0 to 127);
63
    signal s_output_rdy : STD_LOGIC;
64
    signal s_k1         : STD_LOGIC_VECTOR (0 to 63);
65
    signal s_k2         : STD_LOGIC_VECTOR (0 to 63);
66
    signal s_newdata    : STD_LOGIC;
67
    signal s_sel        : STD_LOGIC;
68
    signal s_pre_xor    : STD_LOGIC_VECTOR (0 to 127);
69
    signal s_post_xor   : STD_LOGIC_VECTOR (0 to 127);
70
    signal s_data_from  : STD_LOGIC_VECTOR (0 to 127);
71 3 pfulgoni
 
72
    component datapath is
73
        port    (
74
                clk      : in STD_LOGIC;
75
                reset    : in STD_LOGIC;
76
                data_in  : in STD_LOGIC_VECTOR (0 to 127);
77
                k1       : in STD_LOGIC_VECTOR (0 to 63);
78
                k2       : in STD_LOGIC_VECTOR (0 to 63);
79
                newdata  : in STD_LOGIC;
80
                sel      : in STD_LOGIC;
81
                pre_xor  : in STD_LOGIC_VECTOR (0 to 127);
82
                post_xor : in STD_LOGIC_VECTOR (0 to 127);
83
                data_out : out STD_LOGIC_VECTOR (0 to 127)
84
                );
85
    end component;
86
 
87
    component control is
88
        port    (
89
                clk        : in  STD_LOGIC;
90
                reset      : in  STD_LOGIC;
91
                data_in    : in  STD_LOGIC_VECTOR (0 to 127);
92 4 pfulgoni
                enc_dec    : in  STD_LOGIC;
93
                data_rdy   : in  STD_LOGIC;
94
                data_acq   : out STD_LOGIC;
95 3 pfulgoni
                key_in     : in  STD_LOGIC_VECTOR (0 to 255);
96
                k_len      : in  STD_LOGIC_VECTOR (0 to 1);
97 4 pfulgoni
                key_rdy    : in  STD_LOGIC;
98
                key_acq    : out STD_LOGIC;
99 3 pfulgoni
                data_to    : out STD_LOGIC_VECTOR (0 to 127);
100 4 pfulgoni
                output_rdy : out STD_LOGIC;
101 3 pfulgoni
                k1         : out STD_LOGIC_VECTOR (0 to 63);
102
                k2         : out STD_LOGIC_VECTOR (0 to 63);
103
                newdata    : out STD_LOGIC;
104
                sel        : out STD_LOGIC;
105
                pre_xor    : out STD_LOGIC_VECTOR (0 to 127);
106
                post_xor   : out STD_LOGIC_VECTOR (0 to 127);
107
                data_from  : in  STD_LOGIC_VECTOR (0 to 127)
108
                );
109
    end component;
110
 
111
begin
112
 
113
    DP   : datapath
114
        port map(
115
                clk      => s_clk,
116
                reset    => s_reset,
117
                data_in  => s_data_to,
118
                k1       => s_k1,
119
                k2       => s_k2,
120
                newdata  => s_newdata,
121
                sel      => s_sel,
122
                pre_xor  => s_pre_xor,
123
                post_xor => s_post_xor,
124
                data_out => s_data_from
125
        );
126
 
127
    CTRL : control
128
        port map(
129
                clk        => s_clk,
130
                reset      => s_reset,
131
                data_in    => s_data_in,
132 4 pfulgoni
                enc_dec    => s_enc_dec,
133
                data_rdy   => s_data_rdy,
134
                data_acq   => s_data_acq,
135 3 pfulgoni
                key_in     => s_key_in,
136
                k_len      => s_k_len,
137 4 pfulgoni
                key_rdy    => s_key_rdy,
138
                key_acq    => s_key_acq,
139 3 pfulgoni
                data_to    => s_data_to,
140 4 pfulgoni
                output_rdy => s_output_rdy,
141 3 pfulgoni
                k1         => s_k1,
142
                k2         => s_k2,
143
                newdata    => s_newdata,
144
                sel        => s_sel,
145
                pre_xor    => s_pre_xor,
146
                post_xor   => s_post_xor,
147
                data_from  => s_data_from
148
        );
149
 
150
    s_clk       <= clk;
151
    s_reset     <= reset;
152
    s_data_in   <= data_in;
153 4 pfulgoni
    s_enc_dec   <= enc_dec;
154
    s_data_rdy  <= data_rdy;
155 3 pfulgoni
    s_key_in    <= key;
156
    s_k_len     <= k_len;
157 4 pfulgoni
    s_key_rdy   <= key_rdy;
158
 
159
    data_acq    <= s_data_acq;
160
    key_acq     <= s_key_acq;
161 3 pfulgoni
    data_out    <= s_data_from(64 to 127) & s_data_from(0 to 63);
162 4 pfulgoni
    output_rdy  <= s_output_rdy;
163 3 pfulgoni
 
164
end RTL;

powered by: WebSVN 2.1.0

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