2014-12-15 10:44:12 -05:00
|
|
|
from lib.sata.common import *
|
2014-12-15 13:13:32 -05:00
|
|
|
from lib.sata import SATACON
|
2015-01-14 03:19:41 -05:00
|
|
|
from lib.sata.bist import SATABISTGenerator, SATABISTChecker
|
2014-12-15 10:44:12 -05:00
|
|
|
|
|
|
|
from lib.sata.test.hdd import *
|
|
|
|
from lib.sata.test.common import *
|
|
|
|
|
|
|
|
class TB(Module):
|
|
|
|
def __init__(self):
|
2014-12-18 19:35:18 -05:00
|
|
|
self.hdd = HDD(
|
2014-12-15 13:04:45 -05:00
|
|
|
link_debug=False, link_random_level=0,
|
2014-12-15 10:44:12 -05:00
|
|
|
transport_debug=False, transport_loopback=False,
|
|
|
|
hdd_debug=True)
|
2015-01-14 03:19:41 -05:00
|
|
|
self.controller = SATACON(self.hdd.phy)
|
|
|
|
self.generator = SATABISTGenerator(self.controller.crossbar.get_port())
|
|
|
|
self.checker = SATABISTChecker(self.controller.crossbar.get_port())
|
2014-12-15 10:44:12 -05:00
|
|
|
|
|
|
|
def gen_simulation(self, selfp):
|
|
|
|
hdd = self.hdd
|
|
|
|
hdd.malloc(0, 64)
|
2015-01-14 03:19:41 -05:00
|
|
|
selfp.generator.sector = 0
|
|
|
|
selfp.generator.count = 17
|
|
|
|
selfp.checker.sector = 0
|
|
|
|
selfp.checker.count = 17
|
2014-12-15 10:44:12 -05:00
|
|
|
while True:
|
2015-01-14 03:19:41 -05:00
|
|
|
selfp.generator.start = 1
|
2014-12-15 10:44:12 -05:00
|
|
|
yield
|
2015-01-14 03:19:41 -05:00
|
|
|
selfp.generator.start = 0
|
2014-12-15 10:44:12 -05:00
|
|
|
yield
|
2015-01-14 03:19:41 -05:00
|
|
|
while selfp.generator.done == 0:
|
2014-12-15 10:44:12 -05:00
|
|
|
yield
|
2015-01-14 03:19:41 -05:00
|
|
|
selfp.checker.start = 1
|
2015-01-07 16:15:57 -05:00
|
|
|
yield
|
2015-01-14 03:19:41 -05:00
|
|
|
selfp.checker.start = 0
|
2015-01-07 16:15:57 -05:00
|
|
|
yield
|
2015-01-14 03:19:41 -05:00
|
|
|
while selfp.checker.done == 0:
|
2015-01-07 16:15:57 -05:00
|
|
|
yield
|
2015-01-14 03:19:41 -05:00
|
|
|
print("errors {}".format(selfp.checker.errors))
|
|
|
|
selfp.generator.sector += 1
|
|
|
|
selfp.generator.count = max((selfp.generator.count + 1)%8, 1)
|
|
|
|
selfp.checker.sector += 1
|
|
|
|
selfp.checker.count = max((selfp.checker.count + 1)%8, 1)
|
2014-12-15 10:44:12 -05:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2014-12-15 13:48:22 -05:00
|
|
|
run_simulation(TB(), ncycles=8192*2, vcd_name="my.vcd", keep_files=True)
|