aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/var01/tb_var02.vhdl
blob: e370cf1a17a8e3d97908d9f101f802db18124814 (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
entity tb_var02 is
end tb_var02;

library ieee;
use ieee.std_logic_1164.all;

architecture behav of tb_var02 is
  signal clk : std_logic;
  signal mask : std_logic_vector (3 downto 0);
  signal val : std_logic_vector (31 downto 0);
  signal res : std_logic_vector (31 downto 0);
begin
  dut: entity work.var02
    port map (
      clk => clk,
      mask => mask,
      val => val,
      res => res);

  process
    procedure pulse is
    begin
      clk <= '0';
      wait for 1 ns;
      clk <= '1';
      wait for 1 ns;
    end pulse;
  begin
    mask <= x"f";
    val <= x"12_34_56_78";
    pulse;
    assert res = x"12_34_56_78" severity failure;
    
    mask <= x"8";
    val <= x"9a_00_00_00";
    pulse;
    assert res = x"9a_34_56_78" severity failure;

    mask <= x"0";
    val <= x"00_00_00_00";
    pulse;
    assert res = x"9a_34_56_78" severity failure;

    mask <= x"5";
    val <= x"00_bc_00_de";
    pulse;
    assert res = x"9a_bc_56_de" severity failure;

    wait;
  end process;
end behav;