X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fpinmux_generator.py;h=896c3293477bc0f990d1d67643a81e96adcb61c3;hb=ef57b4134c943253273691606dd0f646e6d0a0b1;hp=3da90f1966f821974aaa591e86dbf7604aa72a63;hpb=b1effd8efa03d5857caf3a4e6d3f177c853afa10;p=pinmux.git diff --git a/src/pinmux_generator.py b/src/pinmux_generator.py index 3da90f1..896c329 100644 --- a/src/pinmux_generator.py +++ b/src/pinmux_generator.py @@ -19,11 +19,10 @@ import getopt import os.path import sys +import json from spec import modules, specgen, dummytest - -from bsv.pinmux_generator import pinmuxgen as bsvgen -from myhdlgen.pinmux_generator import pinmuxgen as myhdlgen - +from spec.ifaceprint import create_sv, temp_create_sv +import jsoncreate def printhelp(): print ('''pinmux_generator.py [-o outputdir] [-v|--validate] [-h|--help] @@ -84,20 +83,43 @@ if __name__ == '__main__': module = modules[pinspec] fname = os.path.join(output_dir or '', "%s.mdwn" % pinspec) + pyname = os.path.join(output_dir or '', "%s_pins.py" % pinspec) d = os.path.split(fname)[0] if not os.path.exists(d): os.makedirs(d) with open(fname, "w") as of: - 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) + with open(pyname, "w") as pyf: + ps = module.pinspec() + pinout, bankspec, pin_spec, fixedpins = ps.write(of) + #chip['litex.map'] = litexmap + if testing: + dummytest(ps, output_dir, output_type) + else: + specgen(of, output_dir, pinout, + bankspec, ps.muxwidths, pin_spec, fixedpins, + ps.fastbus) + pm, chip = jsoncreate.pinparse(ps, pinspec) + litexmap = ps.pywrite(pyf, pm) + jchip = json.dumps(chip) + with open("%s/litex_pinpads.json" % pinspec, "w") as f: + f.write(jchip) + # octavius: please keep line-lengths to below 80 chars + # TODO: fix create_sv to allow different packages + # (and die images) + # Test with different package size, once working + # 'create_sv' will be improved + if pinspec == "ngi_router": + temp_create_sv("%s/%s.svg" % (pinspec, pinspec), chip) + if pinspec == "ls180": + create_sv("%s/%s.svg" % (pinspec, pinspec), chip) else: - gentypes = {'bsv': bsvgen, 'myhdl': myhdlgen} - 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)