From 9fa4bb8ba28c07ce865347e3957a3062528d949a Mon Sep 17 00:00:00 2001 From: Lofty Date: Tue, 1 Jul 2025 09:57:43 +0100 Subject: [PATCH] Remove A passthrough inversion option --- himbaechel/uarch/gatemate/gatemate.h | 3 +-- himbaechel/uarch/gatemate/pack_mult.cc | 22 +++++++++------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/himbaechel/uarch/gatemate/gatemate.h b/himbaechel/uarch/gatemate/gatemate.h index e0cf4044..3114c329 100644 --- a/himbaechel/uarch/gatemate/gatemate.h +++ b/himbaechel/uarch/gatemate/gatemate.h @@ -43,13 +43,12 @@ struct ZeroDriver // Propagate A0 through OUT1 and A1 through OUT2; zero COUTX and POUTX. struct APassThroughCell { - APassThroughCell(CellInfo *lower, CellInfo *upper, IdString name, bool inverted); + APassThroughCell(CellInfo *lower, CellInfo *upper, IdString name); void clean_up(Context *ctx); CellInfo *lower; CellInfo *upper; - bool inverted; }; // Propagate B0 through POUTY1 and B1 through COUTY1 diff --git a/himbaechel/uarch/gatemate/pack_mult.cc b/himbaechel/uarch/gatemate/pack_mult.cc index 6a3a388a..916c0f20 100644 --- a/himbaechel/uarch/gatemate/pack_mult.cc +++ b/himbaechel/uarch/gatemate/pack_mult.cc @@ -48,8 +48,8 @@ ZeroDriver::ZeroDriver(CellInfo *lower, CellInfo *upper, IdString name) : lower{ upper->params[id_C_O2] = Property(0b11, 2); // COMB2OUT -> OUT2 } -APassThroughCell::APassThroughCell(CellInfo *lower, CellInfo *upper, IdString name, bool inverted) - : lower{lower}, upper{upper}, inverted{inverted} +APassThroughCell::APassThroughCell(CellInfo *lower, CellInfo *upper, IdString name) + : lower{lower}, upper{upper} { lower->params[id_INIT_L02] = Property(LUT_D0, 4); // IN5 lower->params[id_INIT_L03] = Property(LUT_ZERO, 4); // (unused) @@ -80,30 +80,26 @@ void APassThroughCell::clean_up(Context *ctx) { bool net_is_gnd = - lower_net->name == ctx->idf("$PACKER_GND") || (inverted && lower_net->name == ctx->idf("$PACKER_VCC")); + lower_net->name == ctx->idf("$PACKER_GND"); bool net_is_vcc = - lower_net->name == ctx->idf("$PACKER_VCC") || (inverted && lower_net->name == ctx->idf("$PACKER_GND")); + lower_net->name == ctx->idf("$PACKER_VCC"); if (net_is_gnd || net_is_vcc) { lower->params[id_INIT_L02] = Property(LUT_ZERO, 4); lower->params[id_INIT_L11] = Property(LUT_ZERO, 4); lower->params[id_INIT_L20] = Property(net_is_vcc ? LUT_ONE : LUT_ZERO, 4); lower->disconnectPort(id_IN1); - } else if (inverted) { - lower->params[id_INIT_L02] = Property(LUT_INV_D0, 4); } } { bool net_is_gnd = - upper_net->name == ctx->idf("$PACKER_GND") || (inverted && upper_net->name == ctx->idf("$PACKER_VCC")); + upper_net->name == ctx->idf("$PACKER_GND"); bool net_is_vcc = - upper_net->name == ctx->idf("$PACKER_VCC") || (inverted && upper_net->name == ctx->idf("$PACKER_GND")); + upper_net->name == ctx->idf("$PACKER_VCC"); if (net_is_gnd || net_is_vcc) { upper->params[id_INIT_L00] = Property(LUT_ZERO, 4); upper->params[id_INIT_L10] = Property(net_is_vcc ? LUT_ONE : LUT_ZERO, 4); upper->disconnectPort(id_IN1); - } else if (inverted) { - upper->params[id_INIT_L00] = Property(LUT_INV_D0, 4); } } } @@ -304,10 +300,10 @@ void GateMatePacker::pack_mult() return ZeroDriver{zero_lower, zero_upper, name}; }; - auto create_a_passthru = [&](IdString name, bool inverted) { + auto create_a_passthru = [&](IdString name) { auto *a_passthru_lower = create_cell_ptr(id_CPE_HALF_L, ctx->idf("%s$a_passthru_lower", name.c_str(ctx))); auto *a_passthru_upper = create_cell_ptr(id_CPE_HALF_U, ctx->idf("%s$a_passthru_upper", name.c_str(ctx))); - return APassThroughCell{a_passthru_lower, a_passthru_upper, name, inverted}; + return APassThroughCell{a_passthru_lower, a_passthru_upper, name}; }; auto create_mult_col = [&](IdString name, int a_width, bool is_even_x, bool carry_enable_cinx, @@ -391,7 +387,7 @@ void GateMatePacker::pack_mult() // Step 1: instantiate all the CPEs. m.zero = create_zero_driver(ctx->idf("%s$col0", mult->name.c_str(ctx))); for (int a = 0; a < a_width / 2; a++) - m.a_passthrus.push_back(create_a_passthru(ctx->idf("%s$col0$row%d", mult->name.c_str(ctx), a), false)); + m.a_passthrus.push_back(create_a_passthru(ctx->idf("%s$col0$row%d", mult->name.c_str(ctx), a))); for (int b = 0; b < b_width / 2; b++) m.cols.push_back(create_mult_col(ctx->idf("%s$col%d", mult->name.c_str(ctx), b + 1), a_width, b % 2 == 0, b == 2 /* ??? */, b > 0 /* ??? */));