| 1 |
4 |
gajos |
-----------------------------------------------------------------------
|
| 2 |
|
|
---- ----
|
| 3 |
|
|
---- Present - a lightweight block cipher project ----
|
| 4 |
|
|
---- ----
|
| 5 |
|
|
---- This file is part of the Present - a lightweight block ----
|
| 6 |
|
|
---- cipher project ----
|
| 7 |
|
|
---- http://www.http://opencores.org/project,present ----
|
| 8 |
|
|
---- ----
|
| 9 |
|
|
---- Description: ----
|
| 10 |
|
|
---- Test bench of shift register - nothing special. ----
|
| 11 |
|
|
---- To Do: ----
|
| 12 |
|
|
---- ----
|
| 13 |
|
|
---- Author(s): ----
|
| 14 |
|
|
---- - Krzysztof Gajewski, gajos@opencores.org ----
|
| 15 |
|
|
---- k.gajewski@gmail.com ----
|
| 16 |
|
|
---- ----
|
| 17 |
|
|
-----------------------------------------------------------------------
|
| 18 |
|
|
---- ----
|
| 19 |
|
|
---- Copyright (C) 2013 Authors and OPENCORES.ORG ----
|
| 20 |
|
|
---- ----
|
| 21 |
|
|
---- This source file may be used and distributed without ----
|
| 22 |
|
|
---- restriction provided that this copyright statement is not ----
|
| 23 |
|
|
---- removed from the file and that any derivative work contains ----
|
| 24 |
|
|
---- the original copyright notice and the associated disclaimer. ----
|
| 25 |
|
|
---- ----
|
| 26 |
|
|
---- This source file is free software; you can redistribute it ----
|
| 27 |
|
|
---- and-or modify it under the terms of the GNU Lesser General ----
|
| 28 |
|
|
---- Public License as published by the Free Software Foundation; ----
|
| 29 |
|
|
---- either version 2.1 of the License, or (at your option) any ----
|
| 30 |
|
|
---- later version. ----
|
| 31 |
|
|
---- ----
|
| 32 |
|
|
---- This source is distributed in the hope that it will be ----
|
| 33 |
|
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
| 34 |
|
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
| 35 |
|
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
| 36 |
|
|
---- details. ----
|
| 37 |
|
|
---- ----
|
| 38 |
|
|
---- You should have received a copy of the GNU Lesser General ----
|
| 39 |
|
|
---- Public License along with this source; if not, download it ----
|
| 40 |
|
|
---- from http://www.opencores.org/lgpl.shtml ----
|
| 41 |
|
|
---- ----
|
| 42 |
|
|
-----------------------------------------------------------------------
|
| 43 |
3 |
gajos |
LIBRARY ieee;
|
| 44 |
|
|
USE ieee.std_logic_1164.ALL;
|
| 45 |
|
|
use work.RSAFinalizerProperties.ALL;
|
| 46 |
|
|
|
| 47 |
|
|
-- Uncomment the following library declaration if using
|
| 48 |
|
|
-- arithmetic functions with Signed or Unsigned values
|
| 49 |
|
|
--USE ieee.numeric_std.ALL;
|
| 50 |
|
|
|
| 51 |
|
|
ENTITY ShiftRegTB IS
|
| 52 |
|
|
END ShiftRegTB;
|
| 53 |
|
|
|
| 54 |
|
|
ARCHITECTURE behavior OF ShiftRegTB IS
|
| 55 |
|
|
|
| 56 |
|
|
-- Component Declaration for the Unit Under Test (UUT)
|
| 57 |
|
|
|
| 58 |
|
|
COMPONENT ShiftReg
|
| 59 |
|
|
-- generic (length_1 : integer := WORD_LENGTH;
|
| 60 |
|
|
-- length_2 : integer := BYTE
|
| 61 |
|
|
GENERIC (
|
| 62 |
|
|
length_1 : integer := BYTE;
|
| 63 |
|
|
length_2 : integer := WORD_LENGTH
|
| 64 |
|
|
);
|
| 65 |
|
|
PORT(
|
| 66 |
|
|
input : in STD_LOGIC_VECTOR(7 downto 0);
|
| 67 |
|
|
--input : IN std_logic_vector(63 downto 0);
|
| 68 |
|
|
output : out STD_LOGIC_VECTOR(63 downto 0);
|
| 69 |
|
|
--output : OUT std_logic_vector(7 downto 0);
|
| 70 |
|
|
en : in STD_LOGIC;
|
| 71 |
|
|
shift : in STD_LOGIC;
|
| 72 |
|
|
clk : in STD_LOGIC;
|
| 73 |
|
|
reset : in STD_LOGIC
|
| 74 |
|
|
);
|
| 75 |
|
|
END COMPONENT;
|
| 76 |
|
|
|
| 77 |
|
|
|
| 78 |
|
|
--Inputs
|
| 79 |
|
|
signal input : STD_LOGIC_VECTOR(7 downto 0) := (others => '0');
|
| 80 |
|
|
--signal input : std_logic_vector(63 downto 0) := (others => '0');
|
| 81 |
|
|
signal en : STD_LOGIC := '0';
|
| 82 |
|
|
signal shift : STD_LOGIC := '0';
|
| 83 |
|
|
signal clk : STD_LOGIC := '0';
|
| 84 |
|
|
signal reset : STD_LOGIC := '0';
|
| 85 |
|
|
|
| 86 |
|
|
--Outputs
|
| 87 |
|
|
signal output : STD_LOGIC_VECTOR(63 downto 0);
|
| 88 |
|
|
--signal output : std_logic_vector(7 downto 0);
|
| 89 |
|
|
|
| 90 |
|
|
-- Clock period definitions
|
| 91 |
|
|
constant clk_period : time := 10 ns;
|
| 92 |
|
|
|
| 93 |
|
|
BEGIN
|
| 94 |
|
|
|
| 95 |
|
|
-- Instantiate the Unit Under Test (UUT)
|
| 96 |
|
|
uut: ShiftReg PORT MAP (
|
| 97 |
|
|
input => input,
|
| 98 |
|
|
output => output,
|
| 99 |
|
|
en => en,
|
| 100 |
|
|
shift => shift,
|
| 101 |
|
|
clk => clk,
|
| 102 |
|
|
reset => reset
|
| 103 |
|
|
);
|
| 104 |
|
|
|
| 105 |
|
|
-- Clock process definitions
|
| 106 |
|
|
clk_process :process
|
| 107 |
|
|
begin
|
| 108 |
|
|
clk <= '0';
|
| 109 |
|
|
wait for clk_period/2;
|
| 110 |
|
|
clk <= '1';
|
| 111 |
|
|
wait for clk_period/2;
|
| 112 |
|
|
end process;
|
| 113 |
|
|
|
| 114 |
|
|
|
| 115 |
|
|
-- Stimulus process
|
| 116 |
|
|
stim_proc: process
|
| 117 |
|
|
begin
|
| 118 |
|
|
reset <= '0';
|
| 119 |
|
|
shift <= '0';
|
| 120 |
|
|
input <= "10101010";
|
| 121 |
|
|
--input <= "1111000011110000111100001111000011110000111100001111000011110000";
|
| 122 |
|
|
wait for 100 ns;
|
| 123 |
|
|
reset <= '1';
|
| 124 |
|
|
wait for clk_period*10;
|
| 125 |
|
|
en <= '1';
|
| 126 |
|
|
wait for clk_period*1;
|
| 127 |
|
|
en <= '0';
|
| 128 |
|
|
wait for clk_period*1;
|
| 129 |
|
|
shift <= '1';
|
| 130 |
|
|
wait for clk_period*10;
|
| 131 |
|
|
assert false severity failure;
|
| 132 |
|
|
end process;
|
| 133 |
|
|
|
| 134 |
|
|
END;
|