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

Subversion Repositories hicovec

[/] [hicovec/] [trunk/] [cpu/] [testbenches/] [tb_multiplexer4.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_multiplexer4
5
--
6
-- PURPOSE:     testbench of multiplexer4 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_multiplexer4 is
17
end tb_multiplexer4;
18
 
19
architecture testbench of tb_multiplexer4 is
20
    component multiplexer4
21
        generic (
22
            w : positive
23
        );
24
        port (
25
            selector:    in std_logic_vector(1 downto 0);
26
            data_in_00:  in std_logic_vector(w-1 downto 0);
27
            data_in_01:  in std_logic_vector(w-1 downto 0);
28
            data_in_10:  in std_logic_vector(w-1 downto 0);
29
            data_in_11:  in std_logic_vector(w-1 downto 0);
30
            data_out:    out std_logic_vector(w-1 downto 0)
31
        );
32
    end component;
33
 
34
    for impl: multiplexer4 use entity work.multiplexer4(rtl);
35
 
36
    signal selector:    std_logic_vector(1 downto 0) := "00";
37
    signal data_in_00:  std_logic_vector(31 downto 0) := "10101100101011001010110010101100";
38
    signal data_in_01:  std_logic_vector(31 downto 0) := "11001001110010011100100111001001";
39
    signal data_in_10:  std_logic_vector(31 downto 0) := "01100110011001100110011001100110";
40
    signal data_in_11:  std_logic_vector(31 downto 0) := "11001111110011111100111111001111";
41
    signal data_out:    std_logic_vector(31 downto 0);
42
 
43
    constant period     : time := 2ns;
44
 
45
    begin
46
        impl: multiplexer4
47
            generic map (w => 32)
48
            port map (selector => selector, data_in_00 => data_in_00, data_in_01 => data_in_01,
49
              data_in_10 => data_in_10, data_in_11 => data_in_11, data_out => data_out);
50
    process
51
    begin
52
            wait for 100ns;
53
 
54
            -- selector = 00
55
            selector <= "00";
56
 
57
            wait for period;
58
 
59
            assert data_out = "10101100101011001010110010101100"
60
                report "selector=00 : data_out"
61
                severity Error;
62
 
63
            -- selector = 01
64
            selector <= "01";
65
 
66
            wait for period;
67
 
68
            assert data_out = "11001001110010011100100111001001"
69
                report "selector=01 : data_out"
70
                severity Error;
71
 
72
            -- selector = 10
73
            selector <= "10";
74
 
75
            wait for period;
76
 
77
            assert data_out = "01100110011001100110011001100110"
78
                report "selector=10 : data_out"
79
                severity Error;
80
 
81
            -- selector = 11
82
            selector <= "11";
83
 
84
            wait for period;
85
 
86
            assert data_out = "11001111110011111100111111001111"
87
                report "selector=11 : data_out"
88
                severity Error;
89
 
90
            wait;
91
 
92
    end process;
93
 
94
end;

powered by: WebSVN 2.1.0

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