minor cleanup of shift_rot main_stage
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 13 May 2020 18:55:41 +0000 (19:55 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 13 May 2020 18:55:51 +0000 (19:55 +0100)
src/soc/shift_rot/main_stage.py

index e0b453b40164cb54409eb67c31831c1b870f3c9e..0b78212075092acbd25cf4d85f01cf0b89f73398 100644 (file)
@@ -30,6 +30,8 @@ class ShiftRotMainStage(PipeModBase):
     def elaborate(self, platform):
         m = Module()
         comb = m.d.comb
+
+        # set up microwatt rotator module
         m.submodules.rotator = rotator = Rotator()
         comb += [
             rotator.rs.eq(self.i.rs),
@@ -40,14 +42,7 @@ class ShiftRotMainStage(PipeModBase):
             rotator.arith.eq(self.i.ctx.op.is_signed),
         ]
 
-        # Defaults
-        comb += [rotator.right_shift.eq(0),
-                 rotator.clear_left.eq(0),
-                 rotator.clear_right.eq(0)]
-
-        comb += [self.o.o.eq(rotator.result_o),
-                 self.o.carry_out.eq(rotator.carry_out_o)]
-
+        # instruction rotate type
         with m.Switch(self.i.ctx.op.insn_type):
             with m.Case(InternalOp.OP_SHL):
                 comb += [rotator.right_shift.eq(0),
@@ -62,10 +57,9 @@ class ShiftRotMainStage(PipeModBase):
                         rotator.clear_left.eq(1),
                         rotator.clear_right.eq(1)]
                 
-
-
-
-
+        # outputs from the microwatt rotator module
+        comb += [self.o.o.eq(rotator.result_o),
+                 self.o.carry_out.eq(rotator.carry_out_o)]
 
         ###### sticky overflow and context, both pass-through #####