-
Notifications
You must be signed in to change notification settings - Fork 4
/
run.py
1473 lines (1149 loc) · 48.2 KB
/
run.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import time, eel, os, glob, sys, \
tkinter, json, socket, requests, re, \
copy, subprocess as sp, tkinter.filedialog as filedialog
from icecream import ic
from distutils.dir_util import copy_tree
from contextlib import closing
from apiConfig import URL
BURQ_ROOT = os.getcwd()
BURQ_SCRIPTS = os.path.join(BURQ_ROOT, 'scripts')
DV_ROOT = os.path.join(BURQ_ROOT, 'dv')
DV_SCRIPTS = os.path.join(DV_ROOT, 'scripts')
sys.path.insert(0, BURQ_SCRIPTS)
sys.path.insert(0, DV_ROOT)
sys.path.insert(0, DV_SCRIPTS)
from run_tests import run_dv_test_on_spike, run_dv_test_on_core, run_c_test_on_spike
from instr_trace_compare import compare_trace_csv
from API import getListOfCores, getCoreRTL
from utils import getEmptyPort, killSpike
from replacer import replacer
from reverter import reverter
from comparison import call
from cleanlify import cleanELF
from socnow import SoCNowCores
from scripts.DV_Swerv_comparison import callSwerv
from scripts.removelines import remove
from port_manip import throw_port_json
userSoCNowCores = SoCNowCores()
@eel.expose
def runTestsSoc(coreSelectedID, testType, testsList, projectName, projectDir):
ic(sys._getframe().f_code.co_name)
ic(coreSelectedID, testType, testsList, projectName, projectDir)
currentProgress = 0
progressTick(currentProgress, 'Fetching RTL', testsList[-1])
testStatuses = []
try:
# Bring the RTL
getCoreRTL(coreSelectedID, projectName, projectDir, currentProgress, progressTick, testsList[-1])
# Process the RTL
currentProgress += 10
progressTick(currentProgress, 'Running test on ISS', testsList[-1])
testStatuses = userSoCNowCores.run_dv_test(
coreSelectedID, testType, testsList, projectName, projectDir,
DV_ROOT, BURQ_ROOT, currentProgress, progressTick
)
currentProgress += 10
progressTick(currentProgress, 'Almost done', testsList[-1])
except:
testStatuses.append("[Incompatble with your Core Configuration]")
currentProgress += 100
progressTick(currentProgress, 'Oops something went wrong', testsList[-1])
# Display result
os.chdir(f'{projectDir}/{projectName}')
report_str = ""
report_str += f"Core,{projectName}\n"
report_str += f"Iss,Spike\n"
report_str += "\n"
report_str += "Test, Test Status\n"
for i, t in enumerate(testsList):
report_str += f"{t},{testStatuses[i]}\n"
with open("test_results.csv", "w+") as f:
f.write(report_str)
os.chdir(BURQ_ROOT)
with open("web/pathfile", "w") as f:
f.write(f"{projectDir}/{projectName}")
with open("web/pathfilev", "w") as f:
f.write("SoCNow")
with open("records", "w+") as f:
f.write(f"{projectDir}/{projectName},SoCNow\n")
eel.goToMain()
@eel.expose
def closeRecentRecord(id, debug=True):
if debug:
ic(sys._getframe().f_code.co_name)
with open("records") as f:
records = f.read().split("\n")
projectToClose = records[int(id)]
# Delete this from records
records.remove(projectToClose)
with open("records", "w") as f:
f.write("\n".join(records))
@eel.expose
def openRecentProject(id, debug=True):
if debug:
ic(sys._getframe().f_code.co_name)
with open("records") as f:
records = f.read().split("\n")
projectToOpen = records[int(id)]
proj, type = projectToOpen.split(",")
with open("web/pathfile","w") as f:
f.write(proj)
with open("web/pathfilev","w") as f:
f.write(type)
eel.goToMain()
@eel.expose
def getRecords(debug=True):
if debug:
ic(sys._getframe().f_code.co_name)
with open("records") as f:
records = f.read()
projects = []
types = []
for record in records.split("\n")[: -1]:
proj, type = record.split(",")
projects.append(proj.split("/")[-1])
types.append(type)
eel.displayRecords(projects,types)
@eel.expose
def runTests(core, iss, tests, projName, projPath, selectedtest, debug=True):
# if debug:
# ic(sys._get_frame().f_code.co_name)
root_path = os.getcwd()
ibex_test_path = "cores/ibex/"
swerv_test__path = "cores/swerv/"
tests_status = []
perOccurProgress = (100 // len(tests)) // 2
if core == "swerv":
if debug:
ic(core)
if selectedtest == 'Swerv_Tests':
if debug:
ic(os.getcwd())
for test in tests:
currentProgress = 0
os.chdir(f"{BURQ_ROOT}/{swerv_test__path}")
# check if test directory exists
if os.path.isdir(test) == False:
# create test direeel.ctory
os.mkdir(test)
currentProgress += 10
progressTickPre(currentProgress,"Creating test directory",f"Test: {test}")
try:
os.chdir(test)
os.system("export RISCV=/opt/riscv32")
os.system(f"export whisper={BURQ_ROOT}/iss/SweRV-ISS/build-Linux/./whisper")
os.system(f"export RV_ROOT={BURQ_ROOT}/cores/swerv")
os.system("export PATH=/opt/riscv32/bin:$PATH")
currentProgress += 10
progressTickPre(currentProgress,"Running test on Core",f"Test: {test}")
os.system(f"make -f $RV_ROOT/tools/Makefile TEST={test}")
currentProgress += 30
progressTickPre(currentProgress,"Running test on ISS",f"Test: {test}")
os.system(f"$whisper --logfile {test}.log {test}.exe --configfile ./snapshots/default/whisper.json")
currentProgress += 30
progressTickPre(currentProgress,"Comparing results",f"Test: {test}")
# Check is test.log and exec.log exists
# if debug:
# ic(os.getcwd())
# ic(os.path.isfile(f"{test}.log"))
# ic(os.path.isfile("exec.log"))
os.chdir(projPath)
if os.path.isdir(projName) == False:
os.mkdir(projName)
os.chdir(projName)
os.mkdir(f"{test}_logs")
os.chdir(f"{BURQ_ROOT}/cores/swerv/{test}")
if os.path.isdir('ERRORFILE.txt') == True:
os.system(f"cp -r {BURQ_ROOT}/cores/swerv/{test}/ERRORFILE.txt {projPath}/{projName}/{test}_logs")
os.chdir(projPath)
os.chdir(projName)
os.system(f"cp -r {BURQ_ROOT}/cores/swerv/{test}/{test}.log {projPath}/{projName}/{test}_logs")
os.system(f"cp -r {BURQ_ROOT}/cores/swerv/{test}/exec.log {projPath}/{projName}/{test}_logs")
os.chdir(f"{BURQ_ROOT}/cores/swerv/{test}")
currentProgress += 20
progressTickPre(currentProgress,"Comparing logs",f"Test: {test}")
status = call(f"{test}.log", "exec.log")
tests_status.append(status)
except:
tests_status.append("Test Cannot run")
if selectedtest=="RISCV_DV_Tests":
os.chdir(swerv_test__path)
ic(os.getcwd())
for test in tests:
currentProgress = 0
os.chdir(f"{BURQ_ROOT}/{swerv_test__path}")
print(test)
# check is test directory exists
if os.path.isdir(f"{test}_0") == False:
os.mkdir(f"{test}_0")
currentProgress += 5
progressTickPre(currentProgress,"Creating test directory",f"Test: {test}")
os.chdir(f"{BURQ_ROOT}/dv")
if os.path.isdir("temporarydv") == False:
os.mkdir("temporarydv")
currentProgress += 5
progressTickPre(currentProgress,"Generating instruction ",f"Test: {test}")
os.system(f"python3 run.py --iss whisper --simulator pyflow --iteration 1 --test={test} --output temporarydv/{test}")
os.chdir(f"{BURQ_ROOT}/cores/swerv/testbench/tests")
#os.mkdir(f"{test}_0")
os.chdir(f"{BURQ_ROOT}/dv/temporarydv/{test}/asm_test")
currentProgress += 5
progressTickPre(currentProgress,"Extracting assembly file",f"Test: {test}")
os.rename(f"{test}_0.S", f"{test}_0.s")
os.chdir(f"{BURQ_ROOT}/cores/swerv/testbench/tests")
if os.path.isdir(f"{test}_0") == False:
os.mkdir(f"{test}_0")
os.system(f"cp -r {BURQ_ROOT}/dv/temporarydv/{test}/asm_test/{test}_0.s {BURQ_ROOT}/cores/swerv/testbench/tests/{test}_0")
#enter in dv root
#run command
#go into test directory
#extract assembly
#go into swev directory
#place it in test bench
#create test directory
#run make and whisper same as we previuosly do
#dv command
# os.system("export RISCV=/opt/riscv32")
os.chdir(f"{test}_0")
#{test}_0 file open and remove first line .include "user_define.h" only from file and save it
with open(f"{test}_0.s", "r") as f:
lines = f.readlines()
with open(f"{test}_0.s", "w") as f:
for line in lines:
if line.strip("\n") != '.include "user_define.h"' :
if line.strip("\n") !=' .include "user_init.s"':
f.write(line)
os.system(f"export whisper={BURQ_ROOT}/iss/SweRV-ISS/build-Linux/./whisper")
os.system(f"export RV_ROOT={BURQ_ROOT}/cores/swerv")
os.system("export PATH=/opt/riscv32/bin:$PATH")
currentProgress += 10
progressTickPre(currentProgress,"Running test on Core",f"Test: {test}")
os.chdir(f"{BURQ_ROOT}/cores/swerv/{test}_0")
os.system(f"make -f $RV_ROOT/tools/Makefile TEST={test}_0")
currentProgress += 40
progressTickPre(currentProgress,"Running test on ISS",f"Test: {test}")
os.system(f"$whisper --logfile {test}_0.log {test}_0.exe --configfile ./snapshots/default/whisper.json")
os.chdir(projPath)
if os.path.isdir(f"{projName}") == False:
os.mkdir(projName)
os.chdir(projName)
os.mkdir(f"{test}_logs")
os.system(f"cp -r {BURQ_ROOT}/cores/swerv/{test}_0/ERRORFILE.txt {projPath}/{projName}/{test}_logs")
os.system(f"cp -r {BURQ_ROOT}/cores/swerv/{test}_0/{test}_0.log {projPath}/{projName}/{test}_logs")
os.system(f"cp -r {BURQ_ROOT}/cores/swerv/{test}_0/exec.log {projPath}/{projName}/{test}_logs")
os.chdir(f"{BURQ_ROOT}/cores/swerv/{test}_0")
ic(os.getcwd())
#check is test.log and exec.log exists
ic(os.path.isfile(f"{test}_0.log"))
ic(os.path.isfile("exec.log"))
currentProgress += 20
progressTickPre(currentProgress,"extracting logs",f"Test: {test}")
rem=remove(f"exec.log",f"{test}_0.log")
currentProgress += 10
progressTickPre(currentProgress,"Comparing logs",f"Test: {test}")
status = callSwerv(f"{test}_0.log", "exec.log")
tests_status.append(status)
currentProgress += 5
progressTickPre(currentProgress,"Generating report",f"Test: {test}")
os.chdir(f"{BURQ_ROOT}/cores/swerv")
# shutil.rmtree(f"{test}_0")
if selectedtest=="User_Defined_Tests":
currentProgress = 0
os.chdir(swerv_test__path)
ic(swerv_test__path)
ic(os.getcwd())
for test in tests:
try:
currentProgress = 0
currentProgress += 10
progressTickPre(currentProgress,"Creating files",f"Test: {test}")
os.chdir(f"{BURQ_ROOT}/testcases/User_Defined_Tests/{test}")
os.system(f"cp -a {BURQ_ROOT}/testcases/User_Defined_Tests/crt0.s {BURQ_ROOT}/testcases/User_Defined_Tests/{test}")
mki_str="""OFILES = test.o crt0.o
TEST_CFLAGS = -mabi=ilp32 -march=rv32imc -nostdlib -g"""
mkifile=open(f"{test}.mki","w+")
#write mki_str in file
mkifile.write(mki_str.replace("test", test))
mkifile.close()
os.system(f"cp -a {BURQ_ROOT}/testcases/User_Defined_Tests/{test} {BURQ_ROOT}/cores/swerv/testbench/tests/")
os.chdir(f"{BURQ_ROOT}/cores/swerv/")
# check is test directory exists
if os.path.isdir(test) == False:
# create test directory
os.mkdir(test)
os.chdir(test)
currentProgress += 10
progressTickPre(currentProgress,"Running test on Core",f"Test: {test}")
os.system("export RISCV=/opt/riscv32")
os.system(f"export whisper={BURQ_ROOT}/iss/SweRV-ISS/build-Linux/./whisper")
os.system(f"export RV_ROOT={BURQ_ROOT}/cores/swerv")
os.system("export PATH=/opt/riscv32/bin:$PATH")
os.system(f"make -f $RV_ROOT/tools/Makefile TEST={test}")
#srem=removezero("exec.log")
currentProgress += 50
progressTickPre(currentProgress,"Running test on ISS",f"Test: {test}")
os.system(f"$whisper --logfile {test}.log {test}.exe --configfile ./snapshots/default/whisper.json")
# wrem=removew(f"{test}.log")
currentProgress += 30
progressTickPre(currentProgress,"Comparing logs",f"Test: {test}")
os.chdir(projPath)
os.mkdir(projName)
os.chdir(projName)
os.mkdir(f"{test}_logs")
os.chdir(f"{BURQ_ROOT}/cores/swerv/{test}")
if os.path.isdir('ERRORFILE.txt') == True:
os.system(f"cp -r {BURQ_ROOT}/cores/swerv/{test}/ERRORFILE.txt {projPath}/{projName}/{test}_logs")
os.chdir(projPath)
os.chdir(projName)
os.system(f"cp -r {BURQ_ROOT}/cores/swerv/{test}/{test}.log {projPath}/{projName}/{test}_logs")
os.system(f"cp -r {BURQ_ROOT}/cores/swerv/{test}/exec.log {projPath}/{projName}/{test}_logs")
os.chdir(f"{BURQ_ROOT}/cores/swerv/{test}")
ic(os.getcwd())
#check is test.log and exec.log exists
ic(os.path.isfile(f"{test}.log"))
ic(os.path.isfile("exec.log"))
status = call(f"{test}.log", "exec.log")
tests_status.append(status)
except:
tests_status.append("Cannot Run")
elif core == "ibex":
currentProgress = 0
print('ibex')
os.chdir(f"{BURQ_ROOT}/{ibex_test_path}")
perOccurProgress = (100 // len(tests)) // 2
currentProgress = 0
makefile_str = """PROGRAM = testname
PROGRAM_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
# Any extra source files to include in the build. Use the upper case .S
# extension for assembly files
EXTRA_SRCS :=
include ${PROGRAM_DIR}/../common/common.mk"""
testroot="testcases/User_Defined_Tests"
for test in tests:
ic(test)
os.chdir(f"{BURQ_ROOT}/{ibex_test_path}")
os.chdir("examples/sw/simple_system/")
if os.path.isdir(test):
# rm test directory
os.system(f"rm -rf {test}")
try:
os.mkdir(test)
copy_tree(f"{BURQ_ROOT}/{testroot}/{test}", f"{test}")
os.chdir(test)
file = open("Makefile", "w+")
file.write(makefile_str.replace("testname", test))
file.close()
os.system("make")
# check test.elf exists
ic(os.path.isfile(f"{test}.elf"))
ic(os.system("ls"))
os.chdir(f"{BURQ_ROOT}/{ibex_test_path}")
os.system("fusesoc --cores-root=. run --target=sim --setup --build lowrisc:ibex:ibex_simple_system --RV32E=0 --RV32M=ibex_pkg::RV32MFast")
os.system(f"./build/lowrisc_ibex_ibex_simple_system_0/sim-verilator/Vibex_simple_system [-t] --meminit=ram,examples/sw/simple_system/{test}/{test}.elf")
currentProgress += perOccurProgress
progressTickPre(currentProgress,"",test)
os.chdir(f"{BURQ_ROOT}/{ibex_test_path}/examples/sw/simple_system/{test}")
os.system(f"spike --isa=rv32gc -m0x10000:0x30000,0x100000:0x100000 --log-commits -l {test}.elf 2> {test}.log")
spike_ibex = None
core_ibex = None
core_ibex.ibexLogExtract(f"{BURQ_ROOT}/{ibex_test_path}/trace_core_00000000.log")#ibex core path
spike_ibex.spikeLogExtract(f"{test}.log")
if spike_ibex.match(core_ibex):
tests_status.append("PASSED")
else:
tests_status.append("FAILED")
currentProgress += perOccurProgress
progressTickPre(currentProgress,"",test)
except:
tests_status.append("COMPILATION ERROR")
currentProgress += perOccurProgress
progressTickPre(currentProgress,"",test)
currentProgress += perOccurProgress
progressTickPre(currentProgress,"",test)
os.chdir(BURQ_ROOT)
os.chdir(projPath)
if os.path.isdir(f"{projName}") == False:
os.mkdir(projName)
os.chdir(projName)
report_str = ""
report_str += f"Core,{core}\n"
report_str += f"Iss,{iss}\n"
report_str += "\n"
report_str += "Test, Test Status\n"
for i,t in enumerate(tests):
report_str += f"{t},{tests_status[i]}\n"
file = open("test_results.csv", "w+")
file.write(report_str)
file.close()
os.chdir(BURQ_ROOT)
file = open("web/pathfile", "w")
file.write(f"{projPath}/{projName}")
file.close()
file = open("web/pathfilev", "w")
file.write("prebuilt_verification")
file.close()
file = open("records", "w+")
file.write(f"{projPath}/{projName},prebuilt_verification\n")
file.close()
eel.goToMain()
# for test in tests:
# copy_tree(f"{swerv_test__path}/{test}", "/tmp/testcases/")
# os.chdir("web/swerv")
# os.system(f"export RV_ROOT={os.getcwd()}")
# os.system("make -f $RV_ROOT/tools/Makefile TEST_DIR=/tmp/testcases/")
# #sp.Popen("make -f $RV_ROOT/tools/Makefile TEST_DIR=/tmp/testcases/".split())
# #sp.Popen()
# os.chdir(root_path)
# eel.changeProgressBar(50)
# if iss == "whisper":
# print("q")
# # os.chdir("web/whisper")
# print("r")
# # os.system(f"export whisper={os.getcwd()}/./whisper")
# print("w")
# os.chdir(root_path)
# for test in tests:
# ic(test)
# os.chdir(f"{swerv_test__path}/{test}")
# os.system(f"$whisper --logfile BubbleSort.log BubbleSort.exe --configfile ./snapshots/default/whisper.json")
# os.system(f"riscv32-unknown-elf-gcc -mabi=ilp32 -march=rv32imc -nostdlib -g -o {test} {test}.c")
# os.system(f"$whisper {test}")
# os.chdir(root_path)
# eel.changeProgressBar(100)
@eel.expose
def stop_everything(debug=True):
if debug:
ic(sys._getframe().f_code.co_name)
# replacer()
os.system("./scripts/openMain.sh")
# eel.start('index.html', mode='custom', cmdline_args=['node_modules/electron/dist/electron', '.'], port=8005)
@eel.expose # Expose this function to Javascript
def say_hello_py(x):
print('Hello from %s' % x)
@eel.expose
def socdetail():
ic(sys._getframe().f_code.co_name)
yourproject = list1[-1]
ic(list1, list2)
b = list2[-1]
with open("web/pathfile", "w") as f:
f.write(f"{yourproject}/{b}")
os.chdir(yourproject)
os.system(f"mkdir {b}")
os.chdir(b)
os.system(f"touch {b}.c")
# list the files in the directory
os.system("ls")
with open(f"{b}.c", "w") as f:
f.write("// write your code here \n")
os.chdir(BURQ_ROOT)
with open("records", "w+") as f:
f.write(f"{yourproject}/{b},custom_test\n")
os.chdir(f"{BURQ_ROOT}")
eel.goToMain()
@eel.expose
def pyverification():
print('pyverification')
yourproject=list1[-1]
aa = os.system(f"cd {yourproject}")
b = list2[-1]
with open("web/pathfile", "w") as f:
f.write(f"{yourproject}/{b}")
os.system(f"cp -a web/verification {yourproject}/{b}")
eel.goToMain()
@eel.expose
def selectFolder(projectnamee):
ic(sys._getframe().f_code.co_name)
root = tkinter.Tk()
root.attributes("-topmost", True)
root.withdraw()
directory_path = filedialog.askdirectory()
list1.clear()
list1.append(directory_path)
list2.append(projectnamee)
eel.select_js(list1[-1])
@eel.expose
def selectFolder1(debug=True):
if debug:
ic(sys._getframe().f_code.co_name)
root = tkinter.Tk()
root.attributes("-topmost", True)
root.withdraw()
directory_path = filedialog.askdirectory()
listuploadcore.clear()
listuploadcore.append(directory_path)
eel.select_js1(listuploadcore[-1])
@eel.expose
def selecttest():
print("selecttest")
root = tkinter.Tk()
root.attributes("-topmost", True)
root.withdraw()
directory_path = filedialog.askdirectory()
print(directory_path)
testcasepath.clear()
print(testcasepath)
testcasepath.append(directory_path)
ic(testcasepath)
eel.select_jstestcase(testcasepath[-1])
@eel.expose
def selectlogfile():
print("selectlogfile")
root = tkinter.Tk()
root.attributes("-topmost", True)
root.withdraw()
directory_path = filedialog.askdirectory()
print(directory_path)
logfilepath.clear()
print(logfilepath)
logfilepath.append(directory_path)
ic(logfilepath)
eel.select_jslog(logfilepath[-1])
#copy corefiles in ser seleted path
def copycorefiles():
print('copycorefiles')
yourproject=list1[-1]
aa=os.system(f"cd {yourproject}")
bb=listuploadcore[-1]
b=list2[-1]
os.system(f"cp bb {yourproject}/{b}")
@eel.expose
def verCoreTest(listver):
print('verCoreTest')
i=listver[-1]
if i=="SWERV-EH1":
eel.testswerv()
print(i)
if i=="IBEX":
eel.testibex()
print(i)
@eel.expose
def getlistswerv():
print('getlistswerv')
namelist=[]
root="cores/swerv/testbench/tests/"
#root1="testcases/User_Defined_Tests/"
# get list of directory names from root
for dirname in os.listdir(root):
# for path in filepaths:
# a=path.split("/")
ic(dirname)
namelist.append(dirname)
#for dirname in os.listdir(root1):
## for path in filepaths:
# # a=path.split("/")
# ic(dirname)
# namelist.append(dirname)
print(namelist)
eel.showSwervTests(namelist)
@eel.expose
def getlistuser():
print('getlistuser()')
namelist=[]
#root="web/swerv/testbench/tests/Floating_point_tests_for_azadi"
root="testcases/User_Defined_Tests"
# get list of directory names from root
for dirname in os.listdir(root):
# for path in filepaths:
# a=path.split("/")
ic(dirname)
namelist.append(dirname)
print(namelist)
eel.showIbexTests(namelist)
@eel.expose
def getlistdv():
print('getlistdv()')
tests = [
"riscv_arithmetic_basic_test",
"riscv_jump_stress_test",
"riscv_rand_instr_test",
"riscv_rand_jump_test",
"riscv_mmu_stress_test",
"riscv_unaligned_load_store_test"
]
eel.showIbexTests(tests)
@eel.expose
def getlistibex():
print('getlistibex')
namelist=[]
root="testcases/Riscv_tests"
root1="testcases/Riscv_tests"
root2="testcases/User_Defined_Tests"
filepaths = [os.path.join(root,i) for i in os.listdir(root)]
filepaths1 = [os.path.join(root1,i) for i in os.listdir(root1)]
filepaths2 = [os.path.join(root1,i) for i in os.listdir(root2)]
for path in filepaths:
ic(path)
a=path.split("/")
namelist.append(a[-1])
print(namelist,"po")
for path in filepaths1:
a=path.split("/")
namelist.append(a[-1])
for path in filepaths2:
a=path.split("/")
namelist.append(a[-1])
print(namelist,"po")
eel.showIbexTests(namelist)
@eel.expose
def datasend(listt, debug=True):
if debug:
ic(sys._getframe().f_code.co_name)
with open("web/pathfilev", "w") as f:
f.write(listt[0])
@eel.expose
def genCore(isa,ext,bus):
print('genCore')
driverKey= f"corei{bus}"
file = open("web/driver", "w")
file.write(driverKey)
file.close()
@eel.expose
def floatingpointtest(source):
print('floatingpointtest')
namelist=[]
#root="web/swerv/testbench/tests/Floating_point_tests_for_azadi"
root="testcases/Floating_point_tests_for_azadi"
# get list of directory names from root
for dirname in os.listdir(root):
# for path in filepaths:
# a=path.split("/")
ic(dirname)
namelist.append(dirname)
print(namelist)
if source=="socnow":
eel.showsocnowfloting(namelist)
if source=="custom":
eel.showfloatingTests(namelist)
@eel.expose
def merlvectortest(source):
print('merlvectortest')
namelist=[]
#root="web/swerv/testbench/tests/Floating_point_tests_for_azadi"
root="testcases/MERL_vector_Tests"
# get list of directory names from root
for dirname in os.listdir(root):
# for path in filepaths:
# a=path.split("/")
ic(dirname)
namelist.append(dirname)
print(namelist)
if source=="socnow":
eel.showsocnowmerlvector(namelist)
if source=="custom":
eel.showMerlTests(namelist)
@eel.expose
def riscvtest(source):
print('riscvtest')
namelist=[]
#root="web/swerv/testbench/tests/Floating_point_tests_for_azadi"
root="testcases/Riscv_tests"
# get list of directory names from root
for dirname in os.listdir(root):
# for path in filepaths:
# a=path.split("/")
ic(dirname)
namelist.append(dirname)
print(namelist)
if source=="socnow":
eel.showsocnowriscvtest(namelist)
if source=="custom":
eel.showriscvTests(namelist)
@eel.expose
def selfcheckingvectortest(source):
print('selfcheckingvectortest')
namelist=[]
#root="web/swerv/testbench/tests/Floating_point_tests_for_azadi"
root="testcases/Self-Checking-vector-tests"
# get list of directory names from root
for dirname in os.listdir(root):
# for path in filepaths:
# a=path.split("/")
ic(dirname)
namelist.append(dirname)
print(namelist)
if source=="socnow":
eel.showsocnowselfcheckingvect(namelist)
if source=="custom":
eel.showselfcheckingvectorTests(namelist)
@eel.expose
def usertest(source,debug=True):
print('usertest()')
namelist = []
#root="web/swerv/testbench/tests/Floating_point_tests_for_azadi"
root = "./testcases/User_Defined_Tests"
# Get list of directory names from root
for dirname in os.listdir(root):
# for path in filepaths:
# a=path.split("/")
if debug:
ic(dirname)
namelist.append(dirname)
if debug:
ic(namelist)
if source=="socnow":
eel.showsocnowusertest(namelist)
if source=="custom":
eel.usersTests(namelist)
@eel.expose
def swervtest(source):
print('swervtest')
namelist=[]
#root="web/swerv/testbench/tests/Floating_point_tests_for_azadi"
root="testcases/Swerv_Tests"
# get list of directory names from root
for dirname in os.listdir(root):
# for path in filepaths:
# a=path.split("/")
ic(dirname)
namelist.append(dirname)
print(namelist)
if source=="socnow":
eel.showsocnowswerv(namelist)
if source=="custom":
eel.showswervTests(namelist)
@eel.expose
def burqgeneratedtest(source):
print('burqgeneratedtest')
os.system(f"{BURQ_ROOT}")
namelist=[]
#root="web/swerv/testbench/tests/Floating_point_tests_for_azadi"
root="testcases/BURQ_Generated_Tests"
# get list of directory names from root
for dirname in os.listdir(root):
# for path in filepaths:
# a=path.split("/")
ic(dirname)
namelist.append(dirname)
print(namelist)
if source=="socnow":
eel.showsocnowburqgen(namelist)
if source=="custom":
eel.showburqTests(namelist)
@eel.expose
def dvtest(source,debug=True):
if debug:
ic(sys._getframe().f_code.co_name)
tests = [
"riscv_arithmetic_basic_test",
"riscv_jump_stress_test",
"riscv_rand_instr_test",
"riscv_rand_jump_test",
"riscv_mmu_stress_test",
"riscv_unaligned_load_store_test"
]
if source=="socnow":
eel.showsocnowdvtest(tests)
if source=="custom":
eel.showdvTests(tests)
@eel.expose
def enduploadcore(config, tests, types):
ic(sys._getframe().f_code.co_name)
ic(config)
ic(tests)
ic(types)
proj_dir = os.path.join(config['path'], config['name'])
core_path = os.path.join(proj_dir, 'core')
progress = 0
progressTickCus(progress, 'Setting up test environment', tests[-1])
with open("web/pathfile", "w") as f:
f.write(proj_dir)
with open("web/pathfilev", "w") as f:
f.write("custom_verification")
uploadedcore = listuploadcore[-1]
os.makedirs(proj_dir)
os.makedirs(core_path)
copy_tree(uploadedcore, core_path)
with open(f"{proj_dir}/config.json", "w+") as f:
json.dump(config, f)
testStatuses = []
progress += 30
progressTickCus(progress, 'Running test on ISS', tests[-1])
if config["swerv"] == "":
ic("Custom core selected")
extension_flags = "rv32" + "".join(config["extensions"])
os.chdir(proj_dir)
os.makedirs("logs")
for i, test in enumerate(tests):
# ISS Sim
try:
os.chdir(DV_ROOT)
if types == "RISCV_DV_Tests":
run_dv_test_on_spike(
extension_flags, test, 1,
os.path.join(proj_dir, 'dv_out'),
os.path.join(proj_dir, 'dv_out/spike_sim', f'{test}.0.log'),
os.path.join(proj_dir, 'logs/spike_trace.csv')
)
else: