From: Eddie Hung Date: Mon, 13 Apr 2020 22:16:51 +0000 (-0700) Subject: zinit: fix review comments from @mwkmwkmwk X-Git-Tag: working-ls180~663^2~1 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c6afce763807862305c4ade28ef5bb72a4b078f6;p=yosys.git zinit: fix review comments from @mwkmwkmwk --- diff --git a/passes/techmap/zinit.cc b/passes/techmap/zinit.cc index fb2f92d4e..b7beb4e9d 100644 --- a/passes/techmap/zinit.cc +++ b/passes/techmap/zinit.cc @@ -117,7 +117,7 @@ struct ZinitPass : public Pass { const auto &d = initbits.at(sig_q[i]); initval.bits.push_back(d.first); const auto &b = d.second; - b.wire->attributes.at(ID::init)[b.offset]; + b.wire->attributes.at(ID::init)[b.offset] = State::Sx; } else initval.bits.push_back(all_mode ? State::S0 : State::Sx); } @@ -126,11 +126,11 @@ struct ZinitPass : public Pass { initwire->attributes[ID::init] = initval; for (int i = 0; i < GetSize(initwire); i++) - if (initval.bits.at(i) == State::S1) + if (initval[i] == State::S1) { sig_d[i] = module->NotGate(NEW_ID, sig_d[i]); module->addNotGate(NEW_ID, SigSpec(initwire, i), sig_q[i]); - initwire->attributes[ID::init].bits.at(i) = State::S0; + initwire->attributes[ID::init][i] = State::S0; } else { @@ -145,8 +145,9 @@ struct ZinitPass : public Pass { if (cell->type == ID($adff)) { auto val = cell->getParam(ID::ARST_VALUE); - for (auto &b : val) - b = (b == State::S1 ? State::S0 : State::S1); + for (int i = 0; i < GetSize(initwire); i++) + if (initval[i] == State::S1) + val[i] = (val[i] == State::S1 ? State::S0 : State::S1); cell->setParam(ID::ARST_VALUE, std::move(val)); } else if (cell->type.in(ID($_DFF_NN0_), ID($_DFF_NN1_), ID($_DFF_NP0_), ID($_DFF_NP1_), diff --git a/tests/techmap/zinit.ys b/tests/techmap/zinit.ys index caeab69d3..c74218f7c 100644 --- a/tests/techmap/zinit.ys +++ b/tests/techmap/zinit.ys @@ -1,5 +1,5 @@ read_verilog -icells <