Skip to content

Commit b64bf01

Browse files
authored
frontend: don't connect a const net to ports connected to x. (#1447)
prjunnamed normalizes ports that are not present in the primitive to be all-x. On iCE40, this can cause a false placement conflict between `SB_IO` cells where one's clock input is `x` and another's is some other net.
1 parent 81ccada commit b64bf01

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

frontend/frontend_base.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,10 @@ template <typename FrontendType> struct GenericFrontend
472472
ci->ports[port_bit_ids].type = dir;
473473
// Resolve connectivity
474474
NetInfo *net;
475-
if (impl.is_vector_bit_constant(bits, i)) {
475+
if (impl.is_vector_bit_undef(bits, i)) {
476+
// Don't connect it if it's an `x`
477+
continue;
478+
} else if (impl.is_vector_bit_constant(bits, i)) {
476479
// Create a constant driver if one is needed
477480
net = create_constant_net(m, inst_name.str(ctx) + "." + port_bit_name + "$const",
478481
impl.get_vector_bit_constval(bits, i));

frontend/json_frontend.cc

+6
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,12 @@ struct JsonFrontendImpl
161161

162162
int get_vector_length(BitVectorDataType &bits) const { return int(bits.size()); }
163163

164+
bool is_vector_bit_undef(BitVectorDataType &bits, int i) const
165+
{
166+
NPNR_ASSERT(i < int(bits.size()));
167+
return bits[i] == "x";
168+
}
169+
164170
bool is_vector_bit_constant(BitVectorDataType &bits, int i) const
165171
{
166172
NPNR_ASSERT(i < int(bits.size()));

0 commit comments

Comments
 (0)