mirror of
https://github.com/enjoy-digital/litedram.git
synced 2025-01-04 09:52:25 -05:00
test: add timeout_generator
This commit is contained in:
parent
ebdbcacc1d
commit
72b91a8fb7
1 changed files with 9 additions and 0 deletions
|
@ -24,6 +24,15 @@ def seed_to_data(seed, random=True, nbits=32):
|
|||
return data
|
||||
|
||||
|
||||
@passive
|
||||
def timeout_generator(ticks):
|
||||
# raise exception after given timeout effectively stopping simulation
|
||||
# because of @passive, simulation can end even if this generator is still running
|
||||
for _ in range(ticks):
|
||||
yield
|
||||
raise TimeoutError("Timeout after %d ticks" % ticks)
|
||||
|
||||
|
||||
class DRAMMemory:
|
||||
def __init__(self, width, depth, init=[]):
|
||||
self.width = width
|
||||
|
|
Loading…
Reference in a new issue