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

Subversion Repositories present

[/] [present/] [trunk/] [PureTesting/] [bench/] [vhdl/] [ShiftRegTB.vhd] - Blame information for rev 8

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

Line No. Rev Author Line
1 8 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
LIBRARY ieee;
44
USE ieee.std_logic_1164.ALL;
45
 
46
-- Uncomment the following library declaration if using
47
-- arithmetic functions with Signed or Unsigned values
48
--USE ieee.numeric_std.ALL;
49
 
50
ENTITY ShiftRegTB IS
51
END ShiftRegTB;
52
 
53
ARCHITECTURE behavior OF ShiftRegTB IS
54
 
55
    -- Component Declaration for the Unit Under Test (UUT)
56
 
57
    COMPONENT ShiftReg
58
--       generic (length_1      : integer :=  WORD_LENGTH;
59
--                length_2      : integer :=  BYTE
60
         GENERIC (
61
             length_1      : integer :=  8;
62
             length_2      : integer :=  64
63
         );
64
    PORT(
65
        input  : in  STD_LOGIC_VECTOR(7 downto 0);
66
                  --input : IN  std_logic_vector(63 downto 0);
67
        output : out STD_LOGIC_VECTOR(63 downto 0);
68
                  --output : OUT  std_logic_vector(7 downto 0);
69
        en     : in  STD_LOGIC;
70
        shift  : in  STD_LOGIC;
71
        clk    : in  STD_LOGIC;
72
        reset  : in  STD_LOGIC
73
    );
74
    END COMPONENT;
75
 
76
 
77
   --Inputs
78
   signal input : STD_LOGIC_VECTOR(7 downto 0) := (others => '0');
79
        --signal input : std_logic_vector(63 downto 0) := (others => '0');
80
   signal en    : STD_LOGIC := '0';
81
   signal shift : STD_LOGIC := '0';
82
   signal clk   : STD_LOGIC := '0';
83
   signal reset : STD_LOGIC := '0';
84
 
85
        --Outputs
86
   signal output : STD_LOGIC_VECTOR(63 downto 0);
87
        --signal output : std_logic_vector(7 downto 0);
88
 
89
   -- Clock period definitions
90
   constant clk_period : time := 10 ns;
91
 
92
BEGIN
93
 
94
        -- Instantiate the Unit Under Test (UUT)
95
   uut: ShiftReg PORT MAP (
96
          input => input,
97
          output => output,
98
          en => en,
99
          shift => shift,
100
          clk => clk,
101
          reset => reset
102
        );
103
 
104
   -- Clock process definitions
105
   clk_process :process
106
   begin
107
                clk <= '0';
108
                wait for clk_period/2;
109
                clk <= '1';
110
                wait for clk_period/2;
111
   end process;
112
 
113
 
114
   -- Stimulus process
115
   stim_proc: process
116
   begin
117
      reset <= '0';
118
                shift <= '0';
119
                input <= "10101010";
120
                --input <= "1111000011110000111100001111000011110000111100001111000011110000";
121
      wait for 100 ns;
122
                reset <= '1';
123
      wait for clk_period*10;
124
                reset <= '0';
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;

powered by: WebSVN 2.1.0

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