X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fpinmux_generator.py;h=2f04f34b08f638d60aec0b58a8a106a065e57695;hb=8c41066184b2196a45421619d98ba0be890a1c05;hp=c88146be844fd7b8e3207cc9fd205c27c1710dc1;hpb=302b814c4144d9bf2ef0ef7f29134bfa97c5cbd1;p=pinmux.git diff --git a/src/pinmux_generator.py b/src/pinmux_generator.py index c88146b..2f04f34 100644 --- a/src/pinmux_generator.py +++ b/src/pinmux_generator.py @@ -19,9 +19,7 @@ import getopt import os.path import sys -from spec import modules, specgen - -from bsv.pinmux_generator import pinmuxgen as bsvgen +from spec import modules, specgen, dummytest def printhelp(): @@ -43,6 +41,7 @@ if __name__ == '__main__': 'o:vht:s:', ['output=', 'validate', + 'test', 'outputtype=', 'spec=', 'help', @@ -58,6 +57,7 @@ if __name__ == '__main__': validate = False spec = None pinspec = None + testing = False for opt, arg in options: if opt in ('-o', '--output'): output_dir = arg @@ -67,6 +67,8 @@ if __name__ == '__main__': output_type = arg elif opt in ('-v', '--validate'): validate = True + elif opt in ('--test',): + testing = True elif opt in ('-h', '--help'): printhelp() sys.exit(0) @@ -83,12 +85,21 @@ if __name__ == '__main__': if not os.path.exists(d): os.makedirs(d) with open(fname, "w") as of: - pinout, bankspec, pinspec, fixedpins = module.pinspec(of) - specgen(of, output_dir, pinout, bankspec, pinspec, fixedpins) + ps = module.pinspec() + pinout, bankspec, pinspec, fixedpins = ps.write(of) + if testing: + dummytest(ps, output_dir, output_type) + else: + specgen(of, output_dir, pinout, + bankspec, pinspec, fixedpins, ps.fastbus) else: - gentypes = {'bsv': bsvgen} - if output_type not in gentypes: + if output_type == 'bsv': + from bsv.pinmux_generator import pinmuxgen as gentypes + elif output_type == 'myhdl': + from myhdlgen.pinmux_generator import pinmuxgen as gentypes + else: print ("ERROR: output type '%s' does not exist" % output_type) printhelp() sys.exit(0) - gentypes[output_type](output_dir, validate) + + gentypes(output_dir, validate)