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

Subversion Repositories mini_aes

[/] [mini_aes/] [trunk/] [source/] [xtime.vhdl] - Blame information for rev 21

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

Line No. Rev Author Line
1 21 arif_endro
-- ------------------------------------------------------------------------
2 15 arif_endro
-- Copyright (C) 2005 Arif Endro Nugroho
3 21 arif_endro
-- All rights reserved.
4 2 arif_endro
-- 
5 21 arif_endro
-- Redistribution and use in source and binary forms, with or without
6
-- modification, are permitted provided that the following conditions
7
-- are met:
8 2 arif_endro
-- 
9 21 arif_endro
-- 1. Redistributions of source code must retain the above copyright
10
--    notice, this list of conditions and the following disclaimer.
11
-- 2. Redistributions in binary form must reproduce the above copyright
12
--    notice, this list of conditions and the following disclaimer in the
13
--    documentation and/or other materials provided with the distribution.
14
-- 3. The name of Arif Endro Nugroho may not be used to endorse or promote
15
--    products derived from this software without specific prior written
16
--    permission.
17 2 arif_endro
-- 
18 21 arif_endro
-- THIS SOFTWARE IS PROVIDED BY ARIF ENDRO NUGROHO "AS IS" AND ANY EXPRESS
19
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
-- DISCLAIMED. IN NO EVENT SHALL ARIF ENDRO NUGROHO BE LIABLE FOR ANY
22
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24
-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
-- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27
-- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
-- POSSIBILITY OF SUCH DAMAGE.
29 2 arif_endro
-- 
30 21 arif_endro
-- End Of License.
31
-- ------------------------------------------------------------------------
32 2 arif_endro
 
33
library ieee;
34
use ieee.std_logic_1164.all;
35
 
36
package xtime_pkg is
37
 
38
  function xtime_2 ( b : std_logic_vector ) return std_logic_vector;
39
  function xtime_4 ( c : std_logic_vector ) return std_logic_vector;
40
  function xtime_8 ( d : std_logic_vector ) return std_logic_vector;
41
 
42
end xtime_pkg;
43
 
44
package body xtime_pkg is
45
 
46
  function xtime_2   ( b : std_logic_vector ) return std_logic_vector is
47
     variable xtime_2_v  : std_logic_vector (07 downto 00) := ( B"0000_0000" );
48
     begin
49
        xtime_2_v := (  b(6 downto 4)                     -- 7,6,5
50
                     & (b(3 downto 2) xor (b(7) & b(7)))  -- 4,3
51
                     &  b(1)                              -- 2
52
                     & (b(0) xor b(7))                    -- 1
53
                     &  b(7));                            -- 0
54
     return xtime_2_v;
55
  end xtime_2;
56
 
57
  function xtime_4  ( c : std_logic_vector ) return std_logic_vector is
58
     variable xtime_4_v : std_logic_vector (07 downto 00) := ( B"0000_0000" );
59
     begin
60
        xtime_4_v := (  c(5)                             -- 7
61
                     &  c(4)                             -- 6
62
                     & (c(3) xor c(7))                   -- 5
63
                     & (c(2) xor c(7) xor c(6))          -- 4
64
                     & (c(1) xor c(6))                   -- 3
65
                     & (c(0) xor c(7))                   -- 2
66
                     & (c(7) xor c(6))                   -- 1
67
                     &  c(6));                           --
68
     return xtime_4_v;
69
  end xtime_4;
70
 
71
  function xtime_8  ( d : std_logic_vector ) return std_logic_vector is
72
     variable xtime_8_v : std_logic_vector (07 downto 00) := ( B"0000_0000" );
73
     begin
74
        xtime_8_v := (  d(4)                            -- 7
75
                     & (d(3) xor d(7))                  -- 6
76
                     & (d(2) xor d(7) xor d(6))         -- 5
77
                     & (d(1) xor d(6) xor d(5))         -- 4
78
                     & (d(0) xor d(7) xor d(5))         -- 3
79
                     & (d(7) xor d(6))                  -- 2
80
                     & (d(6) xor d(5))                  -- 1
81
                     &  d(5));                          -- 0
82
     return xtime_8_v;
83
  end xtime_8;
84
 
85
end xtime_pkg;

powered by: WebSVN 2.1.0

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