aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/memmux01/tb_memmux05.vhdl
blob: 919a3fd5b2e976f9f52b0080f68ff7d31aacb526 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
entity tb_memmux05 is
end tb_memmux05;

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

architecture behav of tb_memmux05 is
  signal ad : std_logic;
  signal val : std_logic_vector (1 downto 0);
  signal dat, res : std_logic_vector (2 downto 0);
begin
  dut : entity work.memmux05
    port map (
      ad => ad,
      val => val,
      dat => dat,
      res => res);

  process
  begin
    dat <= "110";

    ad <= '0';
    val <= "00";
    wait for 1 ns;
    assert res = "100" report "1) res=" & to_bstring (res) severity failure;

    ad <= '1';
    val <= "00";
    wait for 1 ns;
    assert res = "000" report "2) res=" & to_bstring (res) severity failure;

    ad <= '0';
    val <= "01";
    wait for 1 ns;
    assert res = "101" report "3) res=" & to_bstring (res) severity failure;

    ad <= '0';
    val <= "10";
    wait for 1 ns;
    assert res = "110" report "4) res=" & to_bstring (res) severity failure;

    ad <= '1';
    val <= "10";
    wait for 1 ns;
    assert res = "100" report "5) res=" & to_bstring (res) severity failure;

    dat <= "010";

    ad <= '0';
    val <= "00";
    wait for 1 ns;
    assert res = "000" report "6) res=" & to_bstring (res) severity failure;

    ad <= '1';
    val <= "00";
    wait for 1 ns;
    assert res = "000" report "7) res=" & to_bstring (res) severity failure;

    ad <= '1';
    val <= "10";
    wait for 1 ns;
    assert res = "100" report "8) res=" & to_bstring (res) severity failure;

    wait;
  end process;
end behav;