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

Subversion Repositories hicovec

[/] [hicovec/] [trunk/] [cpu/] [testbenches/] [tb_selectunit.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_selectunit
5
--
6
-- PURPOSE:     testbench of selectunit 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
use work.cfg.all;     -- testbench requires k > 7
17
use work.datatypes.all;
18
 
19
entity tb_selectunit is
20
end tb_selectunit;
21
 
22
 
23
 
24
architecture testbench of tb_selectunit is
25
    component selectunit
26
        port (
27
            data_in :   in  vectordata_type;
28
            k_in:       in  std_logic_vector(31 downto 0);
29
            data_out:   out std_logic_vector(31 downto 0)
30
        );
31
    end component;
32
 
33
    for impl: selectunit use entity work.selectunit(rtl);
34
 
35
    signal data_in:     vectordata_type;
36
    signal k_in:        std_logic_vector(31 downto 0) := (others => '0');
37
    signal data_out:    std_logic_vector(31 downto 0);
38
 
39
    constant period     : time := 2ns;
40
 
41
    begin
42
        impl: selectunit port map (data_in => data_in, k_in => k_in, data_out => data_out);
43
    process
44
    begin
45
            wait for 100ns;
46
 
47
            assert k > 7
48
                report "testbench requires k > 7"
49
                    severity Error;
50
 
51
            data_in(0) <= "10101100110111001001111000101111";
52
            data_in(1) <= "01001011011011101010101101010100";
53
            data_in(2) <= "11101101110110101011011011101010";
54
            data_in(3) <= "11001100110011001100110011001101";
55
            data_in(4) <= "11001011001001100101110010011000";
56
            data_in(5) <= "10010010100100101001001010010010";
57
            data_in(6) <= "11111000000111111100000011111000";
58
            data_in(7) <= "10101010101010101010101010101010";
59
 
60
            -- k = 0
61
            k_in <= "00000000000000000000000000000000";
62
 
63
            wait for period;
64
 
65
            assert data_out = "10101100110111001001111000101111"
66
                report "k=0 : data_out"
67
                severity Error;
68
 
69
 
70
            -- k = 1
71
            k_in <= "00000000000000000000000000000001";
72
 
73
            wait for period;
74
 
75
            assert data_out = "01001011011011101010101101010100"
76
                report "k=1 : data_out"
77
                severity Error;
78
 
79
 
80
            -- k = 2
81
            k_in <= "00000000000000000000000000000010";
82
 
83
            wait for period;
84
 
85
            assert data_out = "11101101110110101011011011101010"
86
                report "k=2 : data_out"
87
                severity Error;
88
 
89
            -- k = 3
90
            k_in <= "00000000000000000000000000000011";
91
 
92
            wait for period;
93
 
94
            assert data_out = "11001100110011001100110011001101"
95
                report "k=3 : data_out"
96
                severity Error;
97
 
98
 
99
            -- k = 4
100
            k_in <= "00000000000000000000000000000100";
101
 
102
            wait for period;
103
 
104
            assert data_out = "11001011001001100101110010011000"
105
                report "k=4 : data_out"
106
                severity Error;
107
 
108
 
109
            -- k = 5
110
            k_in <= "00000000000000000000000000000101";
111
 
112
            wait for period;
113
 
114
            assert data_out = "10010010100100101001001010010010"
115
                report "k=5 : data_out"
116
                severity Error;
117
 
118
 
119
            -- k = 6
120
            k_in <= "00000000000000000000000000000110";
121
 
122
            wait for period;
123
 
124
            assert data_out = "11111000000111111100000011111000"
125
                report "k=6 : data_out"
126
                severity Error;
127
 
128
 
129
 
130
            -- k = 7
131
            k_in <= "00000000000000000000000000000111";
132
 
133
            wait for period;
134
 
135
            assert data_out = "10101010101010101010101010101010"
136
                report "k=100000 : data_out"
137
                severity Error;
138
 
139
 
140
            wait;
141
 
142
    end process;
143
 
144
end;

powered by: WebSVN 2.1.0

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