3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-07-29 07:27:58 +00:00

Added RTLIL::Cell::has(portname)

This commit is contained in:
Clifford Wolf 2014-07-26 16:11:28 +02:00
parent a84cb04935
commit 97a59851a6
12 changed files with 33 additions and 27 deletions

View file

@ -348,9 +348,9 @@ namespace {
void port(const char *name, int width)
{
if (cell->connections().count(name) == 0)
if (!cell->has(name))
error(__LINE__);
if (cell->connections().at(name).size() != width)
if (cell->get(name).size() != width)
error(__LINE__);
expected_ports.insert(name);
}
@ -379,9 +379,9 @@ namespace {
for (const char *p = ports; *p; p++) {
char portname[3] = { '\\', *p, 0 };
if (cell->connections().count(portname) == 0)
if (!cell->has(portname))
error(__LINE__);
if (cell->connections().at(portname).size() != 1)
if (cell->get(portname).size() != 1)
error(__LINE__);
}
@ -1340,6 +1340,11 @@ RTLIL::Memory::Memory()
size = 0;
}
bool RTLIL::Cell::has(RTLIL::IdString portname)
{
return connections_.count(portname) != 0;
}
void RTLIL::Cell::unset(RTLIL::IdString portname)
{
connections_.erase(portname);