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

Subversion Repositories camellia

[/] [camellia/] [web_uploads/] [CAMELLIA_CORE.vhd] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 root
-- Camellia Algorithm Implementation
2
-- file: camellia_core.vhd (top level)
3
-- Ahmad Rifqi H (13200013)
4
-- 2004/April/28
5
-- Created      for under graduate  final project       
6
 
7
LIBRARY ieee;
8
USE ieee.std_logic_1164.all;
9
USE ieee.std_logic_arith.all;
10
USE work.CAMELLIA_package.all;
11
 
12
ENTITY CAMELLIA_core IS
13
PORT(  INPUT            : IN   type_128bit;
14
       INV              : in     STD_LOGIC;
15
       clock     : IN    std_logic;
16
       reset     : IN    std_logic;
17
       key_ready         : IN    std_logic;
18
       input_ready : IN  std_logic;
19
       proc      : IN    std_logic;
20
 
21
       DATA_OUTPUT : OUT  type_128bit;
22
       out_ready         : OUT   std_logic
23
       );
24
 
25
-- Declarations
26
 
27
END CAMELLIA_core ;
28
ARCHITECTURE struct OF CAMELLIA_core IS
29
SIGNAL  OUTPUT_BUFF,OUTPUT_BUFF1: type_128bit;
30
SIGNAL  DATA_INPUT_buff,KEY_INPUT_buff: type_128bit;
31
SIGNAL  out_readybuff,out_readybuff1    : std_logic ;
32
  COMPONENT encrypt_decrypt
33
     PORT(  data_in     : IN   type_128bit;
34
            key_in      : IN   type_128bit;
35
            data_out    : OUT  type_128bit;
36
            clock               : IN     std_logic;
37
            reset               : IN     std_logic;
38
            key_ready   : IN     std_logic;
39
            input_ready : IN     std_logic;
40
            out_ready   : OUT    std_logic;
41
            INV         : IN     std_logic
42
          );
43
    END COMPONENT;
44
 
45
begin
46
 
47
C1:  encrypt_decrypt
48
     port map(
49
       data_in  => DATA_INPUT_buff,
50
       key_in   => KEY_INPUT_buff,
51
       data_out         => OUTPUT_BUFF,
52
       clock    => clock,
53
       reset    => reset,
54
       key_ready        => proc,
55
       input_ready => proc,
56
       out_ready        => out_readybuff,
57
       INV              => INV
58
        );
59
 
60
  out_ready     <= out_readybuff1;
61
  DATA_OUTPUT   <= OUTPUT_BUFF1;
62
 
63
PROCESS (reset,CLOCK)
64
     BEGIN
65
     IF (cLock'event and cLock='1' ) THEN
66
          if (reset='1') then
67
            OUTPUT_BUFF1 <= sigma(6)&sigma(6);
68
            out_readybuff1 <='0';
69
            KEY_INPUT_buff <= sigma(6)&sigma(6);
70
            DATA_INPUT_buff <= sigma(6)&sigma(6);
71
 
72
          else
73
 
74
            IF key_ready='1' THEN        -- Read key input
75
               KEY_INPUT_buff <= INPUT;
76
 
77
            ELSE
78
                 KEY_INPUT_buff <= KEY_INPUT_buff;
79
            END IF ;
80
 
81
            IF input_ready='1' THEN      --Read data input
82
               DATA_INPUT_buff <= INPUT;
83
            ELSE  DATA_INPUT_buff <= DATA_INPUT_buff;
84
            END IF ;
85
 
86
            IF out_readybuff ='1' THEN    -- output
87
              OUTPUT_BUFF1 <= OUTPUT_BUFF;
88
            ELSE  OUTPUT_BUFF1 <= OUTPUT_BUFF1;
89
            END IF ;
90
 
91
            out_readybuff1 <= out_readybuff;
92
                end if;
93
     END IF ;
94
 
95
 
96
END PROCESS;
97
END struct;
98
 
99
 
100
 
101
 
102
 
103
 
104
 

powered by: WebSVN 2.1.0

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