-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBLSHDLgen.py
executable file
·72 lines (60 loc) · 1.79 KB
/
BLSHDLgen.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
#!/usr/bin/env sage
import os, errno
import os.path
import sys
import fileinput
import datetime
from sage.all import *
# Unset env variables which seems to upset vivado
del os.environ['CPATH']
del os.environ['LIBRARY_PATH']
# Get current work directory
cwd = os.getcwd()
# Load files
load(cwd + '/script/entity.py')
load(cwd + '/script/domain_param.py')
load(cwd + '/script/testbench.py')
load(cwd + '/bls_sage_ref/bls.py')
# Check arguments
if len(sys.argv) != 3:
print("Usage: %s <domain_param_id|all> <entity_id|all>" % sys.argv[0])
print("Create test bench for specified ALU")
if len(sys.argv) < 2:
print("Please specify domain parameters:")
print("(all)")
Domain_param.print_lst()
sys.exit()
if len(sys.argv) < 3:
print("Please specify entity id:")
Entity.print_lst()
sys.exit()
domain_param_arg = sys.argv[1]
if domain_param_arg == "all":
domain_param_lst = Domain_param.lst()
else:
domain_param_lst = [domain_param_arg]
entity_arg = sys.argv[2]
if entity_arg == "all":
entity_lst = Entity.lst()
else:
entity_lst = [entity_arg]
for domain_param_id in domain_param_lst:
print "Start: ", domain_param_id
dp = Domain_param.factory(domain_param_id)
if dp:
for entity_id in entity_lst:
print " Start: ", entity_id
entity = Entity.factory(entity_id, dp)
if entity:
if entity.is_compatible_with(dp):
tb = entity.get_default_tb(dp)
tb.generate()
tb.do_simulation()
else:
print dp.id + " is not compatible with " + entity_id + ", skipping"
del entity
print " End: ", entity_id
del dp
print "End: ", domain_param_id
load(cwd + '/script/report.py')
# script end