P.replace(pm.sigmap(D), Q);
st.ffP->connections_.at("\\Q").replace(P, pm.module->addWire(NEW_ID, GetSize(P)));
+ for (auto c : Q.chunks()) {
+ auto it = c.wire->attributes.find("\\init");
+ if (it == c.wire->attributes.end())
+ continue;
+ for (int i = c.offset; i < c.offset+c.width; i++) {
+ log_assert(it->second[i] == State::S0 || it->second[i] == State::Sx);
+ it->second[i] = State::Sx;
+ }
+ }
+
cell->setParam("\\PREG", State::S1);
}
code argQ
if (ff) {
- for (auto b : argQ)
- if (b.wire->get_bool_attribute(\keep))
+ for (auto c : argQ.chunks())
+ if (c.wire->get_bool_attribute(\keep))
reject;
if (clock != SigBit()) {
if (dff) {
dffQ = port(dff, \Q);
- for (auto b : dffQ)
- if (b.wire->get_bool_attribute(\keep))
+ for (auto c : dffQ.chunks()) {
+ if (c.wire->get_bool_attribute(\keep))
reject;
+ Const init = c.wire->attributes.at(\init, State::Sx);
+ if (!init.is_fully_undef() && !init.is_fully_zero())
+ reject;
+ }
if (clock != SigBit()) {
if (port(dff, \CLK) != clock)