forked from cyyself/chacha20-xiangshan
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
30 lines (27 loc) · 891 Bytes
/
test.py
File metadata and controls
30 lines (27 loc) · 891 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import sys
import signal
import os
from XSPython import DUTSimTop, difftest as df, xsp
from XSPython.XSPdb import *
def handle_sigint(signum, frame):
print("\nReceived SIGINT, exit.")
sys.exit(0)
signal.signal(signal.SIGINT, handle_sigint)
def test_sim_top():
bin_file = sys.argv[1] if len(sys.argv) > 1 else None
if bin_file is None:
print("Usage: python test.py <bin_file>")
print("Use ready-to-run/microbench.bin for minimal debug test.")
bin_file = "ready-to-run/microbench.bin"
if not os.path.exists(bin_file):
print(f"File {bin_file} does not exist.")
sys.exit(1)
if not os.path.isfile(bin_file):
print(f"{bin_file} is not a file.")
sys.exit(1)
dut = DUTSimTop()
XSPdb(dut, df, xsp, bin_file).set_trace()
while True:
dut.Step(10000000)
if __name__ == "__main__":
test_sim_top()