-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathautogen_hw_tcl.py
29 lines (24 loc) · 1.36 KB
/
autogen_hw_tcl.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
import argparse
from ipcore.dataplane_config import DataplaneConfig
from ipcore.hw_tcl_generator import HwTCLGenerator
def main(inputFilename, outputFilename, additionalFilesetAbsDir, sourceFilePatterns=[]):
dataplane_config = DataplaneConfig.parse_json(
additionalFilesetAbsDir + "/../../" + inputFilename)
dataplane_config.populate_additional_filesets(additionalFilesetAbsDir, sourceFilePatterns)
generator = HwTCLGenerator(dataplane_config)
generator.write_tcl(outputFilename)
def parseargs():
"""Parse commandline input arguments."""
parser = argparse.ArgumentParser(
description="Generates a Platform Design/Qsys component as _hw.tcl file")
parser.add_argument('-c', '--config',
help="JSON file containing autogen configuration")
parser.add_argument('-w', '--working-dir',
help="Working directory to generate the Platform Designer component in")
parser.add_argument('-o', '--output-filename',
help="Name of the output file, recommended to end in '_hw.tcl'")
parser.add_argument('-s', '--source-pattern',nargs='+', help='Patterns to find source files from the working directory')
args = parser.parse_args()
return (args.config, args.output_filename, args.working_dir, args.source_pattern)
if __name__ == "__main__":
main(*parseargs())