-
Notifications
You must be signed in to change notification settings - Fork 902
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add more tests for bounds attributes, fix attributes appearing in ver…
…ilog
- Loading branch information
1 parent
e91e95f
commit 03033ab
Showing
4 changed files
with
258 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module test ( | ||
input ia, | ||
output oa, | ||
input [0:0] ib, | ||
output [0:0] ob, | ||
input [3:0] ic, | ||
output [3:0] oc | ||
); | ||
|
||
assign oa = ia; | ||
assign ob = ib; | ||
assign oc = ic; | ||
|
||
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,147 @@ | ||
read -vhdl bounds.vhd | ||
verific -import work | ||
select -assert-count 1 a:bottom_bound=5'bs11011 | ||
select -assert-count 1 a:top_bound=5'bs01010 | ||
select -assert-count 1 a:bottom_bound=5'bs11010 | ||
select -assert-count 1 a:top_bound=5'bs01011 | ||
hierarchy -top test | ||
|
||
# bit: not a scalar type | ||
select -assert-count 0 w:bit_in a:bottom_bound %i | ||
select -assert-count 0 w:bit_in a:top_bound %i | ||
select -assert-count 0 w:bit_out a:bottom_bound %i | ||
select -assert-count 0 w:bit_out a:top_bound %i | ||
|
||
# bit_vector: not a scalar type | ||
select -assert-count 0 w:bit_vector_in a:bottom_bound %i | ||
select -assert-count 0 w:bit_vector_in a:top_bound %i | ||
select -assert-count 0 w:bit_vector_out a:bottom_bound %i | ||
select -assert-count 0 w:bit_vector_out a:top_bound %i | ||
|
||
# bit_vector with to index: not a scalar type | ||
select -assert-count 0 w:bit_vector_in_to a:bottom_bound %i | ||
select -assert-count 0 w:bit_vector_in_to a:top_bound %i | ||
select -assert-count 0 w:bit_vector_out_to a:bottom_bound %i | ||
select -assert-count 0 w:bit_vector_out_to a:top_bound %i | ||
|
||
# std_ulogic: not a scalar type | ||
select -assert-count 0 w:std_ulogic_in a:bottom_bound %i | ||
select -assert-count 0 w:std_ulogic_in a:top_bound %i | ||
select -assert-count 0 w:std_ulogic_out a:bottom_bound %i | ||
select -assert-count 0 w:std_ulogic_out a:top_bound %i | ||
|
||
# std_ulogic_vector: not a scalar type | ||
select -assert-count 0 w:std_ulogic_vector_in a:bottom_bound %i | ||
select -assert-count 0 w:std_ulogic_vector_in a:top_bound %i | ||
select -assert-count 0 w:std_ulogic_vector_out a:bottom_bound %i | ||
select -assert-count 0 w:std_ulogic_vector_out a:top_bound %i | ||
|
||
# std_ulogic_vector with to index: not a scalar type | ||
select -assert-count 0 w:std_ulogic_vector_in_to a:bottom_bound %i | ||
select -assert-count 0 w:std_ulogic_vector_in_to a:top_bound %i | ||
select -assert-count 0 w:std_ulogic_vector_out_to a:bottom_bound %i | ||
select -assert-count 0 w:std_ulogic_vector_out_to a:top_bound %i | ||
|
||
# std_logic: not a scalar type | ||
select -assert-count 0 w:std_logic_in a:bottom_bound %i | ||
select -assert-count 0 w:std_logic_in a:top_bound %i | ||
select -assert-count 0 w:std_logic_out a:bottom_bound %i | ||
select -assert-count 0 w:std_logic_out a:top_bound %i | ||
|
||
# std_logic_vector: not a scalar type | ||
select -assert-count 0 w:std_logic_vector_in a:bottom_bound %i | ||
select -assert-count 0 w:std_logic_vector_in a:top_bound %i | ||
select -assert-count 0 w:std_logic_vector_out a:bottom_bound %i | ||
select -assert-count 0 w:std_logic_vector_out a:top_bound %i | ||
|
||
# std_logic_vector with to index: not a scalar type | ||
select -assert-count 0 w:std_logic_vector_in_to a:bottom_bound %i | ||
select -assert-count 0 w:std_logic_vector_in_to a:top_bound %i | ||
select -assert-count 0 w:std_logic_vector_out_to a:bottom_bound %i | ||
select -assert-count 0 w:std_logic_vector_out_to a:top_bound %i | ||
|
||
# signed: not a scalar type | ||
select -assert-count 0 w:signed_in a:bottom_bound %i | ||
select -assert-count 0 w:signed_in a:top_bound %i | ||
select -assert-count 0 w:signed_out a:bottom_bound %i | ||
select -assert-count 0 w:signed_out a:top_bound %i | ||
|
||
# signed with to index: not a scalar type | ||
select -assert-count 0 w:signed_in_to a:bottom_bound %i | ||
select -assert-count 0 w:signed_in_to a:top_bound %i | ||
select -assert-count 0 w:signed_out_to a:bottom_bound %i | ||
select -assert-count 0 w:signed_out_to a:top_bound %i | ||
|
||
# unsigned: not a scalar type | ||
select -assert-count 0 w:unsigned_in a:bottom_bound %i | ||
select -assert-count 0 w:unsigned_in a:top_bound %i | ||
select -assert-count 0 w:unsigned_out a:bottom_bound %i | ||
select -assert-count 0 w:unsigned_out a:top_bound %i | ||
|
||
# unsigned with to index: not a scalar type | ||
select -assert-count 0 w:unsigned_in_to a:bottom_bound %i | ||
select -assert-count 0 w:unsigned_in_to a:top_bound %i | ||
select -assert-count 0 w:unsigned_out_to a:bottom_bound %i | ||
select -assert-count 0 w:unsigned_out_to a:top_bound %i | ||
|
||
# integer: scalar type | ||
select -assert-count 1 w:integer_in a:bottom_bound=32'b10000000000000000000000000000000 %i | ||
select -assert-count 1 w:integer_in a:top_bound=32'b01111111111111111111111111111111 %i | ||
select -assert-count 1 w:integer_out a:bottom_bound=32'b10000000000000000000000000000000 %i | ||
select -assert-count 1 w:integer_out a:top_bound=32'b01111111111111111111111111111111 %i | ||
|
||
# integer with range: scalar type | ||
select -assert-count 1 w:integer_with_range_in a:bottom_bound=5'bs11011 %i | ||
select -assert-count 1 w:integer_with_range_in a:top_bound=5'bs01010 %i | ||
select -assert-count 1 w:integer_with_range_out a:bottom_bound=5'bs11010 %i | ||
select -assert-count 1 w:integer_with_range_out a:top_bound=5'bs01010 %i | ||
|
||
# integer with single value range: scalar type | ||
select -assert-count 1 w:integer_single_value_in a:bottom_bound=3'bs101 %i | ||
select -assert-count 1 w:integer_single_value_in a:top_bound=3'bs101 %i | ||
select -assert-count 1 w:integer_single_value_out a:bottom_bound=3'bs101 %i | ||
select -assert-count 1 w:integer_single_value_out a:top_bound=3'bs101 %i | ||
|
||
# integer with null range: scalar type | ||
# select -assert-count 1 w:integer_null_range_in a:bottom_bound=4'bs0111 %i | ||
# select -assert-count 1 w:integer_null_range_in a:top_bound=4'bs1111 %i | ||
select -assert-count 1 w:integer_null_range_out a:bottom_bound=2'bs00 %i | ||
select -assert-count 1 w:integer_null_range_out a:top_bound=2'bs11 %i | ||
|
||
# natural: scalar type | ||
select -assert-count 1 w:natural_in a:bottom_bound=31'b0000000000000000000000000000000 %i | ||
select -assert-count 1 w:natural_in a:top_bound=31'b1111111111111111111111111111111 %i | ||
select -assert-count 1 w:natural_out a:bottom_bound=31'b0000000000000000000000000000000 %i | ||
select -assert-count 1 w:natural_out a:top_bound=31'b1111111111111111111111111111111 %i | ||
|
||
# positive: scalar type | ||
select -assert-count 1 w:positive_in a:bottom_bound=31'b0000000000000000000000000000001 %i | ||
select -assert-count 1 w:positive_in a:top_bound=31'b1111111111111111111111111111111 %i | ||
select -assert-count 1 w:positive_out a:bottom_bound=31'b0000000000000000000000000000001 %i | ||
select -assert-count 1 w:positive_out a:top_bound=31'b1111111111111111111111111111111 %i | ||
|
||
|
||
# integer size changed in VHDL 2019 | ||
design -reset | ||
read -vhdl2019 bounds.vhd | ||
hierarchy -top test | ||
|
||
# integer: scalar type | ||
select -assert-count 1 w:integer_in a:bottom_bound=64'b1000000000000000000000000000000000000000000000000000000000000000 %i | ||
select -assert-count 1 w:integer_in a:top_bound=64'b0111111111111111111111111111111111111111111111111111111111111111 %i | ||
select -assert-count 1 w:integer_out a:bottom_bound=64'b1000000000000000000000000000000000000000000000000000000000000000 %i | ||
select -assert-count 1 w:integer_out a:top_bound=64'b0111111111111111111111111111111111111111111111111111111111111111 %i | ||
|
||
# natural: scalar type | ||
select -assert-count 1 w:natural_in a:bottom_bound=63'b000000000000000000000000000000000000000000000000000000000000000 %i | ||
select -assert-count 1 w:natural_in a:top_bound=63'b111111111111111111111111111111111111111111111111111111111111111 %i | ||
select -assert-count 1 w:natural_out a:bottom_bound=63'b000000000000000000000000000000000000000000000000000000000000000 %i | ||
select -assert-count 1 w:natural_out a:top_bound=63'b111111111111111111111111111111111111111111111111111111111111111 %i | ||
|
||
# positive: scalar type | ||
select -assert-count 1 w:positive_in a:bottom_bound=63'b000000000000000000000000000000000000000000000000000000000000001 %i | ||
select -assert-count 1 w:positive_in a:top_bound=63'b111111111111111111111111111111111111111111111111111111111111111 %i | ||
select -assert-count 1 w:positive_out a:bottom_bound=63'b000000000000000000000000000000000000000000000000000000000000001 %i | ||
select -assert-count 1 w:positive_out a:top_bound=63'b111111111111111111111111111111111111111111111111111111111111111 %i | ||
|
||
design -reset | ||
read -sv bounds.sv | ||
hierarchy -top test | ||
|
||
select -assert-count none a:bottom_bound | ||
select -assert-count none a:top_bound |