------------------------------------------------------------------------------- -- Title : Shift Rows using std_logic_vector -- Project : LGC ------------------------------------------------------------------------------- -- File : shiftrows.vhd -- Author : Frank K. Gurkaynak -- Company : Integrated Systems Laboratory, ETH Zurich -- Created : 2004-11-15 -- Last update: 2004-12-05 -- Platform : ModelSim (simulation), Synopsys (synthesis) -- Standard : VHDL'87 ------------------------------------------------------------------------------- -- Description: This should be ungrouped it is just a 1:1 assignmnet of -- the shiftrows function. ------------------------------------------------------------------------------- -- Copyright (c) 2004 Integrated Systems Laboratory, ETH Zurich ------------------------------------------------------------------------------- -- Revisions : -- CVS ID : $Id: shiftrows.vhd,v 1.1 2004/12/05 16:35:48 kgf Exp $ -- Date Version Author Description -- 2004-11-15 1.0 kgf Created ------------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; entity ishiftrows is port( InxDI : in std_logic_vector (127 downto 0); OutxDO : out std_logic_vector (127 downto 0) ); end ishiftrows; architecture permutation of ishiftrows is type BytesType is array (0 to 15) of std_logic_vector (7 downto 0); signal InBxD, OutBxD : BytesType; begin -- hmm earlier version had fucked up the ordering of the bytes.. -- So when you have a 128 bit data Byte 0 is 127..120 gen_byte_assign: for i in 0 to 15 generate InBxD(i) <= InxDI(((15-i)*8)+7 downto (15-i)*8); OutxDO(((15-i)*8)+7 downto (15-i)*8) <= OutBxD(i); end generate gen_byte_assign; -- Row 0 as it is OutBxD(0) <= InBxD( 0); OutBxD(4) <= InBxD( 4); OutBxD( 8) <= InBxD( 8); OutBxD(12) <= InBxD(12); -- Row 1 one left OutBxD(1) <= InBxD(13); OutBxD(5) <= InBxD( 1); OutBxD( 9) <= InBxD( 5); OutBxD(13) <= InBxD( 9); -- Row 2 two left OutBxD(2) <= InBxD(10); OutBxD(6) <= InBxD(14); OutBxD(10) <= InBxD( 2); OutBxD(14) <= InBxD( 6); -- Row 3 three left OutBxD(3) <= InBxD(7); OutBxD(7) <= InBxD(11); OutBxD(11) <= InBxD(15); OutBxD(15) <= InBxD(3); end permutation;