From 7beb11e5c3183de30b9f781aeda701410d15575c Mon Sep 17 00:00:00 2001 From: Jean THOMAS Date: Mon, 27 Jul 2020 15:10:58 +0200 Subject: [PATCH] Add Precharge-For-Refresh state --- gram/core/bankmachine.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/gram/core/bankmachine.py b/gram/core/bankmachine.py index ad289d6..d956aac 100644 --- a/gram/core/bankmachine.py +++ b/gram/core/bankmachine.py @@ -176,7 +176,10 @@ class BankMachine(Elaboratable): with m.FSM(): with m.State("Regular"): with m.If(self.refresh_req): - m.next = "Refresh" + with m.If(row_opened): + m.next = "Precharge-For-Refresh" + with m.Else(): + m.next = "Refresh" with m.Elif(cmd_buffer.source.valid): with m.If(row_opened): with m.If(row_hit): @@ -216,6 +219,20 @@ class BankMachine(Elaboratable): with m.If(self.cmd.ready): m.next = "tRP" + with m.State("Precharge-For-Refresh"): + m.d.comb += row_close.eq(1) + + with m.If(twtpcon.ready & trascon.ready): + m.d.comb += [ + self.cmd.valid.eq(1), + self.cmd.ras.eq(1), + self.cmd.we.eq(1), + self.cmd.is_cmd.eq(1), + ] + + with m.If(self.cmd.ready): + m.next = "Refresh" + with m.State("Autoprecharge"): m.d.comb += row_close.eq(1) -- 2.30.2