mirror of
https://github.com/YosysHQ/yosys
synced 2025-09-10 19:51:27 +00:00
kernel: Add RTLIL::PortDir for a combined input and output flag
This commit is contained in:
parent
9f62dd6e0e
commit
b394629e3f
3 changed files with 34 additions and 0 deletions
|
@ -4241,6 +4241,22 @@ bool RTLIL::Cell::output(const RTLIL::IdString& portname) const
|
|||
return false;
|
||||
}
|
||||
|
||||
RTLIL::PortDir RTLIL::Cell::port_dir(const RTLIL::IdString& portname) const
|
||||
{
|
||||
if (yosys_celltypes.cell_known(type))
|
||||
return yosys_celltypes.cell_port_dir(type, portname);
|
||||
if (module && module->design) {
|
||||
RTLIL::Module *m = module->design->module(type);
|
||||
if (m == nullptr)
|
||||
return PortDir::PD_UNKNOWN;
|
||||
RTLIL::Wire *w = m->wire(portname);
|
||||
if (w == nullptr)
|
||||
return PortDir::PD_UNKNOWN;
|
||||
return PortDir(w->port_input + w->port_output * 2);
|
||||
}
|
||||
return PortDir::PD_UNKNOWN;
|
||||
}
|
||||
|
||||
bool RTLIL::Cell::hasParam(const RTLIL::IdString& paramname) const
|
||||
{
|
||||
return parameters.count(paramname) != 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue