Merge pull request #44 from enjoy-digital/tRC_Fix

This adds support for tRC timing parameters
This commit is contained in:
enjoy-digital 2018-09-23 18:09:15 +02:00 committed by GitHub
commit 59020270af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 9 deletions

View File

@ -43,7 +43,7 @@ class GeomSettings:
class TimingSettings: class TimingSettings:
def __init__(self, tRP, tRCD, tWR, tWTR, tREFI, tRFC, tFAW, tCCD, tRRD): def __init__(self, tRP, tRCD, tWR, tWTR, tREFI, tRFC, tFAW, tCCD, tRRD, tRC):
self.tRP = tRP self.tRP = tRP
self.tRCD = tRCD self.tRCD = tRCD
self.tWR = tWR self.tWR = tWR
@ -53,6 +53,7 @@ class TimingSettings:
self.tFAW = tFAW self.tFAW = tFAW
self.tCCD = tCCD self.tCCD = tCCD
self.tRRD = tRRD self.tRRD = tRRD
self.tRC = tRC
def cmd_layout(address_width): def cmd_layout(address_width):

View File

@ -89,6 +89,17 @@ class BankMachine(Module):
self.submodules += precharge_timer self.submodules += precharge_timer
self.comb += precharge_timer.wait.eq(~(cmd.valid & cmd.ready & cmd.is_write)) self.comb += precharge_timer.wait.eq(~(cmd.valid & cmd.ready & cmd.is_write))
# Respect tRC activate-activate time
activate_allowed = Signal()
if settings.timing.tRC is not None:
trc_time = settings.timing.tRC - 1
trc_timer = WaitTimer(trc_time)
self.submodules += trc_timer
self.comb += trc_timer.wait.eq(~(cmd.valid & cmd.ready & track_open))
self.comb += activate_allowed.eq(trc_timer.done)
else:
self.comb += activate_allowed.eq(1)
# Auto Precharge # Auto Precharge
if settings.with_auto_precharge: if settings.with_auto_precharge:
self.comb += [ self.comb += [
@ -151,6 +162,7 @@ class BankMachine(Module):
track_close.eq(1) track_close.eq(1)
) )
fsm.act("ACTIVATE", fsm.act("ACTIVATE",
If(activate_allowed,
sel_row_addr.eq(1), sel_row_addr.eq(1),
track_open.eq(1), track_open.eq(1),
cmd.valid.eq(ras_allowed), cmd.valid.eq(ras_allowed),
@ -160,6 +172,7 @@ class BankMachine(Module):
), ),
cmd.ras.eq(1) cmd.ras.eq(1)
) )
)
fsm.act("REFRESH", fsm.act("REFRESH",
If(precharge_timer.done, If(precharge_timer.done,
self.refresh_gnt.eq(1), self.refresh_gnt.eq(1),

View File

@ -35,6 +35,7 @@ class SDRAMModule:
tFAW=None if self.get("tFAW") is None else self.ck_ns_to_cycles(*self.get("tFAW")), tFAW=None if self.get("tFAW") is None else self.ck_ns_to_cycles(*self.get("tFAW")),
tCCD=None if self.get("tCCD") is None else self.ck_ns_to_cycles(*self.get("tCCD")), tCCD=None if self.get("tCCD") is None else self.ck_ns_to_cycles(*self.get("tCCD")),
tRRD=None if self.get("tRRD") is None else self.ns_to_cycles_trrd(self.get("tRRD")), tRRD=None if self.get("tRRD") is None else self.ns_to_cycles_trrd(self.get("tRRD")),
tRC=None if self.get("tRC") is None else self.ns_to_cycles(self.get("tRC"))
) )
def get(self, name): def get(self, name):
@ -252,24 +253,28 @@ class MT41J128M16(SDRAMModule):
tWR_1066 = 13.1 tWR_1066 = 13.1
tRFC_1066 = 86 tRFC_1066 = 86
tFAW_1066 = (27, None) tFAW_1066 = (27, None)
tRC_1066 = 50.625
# DDR3-1333 # DDR3-1333
tRP_1333 = 13.5 tRP_1333 = 13.5
tRCD_1333 = 13.5 tRCD_1333 = 13.5
tWR_1333 = 13.5 tWR_1333 = 13.5
tRFC_1333 = 107 tRFC_1333 = 107
tFAW_1333 = (30, None) tFAW_1333 = (30, None)
tRC_1333 = 49.5
# DDR3-1600 # DDR3-1600
tRP_1600 = 13.75 tRP_1600 = 13.75
tRCD_1600 = 13.75 tRCD_1600 = 13.75
tWR_1600 = 13.75 tWR_1600 = 13.75
tRFC_1600 = 128 tRFC_1600 = 128
tFAW_1600 = (32, None) tFAW_1600 = (32, None)
tRC_1600 = 48.75
# API retro-compatibility # API retro-compatibility
tRP = tRP_1600 tRP = tRP_1600
tRCD = tRCD_1600 tRCD = tRCD_1600
tWR = tWR_1600 tWR = tWR_1600
tRFC = tRFC_1600 tRFC = tRFC_1600
tFAW = tFAW_1600 tFAW = tFAW_1600
tRC = tRC_1600
class MT41K128M16(MT41J128M16): class MT41K128M16(MT41J128M16):