core/refresher: reduce refresh period by one cycle

This commit is contained in:
Florent Kermarrec 2019-07-24 08:18:04 +02:00
parent afb6d0a15e
commit 6c53996a70
2 changed files with 5 additions and 5 deletions

View file

@ -53,7 +53,7 @@ class RefreshTimer(Module):
def __init__(self, trefi):
self.wait = wait = Signal()
self.done = done = Signal()
self.count = count = Signal(bits_for(trefi), reset=trefi)
self.count = count = Signal(bits_for(trefi), reset=trefi-1)
self.load = load = Signal()
self.load_count = load_count = Signal(bits_for(trefi))

View file

@ -44,14 +44,14 @@ class TestRefresh(unittest.TestCase):
def refresh_timer_test(self, trefi):
def generator(dut):
dut.errors = 0
for i in range(16*(trefi + 1)):
yield
if i%(trefi + 1) == (trefi - 1):
for i in range(16*trefi):
if i%trefi == (trefi - 1):
if (yield dut.refresh.done) != 1:
dut.errors += 1
else:
if (yield dut.refresh.done) != 0:
dut.errors += 1
yield
class DUT(Module):
def __init__(self, trefi):
@ -93,7 +93,7 @@ class TestRefresh(unittest.TestCase):
while (yield dut.cmd.valid) == 0:
cmd_valid_gap += 1
yield
if cmd_valid_gap != (settings.timing.tREFI + 1):
if cmd_valid_gap != settings.timing.tREFI:
dut.errors += 1
dut = Refresher(settings)