File tree Expand file tree Collapse file tree 5 files changed +43
-4
lines changed
regression/verilog/modules Expand file tree Collapse file tree 5 files changed +43
-4
lines changed Original file line number Diff line number Diff line change 1+ KNOWNBUG
2+ ref1.sv
3+
4+ ^EXIT=0$
5+ ^SIGNAL=0$
6+ --
7+ ^warning: ignoring
Original file line number Diff line number Diff line change 1+ module M (ref [31 : 0 ] some_ref);
2+ initial some_ref = 123 ;
3+ endmodule
4+
5+ module main ;
6+ bit [31 : 0 ] some_var;
7+ M m (some_var);
8+ assert final (some_var == 123 );
9+ endmodule
Original file line number Diff line number Diff line change @@ -56,6 +56,13 @@ void verilog_typecheckt::collect_port_symbols(const verilog_declt &decl)
5656 new_symbol.is_input = true ;
5757 new_symbol.is_output = true ;
5858 }
59+ else if (port_class == ID_verilog_ref)
60+ {
61+ new_symbol.is_input = false ;
62+ new_symbol.is_output = false ;
63+ }
64+ else
65+ DATA_INVARIANT (false , " unexpected port class" );
5966
6067 new_symbol.module = module_identifier;
6168 new_symbol.value .make_nil ();
Original file line number Diff line number Diff line change @@ -92,13 +92,24 @@ void verilog_typecheckt::check_module_ports(
9292 << " port `" << base_name << " ' not declared" ;
9393 }
9494
95- if (!port_symbol->is_input && !port_symbol->is_output )
95+ irep_idt direction = decl.get_class ();
96+
97+ if (direction.empty ())
9698 {
97- throw errort ().with_location (declarator.source_location ())
98- << " port `" << base_name << " ' not declared as input or output" ;
99+ if (!port_symbol->is_input && !port_symbol->is_output )
100+ {
101+ throw errort ().with_location (declarator.source_location ())
102+ << " port `" << base_name << " ' not declared as input or output" ;
103+ }
104+ else if (port_symbol->is_input && !port_symbol->is_output )
105+ direction = ID_input;
106+ else if (!port_symbol->is_input && port_symbol->is_output )
107+ direction = ID_output;
108+ else
109+ direction = ID_inout;
99110 }
100111
101- ports.emplace_back (identifier, port_symbol->type , decl. get_class () );
112+ ports.emplace_back (identifier, port_symbol->type , direction );
102113
103114 ports.back ().set (" #name" , base_name);
104115 ports.back ().set (ID_C_source_location, declarator.source_location ());
Original file line number Diff line number Diff line change @@ -193,6 +193,11 @@ class module_typet:public typet
193193 return direction () == ID_input || direction () == ID_inout;
194194 }
195195
196+ bool ref () const
197+ {
198+ return direction () == ID_verilog_ref;
199+ }
200+
196201 const source_locationt &source_location () const
197202 {
198203 return (const source_locationt &)find (ID_C_source_location);
You can’t perform that action at this time.
0 commit comments