utils: vlog: handle multilple instances of auto inferred cells

Signed-off-by: Karol Gugala <kgugala@antmicro.com>
Signed-off-by: Tim 'mithro' Ansell <me@mith.ro>
diff --git a/vlog_to_pbtype.py b/vlog_to_pbtype.py
index e8e1899..5c33ece 100755
--- a/vlog_to_pbtype.py
+++ b/vlog_to_pbtype.py
@@ -162,7 +162,7 @@
             instance = "[" + str(instance) + "]"
         cname, cellpin = pin
         if cname.startswith("$"):
-            return cname, True
+            return mod.cell_type(cname) + instance, True
         elif cname != mod.name:
             cname = mod.cell_type(cname)
             modname = mod_pb_name(yj.module(cname)) + instance
@@ -248,6 +248,7 @@
             module_file = yj.get_module_file(i_of)
             module_path = os.path.dirname(module_file)
             module_basename = os.path.basename(module_file)
+
             # Heuristic for autogenerated files from w.py
             if not pbtype_already_included:
                 wm = re.match(r"([A-Za-z0-9_]+)\.sim\.v", module_basename)
diff --git a/yosys/json.py b/yosys/json.py
index 5307108..bdbaa74 100755
--- a/yosys/json.py
+++ b/yosys/json.py
@@ -52,8 +52,6 @@
         """
         clist = []
         for cell, cdata in sorted(self.data["cells"].items()):
-            if cell.startswith("$"):
-                continue
             clist.append((cell, cdata["type"]))
         return clist