Skip to content

Commit 7c536e8

Browse files
authored
Merge pull request #715 from diffblue/signed1-fix
Verilog: one bit signed/unsigned types
2 parents 538cb98 + 8d5a768 commit 7c536e8

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
signed1.sv
3+
--bound 0
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module main;
2+
3+
wire signed one_bit_signed = -1;
4+
5+
assert final (one_bit_signed == -1);
6+
assert final ($bits(one_bit_signed) == 1);
7+
8+
wire unsigned one_bit_unsigned = 1;
9+
10+
assert final (one_bit_unsigned == 1);
11+
assert final ($bits(one_bit_unsigned) == 1);
12+
13+
endmodule

src/verilog/verilog_elaborate_type.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,16 @@ typet verilog_typecheck_exprt::elaborate_type(const typet &src)
166166
// it's just a bit
167167
return bool_typet().with_source_location(source_location);
168168
}
169+
else if(src.id() == ID_signed)
170+
{
171+
// one bit, signed
172+
return signedbv_typet{1}.with_source_location(source_location);
173+
}
174+
else if(src.id() == ID_unsigned)
175+
{
176+
// one bit, unsigned
177+
return unsignedbv_typet{1}.with_source_location(source_location);
178+
}
169179
else if(src.id() == ID_verilog_byte)
170180
{
171181
return signedbv_typet{8}.with_source_location(source_location);

0 commit comments

Comments
 (0)