Fixed a bug in "add -global_input"

This commit is contained in:
Clifford Wolf 2013-11-21 03:01:20 +01:00
parent 64a5f8f75e
commit 84ced2bb8e
1 changed files with 16 additions and 15 deletions

View File

@ -23,12 +23,11 @@
static void add_wire(RTLIL::Design *design, RTLIL::Module *module, std::string name, int width, bool flag_input, bool flag_output, bool flag_global) static void add_wire(RTLIL::Design *design, RTLIL::Module *module, std::string name, int width, bool flag_input, bool flag_output, bool flag_global)
{ {
RTLIL::Wire *wire = NULL;
name = RTLIL::escape_id(name); name = RTLIL::escape_id(name);
if (module->count_id(name) != 0) if (module->count_id(name) != 0)
{ {
RTLIL::Wire *wire = NULL;
if (module->wires.count(name) > 0) if (module->wires.count(name) > 0)
wire = module->wires.at(name); wire = module->wires.at(name);
@ -43,11 +42,12 @@ static void add_wire(RTLIL::Design *design, RTLIL::Module *module, std::string n
if (wire == NULL) if (wire == NULL)
log_cmd_error("Found incompatible object with same name in module %s!\n", module->name.c_str()); log_cmd_error("Found incompatible object with same name in module %s!\n", module->name.c_str());
log("Skipping module %s as it already has such an object.\n", module->name.c_str());
return;
}
RTLIL::Wire *wire = new RTLIL::Wire; log("Module %s already has such an object.\n", module->name.c_str());
}
else
{
wire = new RTLIL::Wire;
wire->name = name; wire->name = name;
wire->width = width; wire->width = width;
wire->port_input = flag_input; wire->port_input = flag_input;
@ -60,6 +60,7 @@ static void add_wire(RTLIL::Design *design, RTLIL::Module *module, std::string n
} }
log("Added wire %s to module %s.\n", name.c_str(), module->name.c_str()); log("Added wire %s to module %s.\n", name.c_str(), module->name.c_str());
}
if (!flag_global) if (!flag_global)
return; return;