diff options
author | David Shah <davey1576@gmail.com> | 2018-06-16 12:17:36 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-06-16 14:44:10 +0200 |
commit | f079e0d204117b53a91da2805d31136607a5ca0e (patch) | |
tree | 344615172ca197083368744e65a20a6f30af8bc1 | |
parent | c0a26271790b8eb6c67d97b45f089660cdcfa37d (diff) | |
download | nextpnr-f079e0d204117b53a91da2805d31136607a5ca0e.tar.gz nextpnr-f079e0d204117b53a91da2805d31136607a5ca0e.tar.bz2 nextpnr-f079e0d204117b53a91da2805d31136607a5ca0e.zip |
ice40: Fix BRAM initialisation
Signed-off-by: David Shah <davey1576@gmail.com>
-rw-r--r-- | ice40/bitstream.cc | 5 | ||||
-rw-r--r-- | ice40/pack.cc | 3 |
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"); |