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

Subversion Repositories mini_aes

[/] [mini_aes/] [trunk/] [source/] [xtime.vhdl] - Diff between revs 15 and 21

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 15 Rev 21
-- $Id: xtime.vhdl,v 1.1.1.1 2005-12-06 02:48:34 arif_endro Exp $
-- ------------------------------------------------------------------------
-------------------------------------------------------------------------------
 
-- Title       : Xtime manipulations
 
-- Project     : Mini AES 128 
 
-------------------------------------------------------------------------------
 
-- File        : xtime.vhdl
 
-- Author      : "Arif E. Nugroho" <arif_endro@yahoo.com>
 
-- Created     : 2005/12/03
 
-- Last update : 
 
-- Simulators  : ModelSim SE PLUS 6.0
 
-- Synthesizers: ISE Xilinx 6.3i
 
-- Target      : 
 
-------------------------------------------------------------------------------
 
-- Description : Xtime manipulation used in AES operations.
 
-------------------------------------------------------------------------------
 
-- Copyright (C) 2005 Arif Endro Nugroho
-- Copyright (C) 2005 Arif Endro Nugroho
-------------------------------------------------------------------------------
-- All rights reserved.
-- 
-- 
--         THIS SOURCE FILE MAY BE USED AND DISTRIBUTED WITHOUT RESTRICTION
-- Redistribution and use in source and binary forms, with or without
-- PROVIDED THAT THIS COPYRIGHT STATEMENT IS NOT REMOVED FROM THE FILE AND THAT
-- modification, are permitted provided that the following conditions
-- ANY DERIVATIVE WORK CONTAINS THE ORIGINAL COPYRIGHT NOTICE AND THE
-- are met:
-- ASSOCIATED DISCLAIMER.
 
-- 
-- 
-------------------------------------------------------------------------------
-- 1. Redistributions of source code must retain the above copyright
 
--    notice, this list of conditions and the following disclaimer.
 
-- 2. Redistributions in binary form must reproduce the above copyright
 
--    notice, this list of conditions and the following disclaimer in the
 
--    documentation and/or other materials provided with the distribution.
 
-- 3. The name of Arif Endro Nugroho may not be used to endorse or promote
 
--    products derived from this software without specific prior written
 
--    permission.
-- 
-- 
--         THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-- THIS SOFTWARE IS PROVIDED BY ARIF ENDRO NUGROHO "AS IS" AND ANY EXPRESS
-- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-- DISCLAIMED. IN NO EVENT SHALL ARIF ENDRO NUGROHO BE LIABLE FOR ANY
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-- OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
-- POSSIBILITY OF SUCH DAMAGE.
-- 
-- 
-------------------------------------------------------------------------------
-- End Of License.
 
-- ------------------------------------------------------------------------
 
 
library ieee;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
 
 
package xtime_pkg is
package xtime_pkg is
 
 
  function xtime_2 ( b : std_logic_vector ) return std_logic_vector;
  function xtime_2 ( b : std_logic_vector ) return std_logic_vector;
  function xtime_4 ( c : std_logic_vector ) return std_logic_vector;
  function xtime_4 ( c : std_logic_vector ) return std_logic_vector;
  function xtime_8 ( d : std_logic_vector ) return std_logic_vector;
  function xtime_8 ( d : std_logic_vector ) return std_logic_vector;
 
 
end xtime_pkg;
end xtime_pkg;
 
 
package body xtime_pkg is
package body xtime_pkg is
 
 
  function xtime_2   ( b : std_logic_vector ) return std_logic_vector is
  function xtime_2   ( b : std_logic_vector ) return std_logic_vector is
     variable xtime_2_v  : std_logic_vector (07 downto 00) := ( B"0000_0000" );
     variable xtime_2_v  : std_logic_vector (07 downto 00) := ( B"0000_0000" );
     begin
     begin
        xtime_2_v := (  b(6 downto 4)                     -- 7,6,5
        xtime_2_v := (  b(6 downto 4)                     -- 7,6,5
                     & (b(3 downto 2) xor (b(7) & b(7)))  -- 4,3
                     & (b(3 downto 2) xor (b(7) & b(7)))  -- 4,3
                     &  b(1)                              -- 2
                     &  b(1)                              -- 2
                     & (b(0) xor b(7))                    -- 1
                     & (b(0) xor b(7))                    -- 1
                     &  b(7));                            -- 0
                     &  b(7));                            -- 0
     return xtime_2_v;
     return xtime_2_v;
  end xtime_2;
  end xtime_2;
 
 
  function xtime_4  ( c : std_logic_vector ) return std_logic_vector is
  function xtime_4  ( c : std_logic_vector ) return std_logic_vector is
     variable xtime_4_v : std_logic_vector (07 downto 00) := ( B"0000_0000" );
     variable xtime_4_v : std_logic_vector (07 downto 00) := ( B"0000_0000" );
     begin
     begin
        xtime_4_v := (  c(5)                             -- 7
        xtime_4_v := (  c(5)                             -- 7
                     &  c(4)                             -- 6
                     &  c(4)                             -- 6
                     & (c(3) xor c(7))                   -- 5
                     & (c(3) xor c(7))                   -- 5
                     & (c(2) xor c(7) xor c(6))          -- 4
                     & (c(2) xor c(7) xor c(6))          -- 4
                     & (c(1) xor c(6))                   -- 3
                     & (c(1) xor c(6))                   -- 3
                     & (c(0) xor c(7))                   -- 2
                     & (c(0) xor c(7))                   -- 2
                     & (c(7) xor c(6))                   -- 1
                     & (c(7) xor c(6))                   -- 1
                     &  c(6));                           --
                     &  c(6));                           --
     return xtime_4_v;
     return xtime_4_v;
  end xtime_4;
  end xtime_4;
 
 
  function xtime_8  ( d : std_logic_vector ) return std_logic_vector is
  function xtime_8  ( d : std_logic_vector ) return std_logic_vector is
     variable xtime_8_v : std_logic_vector (07 downto 00) := ( B"0000_0000" );
     variable xtime_8_v : std_logic_vector (07 downto 00) := ( B"0000_0000" );
     begin
     begin
        xtime_8_v := (  d(4)                            -- 7
        xtime_8_v := (  d(4)                            -- 7
                     & (d(3) xor d(7))                  -- 6
                     & (d(3) xor d(7))                  -- 6
                     & (d(2) xor d(7) xor d(6))         -- 5
                     & (d(2) xor d(7) xor d(6))         -- 5
                     & (d(1) xor d(6) xor d(5))         -- 4
                     & (d(1) xor d(6) xor d(5))         -- 4
                     & (d(0) xor d(7) xor d(5))         -- 3
                     & (d(0) xor d(7) xor d(5))         -- 3
                     & (d(7) xor d(6))                  -- 2
                     & (d(7) xor d(6))                  -- 2
                     & (d(6) xor d(5))                  -- 1
                     & (d(6) xor d(5))                  -- 1
                     &  d(5));                          -- 0
                     &  d(5));                          -- 0
     return xtime_8_v;
     return xtime_8_v;
  end xtime_8;
  end xtime_8;
 
 
end xtime_pkg;
end xtime_pkg;
 
 

powered by: WebSVN 2.1.0

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