run clangformat

Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
gatecat 2026-02-25 11:18:14 +01:00
parent b0d6b97936
commit 0d3a578539
10 changed files with 186 additions and 404 deletions

View File

@ -1147,8 +1147,6 @@ class HeAPPlacer
}
total_iters_for_cell++;
}
if (ctx->verbose) {
auto ci_endt = std::chrono::high_resolution_clock::now();
@ -1326,7 +1324,7 @@ class HeAPPlacer
occupancy.resize(p->max_x + 1,
std::vector<std::vector<int>>(p->max_y + 1, std::vector<int>(buckets.size(), 0)));
fixed_occupancy.resize(p->max_x + 1,
std::vector<std::vector<int>>(p->max_y + 1, std::vector<int>(buckets.size(), 0)));
std::vector<std::vector<int>>(p->max_y + 1, std::vector<int>(buckets.size(), 0)));
groups.resize(p->max_x + 1, std::vector<int>(p->max_y + 1, -1));
chaines.resize(p->max_x + 1, std::vector<ChainExtent>(p->max_y + 1));
cells_at_location.resize(p->max_x + 1, std::vector<std::vector<CellInfo *>>(p->max_y + 1));

View File

@ -954,7 +954,7 @@ struct Router2
if (midpoint_wire == -1) {
midpoint_wire = curr.wire;
best_midpoint_cost = curr.score.cost;
if (curr_cong_weight >= 10) {
if (curr_cong_weight >= 10) {
// try harder at this point to prevent infinite iterations when constants conflict
toexplore = iter + std::min(200, int(curr.score.cost));
} else {
@ -969,7 +969,7 @@ struct Router2
// Meet in the middle; done
midpoint_wire = curr.wire;
break;
}
}
}
// Don't allow the same wire to be bound to the same net with a different driving pip
PipId bound_pip;
@ -1328,7 +1328,8 @@ struct Router2
if (bound_net == nullptr) {
to_bind.push_back(p);
}
} else if (!ad.pre_routed || ctx->getBoundPipNet(p) != net) { // allow pre routing to break normal validity checking rules
} else if (!ad.pre_routed ||
ctx->getBoundPipNet(p) != net) { // allow pre routing to break normal validity checking rules
if (ctx->verbose) {
log_info("Failed to bind pip %s to net %s\n", ctx->nameOfPip(p), net->name.c_str(ctx));
}

View File

@ -54,7 +54,7 @@ std::string get_backtrace_str()
{
std::ostringstream ss;
ss << "Backtrace: " << std::endl;
#if defined(__GLIBC__)
#if defined(__GLIBC__)
static const size_t MAX_BT_SIZE = 1024;
std::array<void *, MAX_BT_SIZE> bt_data;
int bt_len = backtrace(bt_data.data(), MAX_BT_SIZE);
@ -64,7 +64,7 @@ std::string get_backtrace_str()
for (int i = 0; i < bt_len; i++)
ss << " " << bt_symbols[i] << std::endl;
free(bt_symbols);
#else
#else
unw_cursor_t cursor;
unw_context_t context;
unw_getcontext(&context);
@ -78,15 +78,13 @@ std::string get_backtrace_str()
unw_get_reg(&cursor, UNW_REG_IP, &ip);
if (unw_get_proc_name(&cursor, func_name, sizeof(func_name), &offset) == 0) {
ss << " #" << frame_num << ": " << func_name << " + 0x"
<< std::hex << offset << " [0x" << ip << "]\n";
ss << " #" << frame_num << ": " << func_name << " + 0x" << std::hex << offset << " [0x" << ip << "]\n";
} else {
ss << " #" << frame_num << ": -- unknown -- [0x"
<< std::hex << ip << "]\n";
ss << " #" << frame_num << ": -- unknown -- [0x" << std::hex << ip << "]\n";
}
frame_num++;
}
#endif
#endif
return ss.str();
}
#else

View File

