blob: b5428d7829c0af7bd60c6a89017d4b90fc967afb (
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
|
library ieee;
use ieee.std_logic_1164.all;
package pkg2 is
type sulv_vector is array (natural range <>) of std_ulogic_vector;
subtype NULL_RANGE is natural range 0 downto 1;
constant NULL_SULV : std_ulogic_vector(NULL_RANGE) := (others => '0');
constant NULL_SULV_VECTOR : sulv_vector(NULL_RANGE)(NULL_RANGE) := (others => NULL_SULV);
function repeat(
val : std_ulogic_vector;
m : natural
) return sulv_vector;
end package;
package body pkg2 is
function repeat(
val : std_ulogic_vector;
m : natural
) return sulv_vector
is
constant result : sulv_vector(m downto 1)(val'range) := (others => val);
begin
return result;
end function;
end package body;
library ieee;
use ieee.std_logic_1164.all;
use work.pkg2.all;
entity tb3 is
end;
architecture behav of tb3 is
begin
process
constant c : sulv_vector := repeat ("0101", 2);
begin
assert c(2) = x"5";
assert c(1) = "0101";
wait;
end process;
end behav;
|