blob: 46c707632171b2ee7b93c71c3fdbc58d790ed3b3 (
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
|
entity ent is
generic(
BITS : positive);
port(
input : in bit_vector(BITS - 1 downto 0));
end entity;
architecture rtl of ent is
begin
end architecture;
entity test is
end entity;
architecture rtl of test is
constant MAX : positive := 7;
signal input : natural;
function to_bv (l : natural; v : natural) return bit_vector
is
variable res : bit_vector (l - 1 downto 0);
begin
if v /= 0 then
res (0) := '1';
end if;
return res;
end to_bv;
begin
ent : entity work.ent
generic map(
BITS => MAX)
port map(
input => to_bv(MAX, input));
end architecture;
|