Start work on BUFG support

This commit is contained in:
Miodrag Milanovic 2025-01-06 14:15:05 +01:00
parent ed6f6a4d98
commit 0987d5a2b9
5 changed files with 30 additions and 8 deletions

View File

@ -132,6 +132,8 @@ struct BitstreamBackend
cc.tiles[loc].add_word(stringf("CPE%d.%s", x, p.first.c_str(ctx)), p.second.as_bits()); cc.tiles[loc].add_word(stringf("CPE%d.%s", x, p.first.c_str(ctx)), p.second.as_bits());
} }
} break; } break;
case id_BUFG.index:
break;
default: default:
log_error("Unhandled cell %s of type %s\n", cell.second.get()->name.c_str(ctx), log_error("Unhandled cell %s of type %s\n", cell.second.get()->name.c_str(ctx),
cell.second->type.c_str(ctx)); cell.second->type.c_str(ctx));
@ -152,14 +154,18 @@ struct BitstreamBackend
IdString name = IdString(extra_data.name); IdString name = IdString(extra_data.name);
CfgLoc loc = getConfigLoc(ctx, pip.tile); CfgLoc loc = getConfigLoc(ctx, pip.tile);
std::string word = name.c_str(ctx); std::string word = name.c_str(ctx);
int x = getInTileIndex(ctx, pip.tile); if (extra_data.flags & MUX_CONFIG) {
if (boost::starts_with(word, "IM.")) cc.configs[loc.die].add_word(word, int_to_bitvector(extra_data.value, extra_data.bits));
boost::replace_all(word, "IM.", stringf("IM%d.", x)); } else {
if (boost::starts_with(word, "OM.")) int x = getInTileIndex(ctx, pip.tile);
boost::replace_all(word, "OM.", stringf("OM%d.", x)); if (boost::starts_with(word, "IM."))
if (boost::starts_with(word, "IOES.")) boost::replace_all(word, "IM.", stringf("IM%d.", x));
boost::replace_all(word, "IOES.", "IOES1."); if (boost::starts_with(word, "OM."))
cc.tiles[loc].add_word(word, int_to_bitvector(extra_data.value, extra_data.bits)); boost::replace_all(word, "OM.", stringf("OM%d.", x));
if (boost::starts_with(word, "IOES."))
boost::replace_all(word, "IOES.", "IOES1.");
cc.tiles[loc].add_word(word, int_to_bitvector(extra_data.value, extra_data.bits));
}
} }
} }
} }

View File

@ -36,6 +36,7 @@ enum MuxFlags
{ {
MUX_INVERT = 1, MUX_INVERT = 1,
MUX_VISIBLE = 2, MUX_VISIBLE = 2,
MUX_CONFIG = 4,
}; };
enum PipExtra enum PipExtra

View File

@ -29,6 +29,7 @@ PIP_EXTRA_CPE = 2
MUX_INVERT = 1 MUX_INVERT = 1
MUX_VISIBLE = 2 MUX_VISIBLE = 2
MUX_CONFIG = 4
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("--lib", help="Project Peppercorn python database script path", type=str, required=True) parser.add_argument("--lib", help="Project Peppercorn python database script path", type=str, required=True)
@ -85,6 +86,7 @@ def main():
pp = tt.create_pip(mux.src, mux.dst) pp = tt.create_pip(mux.src, mux.dst)
mux_flags = MUX_INVERT if mux.invert else 0 mux_flags = MUX_INVERT if mux.invert else 0
mux_flags |= MUX_VISIBLE if mux.visible else 0 mux_flags |= MUX_VISIBLE if mux.visible else 0
mux_flags |= MUX_CONFIG if mux.config else 0
pp.extra_data = PipExtraData(PIP_EXTRA_MUX, ch.strs.id(mux.name), mux.bits, mux.value, mux_flags) pp.extra_data = PipExtraData(PIP_EXTRA_MUX, ch.strs.id(mux.name), mux.bits, mux.value, mux_flags)
if "CPE" in type_name: if "CPE" in type_name:
pp = tt.create_pip("CPE.IN1", "CPE.RAM_O2") pp = tt.create_pip("CPE.IN1", "CPE.RAM_O2")

View File

@ -348,6 +348,17 @@ void GateMatePacker::pack_cpe()
} }
} }
void GateMatePacker::pack_bufg()
{
log_info("Packing BUFGs..\n");
for (auto &cell : ctx->cells) {
CellInfo &ci = *cell.second;
if (!ci.type.in(id_CC_BUFG))
continue;
ci.type = id_BUFG;
}
}
void GateMatePacker::pack_constants() void GateMatePacker::pack_constants()
{ {
log_info("Packing constants..\n"); log_info("Packing constants..\n");
@ -397,6 +408,7 @@ void GateMateImpl::pack()
GateMatePacker packer(ctx, this); GateMatePacker packer(ctx, this);
packer.pack_constants(); packer.pack_constants();
packer.pack_io(); packer.pack_io();
packer.pack_bufg();
packer.pack_cpe(); packer.pack_cpe();
packer.remove_constants(); packer.remove_constants();
} }

View File

@ -30,6 +30,7 @@ struct GateMatePacker
void pack_io(); void pack_io();
void pack_cpe(); void pack_cpe();
void pack_bufg();
void pack_constants(); void pack_constants();
void disconnect_if_gnd(CellInfo *cell, IdString input); void disconnect_if_gnd(CellInfo *cell, IdString input);