2018-05-26 20:27:21 +08:00
|
|
|
/*
|
|
|
|
* nextpnr -- Next Generation Place and Route
|
|
|
|
*
|
|
|
|
* Copyright (C) 2018 Clifford Wolf <clifford@clifford.at>
|
|
|
|
*
|
|
|
|
* 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-06-10 00:19:20 +08:00
|
|
|
#include "log.h"
|
2018-06-12 02:12:57 +08:00
|
|
|
#include "nextpnr.h"
|
2018-05-26 20:27:21 +08:00
|
|
|
|
2018-06-12 20:24:59 +08:00
|
|
|
NEXTPNR_NAMESPACE_BEGIN
|
|
|
|
|
2018-05-26 22:08:20 +08:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2018-06-18 22:08:19 +08:00
|
|
|
IdString Arch::belTypeToId(BelType type) const
|
2018-05-26 22:08:20 +08:00
|
|
|
{
|
2018-06-07 18:56:49 +08:00
|
|
|
if (type == TYPE_ICESTORM_LC)
|
2018-06-18 22:08:19 +08:00
|
|
|
return id("ICESTORM_LC");
|
2018-06-07 18:56:49 +08:00
|
|
|
if (type == TYPE_ICESTORM_RAM)
|
2018-06-18 22:08:19 +08:00
|
|
|
return id("ICESTORM_RAM");
|
2018-06-07 18:56:49 +08:00
|
|
|
if (type == TYPE_SB_IO)
|
2018-06-18 22:08:19 +08:00
|
|
|
return id("SB_IO");
|
2018-06-10 22:31:06 +08:00
|
|
|
if (type == TYPE_SB_GB)
|
2018-06-18 22:08:19 +08:00
|
|
|
return id("SB_GB");
|
2018-06-07 18:56:49 +08:00
|
|
|
return IdString();
|
2018-05-26 22:08:20 +08:00
|
|
|
}
|
|
|
|
|
2018-06-18 22:08:19 +08:00
|
|
|
BelType Arch::belTypeFromId(IdString type) const
|
2018-05-26 22:08:20 +08:00
|
|
|
{
|
2018-06-18 22:08:19 +08:00
|
|
|
if (type == id("ICESTORM_LC"))
|
2018-06-07 18:56:49 +08:00
|
|
|
return TYPE_ICESTORM_LC;
|
2018-06-18 22:08:19 +08:00
|
|
|
if (type == id("ICESTORM_RAM"))
|
2018-06-07 18:56:49 +08:00
|
|
|
return TYPE_ICESTORM_RAM;
|
2018-06-18 22:08:19 +08:00
|
|
|
if (type == id("SB_IO"))
|
2018-06-07 18:56:49 +08:00
|
|
|
return TYPE_SB_IO;
|
2018-06-18 22:08:19 +08:00
|
|
|
if (type == id("SB_GB"))
|
2018-06-10 22:31:06 +08:00
|
|
|
return TYPE_SB_GB;
|
2018-06-10 00:41:38 +08:00
|
|
|
return TYPE_NONE;
|
2018-05-26 22:08:20 +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-06-18 20:53:01 +08:00
|
|
|
#define X(t) initialize_add(ctx, #t, PIN_##t);
|
2018-06-07 20:36:35 +08:00
|
|
|
#include "portpins.inc"
|
2018-06-03 22:16:59 +08:00
|
|
|
#undef X
|
2018-05-26 22:08:20 +08:00
|
|
|
}
|
|
|
|
|
2018-06-18 22:08:19 +08:00
|
|
|
IdString Arch::portPinToId(PortPin type) const
|
2018-05-26 22:08:20 +08:00
|
|
|
{
|
2018-06-12 21:50:33 +08:00
|
|
|
IdString ret;
|
|
|
|
if (type > 0 && type < PIN_MAXIDX)
|
|
|
|
ret.index = type;
|
|
|
|
return ret;
|
|
|
|
}
|
2018-06-03 22:16:59 +08:00
|
|
|
|
2018-06-18 22:08:19 +08:00
|
|
|
PortPin Arch::portPinFromId(IdString type) const
|
2018-06-12 21:50:33 +08:00
|
|
|
{
|
2018-06-18 22:08:19 +08:00
|
|
|
if (type.index > 0 && type.index < PIN_MAXIDX)
|
|
|
|
return PortPin(type.index);
|
2018-06-10 00:41:38 +08:00
|
|
|
return PIN_NONE;
|
2018-05-26 22:08:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
Arch::Arch(ArchArgs args) : args(args)
|
2018-05-26 20:27:21 +08:00
|
|
|
{
|
2018-06-07 18:26:02 +08:00
|
|
|
#ifdef ICE40_HX1K_ONLY
|
2018-06-18 19:35:25 +08:00
|
|
|
if (args.type == ArchArgs::HX1K) {
|
2018-06-17 22:14:27 +08:00
|
|
|
chip_info =
|
2018-06-18 01:28:03 +08:00
|
|
|
reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_1k)
|
|
|
|
->get();
|
2018-06-10 00:19:20 +08:00
|
|
|
} else {
|
|
|
|
log_error("Unsupported iCE40 chip type.\n");
|
2018-06-07 18:56:49 +08:00
|
|
|
}
|
2018-06-07 18:26:02 +08:00
|
|
|
#else
|
2018-06-18 19:35:25 +08:00
|
|
|
if (args.type == ArchArgs::LP384) {
|
2018-06-17 22:14:27 +08:00
|
|
|
chip_info =
|
2018-06-18 01:28:03 +08:00
|
|
|
reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_384)
|
|
|
|
->get();
|
2018-06-18 19:35:25 +08:00
|
|
|
} else if (args.type == ArchArgs::LP1K || args.type == ArchArgs::HX1K) {
|
2018-06-17 22:14:27 +08:00
|
|
|
chip_info =
|
2018-06-18 01:28:03 +08:00
|
|
|
reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_1k)
|
|
|
|
->get();
|
2018-06-18 19:35:25 +08:00
|
|
|
} else if (args.type == ArchArgs::UP5K) {
|
2018-06-17 22:14:27 +08:00
|
|
|
chip_info =
|
2018-06-18 01:28:03 +08:00
|
|
|
reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_5k)
|
|
|
|
->get();
|
2018-06-18 19:35:25 +08:00
|
|
|
} else if (args.type == ArchArgs::LP8K || args.type == ArchArgs::HX8K) {
|
2018-06-17 22:14:27 +08:00
|
|
|
chip_info =
|
2018-06-18 01:28:03 +08:00
|
|
|
reinterpret_cast<const RelPtr<ChipInfoPOD> *>(chipdb_blob_8k)
|
|
|
|
->get();
|
2018-06-07 18:56:49 +08:00
|
|
|
} else {
|
2018-06-10 00:19:20 +08:00
|
|
|
log_error("Unsupported iCE40 chip type.\n");
|
2018-06-07 18:56:49 +08:00
|
|
|
}
|
2018-06-07 18:26:02 +08:00
|
|
|
#endif
|
2018-05-26 20:56:30 +08:00
|
|
|
|
2018-06-13 17:51:09 +08:00
|
|
|
package_info = nullptr;
|
2018-06-17 22:12:52 +08:00
|
|
|
for (int i = 0; i < chip_info->num_packages; i++) {
|
|
|
|
if (chip_info->packages_data[i].name.get() == args.package) {
|
|
|
|
package_info = &(chip_info->packages_data[i]);
|
2018-06-13 17:51:09 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (package_info == nullptr)
|
|
|
|
log_error("Unsupported package '%s'.\n", args.package.c_str());
|
|
|
|
|
2018-06-17 22:12:52 +08:00
|
|
|
bel_to_cell.resize(chip_info->num_bels);
|
|
|
|
wire_to_net.resize(chip_info->num_wires);
|
|
|
|
pip_to_net.resize(chip_info->num_pips);
|
|
|
|
switches_locked.resize(chip_info->num_switches);
|
2018-05-26 20:27:21 +08:00
|
|
|
}
|
|
|
|
|
2018-06-06 21:13:41 +08:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
std::string Arch::getChipName()
|
2018-06-11 00:25:23 +08:00
|
|
|
{
|
|
|
|
#ifdef ICE40_HX1K_ONLY
|
2018-06-18 19:35:25 +08:00
|
|
|
if (args.type == ArchArgs::HX1K) {
|
2018-06-11 00:25:23 +08:00
|
|
|
return "Lattice LP1K";
|
|
|
|
} else {
|
|
|
|
log_error("Unsupported iCE40 chip type.\n");
|
|
|
|
}
|
|
|
|
#else
|
2018-06-18 19:35:25 +08:00
|
|
|
if (args.type == ArchArgs::LP384) {
|
2018-06-11 00:25:23 +08:00
|
|
|
return "Lattice LP384";
|
2018-06-18 19:35:25 +08:00
|
|
|
} else if (args.type == ArchArgs::LP1K) {
|
2018-06-11 00:25:23 +08:00
|
|
|
return "Lattice LP1K";
|
2018-06-18 19:35:25 +08:00
|
|
|
} else if (args.type == ArchArgs::HX1K) {
|
2018-06-11 00:25:23 +08:00
|
|
|
return "Lattice HX1K";
|
2018-06-18 19:35:25 +08:00
|
|
|
} else if (args.type == ArchArgs::UP5K) {
|
2018-06-11 00:25:23 +08:00
|
|
|
return "Lattice UP5K";
|
2018-06-18 19:35:25 +08:00
|
|
|
} else if (args.type == ArchArgs::LP8K) {
|
2018-06-11 00:25:23 +08:00
|
|
|
return "Lattice LP8K";
|
2018-06-18 19:35:25 +08:00
|
|
|
} else if (args.type == ArchArgs::HX8K) {
|
2018-06-11 00:25:23 +08:00
|
|
|
return "Lattice HX8K";
|
|
|
|
} else {
|
|
|
|
log_error("Unknown chip\n");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
BelId Arch::getBelByName(IdString name) const
|
2018-05-26 20:27:21 +08:00
|
|
|
{
|
2018-06-07 18:56:49 +08:00
|
|
|
BelId ret;
|
2018-05-26 22:08:20 +08:00
|
|
|
|
2018-06-07 18:56:49 +08:00
|
|
|
if (bel_by_name.empty()) {
|
2018-06-17 22:12:52 +08:00
|
|
|
for (int i = 0; i < chip_info->num_bels; i++)
|
2018-06-18 22:08:19 +08:00
|
|
|
bel_by_name[id(chip_info->bel_data[i].name.get())] = i;
|
2018-06-07 18:56:49 +08:00
|
|
|
}
|
2018-05-26 22:08:20 +08:00
|
|
|
|
2018-06-07 18:56:49 +08:00
|
|
|
auto it = bel_by_name.find(name);
|
|
|
|
if (it != bel_by_name.end())
|
|
|
|
ret.index = it->second;
|
2018-05-26 22:08:20 +08:00
|
|
|
|
2018-06-07 18:56:49 +08:00
|
|
|
return ret;
|
2018-05-26 22:08:20 +08:00
|
|
|
}
|
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
BelRange Arch::getBelsAtSameTile(BelId bel) const
|
2018-06-12 19:40:22 +08:00
|
|
|
{
|
|
|
|
BelRange br;
|
|
|
|
assert(bel != BelId());
|
|
|
|
// This requires Bels at the same tile are consecutive
|
2018-06-17 22:12:52 +08:00
|
|
|
int x = chip_info->bel_data[bel.index].x;
|
|
|
|
int y = chip_info->bel_data[bel.index].y;
|
2018-06-12 19:40:22 +08:00
|
|
|
int start = bel.index, end = bel.index;
|
2018-06-17 22:12:52 +08:00
|
|
|
while (start >= 0 && chip_info->bel_data[start].x == x &&
|
|
|
|
chip_info->bel_data[start].y == y)
|
2018-06-12 19:40:22 +08:00
|
|
|
start--;
|
|
|
|
start++;
|
|
|
|
br.b.cursor = start;
|
2018-06-17 22:12:52 +08:00
|
|
|
while (end < chip_info->num_bels && chip_info->bel_data[end].x == x &&
|
|
|
|
chip_info->bel_data[end].y == y)
|
2018-06-12 19:40:22 +08:00
|
|
|
end++;
|
|
|
|
br.e.cursor = end;
|
|
|
|
return br;
|
|
|
|
}
|
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
WireId Arch::getWireBelPin(BelId bel, PortPin pin) const
|
2018-06-06 21:13:41 +08:00
|
|
|
{
|
2018-06-10 00:19:20 +08:00
|
|
|
WireId ret;
|
|
|
|
|
2018-06-10 00:41:38 +08:00
|
|
|
assert(bel != BelId());
|
2018-06-10 00:19:20 +08:00
|
|
|
|
2018-06-17 22:12:52 +08:00
|
|
|
int num_bel_wires = chip_info->bel_data[bel.index].num_bel_wires;
|
2018-06-17 22:14:27 +08:00
|
|
|
const BelWirePOD *bel_wires =
|
|
|
|
chip_info->bel_data[bel.index].bel_wires.get();
|
2018-06-10 00:19:20 +08:00
|
|
|
|
|
|
|
for (int i = 0; i < num_bel_wires; i++)
|
|
|
|
if (bel_wires[i].port == pin) {
|
|
|
|
ret.index = bel_wires[i].wire_index;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2018-06-06 21:13:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
WireId Arch::getWireByName(IdString name) const
|
2018-05-26 22:08:20 +08:00
|
|
|
{
|
2018-06-07 18:56:49 +08:00
|
|
|
WireId ret;
|
2018-05-26 22:08:20 +08:00
|
|
|
|
2018-06-07 18:56:49 +08:00
|
|
|
if (wire_by_name.empty()) {
|
2018-06-17 22:12:52 +08:00
|
|
|
for (int i = 0; i < chip_info->num_wires; i++)
|
2018-06-18 22:08:19 +08:00
|
|
|
wire_by_name[id(chip_info->wire_data[i].name.get())] = i;
|
2018-06-07 18:56:49 +08:00
|
|
|
}
|
2018-05-26 22:08:20 +08:00
|
|
|
|
2018-06-07 18:56:49 +08:00
|
|
|
auto it = wire_by_name.find(name);
|
|
|
|
if (it != wire_by_name.end())
|
|
|
|
ret.index = it->second;
|
2018-05-26 22:08:20 +08:00
|
|
|
|
2018-06-07 18:56:49 +08:00
|
|
|
return ret;
|
2018-05-26 20:27:21 +08:00
|
|
|
}
|
|
|
|
|
2018-06-06 21:13:41 +08:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
PipId Arch::getPipByName(IdString name) const
|
2018-06-06 21:13:41 +08:00
|
|
|
{
|
2018-06-07 18:56:49 +08:00
|
|
|
PipId ret;
|
2018-06-06 21:13:41 +08:00
|
|
|
|
2018-06-07 18:56:49 +08:00
|
|
|
if (pip_by_name.empty()) {
|
2018-06-17 22:12:52 +08:00
|
|
|
for (int i = 0; i < chip_info->num_pips; i++) {
|
2018-06-07 18:56:49 +08:00
|
|
|
PipId pip;
|
|
|
|
pip.index = i;
|
|
|
|
pip_by_name[getPipName(pip)] = i;
|
|
|
|
}
|
|
|
|
}
|
2018-06-06 21:13:41 +08:00
|
|
|
|
2018-06-07 18:56:49 +08:00
|
|
|
auto it = pip_by_name.find(name);
|
|
|
|
if (it != pip_by_name.end())
|
|
|
|
ret.index = it->second;
|
2018-06-06 21:13:41 +08:00
|
|
|
|
2018-06-07 18:56:49 +08:00
|
|
|
return ret;
|
2018-06-06 21:13:41 +08:00
|
|
|
}
|
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
IdString Arch::getPipName(PipId pip) const
|
2018-06-13 20:53:44 +08:00
|
|
|
{
|
|
|
|
assert(pip != PipId());
|
|
|
|
|
2018-06-17 22:12:52 +08:00
|
|
|
int x = chip_info->pip_data[pip.index].x;
|
|
|
|
int y = chip_info->pip_data[pip.index].y;
|
2018-06-13 20:53:44 +08:00
|
|
|
|
|
|
|
std::string src_name =
|
2018-06-17 22:12:52 +08:00
|
|
|
chip_info->wire_data[chip_info->pip_data[pip.index].src].name.get();
|
2018-06-13 20:53:44 +08:00
|
|
|
std::replace(src_name.begin(), src_name.end(), '/', '.');
|
|
|
|
|
|
|
|
std::string dst_name =
|
2018-06-17 22:12:52 +08:00
|
|
|
chip_info->wire_data[chip_info->pip_data[pip.index].dst].name.get();
|
2018-06-13 20:53:44 +08:00
|
|
|
std::replace(dst_name.begin(), dst_name.end(), '/', '.');
|
|
|
|
|
2018-06-18 22:08:19 +08:00
|
|
|
return id("X" + std::to_string(x) + "/Y" + std::to_string(y) + "/" +
|
|
|
|
src_name + ".->." + dst_name);
|
2018-06-13 20:53:44 +08:00
|
|
|
}
|
|
|
|
|
2018-06-06 21:13:41 +08:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
BelId Arch::getPackagePinBel(const std::string &pin) const
|
2018-06-13 18:30:15 +08:00
|
|
|
{
|
|
|
|
for (int i = 0; i < package_info->num_pins; i++) {
|
2018-06-17 19:32:38 +08:00
|
|
|
if (package_info->pins[i].name.get() == pin) {
|
2018-06-13 18:30:15 +08:00
|
|
|
BelId id;
|
|
|
|
id.index = package_info->pins[i].bel_index;
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return BelId();
|
|
|
|
}
|
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
std::string Arch::getBelPackagePin(BelId bel) const
|
2018-06-16 03:29:02 +08:00
|
|
|
{
|
|
|
|
for (int i = 0; i < package_info->num_pins; i++) {
|
|
|
|
if (package_info->pins[i].bel_index == bel.index) {
|
2018-06-17 19:32:38 +08:00
|
|
|
return std::string(package_info->pins[i].name.get());
|
2018-06-16 03:29:02 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|
2018-06-13 18:30:15 +08:00
|
|
|
// -----------------------------------------------------------------------
|
2018-06-06 21:13:41 +08:00
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
bool Arch::estimatePosition(BelId bel, int &x, int &y) const
|
2018-05-26 20:27:21 +08:00
|
|
|
{
|
2018-06-10 00:41:38 +08:00
|
|
|
assert(bel != BelId());
|
2018-06-17 22:12:52 +08:00
|
|
|
x = chip_info->bel_data[bel.index].x;
|
|
|
|
y = chip_info->bel_data[bel.index].y;
|
2018-06-06 21:13:41 +08:00
|
|
|
|
2018-06-17 22:12:52 +08:00
|
|
|
return chip_info->bel_data[bel.index].type != TYPE_SB_GB;
|
2018-06-06 21:13:41 +08:00
|
|
|
}
|
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
delay_t Arch::estimateDelay(WireId src, WireId dst) const
|
2018-06-06 21:13:41 +08:00
|
|
|
{
|
2018-06-14 18:43:00 +08:00
|
|
|
assert(src != WireId());
|
2018-06-17 22:12:52 +08:00
|
|
|
delay_t x1 = chip_info->wire_data[src.index].x;
|
|
|
|
delay_t y1 = chip_info->wire_data[src.index].y;
|
2018-06-06 21:13:41 +08:00
|
|
|
|
2018-06-14 18:43:00 +08:00
|
|
|
assert(dst != WireId());
|
2018-06-17 22:12:52 +08:00
|
|
|
delay_t x2 = chip_info->wire_data[dst.index].x;
|
|
|
|
delay_t y2 = chip_info->wire_data[dst.index].y;
|
2018-06-14 18:43:00 +08:00
|
|
|
|
|
|
|
return fabsf(x1 - x2) + fabsf(y1 - y2);
|
2018-06-13 18:37:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
std::vector<GraphicElement> Arch::getFrameGraphics() const
|
2018-06-13 18:48:58 +08:00
|
|
|
{
|
|
|
|
std::vector<GraphicElement> ret;
|
|
|
|
|
2018-06-17 22:12:52 +08:00
|
|
|
for (int x = 0; x <= chip_info->width; x++)
|
|
|
|
for (int y = 0; y <= chip_info->height; y++) {
|
2018-06-13 18:48:58 +08:00
|
|
|
GraphicElement el;
|
|
|
|
el.type = GraphicElement::G_LINE;
|
|
|
|
el.x1 = x - 0.05, el.x2 = x + 0.05, el.y1 = y, el.y2 = y, el.z = 0;
|
|
|
|
ret.push_back(el);
|
|
|
|
el.x1 = x, el.x2 = x, el.y1 = y - 0.05, el.y2 = y + 0.05, el.z = 0;
|
|
|
|
ret.push_back(el);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
std::vector<GraphicElement> Arch::getBelGraphics(BelId bel) 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
|
|
|
|
|
|
|
auto bel_type = getBelType(bel);
|
|
|
|
|
|
|
|
if (bel_type == TYPE_ICESTORM_LC) {
|
|
|
|
GraphicElement el;
|
|
|
|
el.type = GraphicElement::G_BOX;
|
2018-06-17 22:12:52 +08:00
|
|
|
el.x1 = chip_info->bel_data[bel.index].x + 0.1;
|
|
|
|
el.x2 = chip_info->bel_data[bel.index].x + 0.9;
|
|
|
|
el.y1 = chip_info->bel_data[bel.index].y + 0.10 +
|
|
|
|
(chip_info->bel_data[bel.index].z) * (0.8 / 8);
|
|
|
|
el.y2 = chip_info->bel_data[bel.index].y + 0.18 +
|
|
|
|
(chip_info->bel_data[bel.index].z) * (0.8 / 8);
|
2018-06-07 18:56:49 +08:00
|
|
|
el.z = 0;
|
|
|
|
ret.push_back(el);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bel_type == TYPE_SB_IO) {
|
2018-06-17 22:12:52 +08:00
|
|
|
if (chip_info->bel_data[bel.index].x == 0 ||
|
|
|
|
chip_info->bel_data[bel.index].x == chip_info->width - 1) {
|
2018-06-07 18:56:49 +08:00
|
|
|
GraphicElement el;
|
|
|
|
el.type = GraphicElement::G_BOX;
|
2018-06-17 22:12:52 +08:00
|
|
|
el.x1 = chip_info->bel_data[bel.index].x + 0.1;
|
|
|
|
el.x2 = chip_info->bel_data[bel.index].x + 0.9;
|
|
|
|
if (chip_info->bel_data[bel.index].z == 0) {
|
|
|
|
el.y1 = chip_info->bel_data[bel.index].y + 0.10;
|
|
|
|
el.y2 = chip_info->bel_data[bel.index].y + 0.45;
|
2018-06-07 18:56:49 +08:00
|
|
|
} else {
|
2018-06-17 22:12:52 +08:00
|
|
|
el.y1 = chip_info->bel_data[bel.index].y + 0.55;
|
|
|
|
el.y2 = chip_info->bel_data[bel.index].y + 0.90;
|
2018-06-07 18:56:49 +08:00
|
|
|
}
|
|
|
|
el.z = 0;
|
|
|
|
ret.push_back(el);
|
|
|
|
} else {
|
|
|
|
GraphicElement el;
|
|
|
|
el.type = GraphicElement::G_BOX;
|
2018-06-17 22:12:52 +08:00
|
|
|
if (chip_info->bel_data[bel.index].z == 0) {
|
|
|
|
el.x1 = chip_info->bel_data[bel.index].x + 0.10;
|
|
|
|
el.x2 = chip_info->bel_data[bel.index].x + 0.45;
|
2018-06-07 18:56:49 +08:00
|
|
|
} else {
|
2018-06-17 22:12:52 +08:00
|
|
|
el.x1 = chip_info->bel_data[bel.index].x + 0.55;
|
|
|
|
el.x2 = chip_info->bel_data[bel.index].x + 0.90;
|
2018-06-07 18:56:49 +08:00
|
|
|
}
|
2018-06-17 22:12:52 +08:00
|
|
|
el.y1 = chip_info->bel_data[bel.index].y + 0.1;
|
|
|
|
el.y2 = chip_info->bel_data[bel.index].y + 0.9;
|
2018-06-07 18:56:49 +08:00
|
|
|
el.z = 0;
|
|
|
|
ret.push_back(el);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bel_type == TYPE_ICESTORM_RAM) {
|
|
|
|
GraphicElement el;
|
|
|
|
el.type = GraphicElement::G_BOX;
|
2018-06-17 22:12:52 +08:00
|
|
|
el.x1 = chip_info->bel_data[bel.index].x + 0.1;
|
|
|
|
el.x2 = chip_info->bel_data[bel.index].x + 0.9;
|
|
|
|
el.y1 = chip_info->bel_data[bel.index].y + 0.1;
|
|
|
|
el.y2 = chip_info->bel_data[bel.index].y + 1.9;
|
2018-06-07 18:56:49 +08:00
|
|
|
el.z = 0;
|
|
|
|
ret.push_back(el);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2018-06-06 21:13:41 +08:00
|
|
|
}
|
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
std::vector<GraphicElement> Arch::getWireGraphics(WireId wire) 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
|
|
|
// FIXME
|
|
|
|
return ret;
|
2018-06-06 21:13:41 +08:00
|
|
|
}
|
|
|
|
|
2018-06-18 19:35:25 +08:00
|
|
|
std::vector<GraphicElement> Arch::getPipGraphics(PipId pip) 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
|
|
|
// FIXME
|
|
|
|
return ret;
|
2018-06-06 21:13:41 +08:00
|
|
|
}
|
|
|
|
|
2018-06-20 17:44:28 +08:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
delay_t Arch::getCellDelay(const CellInfo *cell, IdString fromPort,
|
|
|
|
IdString toPort) const
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
IdString Arch::getPortClock(const CellInfo *cell, IdString port) const
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return IdString();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Arch::isClockPort(const CellInfo *cell, IdString port) const
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-06-12 20:24:59 +08:00
|
|
|
NEXTPNR_NAMESPACE_END
|