ecc: update core/test

This commit is contained in:
Florent Kermarrec 2018-10-12 17:13:53 +02:00
parent 8a0d0f09f9
commit 9a950f051a
2 changed files with 5 additions and 4 deletions

View File

@ -150,8 +150,8 @@ class ECCDecoder(SECDEC, Module):
class LiteDRAMNativePortECCW(Module): class LiteDRAMNativePortECCW(Module):
def __init__(self, data_width_from, data_width_to): def __init__(self, data_width_from, data_width_to):
self.sink = sink = Endpoint(wdata_description(data_width_from, False)) self.sink = sink = Endpoint(wdata_description(data_width_from))
self.source = source = Endpoint(wdata_description(data_width_to, False)) self.source = source = Endpoint(wdata_description(data_width_to))
# # # # # #
@ -168,8 +168,8 @@ class LiteDRAMNativePortECCW(Module):
class LiteDRAMNativePortECCR(Module): class LiteDRAMNativePortECCR(Module):
def __init__(self, data_width_from, data_width_to): def __init__(self, data_width_from, data_width_to):
self.sink = sink = Endpoint(rdata_description(data_width_to, False)) self.sink = sink = Endpoint(rdata_description(data_width_to))
self.source = source = Endpoint(rdata_description(data_width_from, False)) self.source = source = Endpoint(rdata_description(data_width_from))
self.enable = Signal() self.enable = Signal()
self.sec = Signal(8) self.sec = Signal(8)
self.dec = Signal(8) self.dec = Signal(8)

View File

@ -53,6 +53,7 @@ class TestECC(unittest.TestCase):
def generator(dut, k, nvalues, nerrors): def generator(dut, k, nvalues, nerrors):
dut.errors = 0 dut.errors = 0
prng = random.Random(42) prng = random.Random(42)
yield dut.decoder.enable.eq(1)
for i in range(nvalues): for i in range(nvalues):
data = prng.randrange(2**k-1) data = prng.randrange(2**k-1)
yield dut.encoder.i.eq(data) yield dut.encoder.i.eq(data)