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

Subversion Repositories hicovec

[/] [hicovec/] [trunk/] [cpu/] [testbenches/] [tb_dataregister.vhd] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 hmanske
------------------------------------------------------------------
2 4 hmanske
-- PROJECT:      HiCoVec (highly configurable vector processor)
3 2 hmanske
--
4
-- ENTITY:      tb_dataregister
5
--
6
-- PURPOSE:     testbench of dataregister entity
7
--
8
-- AUTHOR:      harald manske, haraldmanske@gmx.de
9
--
10
-- VERSION:     1.0
11
-----------------------------------------------------------------
12
library ieee;
13
use ieee.std_logic_1164.all;
14
use ieee.std_logic_unsigned.all;
15
 
16
entity tb_dataregister is
17
end tb_dataregister;
18
 
19
architecture testbench of tb_dataregister is
20
    component dataregister
21
        port(   clk:        in std_logic;
22
                load:       in std_logic;
23
                data_in:    in std_logic_vector(31 downto 0);
24
                data_out:   out std_logic_vector(31 downto 0)
25
            );
26
    end component;
27
 
28
    for impl: dataregister use entity work.dataregister(rtl);
29
 
30
    signal clk:        std_logic;
31
    signal load:       std_logic;
32
    signal data_in:    std_logic_vector(31 downto 0);
33
    signal data_out:   std_logic_vector(31 downto 0);
34
 
35
    constant period     : time := 2ns;
36
 
37
    begin
38
        impl: dataregister port map (clk => clk, load => load, data_in => data_in,
39
                                     data_out => data_out);
40
    process
41
    begin
42
            wait for 100ns;
43
 
44
             -- load 1
45
            data_in <= "11101110111011101110111011101110";
46
            load <= '1';
47
 
48
            clk <= '0'; wait for period / 2; clk <= '1'; wait for period / 2;
49
 
50
            assert data_out = "11101110111011101110111011101110"
51
                report "load 1 : data_out"
52
                severity Error;
53
 
54
 
55
            -- load = 'Z'
56
            data_in <= "00000000000000000000000000000001";
57
            load <= 'Z';
58
 
59
            clk <= '0'; wait for period / 2; clk <= '1'; wait for period / 2;
60
 
61
            assert data_out = "11101110111011101110111011101110"
62
                report "load=z : data_out"
63
                severity Error;
64
 
65
 
66
            -- not load
67
            data_in <= "11111111111111111111111111111111";
68
            load <= '0';
69
 
70
            clk <= '0'; wait for period / 2; clk <= '1'; wait for period / 2;
71
 
72
            assert data_out = "11101110111011101110111011101110"
73
                report "not load: data_out"
74
                severity Error;
75
 
76
 
77
            -- load 2
78
            data_in <= "10101010101010101010101010101010";
79
            load <= '1';
80
 
81
            clk <= '0'; wait for period / 2; clk <= '1'; wait for period / 2;
82
 
83
            assert data_out = "10101010101010101010101010101010"
84
                report "load 2 : data_out"
85
                severity Error;
86
 
87
            wait;
88
 
89
    end process;
90
 
91
end;

powered by: WebSVN 2.1.0

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