Skip to content

Commit 95bcd0c

Browse files
committed
Verilog: better diagnostics on procedural assignment to net
1 parent bc55efc commit 95bcd0c

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
procedural_assignment_to_net.v
3+
4+
^EXIT=2$
5+
^SIGNAL=0$
6+
^file procedural_assignment_to_net\.v line 6: procedural assignment to a net$
7+
^Identifier main\.some_net is declared as bool on line 3\.$
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module main(input i);
2+
3+
wire some_net;
4+
5+
// should error
6+
always @i some_net = i;
7+
8+
endmodule

src/verilog/verilog_typecheck.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,10 @@ void verilog_typecheckt::check_lhs(
802802
!symbol.is_lvalue)
803803
{
804804
throw errort().with_location(lhs.source_location())
805-
<< "assignment to non-register";
805+
<< "procedural assignment to a net\n"
806+
<< "Identifier " << symbol.display_name() << " is declared as "
807+
<< to_string(symbol.type) << " on line " << symbol.location.get_line()
808+
<< '.';
806809
}
807810

808811
break;

0 commit comments

Comments
 (0)