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
22input_and_output.v
33
4+ ^file .* line 4: port `x' is alrady declared$
45^EXIT=2$
56^SIGNAL=0$
67--
78--
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)
286286 {
287287 symbolt &osymbol = *result;
288288
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+
289298 if (symbol.type != osymbol.type )
290299 {
291300 if (get_width (symbol.type ) > get_width (osymbol.type ))
292301 osymbol.type = symbol.type ;
293302 }
294303
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 ;
297306 osymbol.is_state_var = symbol.is_state_var || osymbol.is_state_var ;
298307
299308 // a register can't be an input as well
You can’t perform that action at this time.
0 commit comments