verilog: add sv_maps iterators
[ghdl-vlg.git] / testsuite / synth / issue2113 / a.vhdl
blob82f8039cd664c80861e5840b0b22fd0a17a16969
1 library IEEE;
2 use IEEE.std_logic_1164.all;
4 entity a is
5         port(
6                 irq : out std_ulogic
7         );
8 end a;
10 library IEEE;
11 use IEEE.std_logic_1164.all;
13 entity b is
14         generic(
15                 NUM_CHANNELS : positive := 4
16         );
17         port(
18                 src_channel :  in integer range 0 to NUM_CHANNELS-1;
19                 src_valid :  in std_ulogic;
20                 src_ready : out std_ulogic
21         );
22 end b;
24 architecture struct of a is
26         signal src_valid       : std_ulogic;
27         signal src_ready       : std_ulogic;
28 begin
29         u0 : entity work.b
30         generic map(
31                 NUM_CHANNELS => 1
32         )
33         port map(
34                 src_channel => 0,
35                 src_valid   => src_valid,
36                 src_ready   => src_ready
37         );
38 end architecture;
40 architecture behav of b is
41 begin
42         process(all)
43                 variable ready         : std_ulogic;
44                 variable channel_ready : std_ulogic;
45         begin
46                 ready := '1';
47                 for i in 0 to NUM_CHANNELS-1 loop
48                         if i = src_channel and src_valid = '1' then
49                                 channel_ready := '0';
50                         else
51                                 channel_ready := '1';
52                         end if;
53                         ready := ready and channel_ready;
54                 end loop;
56                 src_ready <= ready;
57         end process;
59 end architecture;