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 22

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 2 arif_endro
-- 
15 21 arif_endro
-- THIS SOFTWARE IS PROVIDED BY ARIF ENDRO NUGROHO "AS IS" AND ANY EXPRESS
16
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
-- DISCLAIMED. IN NO EVENT SHALL ARIF ENDRO NUGROHO BE LIABLE FOR ANY
19
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23
-- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24
-- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
-- POSSIBILITY OF SUCH DAMAGE.
26 2 arif_endro
-- 
27 21 arif_endro
-- End Of License.
28
-- ------------------------------------------------------------------------
29 2 arif_endro
 
30
library ieee;
31
use ieee.std_logic_1164.all;
32
 
33
package xtime_pkg is
34
 
35
  function xtime_2 ( b : std_logic_vector ) return std_logic_vector;
36
  function xtime_4 ( c : std_logic_vector ) return std_logic_vector;
37
  function xtime_8 ( d : std_logic_vector ) return std_logic_vector;
38
 
39
end xtime_pkg;
40
 
41
package body xtime_pkg is
42
 
43
  function xtime_2   ( b : std_logic_vector ) return std_logic_vector is
44
     variable xtime_2_v  : std_logic_vector (07 downto 00) := ( B"0000_0000" );
45
     begin
46
        xtime_2_v := (  b(6 downto 4)                     -- 7,6,5
47
                     & (b(3 downto 2) xor (b(7) & b(7)))  -- 4,3
48
                     &  b(1)                              -- 2
49
                     & (b(0) xor b(7))                    -- 1
50
                     &  b(7));                            -- 0
51
     return xtime_2_v;
52
  end xtime_2;
53
 
54
  function xtime_4  ( c : std_logic_vector ) return std_logic_vector is
55
     variable xtime_4_v : std_logic_vector (07 downto 00) := ( B"0000_0000" );
56
     begin
57
        xtime_4_v := (  c(5)                             -- 7
58
                     &  c(4)                             -- 6
59
                     & (c(3) xor c(7))                   -- 5
60
                     & (c(2) xor c(7) xor c(6))          -- 4
61
                     & (c(1) xor c(6))                   -- 3
62
                     & (c(0) xor c(7))                   -- 2
63
                     & (c(7) xor c(6))                   -- 1
64
                     &  c(6));                           --
65
     return xtime_4_v;
66
  end xtime_4;
67
 
68
  function xtime_8  ( d : std_logic_vector ) return std_logic_vector is
69
     variable xtime_8_v : std_logic_vector (07 downto 00) := ( B"0000_0000" );
70
     begin
71
        xtime_8_v := (  d(4)                            -- 7
72
                     & (d(3) xor d(7))                  -- 6
73
                     & (d(2) xor d(7) xor d(6))         -- 5
74
                     & (d(1) xor d(6) xor d(5))         -- 4
75
                     & (d(0) xor d(7) xor d(5))         -- 3
76
                     & (d(7) xor d(6))                  -- 2
77
                     & (d(6) xor d(5))                  -- 1
78
                     &  d(5));                          -- 0
79
     return xtime_8_v;
80
  end xtime_8;
81
 
82
end xtime_pkg;

powered by: WebSVN 2.1.0

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