File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
regression/verilog/modules Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 1
- KNOWNBUG
1
+ CORE
2
2
input_and_output.v
3
3
4
+ ^file .* line 4: port `x' is alrady declared$
4
5
^EXIT=2$
5
6
^SIGNAL=0$
6
7
--
7
8
--
8
- This should be errored, as some_var must not be both input and output.
Original file line number Diff line number Diff line change @@ -286,14 +286,23 @@ void verilog_typecheckt::collect_symbols(const verilog_declt &decl)
286
286
{
287
287
symbolt &osymbol = *result;
288
288
289
+ // 1800-2017 23.2.2.1
290
+ // "Once a name is used in a port declaration, it shall not be declared
291
+ // again in another port declaration"
292
+ if (osymbol.is_input || osymbol.is_output )
293
+ {
294
+ throw errort ().with_location (declarator.source_location ())
295
+ << " port `" << symbol.base_name << " ' is alrady declared" ;
296
+ }
297
+
289
298
if (symbol.type != osymbol.type )
290
299
{
291
300
if (get_width (symbol.type ) > get_width (osymbol.type ))
292
301
osymbol.type = symbol.type ;
293
302
}
294
303
295
- osymbol.is_input = symbol.is_input || osymbol. is_input ;
296
- osymbol.is_output = symbol.is_output || osymbol. is_output ;
304
+ osymbol.is_input = symbol.is_input ;
305
+ osymbol.is_output = symbol.is_output ;
297
306
osymbol.is_state_var = symbol.is_state_var || osymbol.is_state_var ;
298
307
299
308
// a register can't be an input as well
You can’t perform that action at this time.
0 commit comments