test: split GenCheckDriver run into configure/run

This commit is contained in:
Jędrzej Boczar 2020-03-13 09:58:02 +01:00
parent 4cfbc71fc2
commit ac06382b5a
1 changed files with 16 additions and 7 deletions

View File

@ -29,12 +29,15 @@ class GenCheckDriver:
yield self.module.reset.eq(0) yield self.module.reset.eq(0)
yield yield
def run(self, base, length, end=None): def configure(self, base, length, end=None):
# for non-pattern generators/checkers
if end is None: if end is None:
end = base + 0x100000 end = base + 0x100000
yield self.module.base.eq(base) yield self.module.base.eq(base)
yield self.module.end.eq(end) yield self.module.end.eq(end)
yield self.module.length.eq(length) yield self.module.length.eq(length)
def run(self):
yield self.module.run.eq(1) yield self.module.run.eq(1)
yield self.module.start.eq(1) yield self.module.start.eq(1)
yield yield
@ -101,7 +104,8 @@ class TestBIST(unittest.TestCase):
yield from init_generator(dut) yield from init_generator(dut)
yield from generator.reset() yield from generator.reset()
yield from generator.run(base, length, end=end) yield from generator.configure(base, length, end=end)
yield from generator.run()
yield yield
dut = DUT() dut = DUT()
@ -176,25 +180,30 @@ class TestBIST(unittest.TestCase):
# write # write
yield from generator.reset() yield from generator.reset()
yield from generator.run(16, 64) yield from generator.configure(16, 64)
yield from generator.run()
# read (no errors) # read (no errors)
yield from checker.reset() yield from checker.reset()
yield from checker.run(16, 64) yield from checker.configure(16, 64)
yield from checker.run()
assert checker.errors == 0 assert checker.errors == 0
# corrupt memory (using generator) # corrupt memory (using generator)
yield from generator.reset() yield from generator.reset()
yield from generator.run(16 + 60, 64) yield from generator.configure(16 + 60, 64)
yield from generator.run()
# read (4 errors) # read (4 errors)
yield from checker.reset() yield from checker.reset()
yield from checker.run(16, 64) yield from checker.configure(16, 64)
yield from checker.run()
assert checker.errors != 0 assert checker.errors != 0
# read (no errors) # read (no errors)
yield from checker.reset() yield from checker.reset()
yield from checker.run(16 + 60, 64) yield from checker.configure(16 + 60, 64)
yield from checker.run()
assert checker.errors == 0 assert checker.errors == 0
# dut # dut