From 1966cff21a29ccd53f22bdf6ee64047aadde1d70 Mon Sep 17 00:00:00 2001 From: Jean THOMAS Date: Mon, 13 Jul 2020 13:08:17 +0200 Subject: [PATCH] Fix timings in libgram --- gram/core/bankmachine.py | 27 +++++++++++++++++++++++++++ libgram/src/dfii.c | 4 ++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/gram/core/bankmachine.py b/gram/core/bankmachine.py index 3b85ddd..a9c4319 100644 --- a/gram/core/bankmachine.py +++ b/gram/core/bankmachine.py @@ -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() diff --git a/libgram/src/dfii.c b/libgram/src/dfii.c index d2b7334..044c939 100644 --- a/libgram/src/dfii.c +++ b/libgram/src/dfii.c @@ -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); } -- 2.30.2