aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue531/sample_slice_ports.vhd
blob: 4cf623c5b61efe80043db3bcbb127e54d1b35d2b (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
library ieee;
   use ieee.std_logic_1164.all;
   use ieee.numeric_std.all;

entity sliced_ex is
port (
   clk   : in  std_logic;
   reset : in  std_logic;
   arg_a : in  std_logic_vector(3 downto 0);
   arg_b : in  std_logic_vector(3 downto 0)
);
end sliced_ex;

architecture rtl of sliced_ex is

   signal aa, ab : std_logic_vector(3 downto 0);

begin

   aa <= arg_a(aa'range);
   ab <= arg_b(ab'range);

   monitor : process(clk)
   begin
      if rising_edge(clk) then
        report "arg_a: " & integer'image(to_integer(unsigned(arg_a)))
          & ", arg_b: " & integer'image(to_integer(unsigned(arg_b)));
      end if;
   end process;

   sub_module : entity work.submodule
   port map (
      clk => clk,

      -- This version works
      --arg( 7 downto 0) => aa,
      --arg(15 downto 8) => ab,

      -- This one works
      --arg => arg_a,

      -- This one fails
      arg(3 downto 0) => arg_a(3 downto 0),
      arg(7 downto 4) => arg_b(3 downto 0),

      res => OPEN
   );

end rtl;