aboutsummaryrefslogtreecommitdiffstats
path: root/ice40
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2020-06-02 20:21:05 +0200
committerSylvain Munaut <tnt@246tNt.com>2020-06-02 20:21:16 +0200
commit9b71bba747936e8c5fcb81880d570b515c63599f (patch)
tree61a8075a3e495af8249a95b2c6aa3169abb5dce4 /ice40
parent5e2b6bcef945a89daa215d01e15120162f81da7b (diff)
downloadnextpnr-9b71bba747936e8c5fcb81880d570b515c63599f.tar.gz
nextpnr-9b71bba747936e8c5fcb81880d570b515c63599f.tar.bz2
nextpnr-9b71bba747936e8c5fcb81880d570b515c63599f.zip
ice40: Add fallback behavior for Extra Cell config bits vectors
This helps make new nextpnr compatible with old chipdbs when a parameters goes from single bit to multi bit. Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'ice40')
-rw-r--r--ice40/bitstream.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/ice40/bitstream.cc b/ice40/bitstream.cc
index 3865316f..85f1e847 100644
--- a/ice40/bitstream.cc
+++ b/ice40/bitstream.cc
@@ -133,6 +133,16 @@ static const BelConfigPOD &get_ec_config(const ChipInfoPOD *chip, BelId bel)
typedef std::vector<std::vector<std::vector<std::vector<int8_t>>>> chipconfig_t;
+static bool has_ec_cbit(const BelConfigPOD &cell_cbits, std::string name)
+{
+ for (int i = 0; i < cell_cbits.num_entries; i++) {
+ const auto &cbit = cell_cbits.entries[i];
+ if (cbit.entry_name.get() == name)
+ return true;
+ }
+ return false;
+}
+
static void set_ec_cbit(chipconfig_t &config, const Context *ctx, const BelConfigPOD &cell_cbits, std::string name,
bool value, std::string prefix)
{
@@ -190,7 +200,7 @@ void configure_extra_cell(chipconfig_t &config, const Context *ctx, CellInfo *ce
}
value.resize(p.second);
- if (p.second == 1) {
+ if ((p.second == 1) || !has_ec_cbit(bc, p.first + "_0")) {
set_ec_cbit(config, ctx, bc, p.first, value.at(0), prefix);
} else {
for (int i = 0; i < p.second; i++) {