2018-05-26 20:27:21 +08:00
|
|
|
/*
|
|
|
|
* nextpnr -- Next Generation Place and Route
|
|
|
|
*
|
2021-06-09 20:09:08 +08:00
|
|
|
* Copyright (C) 2018 Claire Xenia Wolf <claire@yosyshq.com>
|
|
|
|
* Copyright (C) 2018 Serge Bazanski <q3k@q3k.org>
|
2018-05-26 20:27:21 +08:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-06-13 20:53:44 +08:00
|
|
|
#include <algorithm>
|
|
|
|
#include <cmath>
|
2018-07-21 01:24:34 +08:00
|
|
|
#include "cells.h"
|
2020-06-27 19:20:16 +08:00
|
|
|
#include "embed.h"
|
2018-07-13 04:04:13 +08:00
|
|
|
#include "gfx.h"
|
2018-06-10 00:19:20 +08:00
|
|
|
#include "log.h"
|
2018-06-12 02:12:57 +08:00
|
|
|
#include "nextpnr.h"
|
2018-07-12 00:15:08 +08:00
|
|
|
#include "placer1.h"
|
2019-01-11 00:42:29 +08:00
|
|
|
#include "placer_heap.h"
|
2023-10-29 14:54:53 +08:00
|
|
|
#include "placer_static.h"
|
2018-07-12 00:04:09 +08:00
|
|
|
#include "router1.h"
|
2020-02-03 19:54:38 +08:00
|
|
|
#include "router2.h"
|
2023-12-09 01:36:48 +08:00
|
|
|
#include "rust.h"
|
2018-12-02 20:01:43 +08:00
|
|
|
#include "timing_opt.h"
|
2018-12-02 21:15:39 +08:00
|
|
|
#include "util.h"
|
2018-06-12 20:24:59 +08:00
|
|
|
NEXTPNR_NAMESPACE_BEGIN
|
|
|
|
|
2018-07-15 01:50:37 +08:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2018-06-19 18:08:37 +08:00
|
|
|
void IdString::initialize_arch(const BaseCtx *ctx)
|
2018-05-26 22:08:20 +08:00
|
|
|
{
|
2018-08-08 23:01:18 +08:00
|
|
|
#define X(t) initialize_add(ctx, #t, ID_##t);
|
|
|
|
#include "constids.inc"
|
2018-06-03 22:16:59 +08:00
|
|
|
#undef X
|
2018-05-26 22:08:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2020-06-27 19:20:16 +08:00
|
|
|
static const ChipInfoPOD *get_chip_info(ArchArgs::ArchArgsTypes chip)
|
|
|
|
{
|
2020-06-25 23:11:47 +08:00
|
|
|
std::string chipdb;
|
|
|
|
if (chip == ArchArgs::LP384) {
|
|
|
|
chipdb = "ice40/chipdb-384.bin";
|
|
|
|
} else if (chip == ArchArgs::LP1K || chip == ArchArgs::HX1K) {
|
|
|
|
chipdb = "ice40/chipdb-1k.bin";
|
2020-07-08 20:09:44 +08:00
|
|
|
} else if (chip == ArchArgs::U1K || chip == ArchArgs::U2K || chip == ArchArgs::U4K) {
|
2020-06-25 23:11:47 +08:00
|
|
|
chipdb = "ice40/chipdb-u4k.bin";
|
2020-07-08 20:09:44 +08:00
|
|
|
} else if (chip == ArchArgs::UP3K || chip == ArchArgs::UP5K) {
|
2020-06-25 23:11:47 +08:00
|
|
|
chipdb = "ice40/chipdb-5k.bin";
|
2020-07-08 19:44:13 +08:00
|
|
|
} else if (chip == ArchArgs::LP8K || chip == ArchArgs::HX8K || chip == ArchArgs::LP4K || chip == ArchArgs::HX4K) {
|
2020-06-25 23:11:47 +08:00
|
|
|
chipdb = "ice40/chipdb-8k.bin";
|
|
|
|
} else {
|
|
|
|
log_error("Unknown chip\n");
|
|
|
|
}
|
2019-02-09 20:34:57 +08:00
|
|
|
|
2020-06-25 23:11:47 +08:00
|
|
|
auto ptr = reinterpret_cast<const RelPtr<ChipInfoPOD> *>(get_chipdb(chipdb));
|
|
|
|
if (ptr == nullptr)
|
|
|
|
return nullptr;
|
|
|
|
return ptr->get();
|
|
|
|
}
|
2019-02-09 20:34:57 +08:00
|
|
|
|
2021-02-03 18:21:45 +08:00
|
|
|
bool Arch::is_available(ArchArgs::ArchArgsTypes chip) { return get_chip_info(chip) != nullptr; }
|
2019-02-09 20:34:57 +08:00
|
|
|
|
2021-02-03 18:21:45 +08:00
|
|
|
std::vector<std::string> Arch::get_supported_packages(ArchArgs::ArchArgsTypes chip)
|
2019-02-09 20:34:57 +08:00
|
|
|
{
|
2020-06-25 23:11:47 +08:00
|
|
|
const ChipInfoPOD *chip_info = get_chip_info(chip);
|
|
|
|
std::vector<std::string> packages;
|
2021-01-28 02:34:41 +08:00
|
|
|
for (auto &pkg : chip_info->packages_data) {
|
|
|
|
std::string name = pkg.name.get();
|
2020-07-08 20:09:44 +08:00
|
|
|
if (chip == ArchArgs::LP4K || chip == ArchArgs::HX4K) {
|
|
|
|
if (name.find(":4k") != std::string::npos)
|
|
|
|
name = name.substr(0, name.size() - 3);
|
|
|
|
else
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
packages.push_back(name);
|
2020-07-08 19:22:59 +08:00
|
|
|
}
|
2020-06-25 23:11:47 +08:00
|
|
|
return packages;
|
2019-02-09 20:34:57 +08:00
|
|
|
}
|
2020-06-25 23:11:47 +08:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
Arch::Arch(ArchArgs args) : args(args)
|
2018-05-26 20:27:21 +08:00
|
|
|
{
|
2020-07-08 19:22:59 +08:00
|
|
|
fast_part = (args.type == ArchArgs::HX8K || args.type == ArchArgs::HX4K || args.type == ArchArgs::HX1K);
|
2018-07-04 18:06:03 +08:00
|
|
|
|
2020-06-25 23:11:47 +08:00
|
|
|
chip_info = get_chip_info(args.type);
|
|
|
|
if (chip_info == nullptr)
|
2018-06-10 00:19:20 +08:00
|
|
|
log_error("Unsupported iCE40 chip type.\n");
|
2018-05-26 20:56:30 +08:00
|
|
|
|
2018-06-13 17:51:09 +08:00
|
|
|
package_info = nullptr;
|
2020-07-08 19:22:59 +08:00
|
|
|
std::string package_name = args.package;
|
2020-07-08 19:44:13 +08:00
|
|
|
if (args.type == ArchArgs::LP4K || args.type == ArchArgs::HX4K)
|
2020-07-08 19:22:59 +08:00
|
|
|
package_name += ":4k";
|
|
|
|
|
2021-01-28 02:34:41 +08:00
|
|
|
for (auto &pkg : chip_info->packages_data) {
|
|
|
|
if (pkg.name.get() == package_name) {
|
|
|
|
package_info = &pkg;
|
2018-06-13 17:51:09 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (package_info == nullptr)
|
|
|
|
log_error("Unsupported package '%s'.\n", args.package.c_str());
|
|
|
|
|
2021-02-01 19:23:17 +08:00
|
|
|
for (int i = 0; i < chip_info->width; i++) {
|
2022-08-10 17:57:17 +08:00
|
|
|
IdString x_id = idf("X%d", i);
|
2021-02-01 19:23:17 +08:00
|
|
|
x_ids.push_back(x_id);
|
|
|
|
id_to_x[x_id] = i;
|
|
|
|
}
|
|
|
|
for (int i = 0; i < chip_info->height; i++) {
|
2022-08-10 17:57:17 +08:00
|
|
|
IdString y_id = idf("Y%d", i);
|
2021-02-01 19:23:17 +08:00
|
|
|
y_ids.push_back(y_id);
|
|
|
|
id_to_y[y_id] = i;
|
|
|
|
}
|
|
|
|
|
2021-01-28 02:34:41 +08:00
|
|
|
bel_carry.resize(chip_info->bel_data.size());
|
|
|
|
bel_to_cell.resize(chip_info->bel_data.size());
|
|
|
|
wire_to_net.resize(chip_info->wire_data.size());
|
|
|
|
pip_to_net.resize(chip_info->pip_data.size());
|
2018-06-17 22:12:52 +08:00
|
|
|
switches_locked.resize(chip_info->num_switches);
|
2021-01-29 11:24:00 +08:00
|
|
|
|
2021-02-05 19:36:19 +08:00
|
|
|
BaseArch::init_cell_types();
|
|
|
|
BaseArch::init_bel_buckets();
|
2018-05-26 20:27:21 +08:00
|
|
|
}
|
|
|
|
|
2018-06-06 21:13:41 +08:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2018-07-31 23:01:38 +08:00
|
|
|
std::string Arch::getChipName() const
|
2018-06-11 00:25:23 +08:00
|
|
|
{
|
2018-06-18 19:35:25 +08:00
|
|
|
if (args.type == ArchArgs::LP384) {
|
2020-07-08 20:16:00 +08:00
|
|
|
return "Lattice iCE40LP384";
|
2018-06-18 19:35:25 +08:00
|
|
|
} else if (args.type == ArchArgs::LP1K) {
|
2020-07-08 20:16:00 +08:00
|
|
|
return "Lattice iCE40LP1K";
|
2018-06-18 19:35:25 +08:00
|
|
|
} else if (args.type == ArchArgs::HX1K) {
|
2020-07-08 20:16:00 +08:00
|
|
|
return "Lattice iCE40HX1K";
|
2020-07-08 20:09:44 +08:00
|
|
|
} else if (args.type == ArchArgs::UP3K) {
|
2020-07-08 20:16:00 +08:00
|
|
|
return "Lattice iCE40UP3K";
|
2018-06-18 19:35:25 +08:00
|
|
|
} else if (args.type == ArchArgs::UP5K) {
|
2020-07-08 20:16:00 +08:00
|
|
|
return "Lattice iCE40UP5K";
|
2020-07-08 20:09:44 +08:00
|
|
|
} else if (args.type == ArchArgs::U1K) {
|
2020-07-08 20:16:00 +08:00
|
|
|
return "Lattice iCE5LP1K";
|
2020-07-08 20:09:44 +08:00
|
|
|
} else if (args.type == ArchArgs::U2K) {
|
2020-07-08 20:16:00 +08:00
|
|
|
return "Lattice iCE5LP2K";
|
2019-02-23 05:36:19 +08:00
|
|
|
} else if (args.type == ArchArgs::U4K) {
|
2020-07-08 20:16:00 +08:00
|
|
|
return "Lattice iCE5LP4K";
|
2020-07-08 19:44:13 +08:00
|
|
|
} else if (args.type == ArchArgs::LP4K) {
|
2020-07-08 20:16:00 +08:00
|
|
|
return "Lattice iCE40LP4K";
|
2018-06-18 19:35:25 +08:00
|
|
|
} else if (args.type == ArchArgs::LP8K) {
|
2020-07-08 20:16:00 +08:00
|
|
|
return "Lattice iCE40LP8K";
|
2020-07-08 19:22:59 +08:00
|
|
|
} else if (args.type == ArchArgs::HX4K) {
|
2020-07-08 20:16:00 +08:00
|
|
|
return "Lattice iCE40HX4K";
|
2018-06-18 19:35:25 +08:00
|
|
|
} else if (args.type == ArchArgs::HX8K) {
|
2020-07-08 20:16:00 +08:00
|
|
|
return "Lattice iCE40HX8K";
|
2018-06-11 00:25:23 +08:00
|
|
|
} else {
|
|
|
|
log_error("Unknown chip\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2018-06-24 20:38:45 +08:00
|
|
|
IdString Arch::archArgsToId(ArchArgs args) const
|
|
|
|
{
|
|
|
|
if (args.type == ArchArgs::LP384)
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_lp384;
|
2018-06-24 20:38:45 +08:00
|
|
|
if (args.type == ArchArgs::LP1K)
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_lp1k;
|
2018-06-24 20:38:45 +08:00
|
|
|
if (args.type == ArchArgs::HX1K)
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_hx1k;
|
2020-07-08 20:09:44 +08:00
|
|
|
if (args.type == ArchArgs::UP3K)
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_up3k;
|
2018-06-24 20:38:45 +08:00
|
|
|
if (args.type == ArchArgs::UP5K)
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_up5k;
|
2020-07-08 20:09:44 +08:00
|
|
|
if (args.type == ArchArgs::U1K)
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_u1k;
|
2020-07-08 20:09:44 +08:00
|
|
|
if (args.type == ArchArgs::U2K)
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_u2k;
|
2019-02-23 05:36:19 +08:00
|
|
|
if (args.type == ArchArgs::U4K)
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_u4k;
|
2020-07-08 19:44:13 +08:00
|
|
|
if (args.type == ArchArgs::LP4K)
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_lp4k;
|
2018-06-24 20:38:45 +08:00
|
|
|
if (args.type == ArchArgs::LP8K)
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_lp8k;
|
2020-07-08 19:22:59 +08:00
|
|
|
if (args.type == ArchArgs::HX4K)
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_hx4k;
|
2018-06-24 20:38:45 +08:00
|
|
|
if (args.type == ArchArgs::HX8K)
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_hx8k;
|
2018-06-24 20:38:45 +08:00
|
|
|
return IdString();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2021-02-01 19:23:17 +08:00
|
|
|
BelId Arch::getBelByName(IdStringList name) const
|
2018-07-15 01:52:56 +08:00
|
|
|
{
|
|
|
|
BelId ret;
|
|
|
|
|
|
|
|
if (bel_by_name.empty()) {
|
2021-02-01 19:23:17 +08:00
|
|
|
for (size_t i = 0; i < chip_info->bel_data.size(); i++) {
|
|
|
|
BelId b;
|
|
|
|
b.index = i;
|
|
|
|
bel_by_name[getBelName(b)] = i;
|
|
|
|
}
|
2018-07-15 01:52:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
auto it = bel_by_name.find(name);
|
|
|
|
if (it != bel_by_name.end())
|
|
|
|
ret.index = it->second;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-07-21 00:09:22 +08:00
|
|
|
BelId Arch::getBelByLocation(Loc loc) const
|
2018-07-20 23:33:57 +08:00
|
|
|
{
|
2018-07-21 00:09:22 +08:00
|
|
|
BelId bel;
|
|
|
|
|
2018-07-20 23:33:57 +08:00
|
|
|
if (bel_by_loc.empty()) {
|
2021-01-28 02:34:41 +08:00
|
|
|
for (size_t i = 0; i < chip_info->bel_data.size(); i++) {
|
2018-07-21 00:09:22 +08:00
|
|
|
BelId b;
|
|
|
|
b.index = i;
|
|
|
|
bel_by_loc[getBelLocation(b)] = i;
|
|
|
|
}
|
2018-07-20 23:33:57 +08:00
|
|
|
}
|
|
|
|
|
2018-07-21 00:09:22 +08:00
|
|
|
auto it = bel_by_loc.find(loc);
|
2018-07-20 23:33:57 +08:00
|
|
|
if (it != bel_by_loc.end())
|
2018-07-21 00:09:22 +08:00
|
|
|
bel.index = it->second;
|
|
|
|
|
|
|
|
return bel;
|
2018-07-20 23:33:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
BelRange Arch::getBelsByTile(int x, int y) const
|
|
|
|
{
|
2018-08-07 08:35:23 +08:00
|
|
|
// In iCE40 chipdb bels at the same tile are consecutive and dense z ordinates
|
|
|
|
// are used
|
2018-07-20 23:33:57 +08:00
|
|
|
BelRange br;
|
2018-07-21 00:09:22 +08:00
|
|
|
|
2020-06-29 18:08:21 +08:00
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
br.b.cursor = Arch::getBelByLocation(Loc(x, y, i)).index;
|
|
|
|
if (br.b.cursor != -1)
|
|
|
|
break;
|
|
|
|
}
|
2018-07-20 23:33:57 +08:00
|
|
|
br.e.cursor = br.b.cursor;
|
|
|
|
|
|
|
|
if (br.e.cursor != -1) {
|
2021-02-08 19:24:00 +08:00
|
|
|
while (br.e.cursor < chip_info->bel_data.ssize() && chip_info->bel_data[br.e.cursor].x == x &&
|
2018-07-20 23:33:57 +08:00
|
|
|
chip_info->bel_data[br.e.cursor].y == y)
|
|
|
|
br.e.cursor++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return br;
|
|
|
|
}
|
|
|
|
|
2018-08-08 23:01:18 +08:00
|
|
|
PortType Arch::getBelPinType(BelId bel, IdString pin) const
|
2018-07-22 17:56:51 +08:00
|
|
|
{
|
|
|
|
NPNR_ASSERT(bel != BelId());
|
|
|
|
|
2021-01-28 02:34:41 +08:00
|
|
|
int num_bel_wires = chip_info->bel_data[bel.index].bel_wires.size();
|
2018-07-22 17:56:51 +08:00
|
|
|
const BelWirePOD *bel_wires = chip_info->bel_data[bel.index].bel_wires.get();
|
|
|
|
|
2018-07-31 17:55:25 +08:00
|
|
|
if (num_bel_wires < 7) {
|
|
|
|
for (int i = 0; i < num_bel_wires; i++) {
|
2018-08-08 23:01:18 +08:00
|
|
|
if (bel_wires[i].port == pin.index)
|
2018-07-31 17:55:25 +08:00
|
|
|
return PortType(bel_wires[i].type);
|
|
|
|
}
|
|
|
|
} else {
|
2018-08-01 11:57:36 +08:00
|
|
|
int b = 0, e = num_bel_wires - 1;
|
2018-07-31 17:55:25 +08:00
|
|
|
while (b <= e) {
|
2018-08-01 11:57:36 +08:00
|
|
|
int i = (b + e) / 2;
|
2018-08-08 23:01:18 +08:00
|
|
|
if (bel_wires[i].port == pin.index)
|
2018-07-31 17:55:25 +08:00
|
|
|
return PortType(bel_wires[i].type);
|
2018-08-08 23:01:18 +08:00
|
|
|
if (bel_wires[i].port > pin.index)
|
2018-08-01 11:57:36 +08:00
|
|
|
e = i - 1;
|
2018-07-31 17:55:25 +08:00
|
|
|
else
|
2018-08-01 11:57:36 +08:00
|
|
|
b = i + 1;
|
2018-07-31 17:55:25 +08:00
|
|
|
}
|
|
|
|
}
|
2018-07-22 17:56:51 +08:00
|
|
|
|
|
|
|
return PORT_INOUT;
|
|
|
|
}
|
|
|
|
|
2018-08-19 22:31:02 +08:00
|
|
|
std::vector<std::pair<IdString, std::string>> Arch::getBelAttrs(BelId bel) const
|
2018-08-18 20:14:27 +08:00
|
|
|
{
|
|
|
|
std::vector<std::pair<IdString, std::string>> ret;
|
2018-08-19 22:31:02 +08:00
|
|
|
|
2022-02-17 01:09:54 +08:00
|
|
|
ret.push_back(std::make_pair(id_INDEX, stringf("%d", bel.index)));
|
2018-08-19 22:31:02 +08:00
|
|
|
|
2018-08-18 20:14:27 +08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-08-08 23:01:18 +08:00
|
|
|
WireId Arch::getBelPinWire(BelId bel, IdString pin) const
|
2018-07-15 01:50:34 +08:00
|
|
|
{
|
2018-07-15 01:52:56 +08:00
|
|
|
WireId ret;
|
2018-07-15 01:50:15 +08:00
|
|
|
|
2018-07-15 01:52:56 +08:00
|
|
|
NPNR_ASSERT(bel != BelId());
|
2018-07-15 01:50:15 +08:00
|
|
|
|
2021-01-28 02:34:41 +08:00
|
|
|
int num_bel_wires = chip_info->bel_data[bel.index].bel_wires.size();
|
2018-07-15 01:52:56 +08:00
|
|
|
const BelWirePOD *bel_wires = chip_info->bel_data[bel.index].bel_wires.get();
|
2018-07-15 01:50:15 +08:00
|
|
|
|
2018-07-31 17:55:25 +08:00
|
|
|
if (num_bel_wires < 7) {
|
|
|
|
for (int i = 0; i < num_bel_wires; i++) {
|
2018-08-08 23:01:18 +08:00
|
|
|
if (bel_wires[i].port == pin.index) {
|
2018-07-31 17:55:25 +08:00
|
|
|
ret.index = bel_wires[i].wire_index;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2018-08-01 11:57:36 +08:00
|
|
|
int b = 0, e = num_bel_wires - 1;
|
2018-07-31 17:55:25 +08:00
|
|
|
while (b <= e) {
|
2018-08-01 11:57:36 +08:00
|
|
|
int i = (b + e) / 2;
|
2018-08-08 23:01:18 +08:00
|
|
|
if (bel_wires[i].port == pin.index) {
|
2018-07-31 17:55:25 +08:00
|
|
|
ret.index = bel_wires[i].wire_index;
|
|
|
|
break;
|
|
|
|
}
|
2018-08-08 23:01:18 +08:00
|
|
|
if (bel_wires[i].port > pin.index)
|
2018-08-01 11:57:36 +08:00
|
|
|
e = i - 1;
|
2018-07-31 17:55:25 +08:00
|
|
|
else
|
2018-08-01 11:57:36 +08:00
|
|
|
b = i + 1;
|
2018-07-15 01:52:56 +08:00
|
|
|
}
|
2018-07-22 20:42:07 +08:00
|
|
|
}
|
2018-07-15 01:50:15 +08:00
|
|
|
|
2018-07-15 01:52:56 +08:00
|
|
|
return ret;
|
2018-07-15 01:50:34 +08:00
|
|
|
}
|
2018-07-15 01:50:15 +08:00
|
|
|
|
2018-08-08 23:01:18 +08:00
|
|
|
std::vector<IdString> Arch::getBelPins(BelId bel) const
|
2018-07-22 18:08:52 +08:00
|
|
|
{
|
2018-08-08 23:01:18 +08:00
|
|
|
std::vector<IdString> ret;
|
2018-07-22 18:08:52 +08:00
|
|
|
|
|
|
|
NPNR_ASSERT(bel != BelId());
|
|
|
|
|
2021-01-28 02:34:41 +08:00
|
|
|
for (auto &w : chip_info->bel_data[bel.index].bel_wires)
|
|
|
|
ret.push_back(IdString(w.port));
|
2018-07-22 18:08:52 +08:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2021-02-03 18:21:45 +08:00
|
|
|
bool Arch::is_bel_locked(BelId bel) const
|
2018-11-17 17:18:17 +08:00
|
|
|
{
|
|
|
|
const BelConfigPOD *bel_config = nullptr;
|
2021-01-28 02:34:41 +08:00
|
|
|
for (auto &bel_cfg : chip_info->bel_config) {
|
|
|
|
if (bel_cfg.bel_index == bel.index) {
|
|
|
|
bel_config = &bel_cfg;
|
2018-11-17 17:18:17 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
NPNR_ASSERT(bel_config != nullptr);
|
2021-01-28 02:34:41 +08:00
|
|
|
for (auto &entry : bel_config->entries) {
|
|
|
|
if (strcmp("LOCKED", entry.cbit_name.get()))
|
2018-11-17 17:18:17 +08:00
|
|
|
continue;
|
2021-01-28 02:34:41 +08:00
|
|
|
if ("LOCKED_" + archArgs().package == entry.entry_name.get())
|
2018-11-17 17:18:17 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-07-15 01:52:56 +08:00
|
|
|
// -----------------------------------------------------------------------
|
2018-07-15 01:50:15 +08:00
|
|
|
|
2021-02-01 19:23:17 +08:00
|
|
|
WireId Arch::getWireByName(IdStringList name) const
|
2018-07-15 01:50:34 +08:00
|
|
|
{
|
2018-07-15 01:52:56 +08:00
|
|
|
WireId ret;
|
2018-07-15 01:50:15 +08:00
|
|
|
|
2018-07-15 01:52:56 +08:00
|
|
|
if (wire_by_name.empty()) {
|
2021-02-08 19:24:00 +08:00
|
|
|
for (int i = 0; i < chip_info->wire_data.ssize(); i++) {
|
2021-02-01 19:23:17 +08:00
|
|
|
WireId w;
|
|
|
|
w.index = i;
|
|
|
|
wire_by_name[getWireName(w)] = i;
|
|
|
|
}
|
2018-07-15 01:52:56 +08:00
|
|
|
}
|
2018-07-15 01:50:15 +08:00
|
|
|
|
2018-07-15 01:52:56 +08:00
|
|
|
auto it = wire_by_name.find(name);
|
|
|
|
if (it != wire_by_name.end())
|
|
|
|
ret.index = it->second;
|
2018-07-15 01:50:15 +08:00
|
|
|
|
2018-07-15 01:52:56 +08:00
|
|
|
return ret;
|
2018-07-15 01:50:34 +08:00
|
|
|
}
|
2018-07-15 01:50:15 +08:00
|
|
|
|
2018-08-04 03:11:12 +08:00
|
|
|
IdString Arch::getWireType(WireId wire) const
|
|
|
|
{
|
|
|
|
NPNR_ASSERT(wire != WireId());
|
2018-08-05 20:18:34 +08:00
|
|
|
switch (chip_info->wire_data[wire.index].type) {
|
|
|
|
case WireInfoPOD::WIRE_TYPE_NONE:
|
|
|
|
return IdString();
|
|
|
|
case WireInfoPOD::WIRE_TYPE_GLB2LOCAL:
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_GLB2LOCAL;
|
2018-08-05 20:18:34 +08:00
|
|
|
case WireInfoPOD::WIRE_TYPE_GLB_NETWK:
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_GLB_NETWK;
|
2018-08-05 20:18:34 +08:00
|
|
|
case WireInfoPOD::WIRE_TYPE_LOCAL:
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_LOCAL;
|
2018-08-05 20:18:34 +08:00
|
|
|
case WireInfoPOD::WIRE_TYPE_LUTFF_IN:
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_LUTFF_IN;
|
2018-08-05 20:18:34 +08:00
|
|
|
case WireInfoPOD::WIRE_TYPE_LUTFF_IN_LUT:
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_LUTFF_IN_LUT;
|
2018-08-05 20:18:34 +08:00
|
|
|
case WireInfoPOD::WIRE_TYPE_LUTFF_LOUT:
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_LUTFF_LOUT;
|
2018-08-05 20:18:34 +08:00
|
|
|
case WireInfoPOD::WIRE_TYPE_LUTFF_OUT:
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_LUTFF_OUT;
|
2018-08-05 20:18:34 +08:00
|
|
|
case WireInfoPOD::WIRE_TYPE_LUTFF_COUT:
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_LUTFF_COUT;
|
2018-08-05 20:18:34 +08:00
|
|
|
case WireInfoPOD::WIRE_TYPE_LUTFF_GLOBAL:
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_LUTFF_GLOBAL;
|
2018-08-05 20:18:34 +08:00
|
|
|
case WireInfoPOD::WIRE_TYPE_CARRY_IN_MUX:
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_CARRY_IN_MUX;
|
2018-08-05 20:18:34 +08:00
|
|
|
case WireInfoPOD::WIRE_TYPE_SP4_V:
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_SP4_V;
|
2018-08-05 20:18:34 +08:00
|
|
|
case WireInfoPOD::WIRE_TYPE_SP4_H:
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_SP4_H;
|
2018-08-05 20:18:34 +08:00
|
|
|
case WireInfoPOD::WIRE_TYPE_SP12_V:
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_SP12_V;
|
2018-08-05 20:18:34 +08:00
|
|
|
case WireInfoPOD::WIRE_TYPE_SP12_H:
|
2022-02-17 01:09:54 +08:00
|
|
|
return id_SP12_H;
|
2018-08-04 03:11:12 +08:00
|
|
|
}
|
|
|
|
return IdString();
|
|
|
|
}
|
|
|
|
|
2018-08-18 20:14:27 +08:00
|
|
|
std::vector<std::pair<IdString, std::string>> Arch::getWireAttrs(WireId wire) const
|
|
|
|
{
|
|
|
|
std::vector<std::pair<IdString, std::string>> ret;
|
|
|
|
auto &wi = chip_info->wire_data[wire.index];
|
|
|
|
|
2022-02-17 01:09:54 +08:00
|
|
|
ret.push_back(std::make_pair(id_INDEX, stringf("%d", wire.index)));
|
2018-08-18 22:20:33 +08:00
|
|
|
|
2022-02-17 01:09:54 +08:00
|
|
|
ret.push_back(std::make_pair(id_GRID_X, stringf("%d", wi.x)));
|
|
|
|
ret.push_back(std::make_pair(id_GRID_Y, stringf("%d", wi.y)));
|
|
|
|
ret.push_back(std::make_pair(id_GRID_Z, stringf("%d", wi.z)));
|
2018-08-18 20:14:27 +08:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-07-15 01:52:56 +08:00
|
|
|
// -----------------------------------------------------------------------
|
2018-07-15 01:50:15 +08:00
|
|
|
|
2021-02-01 19:23:17 +08:00
|
|
|
PipId Arch::getPipByName(IdStringList name) const
|
2018-07-15 01:50:34 +08:00
|
|
|
{
|
2018-07-15 01:52:56 +08:00
|
|
|
PipId ret;
|
2018-07-15 01:50:15 +08:00
|
|
|
|
2018-07-15 01:52:56 +08:00
|
|
|
if (pip_by_name.empty()) {
|
2021-02-08 19:24:00 +08:00
|
|
|
for (int i = 0; i < chip_info->pip_data.ssize(); i++) {
|
2018-07-15 01:52:56 +08:00
|
|
|
PipId pip;
|
|
|
|
pip.index = i;
|
|
|
|
pip_by_name[getPipName(pip)] = i;
|
|
|
|
}
|
|
|
|
}
|
2018-07-15 01:50:15 +08:00
|
|
|
|
2018-07-15 01:52:56 +08:00
|
|
|
auto it = pip_by_name.find(name);
|
|
|
|
if (it != pip_by_name.end())
|
|
|
|
ret.index = it->second;
|
2018-07-15 01:50:15 +08:00
|
|
|
|
2018-07-15 01:52:56 +08:00
|
|
|
return ret;
|
2018-07-15 01:50:34 +08:00
|
|
|
}
|
2018-07-15 01:50:15 +08:00
|
|
|
|
2021-02-01 19:23:17 +08:00
|
|
|
IdStringList Arch::getPipName(PipId pip) const
|
2018-06-13 20:53:44 +08:00
|
|
|
{
|
2018-07-04 18:15:23 +08:00
|
|
|
NPNR_ASSERT(pip != PipId());
|
2018-07-16 03:41:34 +08:00
|
|
|
|
|
|
|
int x = chip_info->pip_data[pip.index].x;
|
|
|
|
int y = chip_info->pip_data[pip.index].y;
|
|
|
|
|
2021-02-01 19:23:17 +08:00
|
|
|
auto &src_wire = chip_info->wire_data[chip_info->pip_data[pip.index].src];
|
|
|
|
auto &dst_wire = chip_info->wire_data[chip_info->pip_data[pip.index].dst];
|
2018-07-16 03:41:34 +08:00
|
|
|
|
2021-02-01 19:23:17 +08:00
|
|
|
std::string src_name = stringf("%d.%d.%s", int(src_wire.name_x), int(src_wire.name_y), src_wire.name.get());
|
|
|
|
std::string dst_name = stringf("%d.%d.%s", int(dst_wire.name_x), int(dst_wire.name_y), dst_wire.name.get());
|
2018-07-16 03:41:34 +08:00
|
|
|
|
2021-02-01 19:23:17 +08:00
|
|
|
std::array<IdString, 3> ids{x_ids.at(x), y_ids.at(y), id(src_name + ".->." + dst_name)};
|
|
|
|
return IdStringList(ids);
|
2018-06-13 20:53:44 +08:00
|
|
|
}
|
|
|
|
|
2018-08-18 20:14:27 +08:00
|
|
|
IdString Arch::getPipType(PipId pip) const { return IdString(); }
|
|
|
|
|
2018-08-19 22:31:02 +08:00
|
|
|
std::vector<std::pair<IdString, std::string>> Arch::getPipAttrs(PipId pip) const
|
2018-08-18 20:14:27 +08:00
|
|
|
{
|
|
|
|
std::vector<std::pair<IdString, std::string>> ret;
|
2018-08-19 22:31:02 +08:00
|
|
|
|
2022-02-17 01:09:54 +08:00
|
|
|
ret.push_back(std::make_pair(id_INDEX, stringf("%d", pip.index)));
|
2018-08-19 22:31:02 +08:00
|
|
|
|
2018-08-18 20:14:27 +08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-06-06 21:13:41 +08:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2021-02-03 18:21:45 +08:00
|
|
|
BelId Arch::get_package_pin_bel(const std::string &pin) const
|
2018-06-13 18:30:15 +08:00
|
|
|
{
|
2021-01-28 02:34:41 +08:00
|
|
|
for (auto &ppin : package_info->pins) {
|
|
|
|
if (ppin.name.get() == pin) {
|
2018-06-13 18:30:15 +08:00
|
|
|
BelId id;
|
2021-01-28 02:34:41 +08:00
|
|
|
id.index = ppin.bel_index;
|
2018-06-13 18:30:15 +08:00
|
|
|
return id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return BelId();
|
|
|
|
}
|
|
|
|
|
2021-02-03 18:21:45 +08:00
|
|
|
std::string Arch::get_bel_package_pin(BelId bel) const
|
2018-06-16 03:29:02 +08:00
|
|
|
{
|
2021-01-28 02:34:41 +08:00
|
|
|
for (auto &ppin : package_info->pins) {
|
|
|
|
if (ppin.bel_index == bel.index) {
|
|
|
|
return std::string(ppin.name.get());
|
2018-06-16 03:29:02 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|
2018-07-12 23:22:29 +08:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2021-02-01 19:23:17 +08:00
|
|
|
GroupId Arch::getGroupByName(IdStringList name) const
|
2018-07-12 23:22:29 +08:00
|
|
|
{
|
|
|
|
for (auto g : getGroups())
|
|
|
|
if (getGroupName(g) == name)
|
|
|
|
return g;
|
|
|
|
return GroupId();
|
|
|
|
}
|
|
|
|
|
2021-02-01 19:23:17 +08:00
|
|
|
IdStringList Arch::getGroupName(GroupId group) const
|
2018-07-26 22:21:01 +08:00
|
|
|
{
|
|
|
|
std::string suffix;
|
|
|
|
|
|
|
|
switch (group.type) {
|
|
|
|
case GroupId::TYPE_FRAME:
|
|
|
|
suffix = "tile";
|
|
|
|
break;
|
|
|
|
case GroupId::TYPE_MAIN_SW:
|
|
|
|
suffix = "main_sw";
|
|
|
|
break;
|
|
|
|
case GroupId::TYPE_LOCAL_SW:
|
|
|
|
suffix = "local_sw";
|
|
|
|
break;
|
|
|
|
case GroupId::TYPE_LC0_SW:
|
|
|
|
suffix = "lc0_sw";
|
|
|
|
break;
|
|
|
|
case GroupId::TYPE_LC1_SW:
|
|
|
|
suffix = "lc1_sw";
|
|
|
|
break;
|
|
|
|
case GroupId::TYPE_LC2_SW:
|
|
|
|
suffix = "lc2_sw";
|
|
|
|
break;
|
|
|
|
case GroupId::TYPE_LC3_SW:
|
|
|
|
suffix = "lc3_sw";
|
|
|
|
break;
|
|
|
|
case GroupId::TYPE_LC4_SW:
|
|
|
|
suffix = "lc4_sw";
|
|
|
|
break;
|
|
|
|
case GroupId::TYPE_LC5_SW:
|
|
|
|
suffix = "lc5_sw";
|
|
|
|
break;
|
|
|
|
case GroupId::TYPE_LC6_SW:
|
|
|
|
suffix = "lc6_sw";
|
|
|
|
break;
|
|
|
|
case GroupId::TYPE_LC7_SW:
|
|
|
|
suffix = "lc7_sw";
|
|
|
|
break;
|
|
|
|
default:
|
2021-02-05 06:47:45 +08:00
|
|
|
return IdStringList();
|
2018-07-26 22:21:01 +08:00
|
|
|
}
|
|
|
|
|
2021-02-01 19:23:17 +08:00
|
|
|
std::array<IdString, 3> ids{x_ids.at(group.x), y_ids.at(group.y), id(suffix)};
|
|
|
|
return IdStringList(ids);
|
2018-07-26 22:21:01 +08:00
|
|
|
}
|
2018-07-12 23:22:29 +08:00
|
|
|
|
|
|
|
std::vector<GroupId> Arch::getGroups() const
|
|
|
|
{
|
|
|
|
std::vector<GroupId> ret;
|
2018-07-26 22:21:01 +08:00
|
|
|
|
|
|
|
for (int y = 0; y < chip_info->height; y++) {
|
|
|
|
for (int x = 0; x < chip_info->width; x++) {
|
|
|
|
TileType type = chip_info->tile_grid[y * chip_info->width + x];
|
|
|
|
if (type == TILE_NONE)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
GroupId group;
|
|
|
|
group.type = GroupId::TYPE_FRAME;
|
|
|
|
group.x = x;
|
|
|
|
group.y = y;
|
|
|
|
// ret.push_back(group);
|
|
|
|
|
|
|
|
group.type = GroupId::TYPE_MAIN_SW;
|
|
|
|
ret.push_back(group);
|
|
|
|
|
|
|
|
group.type = GroupId::TYPE_LOCAL_SW;
|
|
|
|
ret.push_back(group);
|
|
|
|
|
2018-08-05 20:18:34 +08:00
|
|
|
if (type == TILE_LOGIC) {
|
2018-07-26 22:21:01 +08:00
|
|
|
group.type = GroupId::TYPE_LC0_SW;
|
|
|
|
ret.push_back(group);
|
|
|
|
|
|
|
|
group.type = GroupId::TYPE_LC1_SW;
|
|
|
|
ret.push_back(group);
|
|
|
|
|
|
|
|
group.type = GroupId::TYPE_LC2_SW;
|
|
|
|
ret.push_back(group);
|
|
|
|
|
|
|
|
group.type = GroupId::TYPE_LC3_SW;
|
|
|
|
ret.push_back(group);
|
|
|
|
|
|
|
|
group.type = GroupId::TYPE_LC4_SW;
|
|
|
|
ret.push_back(group);
|
|
|
|
|
|
|
|
group.type = GroupId::TYPE_LC5_SW;
|
|
|
|
ret.push_back(group);
|
|
|
|
|
|
|
|
group.type = GroupId::TYPE_LC6_SW;
|
|
|
|
ret.push_back(group);
|
|
|
|
|
|
|
|
group.type = GroupId::TYPE_LC7_SW;
|
|
|
|
ret.push_back(group);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-07-12 23:22:29 +08:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<BelId> Arch::getGroupBels(GroupId group) const
|
|
|
|
{
|
|
|
|
std::vector<BelId> ret;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<WireId> Arch::getGroupWires(GroupId group) const
|
|
|
|
{
|
|
|
|
std::vector<WireId> ret;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<PipId> Arch::getGroupPips(GroupId group) const
|
|
|
|
{
|
|
|
|
std::vector<PipId> ret;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<GroupId> Arch::getGroupGroups(GroupId group) const
|
|
|
|
{
|
|
|
|
std::vector<GroupId> ret;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-06-13 18:30:15 +08:00
|
|
|
// -----------------------------------------------------------------------
|
2018-06-06 21:13:41 +08:00
|
|
|
|
2018-12-02 21:15:39 +08:00
|
|
|
bool Arch::place()
|
|
|
|
{
|
2022-02-17 01:09:54 +08:00
|
|
|
std::string placer = str_or_default(settings, id_placer, defaultPlacer);
|
2019-03-24 19:10:20 +08:00
|
|
|
if (placer == "heap") {
|
2019-02-25 20:48:01 +08:00
|
|
|
PlacerHeapCfg cfg(getCtx());
|
|
|
|
cfg.ioBufTypes.insert(id_SB_IO);
|
|
|
|
if (!placer_heap(getCtx(), cfg))
|
2019-02-25 19:56:10 +08:00
|
|
|
return false;
|
2019-03-24 19:10:20 +08:00
|
|
|
} else if (placer == "sa") {
|
2019-02-25 19:56:10 +08:00
|
|
|
if (!placer1(getCtx(), Placer1Cfg(getCtx())))
|
|
|
|
return false;
|
2023-10-29 14:54:53 +08:00
|
|
|
} else if (placer == "static") {
|
|
|
|
PlacerStaticCfg cfg(getCtx());
|
2023-12-09 12:12:33 +08:00
|
|
|
cfg.logic_groups = 1;
|
2023-10-29 14:54:53 +08:00
|
|
|
{
|
|
|
|
cfg.cell_groups.emplace_back();
|
|
|
|
auto &comb = cfg.cell_groups.back();
|
|
|
|
comb.name = getCtx()->id("COMB");
|
|
|
|
comb.cell_area[id_ICESTORM_LC] = StaticRect(1.0f, 0.125f);
|
|
|
|
comb.bel_area[id_ICESTORM_LC] = StaticRect(1.0f, 0.125f);
|
|
|
|
comb.spacer_rect = StaticRect(1.0f, 0.125f);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
cfg.cell_groups.emplace_back();
|
|
|
|
auto &comb = cfg.cell_groups.back();
|
|
|
|
comb.name = getCtx()->id("RAM");
|
|
|
|
comb.cell_area[id_ICESTORM_RAM] = StaticRect(1.0f, 2.0f);
|
|
|
|
comb.bel_area[id_ICESTORM_RAM] = StaticRect(1.0f, 2.0f);
|
|
|
|
comb.spacer_rect = StaticRect(1.0f, 2.0f);
|
|
|
|
}
|
|
|
|
|
2023-12-09 12:12:33 +08:00
|
|
|
{
|
|
|
|
cfg.cell_groups.emplace_back();
|
2023-12-26 16:54:34 +08:00
|
|
|
auto &comb = cfg.cell_groups.back();
|
2023-12-09 12:12:33 +08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2023-10-29 14:54:53 +08:00
|
|
|
{
|
|
|
|
cfg.cell_groups.emplace_back();
|
|
|
|
auto &comb = cfg.cell_groups.back();
|
|
|
|
comb.name = getCtx()->id("GB");
|
|
|
|
comb.cell_area[id_SB_GB] = StaticRect(0.5f, 0.5f);
|
|
|
|
comb.bel_area[id_SB_GB] = StaticRect(0.5f, 0.5f);
|
|
|
|
comb.spacer_rect = StaticRect(0.5f, 0.5f);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
cfg.cell_groups.emplace_back();
|
|
|
|
auto &comb = cfg.cell_groups.back();
|
|
|
|
comb.name = getCtx()->id("WARMBOOT");
|
2023-12-09 12:12:33 +08:00
|
|
|
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);
|
2023-10-29 14:54:53 +08:00
|
|
|
}
|
2023-11-06 21:07:26 +08:00
|
|
|
|
|
|
|
{
|
|
|
|
cfg.cell_groups.emplace_back();
|
|
|
|
auto &comb = cfg.cell_groups.back();
|
|
|
|
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);
|
2023-12-09 12:12:33 +08:00
|
|
|
comb.spacer_rect = StaticRect(0.5f, 0.5f);
|
2023-11-06 21:07:26 +08:00
|
|
|
}
|
2023-10-29 14:54:53 +08:00
|
|
|
if (!placer_static(getCtx(), cfg))
|
|
|
|
return false;
|
2019-03-24 19:10:20 +08:00
|
|
|
} else {
|
|
|
|
log_error("iCE40 architecture does not support placer '%s'\n", placer.c_str());
|
2019-02-25 19:56:10 +08:00
|
|
|
}
|
2019-06-07 17:48:15 +08:00
|
|
|
bool retVal = true;
|
2022-02-17 01:09:54 +08:00
|
|
|
if (bool_or_default(settings, id_opt_timing, false)) {
|
2018-12-02 22:08:11 +08:00
|
|
|
TimingOptCfg tocfg(getCtx());
|
|
|
|
tocfg.cellTypes.insert(id_ICESTORM_LC);
|
2019-06-07 17:48:15 +08:00
|
|
|
retVal = timing_opt(getCtx(), tocfg);
|
2018-12-02 22:08:11 +08:00
|
|
|
}
|
2022-02-17 01:09:54 +08:00
|
|
|
getCtx()->settings[id_place] = 1;
|
2019-06-07 17:48:15 +08:00
|
|
|
archInfoToAttributes();
|
|
|
|
return retVal;
|
2018-12-02 20:01:43 +08:00
|
|
|
}
|
2018-07-12 00:15:08 +08:00
|
|
|
|
2019-06-26 00:19:25 +08:00
|
|
|
bool Arch::route()
|
|
|
|
{
|
2022-02-17 01:09:54 +08:00
|
|
|
std::string router = str_or_default(settings, id_router, defaultRouter);
|
2020-02-03 19:54:38 +08:00
|
|
|
bool result;
|
|
|
|
if (router == "router1") {
|
|
|
|
result = router1(getCtx(), Router1Cfg(getCtx()));
|
|
|
|
} else if (router == "router2") {
|
|
|
|
router2(getCtx(), Router2Cfg(getCtx()));
|
2020-02-03 21:46:05 +08:00
|
|
|
result = true;
|
2020-02-03 19:54:38 +08:00
|
|
|
} else {
|
|
|
|
log_error("iCE40 architecture does not support router '%s'\n", router.c_str());
|
|
|
|
}
|
2022-02-17 01:09:54 +08:00
|
|
|
getCtx()->settings[id_route] = 1;
|
2019-06-07 17:48:15 +08:00
|
|
|
archInfoToAttributes();
|
2020-02-03 19:54:38 +08:00
|
|
|
return result;
|
2019-06-07 17:48:15 +08:00
|
|
|
}
|
2018-07-12 00:04:09 +08:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2018-07-11 20:03:23 +08:00
|
|
|
DecalXY Arch::getBelDecal(BelId bel) const
|
|
|
|
{
|
|
|
|
DecalXY decalxy;
|
2018-07-12 23:22:29 +08:00
|
|
|
decalxy.decal.type = DecalId::TYPE_BEL;
|
|
|
|
decalxy.decal.index = bel.index;
|
2018-08-05 21:25:42 +08:00
|
|
|
decalxy.decal.active = bel_to_cell.at(bel.index) != nullptr;
|
2018-07-11 20:03:23 +08:00
|
|
|
return decalxy;
|
|
|
|
}
|
2018-06-13 18:48:58 +08:00
|
|
|
|
2018-07-11 20:03:23 +08:00
|
|
|
DecalXY Arch::getWireDecal(WireId wire) const
|
|
|
|
{
|
|
|
|
DecalXY decalxy;
|
2018-07-13 03:05:09 +08:00
|
|
|
decalxy.decal.type = DecalId::TYPE_WIRE;
|
|
|
|
decalxy.decal.index = wire.index;
|
2018-08-05 21:25:42 +08:00
|
|
|
decalxy.decal.active = wire_to_net.at(wire.index) != nullptr;
|
2018-07-11 20:03:23 +08:00
|
|
|
return decalxy;
|
2018-06-13 18:48:58 +08:00
|
|
|
}
|
|
|
|
|
2018-07-11 20:03:23 +08:00
|
|
|
DecalXY Arch::getPipDecal(PipId pip) const
|
|
|
|
{
|
|
|
|
DecalXY decalxy;
|
2018-07-21 01:35:42 +08:00
|
|
|
decalxy.decal.type = DecalId::TYPE_PIP;
|
|
|
|
decalxy.decal.index = pip.index;
|
2018-08-05 21:25:42 +08:00
|
|
|
decalxy.decal.active = pip_to_net.at(pip.index) != nullptr;
|
2018-07-11 20:03:23 +08:00
|
|
|
return decalxy;
|
|
|
|
};
|
|
|
|
|
2018-07-12 23:22:29 +08:00
|
|
|
DecalXY Arch::getGroupDecal(GroupId group) const
|
|
|
|
{
|
|
|
|
DecalXY decalxy;
|
2018-07-13 20:29:03 +08:00
|
|
|
decalxy.decal.type = DecalId::TYPE_GROUP;
|
|
|
|
decalxy.decal.index = (group.type << 16) | (group.x << 8) | (group.y);
|
|
|
|
decalxy.decal.active = true;
|
2018-07-12 23:22:29 +08:00
|
|
|
return decalxy;
|
|
|
|
};
|
|
|
|
|
2018-07-15 01:50:50 +08:00
|
|
|
std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const
|
2018-06-06 21:13:41 +08:00
|
|
|
{
|
2018-06-12 01:56:33 +08:00
|
|
|
std::vector<GraphicElement> ret;
|
2018-06-07 18:56:49 +08:00
|
|
|
|
2018-07-26 22:21:01 +08:00
|
|
|
if (decal.type == DecalId::TYPE_GROUP) {
|
|
|
|
int type = (decal.index >> 16) & 255;
|
|
|
|
int x = (decal.index >> 8) & 255;
|
|
|
|
int y = decal.index & 255;
|
|
|
|
|
|
|
|
if (type == GroupId::TYPE_FRAME) {
|
|
|
|
GraphicElement el;
|
2018-07-26 23:39:19 +08:00
|
|
|
el.type = GraphicElement::TYPE_LINE;
|
|
|
|
el.style = GraphicElement::STYLE_FRAME;
|
2018-07-26 22:21:01 +08:00
|
|
|
|
|
|
|
el.x1 = x + 0.01, el.x2 = x + 0.02, el.y1 = y + 0.01, el.y2 = y + 0.01;
|
|
|
|
ret.push_back(el);
|
|
|
|
el.x1 = x + 0.01, el.x2 = x + 0.01, el.y1 = y + 0.01, el.y2 = y + 0.02;
|
|
|
|
ret.push_back(el);
|
|
|
|
|
|
|
|
el.x1 = x + 0.99, el.x2 = x + 0.98, el.y1 = y + 0.01, el.y2 = y + 0.01;
|
|
|
|
ret.push_back(el);
|
|
|
|
el.x1 = x + 0.99, el.x2 = x + 0.99, el.y1 = y + 0.01, el.y2 = y + 0.02;
|
|
|
|
ret.push_back(el);
|
|
|
|
|
|
|
|
el.x1 = x + 0.99, el.x2 = x + 0.98, el.y1 = y + 0.99, el.y2 = y + 0.99;
|
|
|
|
ret.push_back(el);
|
|
|
|
el.x1 = x + 0.99, el.x2 = x + 0.99, el.y1 = y + 0.99, el.y2 = y + 0.98;
|
|
|
|
ret.push_back(el);
|
|
|
|
|
|
|
|
el.x1 = x + 0.01, el.x2 = x + 0.02, el.y1 = y + 0.99, el.y2 = y + 0.99;
|
|
|
|
ret.push_back(el);
|
|
|
|
el.x1 = x + 0.01, el.x2 = x + 0.01, el.y1 = y + 0.99, el.y2 = y + 0.98;
|
|
|
|
ret.push_back(el);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type == GroupId::TYPE_MAIN_SW) {
|
|
|
|
GraphicElement el;
|
2018-07-26 23:39:19 +08:00
|
|
|
el.type = GraphicElement::TYPE_BOX;
|
|
|
|
el.style = GraphicElement::STYLE_FRAME;
|
2018-07-26 22:21:01 +08:00
|
|
|
|
|
|
|
el.x1 = x + main_swbox_x1;
|
|
|
|
el.x2 = x + main_swbox_x2;
|
|
|
|
el.y1 = y + main_swbox_y1;
|
|
|
|
el.y2 = y + main_swbox_y2;
|
|
|
|
ret.push_back(el);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type == GroupId::TYPE_LOCAL_SW) {
|
|
|
|
GraphicElement el;
|
2018-07-26 23:39:19 +08:00
|
|
|
el.type = GraphicElement::TYPE_BOX;
|
|
|
|
el.style = GraphicElement::STYLE_FRAME;
|
2018-07-26 22:21:01 +08:00
|
|
|
|
|
|
|
el.x1 = x + local_swbox_x1;
|
|
|
|
el.x2 = x + local_swbox_x2;
|
|
|
|
el.y1 = y + local_swbox_y1;
|
|
|
|
el.y2 = y + local_swbox_y2;
|
|
|
|
ret.push_back(el);
|
|
|
|
}
|
2018-08-03 23:37:59 +08:00
|
|
|
|
|
|
|
if (GroupId::TYPE_LC0_SW <= type && type <= GroupId::TYPE_LC7_SW) {
|
|
|
|
GraphicElement el;
|
|
|
|
el.type = GraphicElement::TYPE_BOX;
|
|
|
|
el.style = GraphicElement::STYLE_FRAME;
|
|
|
|
|
|
|
|
el.x1 = x + lut_swbox_x1;
|
|
|
|
el.x2 = x + lut_swbox_x2;
|
|
|
|
el.y1 = y + logic_cell_y1 + logic_cell_pitch * (type - GroupId::TYPE_LC0_SW);
|
|
|
|
el.y2 = y + logic_cell_y2 + logic_cell_pitch * (type - GroupId::TYPE_LC0_SW);
|
|
|
|
ret.push_back(el);
|
|
|
|
}
|
2018-06-07 18:56:49 +08:00
|
|
|
}
|
|
|
|
|
2018-07-13 04:04:13 +08:00
|
|
|
if (decal.type == DecalId::TYPE_WIRE) {
|
2021-01-28 02:34:41 +08:00
|
|
|
int n = chip_info->wire_data[decal.index].segments.size();
|
2018-07-16 02:29:32 +08:00
|
|
|
const WireSegmentPOD *p = chip_info->wire_data[decal.index].segments.get();
|
2018-07-13 03:05:09 +08:00
|
|
|
|
2018-07-26 23:39:19 +08:00
|
|
|
GraphicElement::style_t style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
|
2018-07-13 03:05:09 +08:00
|
|
|
|
|
|
|
for (int i = 0; i < n; i++)
|
2018-08-19 22:53:34 +08:00
|
|
|
gfxTileWire(ret, p[i].x, p[i].y, chip_info->width, chip_info->height, GfxTileWireId(p[i].index), style);
|
2018-07-13 03:05:09 +08:00
|
|
|
}
|
|
|
|
|
2018-07-16 02:29:32 +08:00
|
|
|
if (decal.type == DecalId::TYPE_PIP) {
|
|
|
|
const PipInfoPOD &p = chip_info->pip_data[decal.index];
|
2018-07-26 23:39:19 +08:00
|
|
|
GraphicElement::style_t style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_HIDDEN;
|
2018-07-16 02:29:32 +08:00
|
|
|
gfxTilePip(ret, p.x, p.y, GfxTileWireId(p.src_seg), GfxTileWireId(p.dst_seg), style);
|
|
|
|
}
|
|
|
|
|
2018-07-13 04:04:13 +08:00
|
|
|
if (decal.type == DecalId::TYPE_BEL) {
|
2018-07-11 20:03:23 +08:00
|
|
|
BelId bel;
|
2018-07-12 23:22:29 +08:00
|
|
|
bel.index = decal.index;
|
2018-07-11 20:03:23 +08:00
|
|
|
|
2018-07-15 01:50:50 +08:00
|
|
|
auto bel_type = getBelType(bel);
|
2018-07-11 20:03:23 +08:00
|
|
|
|
2018-08-08 23:01:18 +08:00
|
|
|
if (bel_type == id_ICESTORM_LC) {
|
2018-06-07 18:56:49 +08:00
|
|
|
GraphicElement el;
|
2018-07-26 23:39:19 +08:00
|
|
|
el.type = GraphicElement::TYPE_BOX;
|
|
|
|
el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
|
2018-07-11 20:03:23 +08:00
|
|
|
el.x1 = chip_info->bel_data[bel.index].x + logic_cell_x1;
|
|
|
|
el.x2 = chip_info->bel_data[bel.index].x + logic_cell_x2;
|
2018-07-13 04:04:13 +08:00
|
|
|
el.y1 = chip_info->bel_data[bel.index].y + logic_cell_y1 +
|
|
|
|
(chip_info->bel_data[bel.index].z) * logic_cell_pitch;
|
|
|
|
el.y2 = chip_info->bel_data[bel.index].y + logic_cell_y2 +
|
|
|
|
(chip_info->bel_data[bel.index].z) * logic_cell_pitch;
|
2018-06-07 18:56:49 +08:00
|
|
|
ret.push_back(el);
|
2018-07-11 20:03:23 +08:00
|
|
|
}
|
|
|
|
|
2018-08-08 23:01:18 +08:00
|
|
|
if (bel_type == id_SB_IO) {
|
2018-07-26 22:21:01 +08:00
|
|
|
GraphicElement el;
|
2018-07-26 23:39:19 +08:00
|
|
|
el.type = GraphicElement::TYPE_BOX;
|
|
|
|
el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
|
2018-08-18 22:20:33 +08:00
|
|
|
el.x1 = chip_info->bel_data[bel.index].x + lut_swbox_x1;
|
2018-07-26 22:21:01 +08:00
|
|
|
el.x2 = chip_info->bel_data[bel.index].x + logic_cell_x2;
|
|
|
|
el.y1 = chip_info->bel_data[bel.index].y + logic_cell_y1 +
|
2018-07-26 23:14:56 +08:00
|
|
|
(4 * chip_info->bel_data[bel.index].z) * logic_cell_pitch;
|
2018-07-26 22:21:01 +08:00
|
|
|
el.y2 = chip_info->bel_data[bel.index].y + logic_cell_y2 +
|
2018-07-26 23:14:56 +08:00
|
|
|
(4 * chip_info->bel_data[bel.index].z + 3) * logic_cell_pitch;
|
2018-07-26 22:21:01 +08:00
|
|
|
ret.push_back(el);
|
2018-07-11 20:03:23 +08:00
|
|
|
}
|
|
|
|
|
2018-08-08 23:01:18 +08:00
|
|
|
if (bel_type == id_ICESTORM_RAM) {
|
2018-07-18 18:12:05 +08:00
|
|
|
for (int i = 0; i < 2; i++) {
|
2018-07-13 22:22:28 +08:00
|
|
|
GraphicElement el;
|
2018-07-26 23:39:19 +08:00
|
|
|
el.type = GraphicElement::TYPE_BOX;
|
|
|
|
el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
|
2018-08-18 22:20:33 +08:00
|
|
|
el.x1 = chip_info->bel_data[bel.index].x + lut_swbox_x1;
|
2018-07-13 22:22:28 +08:00
|
|
|
el.x2 = chip_info->bel_data[bel.index].x + logic_cell_x2;
|
2018-07-26 22:21:01 +08:00
|
|
|
el.y1 = chip_info->bel_data[bel.index].y + logic_cell_y1 + i;
|
|
|
|
el.y2 = chip_info->bel_data[bel.index].y + logic_cell_y2 + i + 7 * logic_cell_pitch;
|
2018-07-13 22:22:28 +08:00
|
|
|
ret.push_back(el);
|
|
|
|
}
|
2018-06-07 18:56:49 +08:00
|
|
|
}
|
2018-08-20 00:43:38 +08:00
|
|
|
|
|
|
|
if (bel_type == id_SB_GB) {
|
|
|
|
GraphicElement el;
|
|
|
|
el.type = GraphicElement::TYPE_BOX;
|
|
|
|
el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
|
|
|
|
el.x1 = chip_info->bel_data[bel.index].x + local_swbox_x1 + 0.05;
|
|
|
|
el.x2 = chip_info->bel_data[bel.index].x + logic_cell_x2 - 0.05;
|
|
|
|
el.y1 = chip_info->bel_data[bel.index].y + main_swbox_y2 - 0.05;
|
|
|
|
el.y2 = chip_info->bel_data[bel.index].y + main_swbox_y2 - 0.10;
|
|
|
|
ret.push_back(el);
|
|
|
|
}
|
|
|
|
|
2022-08-11 01:58:22 +08:00
|
|
|
if (bel_type.in(id_ICESTORM_PLL, id_SB_WARMBOOT)) {
|
2018-08-20 00:43:38 +08:00
|
|
|
GraphicElement el;
|
|
|
|
el.type = GraphicElement::TYPE_BOX;
|
|
|
|
el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE;
|
|
|
|
el.x1 = chip_info->bel_data[bel.index].x + local_swbox_x1 + 0.05;
|
|
|
|
el.x2 = chip_info->bel_data[bel.index].x + logic_cell_x2 - 0.05;
|
|
|
|
el.y1 = chip_info->bel_data[bel.index].y + main_swbox_y2;
|
|
|
|
el.y2 = chip_info->bel_data[bel.index].y + main_swbox_y2 + 0.05;
|
|
|
|
ret.push_back(el);
|
|
|
|
}
|
2018-06-07 18:56:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2018-06-06 21:13:41 +08:00
|
|
|
}
|
|
|
|
|
2018-06-20 17:44:28 +08:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2021-02-19 18:39:57 +08:00
|
|
|
bool Arch::getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort, DelayQuad &delay) const
|
2019-01-21 19:58:49 +08:00
|
|
|
{
|
2022-03-28 21:06:09 +08:00
|
|
|
if (cell->type == id_ICESTORM_LC) {
|
|
|
|
if (toPort == id_O) {
|
|
|
|
if (cell->lcInfo.dffEnable)
|
|
|
|
return false;
|
|
|
|
// "false paths"
|
|
|
|
if (fromPort == id_I0 && ((cell->lcInfo.lutInputMask & 0x1U) == 0))
|
|
|
|
return false;
|
|
|
|
if (fromPort == id_I1 && ((cell->lcInfo.lutInputMask & 0x2U) == 0))
|
|
|
|
return false;
|
|
|
|
if (fromPort == id_I2 && ((cell->lcInfo.lutInputMask & 0x4U) == 0))
|
|
|
|
return false;
|
|
|
|
if (fromPort == id_I3 && ((cell->lcInfo.lutInputMask & 0x8U) == 0))
|
|
|
|
return false;
|
|
|
|
}
|
2022-08-11 01:58:22 +08:00
|
|
|
} else if (cell->type.in(id_ICESTORM_RAM, id_ICESTORM_SPRAM)) {
|
2019-01-21 19:58:49 +08:00
|
|
|
return false;
|
|
|
|
}
|
2021-02-03 18:21:45 +08:00
|
|
|
return get_cell_delay_internal(cell, fromPort, toPort, delay);
|
2019-01-21 19:58:49 +08:00
|
|
|
}
|
|
|
|
|
2021-02-19 18:39:57 +08:00
|
|
|
bool Arch::get_cell_delay_internal(const CellInfo *cell, IdString fromPort, IdString toPort, DelayQuad &delay) const
|
2018-06-20 17:44:28 +08:00
|
|
|
{
|
2021-01-28 02:34:41 +08:00
|
|
|
for (auto &tc : chip_info->cell_timing) {
|
2018-08-08 23:01:18 +08:00
|
|
|
if (tc.type == cell->type.index) {
|
2021-01-28 02:34:41 +08:00
|
|
|
for (auto &path : tc.path_delays) {
|
2018-08-08 23:01:18 +08:00
|
|
|
if (path.from_port == fromPort.index && path.to_port == toPort.index) {
|
2018-08-02 22:02:43 +08:00
|
|
|
if (fast_part)
|
2021-02-19 18:39:57 +08:00
|
|
|
delay = DelayQuad(path.fast_delay);
|
2018-08-02 22:02:43 +08:00
|
|
|
else
|
2021-02-19 18:39:57 +08:00
|
|
|
delay = DelayQuad(path.slow_delay);
|
2018-08-02 22:02:43 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2018-06-20 19:01:22 +08:00
|
|
|
}
|
|
|
|
}
|
2018-06-20 18:21:56 +08:00
|
|
|
return false;
|
2018-06-20 17:44:28 +08:00
|
|
|
}
|
|
|
|
|
2018-08-08 20:37:59 +08:00
|
|
|
// Get the port class, also setting clockPort to associated clock if applicable
|
2018-11-02 21:35:59 +08:00
|
|
|
TimingPortClass Arch::getPortTimingClass(const CellInfo *cell, IdString port, int &clockInfoCount) const
|
2018-08-08 20:37:59 +08:00
|
|
|
{
|
2018-11-02 21:35:59 +08:00
|
|
|
clockInfoCount = 0;
|
2018-08-09 01:35:13 +08:00
|
|
|
if (cell->type == id_ICESTORM_LC) {
|
|
|
|
if (port == id_CLK)
|
2018-08-08 20:37:59 +08:00
|
|
|
return TMG_CLOCK_INPUT;
|
2018-08-09 01:35:13 +08:00
|
|
|
if (port == id_CIN)
|
2018-08-08 20:37:59 +08:00
|
|
|
return TMG_COMB_INPUT;
|
2022-08-11 01:58:22 +08:00
|
|
|
if (port.in(id_COUT, id_LO))
|
2018-08-08 20:37:59 +08:00
|
|
|
return TMG_COMB_OUTPUT;
|
2018-09-16 06:16:21 +08:00
|
|
|
if (port == id_O) {
|
|
|
|
// LCs with no inputs are constant drivers
|
|
|
|
if (cell->lcInfo.inputCount == 0)
|
|
|
|
return TMG_IGNORE;
|
|
|
|
if (cell->lcInfo.dffEnable) {
|
2018-11-02 21:35:59 +08:00
|
|
|
clockInfoCount = 1;
|
2018-08-08 20:37:59 +08:00
|
|
|
return TMG_REGISTER_OUTPUT;
|
2018-11-02 21:35:59 +08:00
|
|
|
} else
|
2018-08-08 20:37:59 +08:00
|
|
|
return TMG_COMB_OUTPUT;
|
2018-11-02 21:35:59 +08:00
|
|
|
} else {
|
2018-09-16 06:16:21 +08:00
|
|
|
if (cell->lcInfo.dffEnable) {
|
2018-11-02 21:35:59 +08:00
|
|
|
clockInfoCount = 1;
|
2018-09-16 06:16:21 +08:00
|
|
|
return TMG_REGISTER_INPUT;
|
2018-11-02 21:35:59 +08:00
|
|
|
} else
|
2018-08-08 20:37:59 +08:00
|
|
|
return TMG_COMB_INPUT;
|
|
|
|
}
|
2018-08-08 23:17:16 +08:00
|
|
|
} else if (cell->type == id_ICESTORM_RAM) {
|
2018-08-08 21:00:39 +08:00
|
|
|
|
2022-08-11 01:58:22 +08:00
|
|
|
if (port.in(id_RCLK, id_WCLK))
|
2018-08-08 21:00:39 +08:00
|
|
|
return TMG_CLOCK_INPUT;
|
|
|
|
|
2018-11-02 21:35:59 +08:00
|
|
|
clockInfoCount = 1;
|
2018-06-20 17:44:28 +08:00
|
|
|
|
2018-08-08 21:00:39 +08:00
|
|
|
if (cell->ports.at(port).type == PORT_OUT)
|
|
|
|
return TMG_REGISTER_OUTPUT;
|
|
|
|
else
|
|
|
|
return TMG_REGISTER_INPUT;
|
2022-08-11 01:58:22 +08:00
|
|
|
} else if (cell->type.in(id_ICESTORM_DSP, id_ICESTORM_SPRAM)) {
|
|
|
|
if (port.in(id_CLK, id_CLOCK))
|
2018-08-08 20:37:59 +08:00
|
|
|
return TMG_CLOCK_INPUT;
|
2018-11-02 21:35:59 +08:00
|
|
|
else {
|
|
|
|
clockInfoCount = 1;
|
|
|
|
if (cell->ports.at(port).type == PORT_OUT)
|
|
|
|
return TMG_REGISTER_OUTPUT;
|
|
|
|
else
|
|
|
|
return TMG_REGISTER_INPUT;
|
|
|
|
}
|
2018-08-09 01:35:13 +08:00
|
|
|
} else if (cell->type == id_SB_IO) {
|
2022-08-11 01:58:22 +08:00
|
|
|
if (port.in(id_INPUT_CLK, id_OUTPUT_CLK))
|
2019-01-08 01:18:40 +08:00
|
|
|
return TMG_CLOCK_INPUT;
|
|
|
|
if (port == id_CLOCK_ENABLE) {
|
|
|
|
clockInfoCount = 2;
|
|
|
|
return TMG_REGISTER_INPUT;
|
|
|
|
}
|
|
|
|
if ((port == id_D_IN_0 && !(cell->ioInfo.pintype & 0x1)) || port == id_D_IN_1) {
|
|
|
|
clockInfoCount = 1;
|
|
|
|
return TMG_REGISTER_OUTPUT;
|
|
|
|
} else if (port == id_D_IN_0) {
|
2018-08-08 20:37:59 +08:00
|
|
|
return TMG_STARTPOINT;
|
2019-01-08 01:18:40 +08:00
|
|
|
}
|
2022-08-11 01:58:22 +08:00
|
|
|
if (port.in(id_D_OUT_0, id_D_OUT_1)) {
|
2019-01-08 01:18:40 +08:00
|
|
|
if ((cell->ioInfo.pintype & 0xC) == 0x8) {
|
|
|
|
return TMG_ENDPOINT;
|
|
|
|
} else {
|
|
|
|
clockInfoCount = 1;
|
|
|
|
return TMG_REGISTER_INPUT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (port == id_OUTPUT_ENABLE) {
|
2020-03-29 16:27:42 +08:00
|
|
|
if ((cell->ioInfo.pintype & 0x30) == 0x30) {
|
2019-01-08 01:18:40 +08:00
|
|
|
return TMG_REGISTER_INPUT;
|
|
|
|
} else {
|
|
|
|
return TMG_ENDPOINT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-08 20:37:59 +08:00
|
|
|
return TMG_IGNORE;
|
2018-08-09 01:35:13 +08:00
|
|
|
} else if (cell->type == id_ICESTORM_PLL) {
|
2022-08-11 01:58:22 +08:00
|
|
|
if (port.in(id_PLLOUT_A, id_PLLOUT_B, id_PLLOUT_A_GLOBAL, id_PLLOUT_B_GLOBAL))
|
2018-08-08 20:37:59 +08:00
|
|
|
return TMG_GEN_CLOCK;
|
|
|
|
return TMG_IGNORE;
|
2018-08-09 01:35:13 +08:00
|
|
|
} else if (cell->type == id_ICESTORM_LFOSC) {
|
|
|
|
if (port == id_CLKLF)
|
2018-08-08 20:37:59 +08:00
|
|
|
return TMG_GEN_CLOCK;
|
|
|
|
return TMG_IGNORE;
|
2018-08-09 01:35:13 +08:00
|
|
|
} else if (cell->type == id_ICESTORM_HFOSC) {
|
|
|
|
if (port == id_CLKHF)
|
2018-08-08 20:37:59 +08:00
|
|
|
return TMG_GEN_CLOCK;
|
|
|
|
return TMG_IGNORE;
|
2018-08-09 01:35:13 +08:00
|
|
|
} else if (cell->type == id_SB_GB) {
|
|
|
|
if (port == id_GLOBAL_BUFFER_OUTPUT)
|
2019-02-20 17:43:12 +08:00
|
|
|
return cell->gbInfo.forPadIn ? TMG_GEN_CLOCK : TMG_COMB_OUTPUT;
|
2018-08-08 22:34:41 +08:00
|
|
|
return TMG_COMB_INPUT;
|
2018-08-09 01:35:13 +08:00
|
|
|
} else if (cell->type == id_SB_WARMBOOT) {
|
2018-08-09 00:07:34 +08:00
|
|
|
return TMG_ENDPOINT;
|
2019-06-10 17:30:01 +08:00
|
|
|
} else if (cell->type == id_SB_LED_DRV_CUR) {
|
|
|
|
if (port == id_LEDPU)
|
|
|
|
return TMG_IGNORE;
|
|
|
|
return TMG_ENDPOINT;
|
|
|
|
} else if (cell->type == id_SB_RGB_DRV) {
|
2022-08-11 01:58:22 +08:00
|
|
|
if (port.in(id_RGB0, id_RGB1, id_RGB2, id_RGBPU))
|
2019-06-10 17:30:01 +08:00
|
|
|
return TMG_IGNORE;
|
|
|
|
return TMG_ENDPOINT;
|
2018-11-18 01:02:31 +08:00
|
|
|
} else if (cell->type == id_SB_RGBA_DRV) {
|
2022-08-11 01:58:22 +08:00
|
|
|
if (port.in(id_RGB0, id_RGB1, id_RGB2))
|
2018-11-18 01:02:31 +08:00
|
|
|
return TMG_IGNORE;
|
|
|
|
return TMG_ENDPOINT;
|
2018-12-02 09:27:04 +08:00
|
|
|
} else if (cell->type == id_SB_LEDDA_IP) {
|
2022-08-11 01:58:22 +08:00
|
|
|
if (port.in(id_CLK, id_CLOCK))
|
2018-12-02 09:27:04 +08:00
|
|
|
return TMG_CLOCK_INPUT;
|
|
|
|
return TMG_IGNORE;
|
2022-08-11 01:58:22 +08:00
|
|
|
} else if (cell->type.in(id_SB_I2C, id_SB_SPI)) {
|
2022-02-17 01:09:54 +08:00
|
|
|
if (port == id_SBCLKI)
|
2019-03-23 06:29:34 +08:00
|
|
|
return TMG_CLOCK_INPUT;
|
|
|
|
|
|
|
|
clockInfoCount = 1;
|
|
|
|
|
|
|
|
if (cell->ports.at(port).type == PORT_OUT)
|
|
|
|
return TMG_REGISTER_OUTPUT;
|
|
|
|
else
|
|
|
|
return TMG_REGISTER_INPUT;
|
2018-06-20 19:01:22 +08:00
|
|
|
}
|
2018-11-30 03:26:23 +08:00
|
|
|
log_error("cell type '%s' is unsupported (instantiated as '%s')\n", cell->type.c_str(this), cell->name.c_str(this));
|
2018-06-20 17:44:28 +08:00
|
|
|
}
|
|
|
|
|
2018-11-02 21:35:59 +08:00
|
|
|
TimingClockingInfo Arch::getPortClockingInfo(const CellInfo *cell, IdString port, int index) const
|
|
|
|
{
|
|
|
|
TimingClockingInfo info;
|
|
|
|
if (cell->type == id_ICESTORM_LC) {
|
|
|
|
info.clock_port = id_CLK;
|
2018-11-03 00:56:53 +08:00
|
|
|
info.edge = cell->lcInfo.negClk ? FALLING_EDGE : RISING_EDGE;
|
2018-11-02 21:35:59 +08:00
|
|
|
if (port == id_O) {
|
2021-02-03 18:21:45 +08:00
|
|
|
bool has_clktoq = get_cell_delay_internal(cell, id_CLK, id_O, info.clockToQ);
|
2018-11-02 21:35:59 +08:00
|
|
|
NPNR_ASSERT(has_clktoq);
|
|
|
|
} else {
|
2022-08-11 01:58:22 +08:00
|
|
|
if (port.in(id_I0, id_I1, id_I2, id_I3)) {
|
2021-02-19 18:39:57 +08:00
|
|
|
DelayQuad dlut;
|
2021-02-03 18:21:45 +08:00
|
|
|
bool has_ld = get_cell_delay_internal(cell, port, id_O, dlut);
|
2019-01-21 19:58:49 +08:00
|
|
|
NPNR_ASSERT(has_ld);
|
2020-07-08 22:45:27 +08:00
|
|
|
if (args.type == ArchArgs::LP1K || args.type == ArchArgs::LP4K || args.type == ArchArgs::LP8K ||
|
|
|
|
args.type == ArchArgs::LP384) {
|
2021-02-19 18:39:57 +08:00
|
|
|
info.setup = DelayPair(30 + dlut.maxDelay());
|
2020-07-08 22:45:27 +08:00
|
|
|
} else if (args.type == ArchArgs::UP3K || args.type == ArchArgs::UP5K || args.type == ArchArgs::U4K ||
|
|
|
|
args.type == ArchArgs::U1K || args.type == ArchArgs::U2K) { // XXX verify u4k
|
2021-02-19 18:39:57 +08:00
|
|
|
info.setup = DelayPair(dlut.maxDelay() - 50);
|
2019-01-21 19:58:49 +08:00
|
|
|
} else {
|
2021-02-19 18:39:57 +08:00
|
|
|
info.setup = DelayPair(20 + dlut.maxDelay());
|
2019-01-21 19:58:49 +08:00
|
|
|
}
|
|
|
|
} else {
|
2021-02-19 18:39:57 +08:00
|
|
|
info.setup = DelayPair(100);
|
2019-01-21 19:58:49 +08:00
|
|
|
}
|
2021-02-19 18:39:57 +08:00
|
|
|
info.hold = DelayPair(0);
|
2018-11-02 21:35:59 +08:00
|
|
|
}
|
|
|
|
} else if (cell->type == id_ICESTORM_RAM) {
|
|
|
|
if (port.str(this)[0] == 'R') {
|
|
|
|
info.clock_port = id_RCLK;
|
2022-02-17 01:09:54 +08:00
|
|
|
info.edge = bool_or_default(cell->params, id_NEG_CLK_R) ? FALLING_EDGE : RISING_EDGE;
|
2018-11-02 21:35:59 +08:00
|
|
|
} else {
|
|
|
|
info.clock_port = id_WCLK;
|
2022-02-17 01:09:54 +08:00
|
|
|
info.edge = bool_or_default(cell->params, id_NEG_CLK_W) ? FALLING_EDGE : RISING_EDGE;
|
2018-11-02 21:35:59 +08:00
|
|
|
}
|
|
|
|
if (cell->ports.at(port).type == PORT_OUT) {
|
2021-02-03 18:21:45 +08:00
|
|
|
bool has_clktoq = get_cell_delay_internal(cell, info.clock_port, port, info.clockToQ);
|
2018-11-02 21:35:59 +08:00
|
|
|
NPNR_ASSERT(has_clktoq);
|
|
|
|
} else {
|
2021-02-19 18:39:57 +08:00
|
|
|
info.setup = DelayPair(100);
|
|
|
|
info.hold = DelayPair(0);
|
2018-11-02 21:35:59 +08:00
|
|
|
}
|
2019-01-08 01:18:40 +08:00
|
|
|
} else if (cell->type == id_SB_IO) {
|
|
|
|
delay_t io_setup = 80, io_clktoq = 140;
|
|
|
|
if (args.type == ArchArgs::LP1K || args.type == ArchArgs::LP8K || args.type == ArchArgs::LP384) {
|
|
|
|
io_setup = 115;
|
|
|
|
io_clktoq = 210;
|
2020-07-08 22:45:27 +08:00
|
|
|
} else if (args.type == ArchArgs::UP3K || args.type == ArchArgs::UP5K || args.type == ArchArgs::U4K ||
|
|
|
|
args.type == ArchArgs::U1K || args.type == ArchArgs::U2K) {
|
2019-01-08 01:18:40 +08:00
|
|
|
io_setup = 205;
|
|
|
|
io_clktoq = 1005;
|
|
|
|
}
|
|
|
|
if (port == id_CLOCK_ENABLE) {
|
|
|
|
info.clock_port = (index == 1) ? id_OUTPUT_CLK : id_INPUT_CLK;
|
|
|
|
info.edge = cell->ioInfo.negtrig ? FALLING_EDGE : RISING_EDGE;
|
2021-02-19 18:39:57 +08:00
|
|
|
info.setup = DelayPair(io_setup);
|
|
|
|
info.hold = DelayPair(0);
|
2022-08-11 01:58:22 +08:00
|
|
|
} else if (port.in(id_D_OUT_0, id_OUTPUT_ENABLE)) {
|
2019-01-08 01:18:40 +08:00
|
|
|
info.clock_port = id_OUTPUT_CLK;
|
|
|
|
info.edge = cell->ioInfo.negtrig ? FALLING_EDGE : RISING_EDGE;
|
2021-02-19 18:39:57 +08:00
|
|
|
info.setup = DelayPair(io_setup);
|
|
|
|
info.hold = DelayPair(0);
|
2019-01-08 01:18:40 +08:00
|
|
|
} else if (port == id_D_OUT_1) {
|
|
|
|
info.clock_port = id_OUTPUT_CLK;
|
|
|
|
info.edge = cell->ioInfo.negtrig ? RISING_EDGE : FALLING_EDGE;
|
2021-02-19 18:39:57 +08:00
|
|
|
info.setup = DelayPair(io_setup);
|
|
|
|
info.hold = DelayPair(0);
|
2019-01-08 01:18:40 +08:00
|
|
|
} else if (port == id_D_IN_0) {
|
|
|
|
info.clock_port = id_INPUT_CLK;
|
|
|
|
info.edge = cell->ioInfo.negtrig ? FALLING_EDGE : RISING_EDGE;
|
2021-02-19 18:39:57 +08:00
|
|
|
info.clockToQ = DelayQuad(io_clktoq);
|
2019-01-08 01:18:40 +08:00
|
|
|
} else if (port == id_D_IN_1) {
|
|
|
|
info.clock_port = id_INPUT_CLK;
|
|
|
|
info.edge = cell->ioInfo.negtrig ? RISING_EDGE : FALLING_EDGE;
|
2021-02-19 18:39:57 +08:00
|
|
|
info.clockToQ = DelayQuad(io_clktoq);
|
2019-01-08 01:18:40 +08:00
|
|
|
} else {
|
|
|
|
NPNR_ASSERT_FALSE("no clock data for IO cell port");
|
|
|
|
}
|
2022-08-11 01:58:22 +08:00
|
|
|
} else if (cell->type.in(id_ICESTORM_DSP, id_ICESTORM_SPRAM)) {
|
2018-11-03 22:09:27 +08:00
|
|
|
info.clock_port = cell->type == id_ICESTORM_SPRAM ? id_CLOCK : id_CLK;
|
2018-11-03 00:56:53 +08:00
|
|
|
info.edge = RISING_EDGE;
|
2018-11-02 21:35:59 +08:00
|
|
|
if (cell->ports.at(port).type == PORT_OUT) {
|
2021-02-03 18:21:45 +08:00
|
|
|
bool has_clktoq = get_cell_delay_internal(cell, info.clock_port, port, info.clockToQ);
|
2018-11-02 21:35:59 +08:00
|
|
|
if (!has_clktoq)
|
2021-02-19 18:39:57 +08:00
|
|
|
info.clockToQ = DelayQuad(100);
|
2018-11-02 21:35:59 +08:00
|
|
|
} else {
|
2021-02-19 18:39:57 +08:00
|
|
|
info.setup = DelayPair(100);
|
|
|
|
info.hold = DelayPair(0);
|
2018-11-02 21:35:59 +08:00
|
|
|
}
|
2022-08-11 01:58:22 +08:00
|
|
|
} else if (cell->type.in(id_SB_I2C, id_SB_SPI)) {
|
2022-02-17 01:09:54 +08:00
|
|
|
info.clock_port = id_SBCLKI;
|
2019-03-23 06:29:34 +08:00
|
|
|
info.edge = RISING_EDGE;
|
|
|
|
if (cell->ports.at(port).type == PORT_OUT) {
|
|
|
|
/* Dummy number */
|
2021-02-19 18:39:57 +08:00
|
|
|
info.clockToQ = DelayQuad(1500);
|
2019-03-23 06:29:34 +08:00
|
|
|
} else {
|
|
|
|
/* Dummy number */
|
2021-02-19 18:39:57 +08:00
|
|
|
info.setup = DelayPair(1500);
|
|
|
|
info.hold = DelayPair(0);
|
2019-03-23 06:29:34 +08:00
|
|
|
}
|
2018-11-02 21:35:59 +08:00
|
|
|
} else {
|
|
|
|
NPNR_ASSERT_FALSE("unhandled cell type in getPortClockingInfo");
|
|
|
|
}
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
2021-02-03 18:21:45 +08:00
|
|
|
bool Arch::is_global_net(const NetInfo *net) const
|
2018-06-23 18:09:01 +08:00
|
|
|
{
|
|
|
|
if (net == nullptr)
|
|
|
|
return false;
|
2018-08-08 23:17:16 +08:00
|
|
|
return net->driver.cell != nullptr && net->driver.port == id_GLOBAL_BUFFER_OUTPUT;
|
2018-06-23 18:09:01 +08:00
|
|
|
}
|
|
|
|
|
2018-07-18 18:21:02 +08:00
|
|
|
// Assign arch arg info
|
2018-07-18 20:34:32 +08:00
|
|
|
void Arch::assignArchInfo()
|
2018-07-18 18:21:02 +08:00
|
|
|
{
|
|
|
|
for (auto &net : getCtx()->nets) {
|
|
|
|
NetInfo *ni = net.second.get();
|
2021-02-03 18:21:45 +08:00
|
|
|
if (is_global_net(ni))
|
2018-07-18 18:21:02 +08:00
|
|
|
ni->is_global = true;
|
2018-07-20 17:36:32 +08:00
|
|
|
ni->is_enable = false;
|
|
|
|
ni->is_reset = false;
|
|
|
|
for (auto usr : ni->users) {
|
|
|
|
if (is_enable_port(this, usr))
|
|
|
|
ni->is_enable = true;
|
|
|
|
if (is_reset_port(this, usr))
|
|
|
|
ni->is_reset = true;
|
|
|
|
}
|
2018-07-18 18:21:02 +08:00
|
|
|
}
|
|
|
|
for (auto &cell : getCtx()->cells) {
|
|
|
|
CellInfo *ci = cell.second.get();
|
2018-07-18 20:34:32 +08:00
|
|
|
assignCellInfo(ci);
|
2018-07-18 18:51:07 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-18 20:34:32 +08:00
|
|
|
void Arch::assignCellInfo(CellInfo *cell)
|
2018-07-18 18:51:07 +08:00
|
|
|
{
|
2018-08-08 23:01:18 +08:00
|
|
|
if (cell->type == id_ICESTORM_LC) {
|
2018-08-08 23:17:16 +08:00
|
|
|
cell->lcInfo.dffEnable = bool_or_default(cell->params, id_DFF_ENABLE);
|
|
|
|
cell->lcInfo.carryEnable = bool_or_default(cell->params, id_CARRY_ENABLE);
|
|
|
|
cell->lcInfo.negClk = bool_or_default(cell->params, id_NEG_CLK);
|
2022-02-18 18:52:37 +08:00
|
|
|
cell->lcInfo.clk = cell->getPort(id_CLK);
|
|
|
|
cell->lcInfo.cen = cell->getPort(id_CEN);
|
|
|
|
cell->lcInfo.sr = cell->getPort(id_SR);
|
2018-07-18 18:51:07 +08:00
|
|
|
cell->lcInfo.inputCount = 0;
|
2022-02-18 18:52:37 +08:00
|
|
|
if (cell->getPort(id_I0))
|
2018-07-18 18:51:07 +08:00
|
|
|
cell->lcInfo.inputCount++;
|
2022-02-18 18:52:37 +08:00
|
|
|
if (cell->getPort(id_I1))
|
2018-07-18 18:51:07 +08:00
|
|
|
cell->lcInfo.inputCount++;
|
2022-02-18 18:52:37 +08:00
|
|
|
if (cell->getPort(id_I2))
|
2018-07-18 18:51:07 +08:00
|
|
|
cell->lcInfo.inputCount++;
|
2022-02-18 18:52:37 +08:00
|
|
|
if (cell->getPort(id_I3))
|
2018-07-18 18:51:07 +08:00
|
|
|
cell->lcInfo.inputCount++;
|
2022-03-28 21:06:09 +08:00
|
|
|
// Find don't care LUT inputs to mask for timing analysis
|
|
|
|
cell->lcInfo.lutInputMask = 0x0;
|
|
|
|
unsigned init = int_or_default(cell->params, id_LUT_INIT);
|
|
|
|
for (unsigned k = 0; k < 4; k++) {
|
|
|
|
for (unsigned i = 0; i < 16; i++) {
|
|
|
|
// If toggling the LUT input makes a difference it's not a don't care
|
|
|
|
if (((init >> i) & 0x1U) != ((init >> (i ^ (1U << k))) & 0x1U)) {
|
|
|
|
cell->lcInfo.lutInputMask |= (1U << k);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-09-24 22:14:28 +08:00
|
|
|
} else if (cell->type == id_SB_IO) {
|
|
|
|
cell->ioInfo.lvds = str_or_default(cell->params, id_IO_STANDARD, "SB_LVCMOS") == "SB_LVDS_INPUT";
|
2022-02-17 01:09:54 +08:00
|
|
|
cell->ioInfo.global = bool_or_default(cell->attrs, id_GLOBAL);
|
|
|
|
cell->ioInfo.pintype = int_or_default(cell->params, id_PIN_TYPE);
|
|
|
|
cell->ioInfo.negtrig = bool_or_default(cell->params, id_NEG_TRIGGER);
|
2019-01-08 01:18:40 +08:00
|
|
|
|
2018-11-19 08:57:47 +08:00
|
|
|
} else if (cell->type == id_SB_GB) {
|
2022-02-17 01:09:54 +08:00
|
|
|
cell->gbInfo.forPadIn = bool_or_default(cell->attrs, id_FOR_PAD_IN);
|
2018-07-18 18:21:02 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-07 17:00:53 +08:00
|
|
|
BoundingBox Arch::getRouteBoundingBox(WireId src, WireId dst) const
|
2020-02-03 20:00:05 +08:00
|
|
|
{
|
2022-12-07 17:00:53 +08:00
|
|
|
BoundingBox bb;
|
2020-02-03 20:00:05 +08:00
|
|
|
|
|
|
|
int src_x = chip_info->wire_data[src.index].x;
|
|
|
|
int src_y = chip_info->wire_data[src.index].y;
|
|
|
|
int dst_x = chip_info->wire_data[dst.index].x;
|
|
|
|
int dst_y = chip_info->wire_data[dst.index].y;
|
|
|
|
|
|
|
|
bb.x0 = src_x;
|
|
|
|
bb.y0 = src_y;
|
|
|
|
bb.x1 = src_x;
|
|
|
|
bb.y1 = src_y;
|
|
|
|
|
|
|
|
auto extend = [&](int x, int y) {
|
|
|
|
bb.x0 = std::min(bb.x0, x);
|
|
|
|
bb.x1 = std::max(bb.x1, x);
|
|
|
|
bb.y0 = std::min(bb.y0, y);
|
|
|
|
bb.y1 = std::max(bb.y1, y);
|
|
|
|
};
|
|
|
|
extend(dst_x, dst_y);
|
|
|
|
return bb;
|
|
|
|
}
|
|
|
|
|
2019-11-26 18:03:28 +08:00
|
|
|
const std::string Arch::defaultPlacer = "heap";
|
2023-03-17 16:27:36 +08:00
|
|
|
|
2023-10-29 14:54:53 +08:00
|
|
|
const std::vector<std::string> Arch::availablePlacers = {"sa", "heap", "static"};
|
2019-03-24 19:10:20 +08:00
|
|
|
|
2020-02-03 19:54:38 +08:00
|
|
|
const std::string Arch::defaultRouter = "router1";
|
|
|
|
const std::vector<std::string> Arch::availableRouters = {"router1", "router2"};
|
|
|
|
|
2018-06-12 20:24:59 +08:00
|
|
|
NEXTPNR_NAMESPACE_END
|