make: Getting the Verilog to XML stuff working again.

Signed-off-by: Tim 'mithro' Ansell <me@mith.ro>
diff --git a/vlog_to_model.py b/vlog_to_model.py
index ef71a44..6f8fdd7 100755
--- a/vlog_to_model.py
+++ b/vlog_to_model.py
@@ -44,6 +44,7 @@
 """)
 
 args = parser.parse_args()
+iname = os.path.basename(args.infiles[0])
 
 aig_json = yosys.run.vlog_to_json(args.infiles, True, True)
 
@@ -51,11 +52,11 @@
     yj = YosysJson(aig_json, args.top)
     top = yj.top
 else:
-    wm = re.match(r"([A-Za-z0-9_]+)\.sim\.v", args.infiles[0])
+    wm = re.match(r"([A-Za-z0-9_]+)\.sim\.v", iname)
     if wm:
         top = wm.group(1).upper()
     else:
-        print("ERROR file name not of format %.sim.v, cannot detect top level. Manually specify the top level module using --top")
+        print("ERROR file name not of format %.sim.v ({}), cannot detect top level. Manually specify the top level module using --top").format(iname)
         sys.exit(1)
     yj = YosysJson(aig_json, top)
 
@@ -103,3 +104,4 @@
 f = open(outfile, 'w')
 f.write(ET.tostring(models_xml, pretty_print=True).decode('utf-8'))
 f.close()
+print("Generated {} from {}".format(outfile, iname))
diff --git a/vlog_to_pbtype.py b/vlog_to_pbtype.py
index 66ecaaf..506043f 100755
--- a/vlog_to_pbtype.py
+++ b/vlog_to_pbtype.py
@@ -74,6 +74,7 @@
 """)
 
 args = parser.parse_args()
+iname = os.path.basename(args.infiles[0])
 
 yosys.run.add_define("PB_TYPE")
 vjson = yosys.run.vlog_to_json(args.infiles, False, False)
@@ -89,11 +90,11 @@
 if args.top is not None:
     top = args.top
 else:
-    wm = re.match(r"([A-Za-z0-9_]+)\.sim\.v", args.infiles[0])
+    wm = re.match(r"([A-Za-z0-9_]+)\.sim\.v", iname)
     if wm:
         top = wm.group(1).upper()
     else:
-        print("ERROR file name not of format %.sim.v, cannot detect top level. Manually specify the top level module using --top")
+        print("ERROR file name not of format %.sim.v ({}), cannot detect top level. Manually specify the top level module using --top".format(iname))
         sys.exit(1)
 
 
@@ -314,3 +315,4 @@
 f = open(outfile, 'w')
 f.write(ET.tostring(pb_type_xml, pretty_print=True).decode('utf-8'))
 f.close()
+print("Generated {} from {}".format(outfile, iname))
diff --git a/yosys/json.py b/yosys/json.py
index 6b625ee..968fbdd 100755
--- a/yosys/json.py
+++ b/yosys/json.py
@@ -212,6 +212,9 @@
 
     def module(self, module):
         """Get a given module (by name) as a `YosysModule`"""
+        if module not in self.data["modules"]:
+            raise KeyError("No yosys module named {} (only have {})".format(
+                module, self.data["modules"].keys()))
         return YosysModule(module, self.data["modules"][module])
 
     def modules_with_attr(self, attr_name, attr_value):