Skip to content

Commit

Permalink
static/ice40: bug fixes for ultraplus
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravenslofty committed Dec 9, 2023
1 parent 6d93224 commit b230547
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
12 changes: 10 additions & 2 deletions common/place/placer_static.cc
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,13 @@ class StaticPlacer
continue;
auto size = cfg.cell_groups.at(fnd->second).bel_area.at(type); // TODO: do we care about dimensions too
auto &group = groups.at(fnd->second);
log_info("%s: (%d, %d)\n", type.c_str(ctx), loc.x, loc.y);
log_info(" size: (%d, %d)\n", group.loc_area.width(), group.loc_area.height());
for (int dy = 0; dy <= int(size.h); dy++) {
for (int dx = 0; dx <= int(size.w); dx++) {
float h = (dy == int(size.h)) ? (size.h - int(size.h)) : 1;
float w = (dx == int(size.w)) ? (size.w - int(size.w)) : 1;
log_info(" dx: %d\n", dx);
group.loc_area.at(loc.x + dx, loc.y + dy) += w * h;
}
}
Expand Down Expand Up @@ -1261,21 +1264,26 @@ class StaticPlacer
prepare_density_bins();
initialise();
bool legalised_ip = false;
#ifdef ARCH_ICE40
const int logic_groups = 1;
#else
const int logic_groups = 2;
#endif
while (true) {
step();
for (auto &penalty : dens_penalty)
penalty *= 1.025;
if (!legalised_ip) {
float ip_overlap = 0;
for (int i = 2; i < int(groups.size()); i++)
for (int i = logic_groups; i < int(groups.size()); i++)
ip_overlap = std::max(ip_overlap, groups.at(i).overlap);
if (ip_overlap < 0.15) {
legalise_step(true);
legalised_ip = true;
}
} else {
float logic_overlap = 0;
for (int i = 0; i < 2; i++)
for (int i = 0; i < logic_groups; i++)
logic_overlap = std::max(logic_overlap, groups.at(i).overlap);
if (logic_overlap < 0.1) {
legalise_step(false);
Expand Down
17 changes: 13 additions & 4 deletions ice40/arch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,15 @@ bool Arch::place()
comb.spacer_rect = StaticRect(1.0f, 2.0f);
}

{
cfg.cell_groups.emplace_back();
auto& comb = cfg.cell_groups.back();
comb.name = getCtx()->id("DSP");
comb.cell_area[id_ICESTORM_DSP] = StaticRect(0.9f, 5.0f);
comb.bel_area[id_ICESTORM_DSP] = StaticRect(0.9f, 5.0f);
comb.spacer_rect = StaticRect(0.9f, 5.0f);
}

{
cfg.cell_groups.emplace_back();
auto &comb = cfg.cell_groups.back();
Expand All @@ -684,9 +693,9 @@ bool Arch::place()
cfg.cell_groups.emplace_back();
auto &comb = cfg.cell_groups.back();
comb.name = getCtx()->id("WARMBOOT");
comb.cell_area[id_SB_WARMBOOT] = StaticRect(1.0f, 1.0f);
comb.bel_area[id_SB_WARMBOOT] = StaticRect(1.0f, 1.0f);
comb.spacer_rect = StaticRect(1.0f, 1.0f);
comb.cell_area[id_SB_WARMBOOT] = StaticRect(0.5f, 1.0f);
comb.bel_area[id_SB_WARMBOOT] = StaticRect(0.5f, 1.0f);
comb.spacer_rect = StaticRect(0.5f, 1.0f);
}

{
Expand All @@ -695,7 +704,7 @@ bool Arch::place()
comb.name = getCtx()->id("IO");
comb.cell_area[id_SB_IO] = StaticRect(0.5f, 0.5f);
comb.bel_area[id_SB_IO] = StaticRect(0.5f, 0.5f);
comb.spacer_rect = StaticRect(1.0f, 1.0f);
comb.spacer_rect = StaticRect(0.5f, 0.5f);
}
if (!placer_static(getCtx(), cfg))
return false;
Expand Down

0 comments on commit b230547

Please sign in to comment.