Made creation of Array of Signals in bperm.py more concise, changed
authorcolepoirier <colepoirier@gmail.com>
Sat, 16 May 2020 22:02:36 +0000 (15:02 -0700)
committercolepoirier <colepoirier@gmail.com>
Sat, 16 May 2020 22:05:04 +0000 (15:05 -0700)
string formatting to use python3 f"string{x}"

src/soc/logical/bperm.py

index d312280d15da9d126c505c3202eeb356ed4a5f59..518a4a81f891ed3139786b306cc2eaa4da0305ef 100644 (file)
@@ -36,13 +36,12 @@ class Bpermd(Elaboratable):
     def elaborate(self, platform):
         m = Module()
         index = Signal(8, reset_less=True)
-        signals = [Signal(1, reset_less=True) for i in range(64)]
-        for i, n in enumerate(signals):
-            m.d.comb += n.eq(self.rb[i])
-        rb64 = Array(signals) # makes this indexable dynamically (a pmux)
+        rb64 = Array([Signal(1, reset_less=True, name=f"rb64_{i}") for i in range(64)])
+        for i in range(64):
+            m.d.comb += rb64[i].eq(self.rb[i])
         for i in range(8):
             index = self.rs[8*i:8*i+8]
-            idx = Signal(8, name="idx%d" % i, reset_less=True)
+            idx = Signal(8, name=f"idx_{i}", reset_less=True)
             m.d.comb += idx.eq(index)
             with m.If(idx < 64):
                 m.d.comb += self.perm[i].eq(rb64[idx])