Use CCU2D cell

This commit is contained in:
Miodrag Milanovic 2023-03-31 14:37:01 +02:00 committed by myrtle
parent a00f810093
commit aacb36bf15
4 changed files with 16 additions and 16 deletions

View File

@ -92,7 +92,7 @@ std::unique_ptr<CellInfo> create_machxo2_cell(Context *ctx, IdString type, std::
new_cell->addInput(id_C); new_cell->addInput(id_C);
new_cell->addInput(id_D); new_cell->addInput(id_D);
new_cell->addOutput(id_Z); 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_INIT0] = Property(0, 16);
new_cell->params[id_INIT1] = Property(0, 16); new_cell->params[id_INIT1] = Property(0, 16);
new_cell->params[id_INJECT1_0] = std::string("YES"); new_cell->params[id_INJECT1_0] = std::string("YES");

View File

@ -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 // 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_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; } inline bool is_trellis_io(const BaseCtx *ctx, const CellInfo *cell) { return cell->type == id_TRELLIS_IO; }

View File

@ -143,7 +143,7 @@ X(OFX)
X(F) X(F)
X(M) X(M)
X(CCU2C) X(CCU2D)
X(CCU2_INJECT1) X(CCU2_INJECT1)
X(INJECT1_0) X(INJECT1_0)
X(INJECT1_1) X(INJECT1_1)

View File

@ -586,7 +586,7 @@ class Ecp5Packer
// Create a feed in to the carry chain // Create a feed in to the carry chain
CellInfo *make_carry_feed_in(NetInfo *carry, PortRef chain_in) CellInfo *make_carry_feed_in(NetInfo *carry, PortRef chain_in)
{ {
std::unique_ptr<CellInfo> feedin = create_machxo2_cell(ctx, id_CCU2C); std::unique_ptr<CellInfo> feedin = create_machxo2_cell(ctx, id_CCU2D);
feedin->params[id_INIT0] = Property(10, 16); // LUT4 = 0; LUT2 = A feedin->params[id_INIT0] = Property(10, 16); // LUT4 = 0; LUT2 = A
feedin->params[id_INIT1] = Property(65535, 16); feedin->params[id_INIT1] = Property(65535, 16);
@ -612,7 +612,7 @@ class Ecp5Packer
// Create a feed out and loop through from the carry chain // Create a feed out and loop through from the carry chain
CellInfo *make_carry_feed_out(NetInfo *carry, boost::optional<PortRef> chain_next = boost::optional<PortRef>()) CellInfo *make_carry_feed_out(NetInfo *carry, boost::optional<PortRef> chain_next = boost::optional<PortRef>())
{ {
std::unique_ptr<CellInfo> feedout = create_machxo2_cell(ctx, id_CCU2C); std::unique_ptr<CellInfo> feedout = create_machxo2_cell(ctx, id_CCU2D);
feedout->params[id_INIT0] = Property(0, 16); feedout->params[id_INIT0] = Property(0, 16);
feedout->params[id_INIT1] = Property(10, 16); // LUT4 = 0; LUT2 = A feedout->params[id_INIT1] = Property(10, 16); // LUT4 = 0; LUT2 = A
@ -871,7 +871,7 @@ class Ecp5Packer
cell->ports.at(input).net = nullptr; 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); std::string input_str = input.str(ctx);
int lut = std::stoi(input_str.substr(1)); int lut = std::stoi(input_str.substr(1));
@ -882,7 +882,7 @@ class Ecp5Packer
cell->ports.at(input).net = nullptr; 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)) if (!cell->ports.count(input))
return true; // disconnected port is high return true; // disconnected port is high
@ -914,19 +914,19 @@ class Ecp5Packer
} else if (!constval) { } else if (!constval) {
if (user.port.in(id_A0, id_A1, id_B0, id_B1)) { if (user.port.in(id_A0, id_A1, id_B0, id_B1)) {
// These inputs can be switched to tie-high without consequence // These inputs can be switched to tie-high without consequence
set_ccu2c_input_constant(uc, user.port, constval); set_ccu2d_input_constant(uc, user.port, constval);
} else if (user.port == id_C0 && is_ccu2c_port_high(uc, id_D0)) { } else if (user.port == id_C0 && is_ccu2d_port_high(uc, id_D0)) {
// Partner must be tied high // Partner must be tied high
set_ccu2c_input_constant(uc, user.port, constval); set_ccu2d_input_constant(uc, user.port, constval);
} else if (user.port == id_D0 && is_ccu2c_port_high(uc, id_C0)) { } else if (user.port == id_D0 && is_ccu2d_port_high(uc, id_C0)) {
// Partner must be tied high // Partner must be tied high
set_ccu2c_input_constant(uc, user.port, constval); set_ccu2d_input_constant(uc, user.port, constval);
} else if (user.port == id_C1 && is_ccu2c_port_high(uc, id_D1)) { } else if (user.port == id_C1 && is_ccu2d_port_high(uc, id_D1)) {
// Partner must be tied high // Partner must be tied high
set_ccu2c_input_constant(uc, user.port, constval); set_ccu2d_input_constant(uc, user.port, constval);
} else if (user.port == id_D1 && is_ccu2c_port_high(uc, id_C1)) { } else if (user.port == id_D1 && is_ccu2d_port_high(uc, id_C1)) {
// Partner must be tied high // Partner must be tied high
set_ccu2c_input_constant(uc, user.port, constval); set_ccu2d_input_constant(uc, user.port, constval);
} else { } else {
// Not allowed to change to a tie-high // Not allowed to change to a tie-high
uc->ports[user.port].net = constnet; uc->ports[user.port].net = constnet;