aboutsummaryrefslogtreecommitdiffstats
path: root/ice40
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-06-16 12:17:36 +0200
committerDavid Shah <davey1576@gmail.com>2018-06-16 14:44:10 +0200
commitf079e0d204117b53a91da2805d31136607a5ca0e (patch)
tree344615172ca197083368744e65a20a6f30af8bc1 /ice40
parentc0a26271790b8eb6c67d97b45f089660cdcfa37d (diff)
downloadnextpnr-f079e0d204117b53a91da2805d31136607a5ca0e.tar.gz
nextpnr-f079e0d204117b53a91da2805d31136607a5ca0e.tar.bz2
nextpnr-f079e0d204117b53a91da2805d31136607a5ca0e.zip
ice40: Fix BRAM initialisation
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ice40')
-rw-r--r--ice40/bitstream.cc5
-rw-r--r--ice40/pack.cc3
2 files changed, 4 insertions, 4 deletions
diff --git a/ice40/bitstream.cc b/ice40/bitstream.cc
index fa8e444d..ba4a0e8d 100644
--- a/ice40/bitstream.cc
+++ b/ice40/bitstream.cc
@@ -382,14 +382,15 @@ void write_asc(const Design &design, std::ostream &out)
std::string init = get_param_str_or_def(
cell.second,
std::string("INIT_") + get_hexdigit(w));
+ assert(init != "");
for (int i = 0; i < init.size(); i++) {
bool val = (init.at((init.size() - 1) - i) == '1');
bits.at(i) = val;
}
- for (int i = 0; i < bits.size(); i += 4) {
+ for (int i = bits.size()-4; i >= 0; i -= 4) {
int c = bits.at(i) + (bits.at(i + 1) << 1) +
(bits.at(i + 2) << 2) + (bits.at(i + 3) << 3);
- out << get_hexdigit(c);
+ out << char(std::tolower(get_hexdigit(c)));
}
out << std::endl;
}
diff --git a/ice40/pack.cc b/ice40/pack.cc
index f4c024da..b9a9fe6d 100644
--- a/ice40/pack.cc
+++ b/ice40/pack.cc
@@ -129,8 +129,7 @@ static void pack_ram(Design *design)
ci->name.str() + "_RAM");
packed_cells.insert(ci->name);
new_cells.push_back(packed);
- packed->params["READ_MODE"] = ci->params.at("READ_MODE");
- packed->params["WRITE_MODE"] = ci->params.at("WRITE_MODE");
+ std::copy(ci->params.begin(), ci->params.end(), std::inserter(packed->params, packed->params.begin()));
packed->params["NEG_CLK_W"] =
std::to_string(ci->type == "SB_RAM40_4KNW" ||
ci->type == "SB_RAM40_4KNRNW");