test/gen_access_pattern: cleanup.
This commit is contained in:
parent
72d2bbf09d
commit
2bb8f8fd22
|
@ -1,19 +1,20 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import random
|
import random
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
desc = """
|
description = """
|
||||||
Generate random access pattern.
|
Generate random access pattern for LiteDRAM Pattern Generator/Checker.
|
||||||
Each address in range [base, base+length) will be accessed only once,
|
|
||||||
but in random order. This ensures that no data will be overwritten.
|
Each address in range [base, base+length) will be accessed only once, but in random order.
|
||||||
|
This ensures that no data will be overwritten.
|
||||||
"""
|
"""
|
||||||
parser = argparse.ArgumentParser(description=desc)
|
parser = argparse.ArgumentParser(description=description)
|
||||||
parser.add_argument('base', help='Base address')
|
parser.add_argument("base", help="Base address")
|
||||||
parser.add_argument('length', help='Number of (address, data) pairs')
|
parser.add_argument("length", help="Number of (address, data) pairs")
|
||||||
parser.add_argument('data_width', help='Width of data (used to determine max value)')
|
parser.add_argument("data_width", help="Width of data (used to determine max value)")
|
||||||
parser.add_argument('--seed', help='Use given random seed (int)')
|
parser.add_argument("--seed", help="Use given random seed (int)")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.seed:
|
if args.seed:
|
||||||
|
@ -28,7 +29,7 @@ def main():
|
||||||
data = [random.randrange(0, 2**data_width) for _ in range(length)]
|
data = [random.randrange(0, 2**data_width) for _ in range(length)]
|
||||||
|
|
||||||
for a, d in zip(address, data):
|
for a, d in zip(address, data):
|
||||||
print('0x{:08x},0x{:08x}'.format(a, d))
|
print("0x{:08x}, 0x{:08x}".format(a, d))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue