mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
bist: add random addressing
This commit is contained in:
parent
91bb531641
commit
97eb712766
1 changed files with 17 additions and 6 deletions
23
test/bist.py
23
test/bist.py
|
@ -1,5 +1,6 @@
|
||||||
import time
|
import time
|
||||||
import argparse
|
import argparse
|
||||||
|
import random as rand
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from config import *
|
from config import *
|
||||||
|
|
||||||
|
@ -29,7 +30,7 @@ class LiteSATABISTUnitDriver:
|
||||||
for s in ["start", "sector", "count", "loops", "random", "done", "aborted", "errors", "cycles"]:
|
for s in ["start", "sector", "count", "loops", "random", "done", "aborted", "errors", "cycles"]:
|
||||||
setattr(self, s, getattr(regs, name + "_"+ s))
|
setattr(self, s, getattr(regs, name + "_"+ s))
|
||||||
|
|
||||||
def run(self, sector, count, loops, random, blocking=True, hw_timer=False):
|
def run(self, sector, count, loops, random, blocking=True, hw_timer=True):
|
||||||
self.sector.write(sector)
|
self.sector.write(sector)
|
||||||
self.count.write(count)
|
self.count.write(count)
|
||||||
self.loops.write(loops)
|
self.loops.write(loops)
|
||||||
|
@ -133,6 +134,8 @@ SATA BIST utility.
|
||||||
parser.add_argument("-r", "--random", action="store_true", help="use random data")
|
parser.add_argument("-r", "--random", action="store_true", help="use random data")
|
||||||
parser.add_argument("-c", "--continuous", action="store_true", help="continuous mode (Escape to exit)")
|
parser.add_argument("-c", "--continuous", action="store_true", help="continuous mode (Escape to exit)")
|
||||||
parser.add_argument("-i", "--identify", action="store_true", help="only run identify")
|
parser.add_argument("-i", "--identify", action="store_true", help="only run identify")
|
||||||
|
parser.add_argument("-t", "--software_timer", action="store_true", help="use software timer")
|
||||||
|
parser.add_argument("-a", "--random_addressing", action="store_true", help="use random addressing")
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -153,13 +156,17 @@ if __name__ == "__main__":
|
||||||
length = int(args.total_length)*MB
|
length = int(args.total_length)*MB
|
||||||
random = int(args.random)
|
random = int(args.random)
|
||||||
continuous = int(args.continuous)
|
continuous = int(args.continuous)
|
||||||
|
sw_timer = int(args.software_timer)
|
||||||
|
random_addressing = int(args.random_addressing)
|
||||||
|
|
||||||
|
run_sectors = 0
|
||||||
try:
|
try:
|
||||||
while ((sector*logical_sector_size < length) or continuous) and (sector < identify.total_sectors):
|
while ((run_sectors*logical_sector_size < length) or continuous) and (sector < identify.total_sectors):
|
||||||
retry = 0
|
retry = 0
|
||||||
# generator (write data to HDD)
|
# generator (write data to HDD)
|
||||||
write_done = False
|
write_done = False
|
||||||
while not write_done:
|
while not write_done:
|
||||||
write_aborted, write_errors, write_speed = generator.run(sector, count, loops, random)
|
write_aborted, write_errors, write_speed = generator.run(sector, count, loops, random, True, not sw_timer)
|
||||||
write_done = not write_aborted
|
write_done = not write_aborted
|
||||||
if not write_done:
|
if not write_done:
|
||||||
retry += 1
|
retry += 1
|
||||||
|
@ -167,19 +174,23 @@ if __name__ == "__main__":
|
||||||
# checker (read and check data from HDD)
|
# checker (read and check data from HDD)
|
||||||
read_done = False
|
read_done = False
|
||||||
while not read_done:
|
while not read_done:
|
||||||
read_aborted, read_errors, read_speed = checker.run(sector, count, loops, random)
|
read_aborted, read_errors, read_speed = checker.run(sector, count, loops, random, True, not sw_timer)
|
||||||
read_done = not read_aborted
|
read_done = not read_aborted
|
||||||
if not read_done:
|
if not read_done:
|
||||||
retry += 1
|
retry += 1
|
||||||
|
|
||||||
print("sector=%d(%dMB) wr_speed=%4.2fMB/s rd_speed=%4.2fMB/s errors=%d retry=%d" %(
|
print("sector=%d(%dMB) wr_speed=%4.2fMB/s rd_speed=%4.2fMB/s errors=%d retry=%d" %(
|
||||||
sector,
|
sector,
|
||||||
sector*logical_sector_size/MB,
|
run_sectors*logical_sector_size/MB,
|
||||||
write_speed/MB,
|
write_speed/MB,
|
||||||
read_speed/MB,
|
read_speed/MB,
|
||||||
write_errors + read_errors,
|
write_errors + read_errors,
|
||||||
retry))
|
retry))
|
||||||
sector += count
|
if random_addressing:
|
||||||
|
sector = rand.randint(0, identify.total_sectors//(256*2))*256
|
||||||
|
else:
|
||||||
|
sector += count
|
||||||
|
run_sectors += count
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in a new issue