HAL
utils.py
Go to the documentation of this file.
1 from configuration import *
2 
3 
4 def round_float(value):
5  value_int = int(value * 100)
6  if value_int == 100:
7  return ("1.00")
8  else:
9  return ("0.%d" % value_int)
10 
11 def round_float_1(value):
12  return ("%.1f" % value)
13 
14 def expect(condition, error_message):
15  if not condition:
16  print(error_message)
17  exit(1)
18 
19 def get_gate_library(design, synthesizer):
20  if (synthesizer, design) in special_gate_libraries:
21  return special_gate_libraries[(synthesizer, design)]
22  return default_gate_libraries[synthesizer]
23 
24 # ---- EXECUTE HAL ----
25 def execute_hal(synthesizer, design, rebuild_debug, debug, sizes):
26  input_design = path_to_core_collection + \
27  "/" + netlists[synthesizer][design]
28 
29  expect(os.path.isfile(path_to_hal_bin),
30  "could not find HAL binary in: " + path_to_hal_bin)
31 
32 
33  if not os.path.isfile(input_design):
34  print("could not find design: " + input_design)
35  return False
36 
37  command = "{} -i {} --dataflow --layer 1 --path {} --gate-library {}.lib".format(
38  path_to_hal_bin, input_design, path_dataflow_out, get_gate_library(design, synthesizer))
39 
40  if sizes != "":
41  command = "{} -i {} --dataflow --layer 1 --path {} --gate-library {}.lib --sizes {}".format(
42  path_to_hal_bin, input_design, path_dataflow_out, get_gate_library(design, synthesizer), sizes)
43 
44  print(command)
45 
46  if rebuild_debug or debug:
47  os.system("gdb --args " + command)
48  else:
49  os.system(command)
50 
51  return True
def round_float_1(value)
Definition: utils.py:11
def get_gate_library(design, synthesizer)
Definition: utils.py:19
def round_float(value)
Definition: utils.py:4
def expect(condition, error_message)
Definition: utils.py:14
def execute_hal(synthesizer, design, rebuild_debug, debug, sizes)
Definition: utils.py:25