@ -10,12 +10,12 @@
#define HIMBAECHEL_CONSTIDS "uarch/gowin/constids.inc"
#include "himbaechel_constids.h"
#include "array2d.h"
#include "cst.h"
#include "globals.h"
#include "gowin.h"
#include "gowin_utils.h"
#include "pack.h"
#include "array2d.h"
#include "placer_heap.h"
@ -114,7 +114,7 @@ struct GowinImpl : HimbaechelAPI
bool dsp_valid(Loc l, IdString bel_type, bool explain_invalid) const;
bool hclk_valid(BelId bel, IdString bel_type) const;
array2d<std::vector<CellInfo*>> fast_logic_cell;
array2d<std::vector<CellInfo *>> fast_logic_cell;
};
struct GowinArch : HimbaechelArch
@ -721,7 +721,7 @@ void GowinImpl::postRoute()
}
}
}
std::vector<CellInfo*> to_remove;
std::vector<CellInfo *> to_remove;
for (auto &cell : ctx->cells) {
CellInfo *ci = cell.second.get();
if (ci->type.in(id_BLOCKER_LUT, id_BLOCKER_FF)) {
@ -730,8 +730,8 @@ void GowinImpl::postRoute()
}
for (auto ci : to_remove) {
auto root = ctx->cells.at(ci->cluster).get();
root->constr_children.erase(std::remove_if(root->constr_children.begin(),
root->constr_children.end(), [&](CellInfo *c) { return c == ci; }));
root->constr_children.erase(std::remove_if(root->constr_children.begin(), root->constr_children.end(),
[&](CellInfo *c) { return c == ci; }));
ctx->cells.erase(ci->name);
}
}
@ -1079,9 +1079,7 @@ bool GowinImpl::slice_valid(int x, int y, int z) const
const CellInfo *alu = (z < 6) ? bels.at(z + BelZ::ALU0_Z) : nullptr;
const CellInfo *ramw = bels.at(BelZ::RAMW_Z);
auto is_not_blocker = [](const CellInfo *ci) {
return ci && !ci->type.in(id_BLOCKER_LUT, id_BLOCKER_FF);
};
auto is_not_blocker = [](const CellInfo *ci) { return ci && !ci->type.in(id_BLOCKER_LUT, id_BLOCKER_FF); };
if (alu && lut && lut->type != id_BLOCKER_LUT) {
return false;
@ -1090,17 +1088,13 @@ bool GowinImpl::slice_valid(int x, int y, int z) const
if (ramw) {
// FFs in slices 4 and 5 are not allowed
// also temporarily disallow FF to be placed near RAM
if (is_not_blocker(bels.at(0 * 2 + 1)) ||
is_not_blocker(bels.at(1 * 2 + 1)) ||
is_not_blocker(bels.at(2 * 2 + 1)) ||
is_not_blocker(bels.at(3 * 2 + 1)) ||
is_not_blocker(bels.at(4 * 2 + 1)) ||
is_not_blocker(bels.at(5 * 2 + 1))) {
if (is_not_blocker(bels.at(0 * 2 + 1)) || is_not_blocker(bels.at(1 * 2 + 1)) ||
is_not_blocker(bels.at(2 * 2 + 1)) || is_not_blocker(bels.at(3 * 2 + 1)) ||
is_not_blocker(bels.at(4 * 2 + 1)) || is_not_blocker(bels.at(5 * 2 + 1))) {
return false;
}
if (gwu.has_DFF67()) {
if (is_not_blocker(bels.at(6 * 2 + 1)) ||
is_not_blocker(bels.at(7 * 2 + 1))) {
if (is_not_blocker(bels.at(6 * 2 + 1)) || is_not_blocker(bels.at(7 * 2 + 1))) {
return false;
}
}
@ -1120,11 +1114,10 @@ bool GowinImpl::slice_valid(int x, int y, int z) const
int adj_alu_z = adj_lut_z / 2 + BelZ::ALU0_Z;
const CellInfo *adj_lut = bels.at(adj_lut_z);
const CellInfo *adj_ff = bels.at(adj_lut_z + 1);
const CellInfo *adj_alu = adj_alu_z < (6 + BelZ::ALU0_Z)
? bels.at(adj_alu_z)
: nullptr;
const CellInfo *adj_alu = adj_alu_z < (6 + BelZ::ALU0_Z) ? bels.at(adj_alu_z) : nullptr;
if ((alu && ((adj_lut && adj_lut->type != id_BLOCKER_LUT) || (adj_ff && !adj_alu))) || (((lut && lut->type != id_BLOCKER_LUT) || (ff && !alu)) && adj_alu)) {
if ((alu && ((adj_lut && adj_lut->type != id_BLOCKER_LUT) || (adj_ff && !adj_alu))) ||
(((lut && lut->type != id_BLOCKER_LUT) || (ff && !alu)) && adj_alu)) {
return false;
}
@ -1284,17 +1277,17 @@ void GowinImpl::notifyBelChange(BelId bel, CellInfo *cell)
IdString bel_type = ctx->getBelType(bel);
switch (bel_type.hash()) {
case ID_LUT4: /* fall-through */
case ID_DFF:
case ID_ALU:
case ID_RAM16SDP4:
case ID_MUX2_LUT5:
case ID_MUX2_LUT6:
case ID_MUX2_LUT7:
case ID_MUX2_LUT8:
auto loc = ctx->getBelLocation(bel);
fast_logic_cell.at(loc.x, loc.y).at(loc.z) = cell;
return;
case ID_LUT4: /* fall-through */
case ID_DFF:
case ID_ALU:
case ID_RAM16SDP4:
case ID_MUX2_LUT5:
case ID_MUX2_LUT6:
case ID_MUX2_LUT7:
case ID_MUX2_LUT8:
auto loc = ctx->getBelLocation(bel);
fast_logic_cell.at(loc.x, loc.y).at(loc.z) = cell;
return;
}
if (cell != nullptr && !is_dsp(cell)) {

View File

@ -480,7 +480,8 @@ void GowinPacker::pack_alus(void)
ctx->cells[ncell->name] = std::move(ncell);
}
new_cells.clear();
// The placer doesn't know "a priori" that LUTs and ALUs conflict. So create blocker LUTs to make this explicit and reduce wasted legalisation effort
// The placer doesn't know "a priori" that LUTs and ALUs conflict. So create blocker LUTs to make this explicit and
// reduce wasted legalisation effort
for (auto &cell : ctx->cells) {
auto ci = cell.second.get();
if (ci->cluster == ClusterId()) {
@ -609,7 +610,8 @@ void GowinPacker::pack_ssram(void)
}
}
for (int i = 4; i < 8; ++i) {
auto cell = std::make_unique<CellInfo>(ctx, ctx->idf("%s_BLOCKER_LUT_%d", ctx->nameOf(ci), i), id_BLOCKER_LUT);
auto cell = std::make_unique<CellInfo>(ctx, ctx->idf("%s_BLOCKER_LUT_%d", ctx->nameOf(ci), i),
id_BLOCKER_LUT);
cell->cluster = ci->cluster;
ci->constr_children.push_back(cell.get());
cell->constr_abs_z = true;
@ -619,7 +621,8 @@ void GowinPacker::pack_ssram(void)
new_cells.emplace_back(std::move(cell));
}
for (int i = 0; i < (gwu.has_DFF67() ? 8 : 6); ++i) {
auto cell = std::make_unique<CellInfo>(ctx, ctx->idf("%s_BLOCKER_FF_%d", ctx->nameOf(ci), i), id_BLOCKER_FF);
auto cell = std::make_unique<CellInfo>(ctx, ctx->idf("%s_BLOCKER_FF_%d", ctx->nameOf(ci), i),
id_BLOCKER_FF);
cell->cluster = ci->cluster;
ci->constr_children.push_back(cell.get());
cell->constr_abs_z = true;

View File

@ -44,7 +44,7 @@ extern const uint16_t filter_lookup_low_ss[];
extern const uint16_t filter_lookup_high[];
extern const uint16_t filter_lookup_optimized[];
extern const int64_t lk_table[];
};
}; // namespace Xc7MMCM
namespace {
struct FasmBackend
@ -789,7 +789,6 @@ struct FasmBackend
iostandard.erase(0, 5);
bool is_sstl = iostandard == "SSTL12" || iostandard == "SSTL135" || iostandard == "SSTL15";
int hclk = uarch->hclk_for_iob(pad->bel);
if (only_diff)
@ -1512,14 +1511,13 @@ struct FasmBackend
pop(2);
}
void write_mmcm_clkout(const std::string &name, CellInfo *ci)
void write_mmcm_clkout(const std::string &name, CellInfo *ci)
{
// FIXME: variable duty cycle
int high = 1, low = 1, phasemux = 0, delaytime = 0, frac = 0;
bool no_count = false, edge = false;
double divide = float_or_default(ci, name + ((name == "CLKFBOUT") ? "_MULT_F" :
(name == "CLKOUT0" ? "_DIVIDE_F" : "_DIVIDE")), 1);
double divide = float_or_default(
ci, name + ((name == "CLKFBOUT") ? "_MULT_F" : (name == "CLKOUT0" ? "_DIVIDE_F" : "_DIVIDE")), 1);
double phase = float_or_default(ci, name + "_PHASE", 1);
if (divide <= 1) {
no_count = true;
@ -1568,16 +1566,19 @@ struct FasmBackend
write_int_vector(name + "_CLKOUT1_HIGH_TIME[5:0]", high, 6);
write_int_vector(name + "_CLKOUT1_LOW_TIME[5:0]", low, 6);
auto phase_mux_feature = name + (is_clkout_5_or_6 ? "_CLKOUT2_FRACTIONAL_PHASE_MUX_F[0]" : "_CLKOUT2_PHASE_MUX[0]");
auto phase_mux_feature =
name + (is_clkout_5_or_6 ? "_CLKOUT2_FRACTIONAL_PHASE_MUX_F[0]" : "_CLKOUT2_PHASE_MUX[0]");
write_int_vector(name + "_CLKOUT1_PHASE_MUX[2:0]", phasemux, 3);
auto edge_feature = name + (is_clkout_5_or_6 ? "_CLKOUT2_FRACTIONAL_EDGE[0]" : "_CLKOUT2_EDGE[0]");
write_bit(edge_feature, edge);
auto no_count_feature = name + (is_clkout_5_or_6 ? "_CLKOUT2_FRACTIONAL_NO_COUNT[0]" : "_CLKOUT2_NO_COUNT[0]");
auto no_count_feature =
name + (is_clkout_5_or_6 ? "_CLKOUT2_FRACTIONAL_NO_COUNT[0]" : "_CLKOUT2_NO_COUNT[0]");
write_bit(no_count_feature, no_count);
auto delay_time_feature = name + (is_clkout_5_or_6 ? "_CLKOUT2_FRACTIONAL_DELAY_TIME[5:0]" : "_CLKOUT2_DELAY_TIME[5:0]");
auto delay_time_feature =
name + (is_clkout_5_or_6 ? "_CLKOUT2_FRACTIONAL_DELAY_TIME[5:0]" : "_CLKOUT2_DELAY_TIME[5:0]");
write_int_vector(delay_time_feature, delaytime, 6);
if (!is_clkout_5_or_6 && frac != 0) {
@ -1617,7 +1618,8 @@ struct FasmBackend
// both modes set this bit
write_bit("Z_ZHOLD");
} else {
log_error("unsupported COMPENSATION type '%s' for MMCM (supported compensation types: INTERNAL, ZHOLD)\n", comp.c_str());
log_error("unsupported COMPENSATION type '%s' for MMCM (supported compensation types: INTERNAL, ZHOLD)\n",
comp.c_str());
}
pop();

View File

@ -24,342 +24,121 @@
NEXTPNR_NAMESPACE_BEGIN
namespace Xc7MMCM {
extern const uint16_t filter_lookup_low [] = {
0b0010111100, // 1
0b0010111100, // 2
0b0010111100, // 3
0b0010111100, // 4
0b0010011100, // ....
0b0010101100,
0b0010110100,
0b0010001100,
0b0010010100,
0b0010010100,
0b0010100100,
0b0010111000,
0b0010111000,
0b0010111000,
0b0010111000,
0b0010000100,
0b0010000100,
0b0010000100,
0b0010011000,
0b0010011000,
0b0010011000,
0b0010011000,
0b0010011000,
0b0010011000,
0b0010011000,
0b0010101000,
0b0010101000,
0b0010101000,
0b0010101000,
0b0010101000,
0b0010110000,
0b0010110000,
0b0010110000,
0b0010110000,
0b0010110000,
0b0010110000,
0b0010110000,
0b0010110000,
0b0010110000,
0b0010110000,
0b0010110000,
0b0010110000,
0b0010110000,
0b0010110000,
0b0010110000,
0b0010110000,
0b0010110000,
0b0010001000,
0b0010001000,
0b0010001000,
0b0010001000,
0b0010001000,
0b0010001000,
0b0010001000,
0b0010001000,
0b0010001000,
0b0010001000,
0b0010001000,
0b0010001000,
0b0010001000, // ....
0b0010001000, // 61
0b0010001000, // 62
0b0010001000, // 63
0b0010001000 // 64
extern const uint16_t filter_lookup_low[] = {
0b0010111100, // 1
0b0010111100, // 2
0b0010111100, // 3
0b0010111100, // 4
0b0010011100, // ....
0b0010101100, 0b0010110100, 0b0010001100, 0b0010010100, 0b0010010100, 0b0010100100, 0b0010111000, 0b0010111000,
0b0010111000, 0b0010111000, 0b0010000100, 0b0010000100, 0b0010000100, 0b0010011000, 0b0010011000, 0b0010011000,
0b0010011000, 0b0010011000, 0b0010011000, 0b0010011000, 0b0010101000, 0b0010101000, 0b0010101000, 0b0010101000,
0b0010101000, 0b0010110000, 0b0010110000, 0b0010110000, 0b0010110000, 0b0010110000, 0b0010110000, 0b0010110000,
0b0010110000, 0b0010110000, 0b0010110000, 0b0010110000, 0b0010110000, 0b0010110000, 0b0010110000, 0b0010110000,
0b0010110000, 0b0010110000, 0b0010001000, 0b0010001000, 0b0010001000, 0b0010001000, 0b0010001000, 0b0010001000,
0b0010001000, 0b0010001000, 0b0010001000, 0b0010001000, 0b0010001000, 0b0010001000,
0b0010001000, // ....
0b0010001000, // 61
0b0010001000, // 62
0b0010001000, // 63
0b0010001000 // 64
};
extern const uint16_t filter_lookup_low_ss [] = {
0b0010111111, // 1
0b0010111111, // 2
0b0010111111, // 3
0b0010111111, // 4
0b0010011111, // ....
0b0010101111,
0b0010110111,
0b0010001111,
0b0010010111,
0b0010010111,
0b0010100111,
0b0010111011,
0b0010111011,
0b0010111011,
0b0010111011,
0b0010000111,
0b0010000111,
0b0010000111,
0b0010011011,
0b0010011011,
0b0010011011,
0b0010011011,
0b0010011011,
0b0010011011,
0b0010011011,
0b0010101011,
0b0010101011,
0b0010101011,
0b0010101011,
0b0010101011,
0b0010110011,
0b0010110011,
0b0010110011,
0b0010110011,
0b0010110011,
0b0010110011,
0b0010110011,
0b0010110011,
0b0010110011,
0b0010110011,
0b0010110011,
0b0010110011,
0b0010110011,
0b0010110011,
0b0010110011,
0b0010110011,
0b0010110011,
0b0010001011,
0b0010001011,
0b0010001011,
0b0010001011,
0b0010001011,
0b0010001011,
0b0010001011,
0b0010001011,
0b0010001011,
0b0010001011,
0b0010001011,
0b0010001011,
0b0010001011, // ....
0b0010001011, // 61
0b0010001011, // 62
0b0010001011, // 63
0b0010001011 // 64
extern const uint16_t filter_lookup_low_ss[] = {
0b0010111111, // 1
0b0010111111, // 2
0b0010111111, // 3
0b0010111111, // 4
0b0010011111, // ....
0b0010101111, 0b0010110111, 0b0010001111, 0b0010010111, 0b0010010111, 0b0010100111, 0b0010111011, 0b0010111011,
0b0010111011, 0b0010111011, 0b0010000111, 0b0010000111, 0b0010000111, 0b0010011011, 0b0010011011, 0b0010011011,
0b0010011011, 0b0010011011, 0b0010011011, 0b0010011011, 0b0010101011, 0b0010101011, 0b0010101011, 0b0010101011,
0b0010101011, 0b0010110011, 0b0010110011, 0b0010110011, 0b0010110011, 0b0010110011, 0b0010110011, 0b0010110011,
0b0010110011, 0b0010110011, 0b0010110011, 0b0010110011, 0b0010110011, 0b0010110011, 0b0010110011, 0b0010110011,
0b0010110011, 0b0010110011, 0b0010001011, 0b0010001011, 0b0010001011, 0b0010001011, 0b0010001011, 0b0010001011,
0b0010001011, 0b0010001011, 0b0010001011, 0b0010001011, 0b0010001011, 0b0010001011,
0b0010001011, // ....
0b0010001011, // 61
0b0010001011, // 62
0b0010001011, // 63
0b0010001011 // 64
};
extern const uint16_t filter_lookup_high [] = {
0b0010111100, // 1
0b0100111100, // 2
0b0101101100, // 3
0b0111011100, // 4
0b1101011100, // ....
0b1110101100,
0b1110110100,
0b1111001100,
0b1110010100,
0b1111010100,
0b1111100100,
0b1101000100,
0b1111100100,
0b1111100100,
0b1111100100,
0b1111100100,
0b1111010100,
0b1111010100,
0b1100000100,
0b1100000100,
0b1100000100,
0b0101110000,
0b0101110000,
0b0101110000,
0b0101110000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0010100000,
0b0010100000,
0b0010100000,
0b0010100000,
0b0010100000,
0b0111000100,
0b0111000100,
0b0100110000,
0b0100110000,
0b0100110000,
0b0100110000,
0b0110000100,
0b0110000100,
0b0101011000,
0b0101011000,
0b0101011000,
0b0010010000,
0b0010010000,
0b0010010000, // ....
0b0010010000, // 61
0b0100101000, // 62
0b0011110000, // 63
0b0011110000 // 64
extern const uint16_t filter_lookup_high[] = {
0b0010111100, // 1
0b0100111100, // 2
0b0101101100, // 3
0b0111011100, // 4
0b1101011100, // ....
0b1110101100, 0b1110110100, 0b1111001100, 0b1110010100, 0b1111010100, 0b1111100100, 0b1101000100, 0b1111100100,
0b1111100100, 0b1111100100, 0b1111100100, 0b1111010100, 0b1111010100, 0b1100000100, 0b1100000100, 0b1100000100,
0b0101110000, 0b0101110000, 0b0101110000, 0b0101110000, 0b0011010000, 0b0011010000, 0b0011010000, 0b0011010000,
0b0011010000, 0b0011010000, 0b0011010000, 0b0011010000, 0b0011010000, 0b0011010000, 0b0011010000, 0b0011010000,
0b0011010000, 0b0011010000, 0b0011010000, 0b0011010000, 0b0010100000, 0b0010100000, 0b0010100000, 0b0010100000,
0b0010100000, 0b0111000100, 0b0111000100, 0b0100110000, 0b0100110000, 0b0100110000, 0b0100110000, 0b0110000100,
0b0110000100, 0b0101011000, 0b0101011000, 0b0101011000, 0b0010010000, 0b0010010000,
0b0010010000, // ....
0b0010010000, // 61
0b0100101000, // 62
0b0011110000, // 63
0b0011110000 // 64
};
extern const uint16_t filter_lookup_optimized [] = {
0b0010111100, // 1
0b0100111100, // 2
0b0101101100, // 3
0b0111011100, // 4
0b1101011100, // ....
0b1110101100,
0b1110110100,
0b1111001100,
0b1110010100,
0b1111010100,
0b1111100100,
0b1101000100,
0b1111100100,
0b1111100100,
0b1111100100,
0b1111100100,
0b1111010100,
0b1111010100,
0b1100000100,
0b1100000100,
0b1100000100,
0b0101110000,
0b0101110000,
0b0101110000,
0b0101110000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0011010000,
0b0010100000,
0b0010100000,
0b0010100000,
0b0010100000,
0b0010100000,
0b0111000100,
0b0111000100,
0b0100110000,
0b0100110000,
0b0100110000,
0b0100110000,
0b0110000100,
0b0110000100,
0b0101011000,
0b0101011000,
0b0101011000,
0b0010010000,
0b0010010000,
0b0010010000, // ....
0b0010010000, // 61
0b0100101000, // 62
0b0011110000, // 63
0b0011110000 // 64
extern const uint16_t filter_lookup_optimized[] = {
0b0010111100, // 1
0b0100111100, // 2
0b0101101100, // 3
0b0111011100, // 4
0b1101011100, // ....
0b1110101100, 0b1110110100, 0b1111001100, 0b1110010100, 0b1111010100, 0b1111100100, 0b1101000100, 0b1111100100,
0b1111100100, 0b1111100100, 0b1111100100, 0b1111010100, 0b1111010100, 0b1100000100, 0b1100000100, 0b1100000100,
0b0101110000, 0b0101110000, 0b0101110000, 0b0101110000, 0b0011010000, 0b0011010000, 0b0011010000, 0b0011010000,
0b0011010000, 0b0011010000, 0b0011010000, 0b0011010000, 0b0011010000, 0b0011010000, 0b0011010000, 0b0011010000,
0b0011010000, 0b0011010000, 0b0011010000, 0b0011010000, 0b0010100000, 0b0010100000, 0b0010100000, 0b0010100000,
0b0010100000, 0b0111000100, 0b0111000100, 0b0100110000, 0b0100110000, 0b0100110000, 0b0100110000, 0b0110000100,
0b0110000100, 0b0101011000, 0b0101011000, 0b0101011000, 0b0010010000, 0b0010010000,
0b0010010000, // ....
0b0010010000, // 61
0b0100101000, // 62
0b0011110000, // 63
0b0011110000 // 64
};
extern const int64_t lk_table [] = {
// LockRefDly(5) LockFBDly(5) LockCnt(10) LockSatHigh(10) UnlockCnt(10)
0b0011000110111110100011111010010000000001UL,
0b0011000110111110100011111010010000000001UL,
0b0100001000111110100011111010010000000001UL,
0b0101101011111110100011111010010000000001UL,
0b0111001110111110100011111010010000000001UL,
0b1000110001111110100011111010010000000001UL,
0b1001110011111110100011111010010000000001UL,
0b1011010110111110100011111010010000000001UL,
0b1100111001111110100011111010010000000001UL,
0b1110011100111110100011111010010000000001UL,
0b1111111111111000010011111010010000000001UL,
0b1111111111110011100111111010010000000001UL,
0b1111111111101110111011111010010000000001UL,
0b1111111111101011110011111010010000000001UL,
0b1111111111101000101011111010010000000001UL,
0b1111111111100111000111111010010000000001UL,
0b1111111111100011111111111010010000000001UL,
0b1111111111100010011011111010010000000001UL,
0b1111111111100000110111111010010000000001UL,
0b1111111111011111010011111010010000000001UL,
0b1111111111011101101111111010010000000001UL,
0b1111111111011100001011111010010000000001UL,
0b1111111111011010100111111010010000000001UL,
0b1111111111011001000011111010010000000001UL,
0b1111111111011001000011111010010000000001UL,
0b1111111111010111011111111010010000000001UL,
0b1111111111010101111011111010010000000001UL,
0b1111111111010101111011111010010000000001UL,
0b1111111111010100010111111010010000000001UL,
0b1111111111010100010111111010010000000001UL,
0b1111111111010010110011111010010000000001UL,
0b1111111111010010110011111010010000000001UL,
0b1111111111010010110011111010010000000001UL,
0b1111111111010001001111111010010000000001UL,
0b1111111111010001001111111010010000000001UL,
0b1111111111010001001111111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL
};
extern const int64_t lk_table[] = {
// LockRefDly(5) LockFBDly(5) LockCnt(10) LockSatHigh(10) UnlockCnt(10)
0b0011000110111110100011111010010000000001UL, 0b0011000110111110100011111010010000000001UL,
0b0100001000111110100011111010010000000001UL, 0b0101101011111110100011111010010000000001UL,
0b0111001110111110100011111010010000000001UL, 0b1000110001111110100011111010010000000001UL,
0b1001110011111110100011111010010000000001UL, 0b1011010110111110100011111010010000000001UL,
0b1100111001111110100011111010010000000001UL, 0b1110011100111110100011111010010000000001UL,
0b1111111111111000010011111010010000000001UL, 0b1111111111110011100111111010010000000001UL,
0b1111111111101110111011111010010000000001UL, 0b1111111111101011110011111010010000000001UL,
0b1111111111101000101011111010010000000001UL, 0b1111111111100111000111111010010000000001UL,
0b1111111111100011111111111010010000000001UL, 0b1111111111100010011011111010010000000001UL,
0b1111111111100000110111111010010000000001UL, 0b1111111111011111010011111010010000000001UL,
0b1111111111011101101111111010010000000001UL, 0b1111111111011100001011111010010000000001UL,
0b1111111111011010100111111010010000000001UL, 0b1111111111011001000011111010010000000001UL,
0b1111111111011001000011111010010000000001UL, 0b1111111111010111011111111010010000000001UL,
0b1111111111010101111011111010010000000001UL, 0b1111111111010101111011111010010000000001UL,
0b1111111111010100010111111010010000000001UL, 0b1111111111010100010111111010010000000001UL,
0b1111111111010010110011111010010000000001UL, 0b1111111111010010110011111010010000000001UL,
0b1111111111010010110011111010010000000001UL, 0b1111111111010001001111111010010000000001UL,
0b1111111111010001001111111010010000000001UL, 0b1111111111010001001111111010010000000001UL,
0b1111111111001111101011111010010000000001UL, 0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL, 0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL, 0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL, 0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL, 0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL, 0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL, 0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL, 0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL, 0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL, 0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL, 0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL, 0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL, 0b1111111111001111101011111010010000000001UL,
0b1111111111001111101011111010010000000001UL};
}
} // namespace Xc7MMCM
NEXTPNR_NAMESPACE_END

View File

@ -536,8 +536,8 @@ struct NexusFasmWriter
BelId bel = cell->bel;
push_bel(bel);
write_enum(cell, "SOURCESEL", "DIS");
write_int_vector(stringf("MSPIADDR[31:0]"),
ctx->parse_lattice_param_from_cell(cell, id_MSPIADDR, 32, 0).intval, 32);
write_int_vector(stringf("MSPIADDR[31:0]"), ctx->parse_lattice_param_from_cell(cell, id_MSPIADDR, 32, 0).intval,
32);
pop();
}
// Write config for an CONFIG_LMMI_CORE cell
@ -662,7 +662,7 @@ struct NexusFasmWriter
write_enum(cell, "TSREG.REGSET", "RESET");
if (cell->params.count(ctx->id("DELAY.DEL_VALUE"))) {
write_int_vector(stringf("DELAY.DEL_VALUE[6:0]"),
int_or_default(cell->params, ctx->id("DELAY.DEL_VALUE"), 0), 7);
int_or_default(cell->params, ctx->id("DELAY.DEL_VALUE"), 0), 7);
}
write_enum(cell, "DELAY.COARSE_DELAY");
write_enum(cell, "DELAY.COARSE_DELAY_MODE");

View File

@ -1077,11 +1077,19 @@ struct NexusPacker
{
// Convert primitives from their non-CORE variant to their CORE variant
static const dict<IdString, IdString> prim_map = {
{id_OSCA, id_OSC_CORE}, {id_DP16K, id_DP16K_MODE}, {id_PDP16K, id_PDP16K_MODE},
{id_PDPSC16K, id_PDPSC16K_MODE}, {id_SP16K, id_SP16K_MODE}, {id_FIFO16K, id_FIFO16K_MODE},
{id_SP512K, id_SP512K_MODE}, {id_DPSC512K, id_DPSC512K_MODE}, {id_PDPSC512K, id_PDPSC512K_MODE},
{id_PLL, id_PLL_CORE}, {id_DPHY, id_DPHY_CORE},
{id_MULTIBOOT, id_CONFIG_MULTIBOOT_CORE}, {id_CONFIG_LMMI, id_CONFIG_LMMI_CORE},
{id_OSCA, id_OSC_CORE},
{id_DP16K, id_DP16K_MODE},
{id_PDP16K, id_PDP16K_MODE},
{id_PDPSC16K, id_PDPSC16K_MODE},
{id_SP16K, id_SP16K_MODE},
{id_FIFO16K, id_FIFO16K_MODE},
{id_SP512K, id_SP512K_MODE},
{id_DPSC512K, id_DPSC512K_MODE},
{id_PDPSC512K, id_PDPSC512K_MODE},
{id_PLL, id_PLL_CORE},
{id_DPHY, id_DPHY_CORE},
{id_MULTIBOOT, id_CONFIG_MULTIBOOT_CORE},
{id_CONFIG_LMMI, id_CONFIG_LMMI_CORE},
};
// extra prefix needed for this primitive for some reason
@ -1104,7 +1112,6 @@ struct NexusPacker
continue;
prim_to_core(ci, prim_map.at(ci->type));
}
}
void add_bus_xform(XFormRule &rule, const std::string &o, const std::string &n, int width, int old_offset = 0,
@ -1250,7 +1257,8 @@ struct NexusPacker
xform_cell(base_iodelay_rules, ci);
NetInfo *a = ci->getPort(id_A);
if (a != nullptr && a->driver.cell != nullptr && a->driver.cell->type.in(id_SEIO18_CORE, id_SEIO33_CORE, id_DIFFIO18_CORE)) {
if (a != nullptr && a->driver.cell != nullptr &&
a->driver.cell->type.in(id_SEIO18_CORE, id_SEIO33_CORE, id_DIFFIO18_CORE)) {
// It's an input delay
log_info(" processing input delay cell '%s'\n", ci->name.c_str(ctx));
ci->params[id_INMUX] = std::string("DELAY");
@ -1259,7 +1267,8 @@ struct NexusPacker
continue;
}
NetInfo *z = ci->getPort(id_Z);
if (z != nullptr && z->users.entries() == 1 && (*z->users.begin()).cell->type.in(id_SEIO18_CORE, id_SEIO33_CORE, id_DIFFIO18_CORE)) {
if (z != nullptr && z->users.entries() == 1 &&
(*z->users.begin()).cell->type.in(id_SEIO18_CORE, id_SEIO33_CORE, id_DIFFIO18_CORE)) {
// It's an output delay
log_info(" processing output delay cell '%s'\n", ci->name.c_str(ctx));
ci->params[id_OUTMUX] = std::string("DELAY");
@ -1271,7 +1280,6 @@ struct NexusPacker
}
}
void transform_iologic()
{
dict<IdString, XFormRule> iol_rules;
@ -1312,7 +1320,7 @@ struct NexusPacker
{
// Find pairs of delay IOLOGIC and logic IOLOGIC
// <delay iol, logic iol, ouput>
std::vector<std::tuple<CellInfo*, CellInfo *, bool>> delay_iol;
std::vector<std::tuple<CellInfo *, CellInfo *, bool>> delay_iol;
for (auto &cell : ctx->cells) {
CellInfo *ci = cell.second.get();
if (!ci->type.in(id_SIOLOGIC, id_IOLOGIC))
@ -1368,8 +1376,8 @@ struct NexusPacker
continue;
delay_iol->movePortTo(port.first, logic_iol, port.first);
}
log_info(" merged delay IOLOGIC '%s' into logic IOLOGIC '%s'\n",
delay_iol->name.c_str(ctx), logic_iol->name.c_str(ctx));
log_info(" merged delay IOLOGIC '%s' into logic IOLOGIC '%s'\n", delay_iol->name.c_str(ctx),
logic_iol->name.c_str(ctx));
ctx->cells.erase(delay_iol->name);
}
}

View File

@ -244,7 +244,7 @@ static const dict<IdString, Arch::CellPinsData> base_cell_pin_data = {
{id_CONFIG_MULTIBOOT_CORE,
{
{{}, PINSTYLE_CIB},
}},
}},
{id_CONFIG_LMMI_CORE,
{
{id_LMMICLK, PINSTYLE_DEDI},
@ -252,11 +252,11 @@ static const dict<IdString, Arch::CellPinsData> base_cell_pin_data = {
{id_RSTSMCLK, PINSTYLE_DEDI},
{id_SMCLK, PINSTYLE_DEDI},
{{}, PINSTYLE_CIB},
}},
}},
{id_CONFIG_CLKRST_CORE,
{
{{}, PINSTYLE_DEDI},
}},
{{}, PINSTYLE_DEDI},
}},
};
} // namespace