1use work.all; 2--use work.attrs_pkg.all; 3 4entity uattr3 is 5 attribute ename: string; 6 attribute ename of uattr3: entity is "user attributes 3"; 7 attribute special: boolean; 8 attribute is_clock: boolean; 9 attribute sign_bit: integer; 10begin 11end entity uattr3; 12 13 14architecture tb of uattr3 is 15 16 attribute ename of tb: architecture is uattr3'ename & " Demonstration"; 17 attribute stype: integer; 18 19 signal bv : bit_vector(7 downto 0) := "11000100"; 20 attribute stype of bv: signal is 2; 21 attribute sign_bit of bv: signal is bv'left; 22 signal b : bit; 23 attribute stype of b: signal is 1; 24 attribute special of b: signal is true; 25 signal clk : bit; 26 attribute is_clock of clk: signal is true; 27 signal clk1 : bit; 28 signal clk2 : bit; 29 30 signal cnt : integer := 0; 31 32begin 33 34 start_up: process 35 begin 36--report "Object: " & tb'ename & " ... starting up ..."; 37 wait; 38 end process start_up; 39 40 bv <= "00001111" when cnt = 0 else 41 "00011110" when cnt = 1 else 42 "00111100" when cnt = 2 else 43 "01111000" when cnt = 3 else 44 "11110000" when cnt = 4; 45 46 b <= '1' when bv = "00111100" else '0'; 47 48 clock: process 49 begin 50 while cnt < 6 loop 51 wait for 1 ns; 52 clk <= not clk; 53 end loop; 54 wait; 55 end process clock; 56 57 proc1: process 58 begin 59 if(clk'event and clk = '1' and clk'is_clock) then 60 cnt <= cnt + 1; 61 clk1 <= not clk1; 62 report "Tick ... " & integer'image(cnt); 63 end if; 64 65 wait on clk; 66 end process; 67 68 bmon: process(b) 69 begin 70--report "stype of b is: " & integer'image(b'stype); 71 if b = '1' and b'special then 72--report "stype of bv is: " & integer'image(bv'stype); 73 assert bv = "00111100" report "Error: got unexpected bv value" severity failure; 74 end if; 75 end process; 76 77 bvmon: process(bv) 78 variable i_v : integer; 79 attribute stype of i_v: variable is 0; 80 begin 81 i_v := cnt; 82 case bv is 83 when "00001111" => 84 report ent1'ent_name; 85 report ent1'ent_type; 86 report "Completeness: " & integer'image(ent1'ent_stat); 87 assert cnt = 0 report "Error0: got unexpected cnt value" severity failure; 88 when "00011110" => 89 assert cnt = 1 report "Error1: got unexpected cnt value" severity failure; 90 when "00111100" => 91 report ent2'ent_name; 92 report ent2'ent_type; 93 report "Completeness: " & integer'image(ent2'ent_stat); 94 assert cnt = 2 report "Error2: got unexpected cnt value" severity failure; 95 when "01111000" => 96 assert cnt = 3 report "Error3: got unexpected cnt value" severity failure; 97 when "11110000" => 98 report ent3'ent_name; 99 report ent3'ent_type; 100 report "Completeness: " & integer'image(ent3'ent_stat); 101 assert cnt = 4 report "Error4: got unexpected cnt value" severity failure; 102 when others => 103--report "stype of i_v is: " & integer'image(i_v'stype); 104 null; 105 end case; 106 107 end process; 108 109 d1: entity work.ent1(rtl); 110 d2: entity work.ent2(bhv); 111 d3: entity work.ent3(rtl); 112 113end tb; 114