read_aiger: also parse abc9_mergeability
authorEddie Hung <eddie@fpgeh.com>
Wed, 22 Jan 2020 22:21:25 +0000 (14:21 -0800)
committerEddie Hung <eddie@fpgeh.com>
Wed, 22 Jan 2020 22:21:25 +0000 (14:21 -0800)
frontends/aiger/aigerparse.cc
frontends/aiger/aigerparse.h

index e7478c3164cd79f5f0a6a20b2c920948bcddaf3b..b9c648afda668ddbdfddbac80bb1db3d1bfac926 100644 (file)
@@ -442,11 +442,13 @@ void AigerReader::parse_xaiger()
                        }
                }
                else if (c == 'r') {
-                       uint32_t dataSize YS_ATTRIBUTE(unused) = parse_xaiger_literal(f);
+                       uint32_t dataSize = parse_xaiger_literal(f);
                        flopNum = parse_xaiger_literal(f);
                        log_debug("flopNum = %u\n", flopNum);
                        log_assert(dataSize == (flopNum+1) * sizeof(uint32_t));
-                       f.ignore(flopNum * sizeof(uint32_t));
+                       mergeability.reserve(flopNum);
+                       for (unsigned i = 0; i < flopNum; i++)
+                               mergeability.emplace_back(parse_xaiger_literal(f));
                }
                else if (c == 'n') {
                        parse_xaiger_literal(f);
@@ -774,6 +776,7 @@ void AigerReader::post_process()
                auto ff = module->addCell(NEW_ID, "$__ABC9_FF_");
                ff->setPort("\\D", d);
                ff->setPort("\\Q", q);
+               ff->attributes["\\abc9_mergeability"] = mergeability[i];
        }
 
        dict<RTLIL::IdString, int> wideports_cache;
index 722f1e472e9cc3c6e5e5e3d3f861f598745ac566..46ac81212b4f8f8e60fb58372212198d1307a0a7 100644 (file)
@@ -45,6 +45,7 @@ struct AigerReader
     std::vector<RTLIL::Wire*> outputs;
     std::vector<RTLIL::Wire*> bad_properties;
     std::vector<RTLIL::Cell*> boxes;
+    std::vector<int> mergeability;
 
     AigerReader(RTLIL::Design *design, std::istream &f, RTLIL::IdString module_name, RTLIL::IdString clk_name, std::string map_filename, bool wideports);
     void parse_aiger();