2015-02-28 04:53:51 -05:00
|
|
|
from misoclib.mem.litesata.common import *
|
2015-05-23 08:08:56 -04:00
|
|
|
from misoclib.mem.litesata.core import LiteSATACore
|
|
|
|
from misoclib.mem.litesata.frontend.crossbar import LiteSATACrossbar
|
2015-02-28 04:53:51 -05:00
|
|
|
from misoclib.mem.litesata.frontend.bist import LiteSATABISTGenerator, LiteSATABISTChecker
|
2014-12-15 10:44:12 -05:00
|
|
|
|
2015-02-28 04:53:51 -05:00
|
|
|
from misoclib.mem.litesata.test.common import *
|
2015-04-27 08:50:43 -04:00
|
|
|
from misoclib.mem.litesata.test.model.hdd import *
|
2014-12-15 10:44:12 -05:00
|
|
|
|
2015-04-13 09:12:39 -04:00
|
|
|
|
2014-12-15 10:44:12 -05:00
|
|
|
class TB(Module):
|
2015-04-13 08:55:26 -04:00
|
|
|
def __init__(self):
|
|
|
|
self.submodules.hdd = HDD(
|
|
|
|
link_debug=False, link_random_level=0,
|
|
|
|
transport_debug=False, transport_loopback=False,
|
|
|
|
hdd_debug=True)
|
2015-05-23 08:08:56 -04:00
|
|
|
self.submodules.core = LiteSATACore(self.hdd.phy)
|
|
|
|
self.submodules.crossbar = LiteSATACrossbar(self.core)
|
|
|
|
self.submodules.generator = LiteSATABISTGenerator(self.crossbar.get_port())
|
|
|
|
self.submodules.checker = LiteSATABISTChecker(self.crossbar.get_port())
|
2014-12-15 10:44:12 -05:00
|
|
|
|
2015-04-13 08:55:26 -04:00
|
|
|
def gen_simulation(self, selfp):
|
|
|
|
hdd = self.hdd
|
|
|
|
hdd.malloc(0, 64)
|
2015-05-23 08:08:56 -04:00
|
|
|
sector = 0
|
|
|
|
count = 17
|
|
|
|
generator = selfp.generator
|
|
|
|
checker = selfp.checker
|
2015-04-13 08:55:26 -04:00
|
|
|
while True:
|
2015-05-23 08:08:56 -04:00
|
|
|
# write data
|
|
|
|
generator.sector = sector
|
|
|
|
generator.count = count
|
|
|
|
generator.start = 1
|
2015-04-13 08:55:26 -04:00
|
|
|
yield
|
2015-05-23 08:08:56 -04:00
|
|
|
generator.start = 0
|
2015-04-13 08:55:26 -04:00
|
|
|
yield
|
2015-05-23 08:08:56 -04:00
|
|
|
while generator.done == 0:
|
2015-04-13 08:55:26 -04:00
|
|
|
yield
|
2015-05-23 08:08:56 -04:00
|
|
|
|
|
|
|
# verify data
|
|
|
|
checker.sector = sector
|
|
|
|
checker.count = count
|
|
|
|
checker.start = 1
|
2015-04-13 08:55:26 -04:00
|
|
|
yield
|
2015-05-23 08:08:56 -04:00
|
|
|
checker.start = 0
|
2015-04-13 08:55:26 -04:00
|
|
|
yield
|
2015-05-23 08:08:56 -04:00
|
|
|
while checker.done == 0:
|
2015-04-13 08:55:26 -04:00
|
|
|
yield
|
2015-05-23 08:08:56 -04:00
|
|
|
print("errors {}".format(checker.errors))
|
|
|
|
|
|
|
|
# prepare next iteration
|
|
|
|
sector += 1
|
|
|
|
count = max((count + 1)%8, 1)
|
2014-12-15 10:44:12 -05:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2015-04-13 08:55:26 -04:00
|
|
|
run_simulation(TB(), ncycles=8192*2, vcd_name="my.vcd", keep_files=True)
|