Extend chipdb with metadata
This commit is contained in:
parent
d5b5f7e4b2
commit
7ad9914e51
@ -47,7 +47,7 @@ MainWindow::~MainWindow() {}
|
||||
|
||||
void MainWindow::newContext(Context *ctx)
|
||||
{
|
||||
std::string title = "nextpnr-machxo2 - " + ctx->getChipName() + " ( " + ctx->archArgs().package + " )";
|
||||
std::string title = "nextpnr-machxo2 - " + std::string(ctx->device_name) + " (" + std::string(ctx->package_name) + ") - Part : " + ctx->getChipName();
|
||||
setWindowTitle(title.c_str());
|
||||
}
|
||||
|
||||
@ -78,19 +78,7 @@ void MainWindow::createMenu()
|
||||
|
||||
void MainWindow::new_proj()
|
||||
{
|
||||
QMap<QString, int> arch;
|
||||
if (Arch::is_available(ArchArgs::LCMXO2_256HC))
|
||||
arch.insert("LCMXO2-256HC", ArchArgs::LCMXO2_256HC);
|
||||
if (Arch::is_available(ArchArgs::LCMXO2_640HC))
|
||||
arch.insert("LCMXO2-640HC", ArchArgs::LCMXO2_640HC);
|
||||
if (Arch::is_available(ArchArgs::LCMXO2_1200HC))
|
||||
arch.insert("LCMXO2-1200HC", ArchArgs::LCMXO2_1200HC);
|
||||
if (Arch::is_available(ArchArgs::LCMXO2_2000HC))
|
||||
arch.insert("LCMXO2-2000HC", ArchArgs::LCMXO2_2000HC);
|
||||
if (Arch::is_available(ArchArgs::LCMXO2_4000HC))
|
||||
arch.insert("LCMXO2-4000HC", ArchArgs::LCMXO2_4000HC);
|
||||
if (Arch::is_available(ArchArgs::LCMXO2_7000HC))
|
||||
arch.insert("LCMXO2-7000HC", ArchArgs::LCMXO2_7000HC);
|
||||
/* QMap<QString, int> arch;
|
||||
bool ok;
|
||||
QString item = QInputDialog::getItem(this, "Select new context", "Chip:", arch.keys(), 0, false, &ok);
|
||||
if (ok && !item.isEmpty()) {
|
||||
@ -113,6 +101,7 @@ void MainWindow::new_proj()
|
||||
Q_EMIT contextChanged(ctx.get());
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void MainWindow::open_lpf()
|
||||
|
152
machxo2/arch.cc
152
machxo2/arch.cc
@ -28,6 +28,7 @@
|
||||
#include "router1.h"
|
||||
#include "router2.h"
|
||||
#include "util.h"
|
||||
#include "chipdb/available.h"
|
||||
|
||||
NEXTPNR_NAMESPACE_BEGIN
|
||||
|
||||
@ -44,51 +45,53 @@ void IdString::initialize_arch(const BaseCtx *ctx)
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
static const ChipInfoPOD *get_chip_info(ArchArgs::ArchArgsTypes chip)
|
||||
static void get_chip_info(std::string device, const ChipInfoPOD **chip_info, const PackageInfoPOD **package_info, const char **device_name, const char **package_name)
|
||||
{
|
||||
std::string chipdb;
|
||||
if (chip == ArchArgs::LCMXO2_256HC) {
|
||||
chipdb = "machxo2/chipdb-256.bin";
|
||||
} else if (chip == ArchArgs::LCMXO2_640HC) {
|
||||
chipdb = "machxo2/chipdb-640.bin";
|
||||
} else if (chip == ArchArgs::LCMXO2_1200HC) {
|
||||
chipdb = "machxo2/chipdb-1200.bin";
|
||||
} else if (chip == ArchArgs::LCMXO2_2000HC) {
|
||||
chipdb = "machxo2/chipdb-2000.bin";
|
||||
} else if (chip == ArchArgs::LCMXO2_4000HC) {
|
||||
chipdb = "machxo2/chipdb-4000.bin";
|
||||
} else if (chip == ArchArgs::LCMXO2_7000HC) {
|
||||
chipdb = "machxo2/chipdb-7000.bin";
|
||||
} else {
|
||||
log_error("Unknown chip\n");
|
||||
std::stringstream ss(available_devices);
|
||||
std::string name;
|
||||
while(getline(ss, name, ';')){
|
||||
std::string chipdb = stringf("machxo2/chipdb-%s.bin", name.c_str());
|
||||
auto db_ptr = reinterpret_cast<const RelPtr<ChipInfoPOD> *>(get_chipdb(chipdb));
|
||||
if (!db_ptr)
|
||||
continue; // chipdb not available
|
||||
for (auto &chip : db_ptr->get()->variants) {
|
||||
for (auto &pkg : chip.packages) {
|
||||
for (auto &speedgrade : chip.speed_grades) {
|
||||
for (auto &rating : chip.suffixes) {
|
||||
std::string name = stringf("%s-%d%s%s", chip.name.get(), speedgrade.speed, pkg.short_name.get(), rating.suffix.get());
|
||||
if (device == name) {
|
||||
*chip_info = db_ptr->get();
|
||||
*package_info = nullptr;
|
||||
*package_name = pkg.name.get();
|
||||
*device_name = chip.name.get();
|
||||
for (int i = 0; i < (*chip_info)->num_packages; i++) {
|
||||
if (pkg.name.get() == (*chip_info)->package_info[i].name.get()) {
|
||||
*package_info = &((*chip_info)->package_info[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto ptr = reinterpret_cast<const RelPtr<ChipInfoPOD> *>(get_chipdb(chipdb));
|
||||
if (ptr == nullptr)
|
||||
return nullptr;
|
||||
return ptr->get();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
Arch::Arch(ArchArgs args) : args(args)
|
||||
{
|
||||
chip_info = get_chip_info(args.type);
|
||||
get_chip_info(args.device, &chip_info, &package_info, &device_name, &package_name);
|
||||
if (chip_info == nullptr)
|
||||
log_error("Unsupported MachXO2 chip type.\n");
|
||||
if (chip_info->const_id_count != DB_CONST_ID_COUNT)
|
||||
log_error("Chip database 'bba' and nextpnr code are out of sync; please rebuild (or contact distribution "
|
||||
"maintainer)!\n");
|
||||
|
||||
package_info = nullptr;
|
||||
for (int i = 0; i < chip_info->num_packages; i++) {
|
||||
if (args.package == chip_info->package_info[i].name.get()) {
|
||||
package_info = &(chip_info->package_info[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!package_info)
|
||||
log_error("Unsupported package '%s' for '%s'.\n", args.package.c_str(), getChipName().c_str());
|
||||
log_error("Unsupported package '%s' for '%s'.\n", package_name, getChipName().c_str());
|
||||
|
||||
BaseArch::init_cell_types();
|
||||
BaseArch::init_bel_buckets();
|
||||
@ -110,83 +113,32 @@ Arch::Arch(ArchArgs args) : args(args)
|
||||
}
|
||||
}
|
||||
|
||||
bool Arch::is_available(ArchArgs::ArchArgsTypes chip) { return get_chip_info(chip) != nullptr; }
|
||||
|
||||
std::vector<std::string> Arch::get_supported_packages(ArchArgs::ArchArgsTypes chip)
|
||||
void Arch::list_devices()
|
||||
{
|
||||
const ChipInfoPOD *chip_info = get_chip_info(chip);
|
||||
std::vector<std::string> pkgs;
|
||||
for (int i = 0; i < chip_info->num_packages; i++) {
|
||||
pkgs.push_back(chip_info->package_info[i].name.get());
|
||||
log("Supported devices: \n");
|
||||
std::stringstream ss(available_devices);
|
||||
std::string name;
|
||||
while(getline(ss, name, ';')){
|
||||
std::string chipdb = stringf("machxo2/chipdb-%s.bin", name.c_str());
|
||||
auto db_ptr = reinterpret_cast<const RelPtr<ChipInfoPOD> *>(get_chipdb(chipdb));
|
||||
if (!db_ptr)
|
||||
continue; // chipdb not available
|
||||
for (auto &chip : db_ptr->get()->variants) {
|
||||
for (auto &pkg : chip.packages) {
|
||||
for (auto &speedgrade : chip.speed_grades) {
|
||||
for (auto &rating : chip.suffixes) {
|
||||
log(" %s-%d%s%s\n", chip.name.get(), speedgrade.speed, pkg.short_name.get(), rating.suffix.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
return pkgs;
|
||||
}
|
||||
|
||||
std::string Arch::getChipName() const
|
||||
{
|
||||
if (args.type == ArchArgs::LCMXO2_256HC) {
|
||||
return "LCMXO2-256HC";
|
||||
} else if (args.type == ArchArgs::LCMXO2_640HC) {
|
||||
return "LCMXO2-640HC";
|
||||
} else if (args.type == ArchArgs::LCMXO2_1200HC) {
|
||||
return "LCMXO2-1200HC";
|
||||
} else if (args.type == ArchArgs::LCMXO2_2000HC) {
|
||||
return "LCMXO2-2000HC";
|
||||
} else if (args.type == ArchArgs::LCMXO2_4000HC) {
|
||||
return "LCMXO2-4000HC";
|
||||
} else if (args.type == ArchArgs::LCMXO2_7000HC) {
|
||||
return "LCMXO2-7000HC";
|
||||
} else {
|
||||
log_error("Unknown chip\n");
|
||||
}
|
||||
}
|
||||
|
||||
std::string Arch::get_full_chip_name() const
|
||||
{
|
||||
std::string name = getChipName();
|
||||
name += "-";
|
||||
switch (args.speed) {
|
||||
case ArchArgs::SPEED_1:
|
||||
name += "1";
|
||||
break;
|
||||
case ArchArgs::SPEED_2:
|
||||
name += "2";
|
||||
break;
|
||||
case ArchArgs::SPEED_3:
|
||||
name += "3";
|
||||
break;
|
||||
case ArchArgs::SPEED_4:
|
||||
name += "4";
|
||||
break;
|
||||
case ArchArgs::SPEED_5:
|
||||
name += "5";
|
||||
break;
|
||||
case ArchArgs::SPEED_6:
|
||||
name += "6";
|
||||
break;
|
||||
}
|
||||
name += args.package;
|
||||
return name;
|
||||
}
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
IdString Arch::archArgsToId(ArchArgs args) const
|
||||
{
|
||||
if (args.type == ArchArgs::LCMXO2_256HC) {
|
||||
return id_lcmxo2_256hc;
|
||||
} else if (args.type == ArchArgs::LCMXO2_640HC) {
|
||||
return id_lcmxo2_640hc;
|
||||
} else if (args.type == ArchArgs::LCMXO2_1200HC) {
|
||||
return id_lcmxo2_1200hc;
|
||||
} else if (args.type == ArchArgs::LCMXO2_2000HC) {
|
||||
return id_lcmxo2_2000hc;
|
||||
} else if (args.type == ArchArgs::LCMXO2_4000HC) {
|
||||
return id_lcmxo2_4000hc;
|
||||
} else if (args.type == ArchArgs::LCMXO2_7000HC) {
|
||||
return id_lcmxo2_7000hc;
|
||||
}
|
||||
|
||||
return IdString();
|
||||
}
|
||||
std::string Arch::getChipName() const { return args.device; }
|
||||
IdString Arch::archArgsToId(ArchArgs args) const { return id(args.device); }
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
|
@ -25,31 +25,13 @@
|
||||
#include <set>
|
||||
|
||||
#include "base_arch.h"
|
||||
#include "nextpnr_namespaces.h"
|
||||
#include "nextpnr_types.h"
|
||||
#include "relptr.h"
|
||||
|
||||
NEXTPNR_NAMESPACE_BEGIN
|
||||
|
||||
/**** Everything in this section must be kept in sync with chipdb.py ****/
|
||||
|
||||
template <typename T> struct RelPtr
|
||||
{
|
||||
int32_t offset;
|
||||
|
||||
// void set(const T *ptr) {
|
||||
// offset = reinterpret_cast<const char*>(ptr) -
|
||||
// reinterpret_cast<const char*>(this);
|
||||
// }
|
||||
|
||||
const T *get() const { return reinterpret_cast<const T *>(reinterpret_cast<const char *>(this) + offset); }
|
||||
|
||||
const T &operator[](std::size_t index) const { return get()[index]; }
|
||||
|
||||
const T &operator*() const { return *(get()); }
|
||||
|
||||
const T *operator->() const { return get(); }
|
||||
};
|
||||
|
||||
// FIXME: All "rel locs" are actually absolute, naming typo in facade_import.
|
||||
// Does not affect runtime functionality.
|
||||
|
||||
@ -141,7 +123,29 @@ NPNR_PACKED_STRUCT(struct TileInfoPOD {
|
||||
RelPtr<TileNamePOD> tile_names;
|
||||
});
|
||||
|
||||
NPNR_PACKED_STRUCT(struct PackageSupportedPOD {
|
||||
RelPtr<char> name;
|
||||
RelPtr<char> short_name;
|
||||
});
|
||||
|
||||
NPNR_PACKED_STRUCT(struct SuffixeSupportedPOD {
|
||||
RelPtr<char> suffix;
|
||||
});
|
||||
|
||||
NPNR_PACKED_STRUCT(struct SpeedSupportedPOD {
|
||||
int32_t speed;
|
||||
});
|
||||
|
||||
NPNR_PACKED_STRUCT(struct VariantInfoPOD {
|
||||
RelPtr<char> name;
|
||||
RelSlice<PackageSupportedPOD> packages;
|
||||
RelSlice<SpeedSupportedPOD> speed_grades;
|
||||
RelSlice<SuffixeSupportedPOD> suffixes;
|
||||
});
|
||||
|
||||
NPNR_PACKED_STRUCT(struct ChipInfoPOD {
|
||||
RelPtr<char> family;
|
||||
RelPtr<char> device_name;
|
||||
int32_t width, height;
|
||||
int32_t num_tiles;
|
||||
int32_t num_packages, num_pios;
|
||||
@ -151,6 +155,7 @@ NPNR_PACKED_STRUCT(struct ChipInfoPOD {
|
||||
RelPtr<PackageInfoPOD> package_info;
|
||||
RelPtr<PIOInfoPOD> pio_info;
|
||||
RelPtr<TileInfoPOD> tile_info;
|
||||
RelSlice<VariantInfoPOD> variants;
|
||||
});
|
||||
|
||||
/************************ End of chipdb section. ************************/
|
||||
@ -361,26 +366,7 @@ struct PipRange
|
||||
|
||||
struct ArchArgs
|
||||
{
|
||||
enum ArchArgsTypes
|
||||
{
|
||||
NONE,
|
||||
LCMXO2_256HC,
|
||||
LCMXO2_640HC,
|
||||
LCMXO2_1200HC,
|
||||
LCMXO2_2000HC,
|
||||
LCMXO2_4000HC,
|
||||
LCMXO2_7000HC,
|
||||
} type = NONE;
|
||||
std::string package;
|
||||
enum SpeedGrade
|
||||
{
|
||||
SPEED_1 = 0,
|
||||
SPEED_2,
|
||||
SPEED_3,
|
||||
SPEED_4,
|
||||
SPEED_5,
|
||||
SPEED_6,
|
||||
} speed = SPEED_4;
|
||||
std::string device;
|
||||
};
|
||||
|
||||
struct ArchRanges : BaseArchRanges
|
||||
@ -403,6 +389,8 @@ struct Arch : BaseArch<ArchRanges>
|
||||
{
|
||||
const ChipInfoPOD *chip_info;
|
||||
const PackageInfoPOD *package_info;
|
||||
const char *package_name;
|
||||
const char *device_name;
|
||||
|
||||
mutable dict<IdStringList, PipId> pip_by_name;
|
||||
|
||||
@ -429,8 +417,7 @@ struct Arch : BaseArch<ArchRanges>
|
||||
ArchArgs args;
|
||||
Arch(ArchArgs args);
|
||||
|
||||
static bool is_available(ArchArgs::ArchArgsTypes chip);
|
||||
static std::vector<std::string> get_supported_packages(ArchArgs::ArchArgsTypes chip);
|
||||
static void list_devices();
|
||||
|
||||
std::string getChipName() const override;
|
||||
// Extra helper
|
||||
|
@ -30,7 +30,7 @@ NEXTPNR_NAMESPACE_BEGIN
|
||||
void arch_wrap_python(py::module &m)
|
||||
{
|
||||
using namespace PythonConversion;
|
||||
py::class_<ArchArgs>(m, "ArchArgs").def_readwrite("type", &ArchArgs::type);
|
||||
py::class_<ArchArgs>(m, "ArchArgs").def_readwrite("device", &ArchArgs::device);
|
||||
|
||||
py::class_<BelId>(m, "BelId").def_readwrite("index", &BelId::index);
|
||||
|
||||
|
1
machxo2/available.h.in
Normal file
1
machxo2/available.h.in
Normal file
@ -0,0 +1 @@
|
||||
static const char *available_devices = "@MACHXO2_DEVICES@";
|
@ -30,10 +30,8 @@ NEXTPNR_NAMESPACE_BEGIN
|
||||
|
||||
// These seem simple enough to do inline for now.
|
||||
namespace BaseConfigs {
|
||||
void config_empty_lcmxo2_1200hc(ChipConfig &cc)
|
||||
void config_empty_lcmxo2_1200(ChipConfig &cc)
|
||||
{
|
||||
cc.chip_name = "LCMXO2-1200HC";
|
||||
|
||||
cc.tiles["EBR_R6C11:EBR1"].add_unknown(0, 12);
|
||||
cc.tiles["EBR_R6C15:EBR1"].add_unknown(0, 12);
|
||||
cc.tiles["EBR_R6C18:EBR1"].add_unknown(0, 12);
|
||||
@ -196,16 +194,16 @@ static std::string get_pic_tile(Context *ctx, BelId bel)
|
||||
void write_bitstream(Context *ctx, std::string text_config_file)
|
||||
{
|
||||
ChipConfig cc;
|
||||
|
||||
switch (ctx->args.type) {
|
||||
case ArchArgs::LCMXO2_1200HC:
|
||||
BaseConfigs::config_empty_lcmxo2_1200hc(cc);
|
||||
break;
|
||||
default:
|
||||
IdString base_id = ctx->id(ctx->chip_info->device_name.get());
|
||||
//IdString device_id = ctx->id(ctx->device_name);
|
||||
if (base_id == ctx->id("LCMXO2-1200"))
|
||||
BaseConfigs::config_empty_lcmxo2_1200(cc);
|
||||
else
|
||||
NPNR_ASSERT_FALSE("Unsupported device type");
|
||||
}
|
||||
cc.chip_name = ctx->chip_info->device_name.get();
|
||||
cc.chip_variant = ctx->device_name;
|
||||
|
||||
cc.metadata.push_back("Part: " + ctx->get_full_chip_name());
|
||||
cc.metadata.push_back("Part: " + ctx->getChipName());
|
||||
|
||||
// Add all set, configurable pips to the config
|
||||
for (auto pip : ctx->getPips()) {
|
||||
|
@ -123,12 +123,6 @@ X(IO_TYPE)
|
||||
X(LOC)
|
||||
X(NOM_FREQ)
|
||||
X(VCC)
|
||||
X(lcmxo2_1200hc)
|
||||
X(lcmxo2_2000hc)
|
||||
X(lcmxo2_256hc)
|
||||
X(lcmxo2_4000hc)
|
||||
X(lcmxo2_640hc)
|
||||
X(lcmxo2_7000hc)
|
||||
X(machxo2)
|
||||
X(pack)
|
||||
X(place)
|
||||
|
@ -25,6 +25,49 @@ def get_tiletype_index(name):
|
||||
tiletype_names[name] = idx
|
||||
return idx
|
||||
|
||||
def package_shortname(long_name, family):
|
||||
if long_name.startswith("CABGA"):
|
||||
if (family == "MachXO"):
|
||||
return "B" + long_name[5:]
|
||||
else:
|
||||
return "BG" + long_name[5:]
|
||||
elif long_name.startswith("CSBGA"):
|
||||
if (family == "MachXO"):
|
||||
return "M" + long_name[5:]
|
||||
else:
|
||||
return "MG" + long_name[5:]
|
||||
elif long_name.startswith("CSFBGA"):
|
||||
return "MG" + long_name[6:]
|
||||
elif long_name.startswith("UCBGA"):
|
||||
return "UMG" + long_name[5:]
|
||||
elif long_name.startswith("FPBGA"):
|
||||
return "FG" + long_name[5:]
|
||||
elif long_name.startswith("FTBGA"):
|
||||
if (family == "MachXO"):
|
||||
return "FT" + long_name[5:]
|
||||
else:
|
||||
return "FTG" + long_name[5:]
|
||||
elif long_name.startswith("WLCSP"):
|
||||
if (family == "MachXO3D"):
|
||||
return "UTG" + long_name[5:]
|
||||
else:
|
||||
return "UWG" + long_name[5:]
|
||||
elif long_name.startswith("TQFP"):
|
||||
if (family == "MachXO"):
|
||||
return "T" + long_name[4:]
|
||||
else:
|
||||
return "TG" + long_name[4:]
|
||||
elif long_name.startswith("QFN"):
|
||||
if (family == "MachXO3D"):
|
||||
return "SG" + long_name[3:]
|
||||
else:
|
||||
if long_name[3]=="8":
|
||||
return "QN" + long_name[3:]
|
||||
else:
|
||||
return "SG" + long_name[3:]
|
||||
else:
|
||||
print("unknown package name " + long_name)
|
||||
sys.exit(-1)
|
||||
|
||||
constids = dict()
|
||||
|
||||
@ -42,17 +85,27 @@ class BinaryBlobAssembler:
|
||||
else:
|
||||
print("ref %s %s" % (name, comment))
|
||||
|
||||
def r_slice(self, name, length, comment):
|
||||
if comment is None:
|
||||
print("ref %s" % (name,))
|
||||
else:
|
||||
print("ref %s %s" % (name, comment))
|
||||
print ("u32 %d" % (length, ))
|
||||
|
||||
def s(self, s, comment):
|
||||
assert "|" not in s
|
||||
print("str |%s| %s" % (s, comment))
|
||||
|
||||
def u8(self, v, comment):
|
||||
assert -128 <= int(v) <= 127
|
||||
if comment is None:
|
||||
print("u8 %d" % (v,))
|
||||
else:
|
||||
print("u8 %d %s" % (v, comment))
|
||||
|
||||
def u16(self, v, comment):
|
||||
# is actually used as signed 16 bit
|
||||
assert -32768 <= int(v) <= 32767
|
||||
if comment is None:
|
||||
print("u16 %d" % (v,))
|
||||
else:
|
||||
@ -90,6 +143,14 @@ def get_bel_index(rg, loc, name):
|
||||
|
||||
packages = {}
|
||||
pindata = []
|
||||
variants = {}
|
||||
|
||||
def process_devices_db(family, device):
|
||||
devicefile = path.join(database.get_db_root(), "devices.json")
|
||||
with open(devicefile, 'r') as f:
|
||||
devicedb = json.load(f)
|
||||
for varname, vardata in sorted(devicedb["families"][family]["devices"][device]["variants"].items()):
|
||||
variants[varname] = vardata
|
||||
|
||||
def process_pio_db(rg, device):
|
||||
piofile = path.join(database.get_db_root(), dev_family[device], dev_names[device], "iodb.json")
|
||||
@ -312,8 +373,28 @@ def write_database(dev_name, chip, rg, endianness):
|
||||
for tt, idx in sorted(tiletype_names.items(), key=lambda x: x[1]):
|
||||
bba.s(tt, "name")
|
||||
|
||||
for name, var_data in sorted(variants.items()):
|
||||
bba.l("supported_packages_%s" % name, "PackageSupportedPOD")
|
||||
for package in var_data["packages"]:
|
||||
bba.s(package, "name")
|
||||
bba.s(package_shortname(package, chip.info.family), "short_name")
|
||||
bba.l("supported_speed_grades_%s" % name, "SpeedSupportedPOD")
|
||||
for speed in var_data["speeds"]:
|
||||
bba.u32(speed, "speed")
|
||||
bba.l("supported_suffixes_%s" % name, "SuffixeSupportedPOD")
|
||||
for suffix in var_data["suffixes"]:
|
||||
bba.s(suffix, "suffix")
|
||||
|
||||
bba.l("variant_data", "VariantInfoPOD")
|
||||
for name, var_data in sorted(variants.items()):
|
||||
bba.s(name, "variant_name")
|
||||
bba.r_slice("supported_packages_%s" % name, len(var_data["packages"]), "supported_packages")
|
||||
bba.r_slice("supported_speed_grades_%s" % name, len(var_data["speeds"]), "supported_speed_grades")
|
||||
bba.r_slice("supported_suffixes_%s" % name, len(var_data["suffixes"]), "supported_suffixes")
|
||||
|
||||
bba.l("chip_info")
|
||||
bba.s(chip.info.family, "family")
|
||||
bba.s(chip.info.name, "device_name")
|
||||
bba.u32(max_col + 1, "width")
|
||||
bba.u32(max_row + 1, "height")
|
||||
bba.u32((max_col + 1) * (max_row + 1), "num_tiles")
|
||||
@ -326,6 +407,7 @@ def write_database(dev_name, chip, rg, endianness):
|
||||
bba.r("package_data", "package_info")
|
||||
bba.r("pio_info", "pio_info")
|
||||
bba.r("tiles_info", "tile_info")
|
||||
bba.r_slice("variant_data", len(variants), "variant_info")
|
||||
|
||||
bba.pop()
|
||||
|
||||
@ -386,6 +468,7 @@ def main():
|
||||
max_row = chip.get_max_row()
|
||||
max_col = chip.get_max_col()
|
||||
process_pio_db(rg, args.device)
|
||||
process_devices_db(chip.info.family, chip.info.name)
|
||||
bba = write_database(args.device, chip, rg, "le")
|
||||
|
||||
|
||||
|
@ -48,6 +48,9 @@ target_compile_options(chipdb-${family} PRIVATE -g0 -O0 -w)
|
||||
target_compile_definitions(chipdb-${family} PRIVATE NEXTPNR_NAMESPACE=nextpnr_${family})
|
||||
target_include_directories(chipdb-${family} PRIVATE ${family})
|
||||
|
||||
configure_file(${family}/available.h.in ${family}/chipdb/available.h)
|
||||
|
||||
foreach(family_target ${family_targets})
|
||||
target_sources(${family_target} PRIVATE $<TARGET_OBJECTS:chipdb-${family}>)
|
||||
target_sources(${family_target} PRIVATE ${family}/chipdb/available.h)
|
||||
endforeach()
|
||||
|
@ -47,26 +47,9 @@ MachXO2CommandHandler::MachXO2CommandHandler(int argc, char **argv) : CommandHan
|
||||
po::options_description MachXO2CommandHandler::getArchOptions()
|
||||
{
|
||||
po::options_description specific("Architecture specific options");
|
||||
if (Arch::is_available(ArchArgs::LCMXO2_256HC))
|
||||
specific.add_options()("256", "set device type to LCMXO2-256HC");
|
||||
if (Arch::is_available(ArchArgs::LCMXO2_640HC))
|
||||
specific.add_options()("640", "set device type to LCMXO2-640HC");
|
||||
if (Arch::is_available(ArchArgs::LCMXO2_1200HC))
|
||||
specific.add_options()("1200", "set device type to LCMXO2-1200HC");
|
||||
if (Arch::is_available(ArchArgs::LCMXO2_2000HC))
|
||||
specific.add_options()("2000", "set device type to LCMXO2-2000HC");
|
||||
if (Arch::is_available(ArchArgs::LCMXO2_4000HC))
|
||||
specific.add_options()("4000", "set device type to LCMXO2-4000HC");
|
||||
if (Arch::is_available(ArchArgs::LCMXO2_7000HC))
|
||||
specific.add_options()("7000", "set device type to LCMXO2-7000HC");
|
||||
|
||||
specific.add_options()("package", po::value<std::string>(), "select device package");
|
||||
specific.add_options()("speed", po::value<int>(), "select device speedgrade (1 to 6 inclusive)");
|
||||
|
||||
specific.add_options()("override-basecfg", po::value<std::string>(),
|
||||
"base chip configuration in Trellis text format");
|
||||
specific.add_options()("device", po::value<std::string>(), "device name");
|
||||
specific.add_options()("list-devices", "list all supported device names");
|
||||
specific.add_options()("textcfg", po::value<std::string>(), "textual configuration in Trellis format to write");
|
||||
|
||||
// specific.add_options()("lpf", po::value<std::vector<std::string>>(), "LPF pin constraint file(s)");
|
||||
|
||||
return specific;
|
||||
@ -84,28 +67,14 @@ void MachXO2CommandHandler::customBitstream(Context *ctx)
|
||||
std::unique_ptr<Context> MachXO2CommandHandler::createContext(dict<std::string, Property> &values)
|
||||
{
|
||||
ArchArgs chipArgs;
|
||||
chipArgs.type = ArchArgs::NONE;
|
||||
if (vm.count("256"))
|
||||
chipArgs.type = ArchArgs::LCMXO2_256HC;
|
||||
if (vm.count("640"))
|
||||
chipArgs.type = ArchArgs::LCMXO2_640HC;
|
||||
if (vm.count("1200"))
|
||||
chipArgs.type = ArchArgs::LCMXO2_1200HC;
|
||||
if (vm.count("2000"))
|
||||
chipArgs.type = ArchArgs::LCMXO2_2000HC;
|
||||
if (vm.count("4000"))
|
||||
chipArgs.type = ArchArgs::LCMXO2_4000HC;
|
||||
if (vm.count("7000"))
|
||||
chipArgs.type = ArchArgs::LCMXO2_7000HC;
|
||||
if (vm.count("package"))
|
||||
chipArgs.package = vm["package"].as<std::string>();
|
||||
|
||||
if (values.find("arch.name") != values.end()) {
|
||||
std::string arch_name = values["arch.name"].as_string();
|
||||
if (arch_name != "machxo2")
|
||||
log_error("Unsuported architecture '%s'.\n", arch_name.c_str());
|
||||
if (vm.count("list-devices")) {
|
||||
Arch::list_devices();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (!vm.count("device")) {
|
||||
log_error("device must be specified on the command line (e.g. --device LCMXO2-7000HC-4TG144I)\n");
|
||||
}
|
||||
chipArgs.device = vm["device"].as<std::string>();
|
||||
auto ctx = std::unique_ptr<Context>(new Context(chipArgs));
|
||||
return ctx;
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ static void pack_io(Context *ctx)
|
||||
BelId pinBel = ctx->getPackagePinBel(pin);
|
||||
if (pinBel == BelId()) {
|
||||
log_error("IO buffer '%s' constrained to pin '%s', which does not exist for package '%s'.\n",
|
||||
ci->name.c_str(ctx), pin.c_str(), ctx->args.package.c_str());
|
||||
ci->name.c_str(ctx), pin.c_str(), ctx->package_name);
|
||||
} else {
|
||||
log_info("pin '%s' constrained to Bel '%s'.\n", ci->name.c_str(ctx), ctx->nameOfBel(pinBel));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user