random commenting and code-morph of Logical
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 14 May 2020 21:02:59 +0000 (22:02 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 14 May 2020 21:02:59 +0000 (22:02 +0100)
src/soc/logical/main_stage.py

index 72fb9d4fd21cf947c975243bfcdc02fd71b09f59..961b201c1d59d3c1715f24c73cb08d47112f852b 100644 (file)
@@ -51,15 +51,14 @@ class LogicalMainStage(PipeModBase):
             with m.Case(InternalOp.OP_CMPB):
                 for i in range(8):
                     slc = slice(i*8, (i+1)*8)
-                    with m.If(a[slc] == b[slc]):
-                        comb += o[slc].eq(Repl(1, 8))
-                    with m.Else():
-                        comb += o[slc].eq(Repl(0, 8))
+                    comb += o[slc].eq(Repl(a[slc] == b[slc], 8))
 
             ###### popcount #######
             with m.Case(InternalOp.OP_POPCNT):
                 # starting from a, perform successive addition-reductions
+                # creating arrays big enough to store the sum, each time
                 pc = [a]
+                # QTY32 2-bit (to take 2x 1-bit sums) etc.
                 work = [(32, 2), (16, 3), (8, 4), (4, 5), (2, 6), (1, 6)]
                 for l, b in work:
                     pc.append(array_of(l, b))