aboutsummaryrefslogtreecommitdiffstats
path: root/ecp5/bitstream.cc
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-07-24 12:22:57 +0200
committerDavid Shah <davey1576@gmail.com>2018-07-24 12:22:57 +0200
commitf61e9e56094946492bdd364ab272c19919a9faca (patch)
tree9971ca5903aa39b0cd7ff6a513f9ba25eece4274 /ecp5/bitstream.cc
parent7858663aa7f211cebde2d543f7d0094d84ca11b1 (diff)
downloadnextpnr-f61e9e56094946492bdd364ab272c19919a9faca.tar.gz
nextpnr-f61e9e56094946492bdd364ab272c19919a9faca.tar.bz2
nextpnr-f61e9e56094946492bdd364ab272c19919a9faca.zip
ecp5: Set BANKREF to correct VccIO
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ecp5/bitstream.cc')
-rw-r--r--ecp5/bitstream.cc27
1 files changed, 25 insertions, 2 deletions
diff --git a/ecp5/bitstream.cc b/ecp5/bitstream.cc
index 19ddb9f9..1efee5fc 100644
--- a/ecp5/bitstream.cc
+++ b/ecp5/bitstream.cc
@@ -30,6 +30,7 @@
#include <fstream>
#include <streambuf>
+#include "io.h"
#include "log.h"
#include "util.h"
@@ -182,12 +183,34 @@ void write_bitstream(Context *ctx, std::string base_config_file, std::string tex
}
}
}
+ // Find bank voltages
+ std::unordered_map<int, IOVoltage> bankVcc;
+ for (auto &cell : ctx->cells) {
+ CellInfo *ci = cell.second.get();
+ if (ci->bel != BelId() && ci->type == ctx->id("TRELLIS_IO")) {
+ int bank = ctx->getPioBelBank(ci->bel);
+ std::string iotype = str_or_default(ci->attrs, ctx->id("IO_TYPE"), "LVCMOS33");
+ IOVoltage vcc = get_vccio(ioType_from_str(iotype));
+ if (bankVcc.find(bank) != bankVcc.end()) {
+ // TODO: strong and weak constraints
+ if (bankVcc[bank] != vcc) {
+ log_error("Error processing '%s': incompatible IO voltages %s and %s on bank %d.",
+ cell.first.c_str(ctx), iovoltage_to_str(bankVcc[bank]).c_str(),
+ iovoltage_to_str(vcc).c_str(), bank);
+ }
+ } else {
+ bankVcc[bank] = vcc;
+ }
+ }
+ }
- // Set all bankref tiles to 3.3V (TODO)
+ // Set all bankref tiles to appropriate VccIO
for (const auto &tile : empty_chip.tiles) {
std::string type = tile.second->info.type;
if (type.find("BANKREF") != std::string::npos && type != "BANKREF8") {
- cc.tiles[tile.first].add_enum("BANK.VCCIO", "3V3");
+ int bank = std::stoi(type.substr(7));
+ if (bankVcc.find(bank) != bankVcc.end())
+ cc.tiles[tile.first].add_enum("BANK.VCCIO", iovoltage_to_str(bankVcc[bank]));
}
}