print cell name for properties in yosys-smtbmc
authorN. Engelhardt <nak@yosyshq.com>
Fri, 4 Feb 2022 17:23:12 +0000 (18:23 +0100)
committerN. Engelhardt <nak@yosyshq.com>
Tue, 22 Feb 2022 16:00:10 +0000 (17:00 +0100)
backends/smt2/smt2.cc
backends/smt2/smtio.py

index a928419a1b6437c237e2e076132c4229085e341c..9bf0de03ed3a1da647d91c82b11c800f245bb995 100644 (file)
@@ -985,8 +985,10 @@ struct Smt2Worker
 
                                string name_a = get_bool(cell->getPort(ID::A));
                                string name_en = get_bool(cell->getPort(ID::EN));
-                               string infostr = (cell->name[0] == '$' && cell->attributes.count(ID::src)) ? cell->attributes.at(ID::src).decode_string() : get_id(cell);
-                               decls.push_back(stringf("; yosys-smt2-%s %d %s\n", cell->type.c_str() + 1, id, infostr.c_str()));
+                               if (cell->name[0] == '$' && cell->attributes.count(ID::src))
+                                       decls.push_back(stringf("; yosys-smt2-%s %d %s %s\n", cell->type.c_str() + 1, id, get_id(cell), cell->attributes.at(ID::src).decode_string().c_str()));
+                               else
+                                       decls.push_back(stringf("; yosys-smt2-%s %d %s\n", cell->type.c_str() + 1, id, get_id(cell)));
 
                                if (cell->type == ID($cover))
                                        decls.push_back(stringf("(define-fun |%s_%c %d| ((state |%s_s|)) Bool (and %s %s)) ; %s\n",
index d73a875ba4c116e164d90c782098b2e23b56025f..3d458e6cffc9a0cbd2ce0987d1340160558d76b5 100644 (file)
@@ -536,10 +536,16 @@ class SmtIo:
                     self.modinfo[self.curmod].clocks[fields[2]] = "event"
 
         if fields[1] == "yosys-smt2-assert":
-            self.modinfo[self.curmod].asserts["%s_a %s" % (self.curmod, fields[2])] = fields[3]
+            if len(fields) > 4:
+                self.modinfo[self.curmod].asserts["%s_a %s" % (self.curmod, fields[2])] = f'{fields[4]} ({fields[3]})'
+            else:
+                self.modinfo[self.curmod].asserts["%s_a %s" % (self.curmod, fields[2])] = fields[3]
 
         if fields[1] == "yosys-smt2-cover":
-            self.modinfo[self.curmod].covers["%s_c %s" % (self.curmod, fields[2])] = fields[3]
+            if len(fields) > 4:
+                self.modinfo[self.curmod].covers["%s_c %s" % (self.curmod, fields[2])] = f'{fields[4]} ({fields[3]})'
+            else:
+                self.modinfo[self.curmod].covers["%s_c %s" % (self.curmod, fields[2])] = fields[3]
 
         if fields[1] == "yosys-smt2-maximize":
             self.modinfo[self.curmod].maximize.add(fields[2])