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

Subversion Repositories hicovec

[/] [hicovec/] [trunk/] [cpu/] [testbenches/] [tb_multiplexer2.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_multiplexer2
5
--
6
-- PURPOSE:     testbench of multiplexer2 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_multiplexer2 is
17
end tb_multiplexer2;
18
 
19
architecture testbench of tb_multiplexer2 is
20
    component multiplexer2
21
        generic (
22
            w : positive
23
        );
24
        port(
25
            selector:   in std_logic;
26
            data_in_0:  in std_logic_vector(w-1 downto 0);
27
            data_in_1:  in std_logic_vector(w-1 downto 0);
28
            data_out:   out std_logic_vector(w-1 downto 0)
29
        );
30
    end component;
31
 
32
    for impl: multiplexer2 use entity work.multiplexer2(rtl);
33
 
34
    signal selector:   std_logic := '0';
35
    signal data_in_0:  std_logic_vector(31 downto 0) := "00000000000000000000000000000000";
36
    signal data_in_1:  std_logic_vector(31 downto 0) := "00000000000000000000000000000001";
37
 
38
    signal data_out:    std_logic_vector(31 downto 0);
39
 
40
    constant period     : time := 2ns;
41
 
42
    begin
43
        impl: multiplexer2
44
            generic map (w => 32)
45
            port map (selector => selector, data_in_0 => data_in_0, data_in_1 => data_in_1,
46
              data_out => data_out);
47
    process
48
    begin
49
            wait for 100ns;
50
 
51
            -- selector = 0
52
            selector <= '0';
53
 
54
            wait for period;
55
 
56
            assert data_out = "00000000000000000000000000000000"
57
                report "selector=0 : data_out"
58
                severity Error;
59
 
60
            -- selector = 1
61
            selector <= '1';
62
 
63
            wait for period;
64
 
65
            assert data_out = "00000000000000000000000000000001"
66
                report "selector=1 : data_out"
67
                severity Error;
68
 
69
            wait;
70
 
71
    end process;
72
 
73
end;

powered by: WebSVN 2.1.0

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