Fix timings in libgram
authorJean THOMAS <git0@pub.jeanthomas.me>
Mon, 13 Jul 2020 11:08:17 +0000 (13:08 +0200)
committerJean THOMAS <git0@pub.jeanthomas.me>
Mon, 13 Jul 2020 11:08:17 +0000 (13:08 +0200)
gram/core/bankmachine.py
libgram/src/dfii.c

index 3b85ddd98377c4048ca1ff27715bf5d0b855672b..a9c431927b6be323a69230bad4fd70fb52beea95 100644 (file)
@@ -18,6 +18,24 @@ __ALL__ = ["BankMachine"]
 
 # AddressSlicer ------------------------------------------------------------------------------------
 
+class _AddressSlicerWIP(Elaboratable):
+    def __init__(self, addrbits, colbits, address_align):
+        self._address_align = address_align
+        self._split = colbits - address_align
+        
+        self.address = Signal(addrbits)
+        self.row = Signal(addrbits-self._split)
+        self.col = Signal(address_align+self._split)
+
+    def elaborate(self, platform):
+        m = Module()
+
+        m.d.comb += [
+            self.row.eq(self.address[self._split:]),
+            self.col.eq(Cat(Repl(0, self._address_align), self.address[:self._split]))
+        ]
+
+        return m
 
 class _AddressSlicer:
     """Helper for extracting row/col from address
@@ -131,6 +149,15 @@ class BankMachine(Elaboratable):
 
         slicer = _AddressSlicer(self.settings.geom.colbits, self._address_align)
 
+        m.submodules.lookahead_slicer = lookahead_slicer = _AddressSlicerWIP(len(cmd_buffer_lookahead.source.addr),
+            self.settings.geom.colbits, self._address_align)
+        m.submodules.current_slicer = current_slicer = _AddressSlicerWIP(len(cmd_buffer.source.addr),
+            self.settings.geom.colbits, self._address_align)
+        m.d.comb += [
+            current_slicer.address.eq(cmd_buffer.source.addr),
+            lookahead_slicer.address.eq(cmd_buffer_lookahead.source.addr),
+        ]
+
         # Row tracking -----------------------------------------------------------------------------
         row = Signal(self.settings.geom.rowbits)
         row_opened = Signal()
index d2b73349d19d60cd577ef2221a3f92332fee9246..044c939bfe6e3e152797f9b7265e198af824ccbb 100644 (file)
@@ -81,11 +81,11 @@ void dfii_initseq(struct gramCtx *ctx) {
        dfii_set_p0_address(ctx, 0x320);
        dfii_set_p0_baddress(ctx, 0);
        dfii_p0_command(ctx, DFII_COMMAND_RAS|DFII_COMMAND_CAS|DFII_COMMAND_WE|DFII_COMMAND_CS);
-       cdelay(200);
+       cdelay(600);
 
        /* ZQ Calibration */
        dfii_set_p0_address(ctx, 0x400);
        dfii_set_p0_baddress(ctx, 0);
        dfii_p0_command(ctx, DFII_COMMAND_WE|DFII_COMMAND_CS);
-       cdelay(200);
+       cdelay(600);
 }