8 from configuration
import *
13 parser = argparse.ArgumentParser(description=
'Call the HAL dataflow plugin.')
14 parser.add_argument(
'design', metavar=
'design', type=str, help=
'name of the design')
15 parser.add_argument(
'synthesizer', metavar=
'synthesizer', type=str, help=
'name of the synthesizer')
16 parser.add_argument(
'--rebuild', action=
'store_true', help=
'if set will clear build folder and rebuild cmake')
17 parser.add_argument(
'--rebuild-debug', action=
'store_true', help=
'if set will clear build folder and rebuild cmake with debug and execute with gdb')
18 parser.add_argument(
'--debug', action=
'store_true', help=
'if set will execute with gdb')
19 parser.add_argument(
'--sizes', metavar=
'sizes', type=str, help=
'define allowed sizes')
20 parser.add_argument(
'--hal-file', action=
'store_true', help=
'use the .hal file instead of the netlist')
21 parser.add_argument(
'--create-hal-file', action=
'store_true', help=
'run hal without the dataflow plugin to create a .hal file for the netlist')
28 def expect(condition, error_message):
33 args = parser.parse_args()
35 synthesizers = set(x
for x
in netlists)
36 designs = set(x
for y
in netlists
for x
in netlists[y])
38 expect(os.path.isdir(path_to_core_collection),
"core collection needs to be placed in: " + path_to_core_collection)
39 expect(os.path.isdir(path_to_core_collection),
"hal needs to be placed in: " + path_to_core_collection)
40 expect(args.design
in designs,
"available designs: " +
", ".
join(designs))
41 expect(args.synthesizer
in synthesizers,
"available synthesizers: " +
", ".
join(synthesizers))
48 if args.rebuild
or args.rebuild_debug:
49 print(
"will recreate cmake")
51 os.system(
'rm -rf ' + path_to_hal_build +
"/*")
52 os.chdir(path_to_hal_build)
54 os.system(
"cmake ../ -GNinja -DPL_DATAFLOW=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_GUI=OFF")
56 os.system(
"cmake ../ -GNinja -DPL_DATAFLOW=ON -DCMAKE_BUILD_TYPE=Debug -DWITH_GUI=OFF")
58 expect(os.path.isdir(path_to_hal_build),
"path to hal build '{}' does not exist".format(path_to_hal_build))
60 os.chdir(path_to_hal_build)
62 return_ninja = os.system(
'ninja')
63 expect(return_ninja == 0,
"error in build: return code: " +
str(return_ninja))
70 expect(os.path.isfile(path_to_hal_bin),
"could not find HAL binary in: " + path_to_hal_bin)
72 input_design = path_to_core_collection +
"/" + netlists[args.synthesizer][args.design]
75 if args.create_hal_file:
76 command =
"{} -i {} --gate-library {}.lib".format(path_to_hal_bin, input_design,
get_gate_library(args.design, args.synthesizer))
80 input_design = input_design[:input_design.rfind(
".")] +
".hal"
82 expect(os.path.isfile(input_design),
"could not find design: " + input_design)
84 command =
"{} -i {} --dataflow --path {} --gate-library {}.lib".format(path_to_hal_bin, input_design, path_dataflow_out,
get_gate_library(args.design, args.synthesizer))
86 if args.sizes !=
None:
87 command +=
" --sizes {}".format(args.sizes)
91 if args.rebuild_debug
or args.debug:
92 os.system(
"gdb --args " + command)
def expect(condition, error_message)
-— ARG CHECKS -—
GateLibrary * get_gate_library(const std::string &file_path)
CORE_API std::string join(const std::string &joiner, const Iterator &begin, const Iterator &end, const Transform &transform)