From aacb36bf15a3eda2d484f94ed38082a8534723b4 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 31 Mar 2023 14:37:01 +0200 Subject: [PATCH] Use CCU2D cell --- machxo2/cells.cc | 2 +- machxo2/cells.h | 2 +- machxo2/constids.inc | 2 +- machxo2/pack.cc | 26 +++++++++++++------------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/machxo2/cells.cc b/machxo2/cells.cc index 22930297..f97a16a0 100644 --- a/machxo2/cells.cc +++ b/machxo2/cells.cc @@ -92,7 +92,7 @@ std::unique_ptr create_machxo2_cell(Context *ctx, IdString type, std:: new_cell->addInput(id_C); new_cell->addInput(id_D); new_cell->addOutput(id_Z); - } else if (type == id_CCU2C) { + } else if (type == id_CCU2D) { new_cell->params[id_INIT0] = Property(0, 16); new_cell->params[id_INIT1] = Property(0, 16); new_cell->params[id_INJECT1_0] = std::string("YES"); diff --git a/machxo2/cells.h b/machxo2/cells.h index 43411019..dd59e073 100644 --- a/machxo2/cells.h +++ b/machxo2/cells.h @@ -35,7 +35,7 @@ inline bool is_lut(const BaseCtx *ctx, const CellInfo *cell) { return cell->type // Return true if a cell is a flipflop inline bool is_ff(const BaseCtx *ctx, const CellInfo *cell) { return cell->type == id_TRELLIS_FF; } -inline bool is_carry(const BaseCtx *ctx, const CellInfo *cell) { return cell->type == id_CCU2C; } +inline bool is_carry(const BaseCtx *ctx, const CellInfo *cell) { return cell->type == id_CCU2D; } inline bool is_trellis_io(const BaseCtx *ctx, const CellInfo *cell) { return cell->type == id_TRELLIS_IO; } diff --git a/machxo2/constids.inc b/machxo2/constids.inc index adb7254d..0debca18 100644 --- a/machxo2/constids.inc +++ b/machxo2/constids.inc @@ -143,7 +143,7 @@ X(OFX) X(F) X(M) -X(CCU2C) +X(CCU2D) X(CCU2_INJECT1) X(INJECT1_0) X(INJECT1_1) diff --git a/machxo2/pack.cc b/machxo2/pack.cc index e0ea62ea..fd4fb43e 100644 --- a/machxo2/pack.cc +++ b/machxo2/pack.cc @@ -586,7 +586,7 @@ class Ecp5Packer // Create a feed in to the carry chain CellInfo *make_carry_feed_in(NetInfo *carry, PortRef chain_in) { - std::unique_ptr feedin = create_machxo2_cell(ctx, id_CCU2C); + std::unique_ptr feedin = create_machxo2_cell(ctx, id_CCU2D); feedin->params[id_INIT0] = Property(10, 16); // LUT4 = 0; LUT2 = A feedin->params[id_INIT1] = Property(65535, 16); @@ -612,7 +612,7 @@ class Ecp5Packer // Create a feed out and loop through from the carry chain CellInfo *make_carry_feed_out(NetInfo *carry, boost::optional chain_next = boost::optional()) { - std::unique_ptr feedout = create_machxo2_cell(ctx, id_CCU2C); + std::unique_ptr feedout = create_machxo2_cell(ctx, id_CCU2D); feedout->params[id_INIT0] = Property(0, 16); feedout->params[id_INIT1] = Property(10, 16); // LUT4 = 0; LUT2 = A @@ -871,7 +871,7 @@ class Ecp5Packer cell->ports.at(input).net = nullptr; } - void set_ccu2c_input_constant(CellInfo *cell, IdString input, bool value) + void set_ccu2d_input_constant(CellInfo *cell, IdString input, bool value) { std::string input_str = input.str(ctx); int lut = std::stoi(input_str.substr(1)); @@ -882,7 +882,7 @@ class Ecp5Packer cell->ports.at(input).net = nullptr; } - bool is_ccu2c_port_high(CellInfo *cell, IdString input) + bool is_ccu2d_port_high(CellInfo *cell, IdString input) { if (!cell->ports.count(input)) return true; // disconnected port is high @@ -914,19 +914,19 @@ class Ecp5Packer } else if (!constval) { if (user.port.in(id_A0, id_A1, id_B0, id_B1)) { // These inputs can be switched to tie-high without consequence - set_ccu2c_input_constant(uc, user.port, constval); - } else if (user.port == id_C0 && is_ccu2c_port_high(uc, id_D0)) { + set_ccu2d_input_constant(uc, user.port, constval); + } else if (user.port == id_C0 && is_ccu2d_port_high(uc, id_D0)) { // Partner must be tied high - set_ccu2c_input_constant(uc, user.port, constval); - } else if (user.port == id_D0 && is_ccu2c_port_high(uc, id_C0)) { + set_ccu2d_input_constant(uc, user.port, constval); + } else if (user.port == id_D0 && is_ccu2d_port_high(uc, id_C0)) { // Partner must be tied high - set_ccu2c_input_constant(uc, user.port, constval); - } else if (user.port == id_C1 && is_ccu2c_port_high(uc, id_D1)) { + set_ccu2d_input_constant(uc, user.port, constval); + } else if (user.port == id_C1 && is_ccu2d_port_high(uc, id_D1)) { // Partner must be tied high - set_ccu2c_input_constant(uc, user.port, constval); - } else if (user.port == id_D1 && is_ccu2c_port_high(uc, id_C1)) { + set_ccu2d_input_constant(uc, user.port, constval); + } else if (user.port == id_D1 && is_ccu2d_port_high(uc, id_C1)) { // Partner must be tied high - set_ccu2c_input_constant(uc, user.port, constval); + set_ccu2d_input_constant(uc, user.port, constval); } else { // Not allowed to change to a tie-high uc->ports[user.port].net = constnet;