Move \init from source wire to submod if output port
authorEddie Hung <eddie@fpgeh.com>
Tue, 26 Nov 2019 00:07:47 +0000 (16:07 -0800)
committerEddie Hung <eddie@fpgeh.com>
Tue, 26 Nov 2019 00:07:47 +0000 (16:07 -0800)
passes/hierarchy/submod.cc

index 212932e4676011f8eb8b380e556257ce90327d26..7952c2dd6f79295753810e465a4094febbff869b 100644 (file)
@@ -162,6 +162,13 @@ struct SubmodWorker
                        new_wire->port_input = new_wire_port_input;
                        new_wire->port_output = new_wire_port_output;
                        new_wire->attributes = wire->attributes;
+                       if (new_wire->port_output) {
+                               auto it = wire->attributes.find(ID(init));
+                               if (it != wire->attributes.end()) {
+                                       new_wire->attributes[ID(init)] = it->second[bit.offset];
+                                       it->second[bit.offset] = State::Sx;
+                               }
+                       }
 
                        if (new_wire->port_input && new_wire->port_output)
                                log("  signal %s: inout %s\n", wire->name.c_str(), new_wire->name.c_str());