From 84d542624213ab8639bac31ade79ce27097f4e06 Mon Sep 17 00:00:00 2001 From: David Shah Date: Mon, 20 Jan 2020 15:57:06 +0000 Subject: nexus: Working on validity checking Signed-off-by: David Shah --- common/design_utils.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'common') diff --git a/common/design_utils.h b/common/design_utils.h index 1ae1d648..301547c6 100644 --- a/common/design_utils.h +++ b/common/design_utils.h @@ -82,6 +82,13 @@ template CellInfo *net_driven_by(const Context *ctx, const NetInfo } } +// Check if a port is used +inline bool port_used(CellInfo *cell, IdString port_name) +{ + auto port_fnd = cell->ports.find(port_name); + return port_fnd != cell->ports.end() && port_fnd->second.net != nullptr; +} + // Connect a net to a port void connect_port(const Context *ctx, NetInfo *net, CellInfo *cell, IdString port_name); -- cgit v1.2.3