blob: 75a2ddd91d3e1edee790bfb00c7e1d79d19deab3 (
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
use work.all;
--use work.attrs_pkg.all;
entity uattr3 is
attribute ename: string;
attribute ename of uattr3: entity is "user attributes 3";
attribute special: boolean;
attribute is_clock: boolean;
attribute sign_bit: integer;
begin
end entity uattr3;
architecture tb of uattr3 is
attribute ename of tb: architecture is uattr3'ename & " Demonstration";
attribute stype: integer;
signal bv : bit_vector(7 downto 0) := "11000100";
attribute stype of bv: signal is 2;
attribute sign_bit of bv: signal is bv'left;
signal b : bit;
attribute stype of b: signal is 1;
attribute special of b: signal is true;
signal clk : bit;
attribute is_clock of clk: signal is true;
signal clk1 : bit;
signal clk2 : bit;
signal cnt : integer := 0;
begin
start_up: process
begin
--report "Object: " & tb'ename & " ... starting up ...";
wait;
end process start_up;
bv <= "00001111" when cnt = 0 else
"00011110" when cnt = 1 else
"00111100" when cnt = 2 else
"01111000" when cnt = 3 else
"11110000" when cnt = 4;
b <= '1' when bv = "00111100" else '0';
clock: process
begin
while cnt < 6 loop
wait for 1 ns;
clk <= not clk;
end loop;
wait;
end process clock;
proc1: process
begin
if(clk'event and clk = '1' and clk'is_clock) then
cnt <= cnt + 1;
clk1 <= not clk1;
report "Tick ... " & integer'image(cnt);
end if;
wait on clk;
end process;
bmon: process(b)
begin
--report "stype of b is: " & integer'image(b'stype);
if b = '1' and b'special then
--report "stype of bv is: " & integer'image(bv'stype);
assert bv = "00111100" report "Error: got unexpected bv value" severity failure;
end if;
end process;
bvmon: process(bv)
variable i_v : integer;
attribute stype of i_v: variable is 0;
begin
i_v := cnt;
case bv is
when "00001111" =>
report ent1'ent_name;
report ent1'ent_type;
report "Completeness: " & integer'image(ent1'ent_stat);
assert cnt = 0 report "Error0: got unexpected cnt value" severity failure;
when "00011110" =>
assert cnt = 1 report "Error1: got unexpected cnt value" severity failure;
when "00111100" =>
report ent2'ent_name;
report ent2'ent_type;
report "Completeness: " & integer'image(ent2'ent_stat);
assert cnt = 2 report "Error2: got unexpected cnt value" severity failure;
when "01111000" =>
assert cnt = 3 report "Error3: got unexpected cnt value" severity failure;
when "11110000" =>
report ent3'ent_name;
report ent3'ent_type;
report "Completeness: " & integer'image(ent3'ent_stat);
assert cnt = 4 report "Error4: got unexpected cnt value" severity failure;
when others =>
--report "stype of i_v is: " & integer'image(i_v'stype);
null;
end case;
end process;
d1: entity work.ent1(rtl);
d2: entity work.ent2(bhv);
d3: entity work.ent3(rtl);
end tb;
|