blob: 870c42d16c40a8f18e811c9d833ab1f76658420f (
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
|
entity module is end entity;
architecture arch of module is
function func(a:natural) return natural is
begin
if a=32 then return 2;
elsif a=16 then return 1;
else return 0;
end if;
end function;
constant DATAPATH :natural := 32;
constant LSLICES :natural := func(DATAPATH);
-- constant LSLICES :natural := 2;
signal a :bit;
signal s :bit_vector(LSLICES-1 downto 0);
begin
DATA8: if DATAPATH=8 generate
a <= '0';
end generate;
-- DATA16: if DATAPATH=16 generate
-- with s select a <=
-- '1' when "0",
-- '0' when others;
-- end generate;
DATA32: if DATAPATH=32 generate
with s select a <=
'1' when "00",
'0' when "01",
'1' when "10",
'0' when others;
end generate;
end architecture;
|