Simplify refresher code
authorJean THOMAS <git0@pub.jeanthomas.me>
Mon, 27 Jul 2020 17:29:00 +0000 (19:29 +0200)
committerJean THOMAS <git0@pub.jeanthomas.me>
Mon, 27 Jul 2020 17:29:00 +0000 (19:29 +0200)
gram/core/refresher.py

index 7c68fec76c0befd372ddf4d1c664a11ba219631c..80cb6594a5a16bcf0c3d2760a10a6018af079902 100644 (file)
@@ -368,34 +368,25 @@ class Refresher(Elaboratable):
 
             if settings.timing.tZQCS is None:
                 with m.State("Do-Refresh"):
-                    m.d.comb += self.cmd.valid.eq(1)
+                    m.d.comb += self.cmd.valid.eq(~sequencer.done)
                     with m.If(sequencer.done):
-                        m.d.comb += [
-                            self.cmd.valid.eq(0),
-                            self.cmd.last.eq(1),
-                        ]
+                        m.d.comb += self.cmd.last.eq(1)
                         m.next = "Idle"
             else:
                 with m.State("Do-Refresh"):
-                    m.d.comb += self.cmd.valid.eq(1)
+                    m.d.comb += self.cmd.valid.eq(~wants_zqcs)
                     with m.If(sequencer.done):
                         with m.If(wants_zqcs):
                             m.d.comb += zqcs_executer.start.eq(1)
                             m.next = "Do-Zqcs"
                         with m.Else():
-                            m.d.comb += [
-                                self.cmd.valid.eq(0),
-                                self.cmd.last.eq(1),
-                            ]
+                            m.d.comb += self.cmd.last.eq(1)
                             m.next = "Idle"
 
                 with m.State("Do-Zqcs"):
-                    m.d.comb += self.cmd.valid.eq(1)
+                    m.d.comb += self.cmd.valid.eq(~zqcs_executer.done)
                     with m.If(zqcs_executer.done):
-                        m.d.comb += [
-                            self.cmd.valid.eq(0),
-                            self.cmd.last.eq(1),
-                        ]
+                        m.d.comb += self.cmd.last.eq(1)
                         m.next = "Idle"
 
         # Connect sequencer/executer outputs to cmd