fabulous: Misc improvements

Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
gatecat 2023-02-27 10:38:25 +01:00 committed by myrtle
parent cdd7bb676f
commit 2f509734df
3 changed files with 24 additions and 2 deletions

View File

@ -115,3 +115,4 @@ X(_CONST1)
X(_LUT_PERM)
X(_LUT_PERM_IN)
X(I_reg)

View File

@ -102,7 +102,9 @@ struct FabulousImpl : ViaductAPI
if (ci->type == id_FABULOUS_LC) {
auto &lct = cell_tags.get(ci);
if (lct.comb.carry_used) {
ctx->addCellTimingDelay(ci->name, id_Ci, id_Co, 1.0);
ctx->addCellTimingDelay(ci->name, id_Ci, id_Co, 0.2);
ctx->addCellTimingDelay(ci->name, ctx->id("I1"), id_Co, 1.0);
ctx->addCellTimingDelay(ci->name, ctx->id("I2"), id_Co, 1.0);
}
if (lct.ff.ff_used) {
ctx->addCellTimingClock(ci->name, id_CLK);
@ -638,7 +640,7 @@ struct FabulousImpl : ViaductAPI
delay_t predictDelay(BelId src_bel, IdString src_pin, BelId dst_bel, IdString dst_pin) const override
{
if (src_pin == id_Ci && dst_pin == id_Co)
if (src_pin == id_Co && dst_pin == id_Ci)
return 0.5;
auto driver_loc = ctx->getBelLocation(src_bel);

View File

@ -223,6 +223,23 @@ struct FabFasmWriter
}
}
void write_iopass(const CellInfo *ci)
{
Loc loc = ctx->getBelLocation(ci->bel);
// We use 'nice' names based on function for the IOPass bels inside nextpnr
// but in the bitstream we need to use character names
NPNR_ASSERT(loc.z <= 26);
prefix = stringf("X%dY%d.%c.", loc.x, loc.y, 'A' + loc.z);
if (ci->params.count(id_I_reg)) {
uint64_t regval = int_or_default(ci->params, id_I_reg);
for (unsigned i = 0; i < 4; i++) {
if (regval & (1 << i))
out << prefix << stringf("I%d_reg", i) << std::endl;
}
}
prefix = "";
}
void write_cell(const CellInfo *ci)
{
out << stringf("# config for cell '%s'\n", ctx->nameOf(ci)) << std::endl;
@ -231,6 +248,8 @@ struct FabFasmWriter
write_logic(ci);
else if (ci->type == id_IO_1_bidirectional_frame_config_pass)
write_io(ci);
else if (ci->type.in(id_InPass4_frame_config, id_OutPass4_frame_config))
write_iopass(ci);
else
write_generic_cell(ci);
// TODO: other cell types