input cell-types now output 0 on output as well.\
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 13 Jun 2018 12:15:46 +0000 (13:15 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 13 Jun 2018 12:15:46 +0000 (13:15 +0100)
not a good idea to output an input!

src/bsv/actual_pinmux.py

index a920db61c6ec894271570c412d943842df5af122..a4ff0e4089dfcaffb7edcbc07627e119e58f4672 100644 (file)
@@ -36,14 +36,22 @@ def transfn(temp):
         temp[0] = temp[0] .replace(' ', '')
     return '_'.join(temp)
 
-def fmt(cell):
+def fmt(ifaces, cell):
     """ blank entries need to output a 0 to the pin (it could just as
         well be a 1 but we choose 0).  reason: blank entries in
         the pinmap.txt file indicate that there's nothing to choose
         from.  however the user may still set the muxer to that value,
         and rather than throw an exception we choose to output... zero.
     """
-    return "%s_io" % cell if cell else '0'
+    empty = '0' # XXX TODO: fix this, as it's assigned to GenericIOType
+    if not cell:
+        return empty
+    # work out the type.  if it's an input, return empty
+    temp = cell[1].translate(digits)
+    x = ifaces.getifacetype(temp)
+    if x == 'input':
+        return empty
+    return "%s_io" % cell
 
 def init(p, ifaces):
     """ generates the actual output pinmux for each io-cell.  blank lines
@@ -57,8 +65,8 @@ def init(p, ifaces):
         p.pinmux += "      %s_out=" % cn(cell[0])
         for i in range(0, len(cell) - 2):
             p.pinmux += "wr%s" % cn(cell[0]) + \
-                "==" + str(i) + "?" + fmt(cell[i + 1]) + ":\n\t\t\t"
-        p.pinmux += fmt(cell[i + 2])
+                "==" + str(i) + "?" + fmt(ifaces, cell[i + 1]) + ":\n\t\t\t"
+        p.pinmux += fmt(ifaces, cell[i + 2])
         p.pinmux += ";\n"
         # ======================================================== #