ha! have to explicitly specify the ports when writing out to ilang or verilog
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 30 Jul 2020 12:27:55 +0000 (13:27 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 30 Jul 2020 12:27:55 +0000 (13:27 +0100)
this gives unused signals that default to a non-zero value to inherently
set by default to that value.
exposing them externally via ports makes setting them the *users*

src/soc/experiment/l0_cache.py
src/soc/simple/issuer.py
src/soc/simple/issuer_verilog.py

index 7ffaa05d5b0f5350ee0623f116d9c407d4214288..cc74c53810ef15759a71189518e7faffae6d5d3a 100644 (file)
@@ -259,10 +259,13 @@ class L0CacheBuffer(Elaboratable):
 
         return m
 
-    def ports(self):
+    def __iter__(self):
         for p in self.dports:
             yield from p.ports()
 
+    def ports(self):
+        return list(self)
+
 
 class TstL0CacheBuffer(Elaboratable):
     def __init__(self, pspec, n_units=3):
index 1c3574facf31627ae9eed7fbe87ad46a22b75a43..c45bb28a1e11b0e7ba09d62a58f5fa4da125de90 100644 (file)
@@ -211,6 +211,23 @@ class TestIssuer(Elaboratable):
     def ports(self):
         return list(self)
 
+    def external_ports(self):
+        return self.pc_i.ports() + [self.pc_o,
+                                    self.go_insn_i,
+                                    self.memerr_o,
+                                    self.core_start_i,
+                                    self.core_stop_i,
+                                    self.core_bigendian_i,
+                                    self.busy_o,
+                                    self.halted_o,
+                                    ] + \
+                self.imem.ports() + \
+                self.core.l0.cmpi.lsmem.lsi.ports()
+
+
+    def ports(self):
+        return list(self)
+
 
 if __name__ == '__main__':
     units = {'alu': 1, 'cr': 1, 'branch': 1, 'trap': 1, 'logical': 1,
@@ -227,6 +244,6 @@ if __name__ == '__main__':
     vl = main(dut, ports=dut.ports(), name="test_issuer")
 
     if len(sys.argv) == 1:
-        vl = rtlil.convert(dut, ports=dut.ports(), name="test_issuer")
+        vl = rtlil.convert(dut, ports=dut.external_ports(), name="test_issuer")
         with open("test_issuer.il", "w") as f:
             f.write(vl)
index 14a8d53dbbb4c6c3d35ed0a0a3ca5010809f97b6..d77464b545d20da905f319e1c4f379cd9ec35d5b 100644 (file)
@@ -24,6 +24,6 @@ if __name__ == '__main__':
                          units=units)
     dut = TestIssuer(pspec)
 
-    vl = verilog.convert(dut, ports=dut.ports(), name="test_issuer")
+    vl = verilog.convert(dut, ports=dut.external_ports(), name="test_issuer")
     with open(sys.argv[1], "w") as f:
         f.write(vl)