Skip to content

Commit 8d0f149

Browse files
author
djns1
committed
Fixed unused input bug
1 parent 490b804 commit 8d0f149

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

ODIN_II/SRC/netlist_create_from_ast.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1846,6 +1846,8 @@ void connect_module_instantiation_and_alias(short PASS, ast_node_t* module_insta
18461846

18471847
/* search for the old_input name */
18481848
if ((sc_spot_input_old = sc_lookup_string(input_nets_sc, alias_name)) == -1) {
1849+
if( is_inout )
1850+
goto instantiate_output;
18491851
/* doesn it have to exist since might only be used in module */
18501852
error_message(NETLIST, module_instance->line_number, module_instance->file_number,
18511853
"This module port %s is unused in module %s", alias_name, module_node->children[0]->types.identifier);
@@ -1910,7 +1912,8 @@ void connect_module_instantiation_and_alias(short PASS, ast_node_t* module_insta
19101912
vtr::free(full_name);
19111913
vtr::free(alias_name);
19121914
}
1913-
1915+
1916+
instantiate_output:
19141917
if (module_var_node->types.variable.is_output) {
19151918
/* ELSE IF - this is an output pin from the module. We need to alias this output
19161919
* pin with it's calling name here so that everyone can see it at this level */

ODIN_II/SRC/parse_making_ast.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ ast_node_t* markAndProcessPortWith(ids top_type, ids port_id, ids net_id, ast_no
479479
/* look for processed inouts with this name */
480480
sc_spot = sc_lookup_string(this_inouts_sc, port->children[0]->types.identifier);
481481
if (sc_spot > -1 && ((ast_node_t*)this_inouts_sc->data[sc_spot])->types.variable.is_port) {
482-
error_message(PARSE_ERROR, port->line_number, current_parse_file, "%s already has inout with this name %s\n",
482+
error_message(AST, port->line_number, current_parse_file, "%s already has inout with this name %s\n",
483483
top_type_name, ((ast_node_t*)this_inouts_sc->data[sc_spot])->children[0]->types.identifier);
484484
}
485485

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module inout_reg(input oe, inout line);
2+
reg val;
3+
assign line = oe ? val : 1'bz;
4+
assign val = oe ? 1'bz : line;
5+
endmodule
6+
7+
module inout_basic(input oe, input in, output out);
8+
wire internal;
9+
assign internal = oe ? 1'bz : in;
10+
inout_reg c(oe, internal);
11+
assign out = internal;
12+
endmodule

0 commit comments

Comments
 (0)