HAL
test_multiple.py
Go to the documentation of this file.
1 import sys, os
2 
3 hal_base_path = "/home/simon/projects/hal/"
4 dir_path = "/home/simon/playground/boolean_inf_test/netlists"
5 gate_library_path = "/home/simon/projects/hal/plugins/gate_libraries/definitions/lsi_10k.hgl"
6 
7 sys.path.append(hal_base_path + "build/lib/") #this is where your hal python lib is located
8 os.environ["HAL_BASE_PATH"] = hal_base_path + "build" # hal base path
9 
10 import hal_py
11 
12 #initialize HAL
13 hal_py.plugin_manager.load_all_plugins()
14 
15 from hal_plugins import boolean_influence
16 
17 import glob
18 
19 files = glob.glob(dir_path + '/**/netlist/*.v', recursive=True)
20 
21 print(files)
22 print(len(files))
23 
24 for file in files:
25  print("Getting influences in netlist {}".format(file))
26 
27  netlist = hal_py.NetlistFactory.load_netlist(file, gate_library_path)
28 
29  for gate in netlist.gates:
30  if gate.type.has_property(hal_py.GateTypeProperty.ff):
31  print("Gathering influences for gate {}".format(gate.id))
32  inf = boolean_influence.get_boolean_influences_of_gate(gate)
33 
34 
35 #unload everything hal related
36 hal_py.plugin_manager.unload_all_plugins()