From 0afc0186a8f5bad88ded238b5e38b9a5eff0c01f Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 23 Mar 2018 23:07:13 +0000 Subject: [PATCH] add spec generation --- src/pinmux_generator.py | 28 +++++++++++++++++++++------- src/spec/__init__.py | 9 +++++++++ src/spec/gen.py | 2 ++ src/spec/m_class.py | 3 ++- 4 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 src/spec/gen.py diff --git a/src/pinmux_generator.py b/src/pinmux_generator.py index a5e381a..8d36f1c 100644 --- a/src/pinmux_generator.py +++ b/src/pinmux_generator.py @@ -19,6 +19,7 @@ import getopt import os.path import sys +from spec import modules, specgen from bsv.pinmux_generator import pinmuxgen as bsvgen @@ -38,10 +39,11 @@ if __name__ == '__main__': try: options, remainder = getopt.getopt( sys.argv[1:], - 'o:vht:', + 'o:vht:s:', ['output=', 'validate', 'outputtype=', + 'spec=', 'help', 'version=', ]) @@ -53,9 +55,12 @@ if __name__ == '__main__': output_type = 'bsv' output_dir = None validate = False + spec = None for opt, arg in options: if opt in ('-o', '--output'): output_dir = arg + elif opt in ('-s', '--spec'): + pinspec = arg elif opt in ('-t', '--outputtype'): output_type = arg elif opt in ('-v', '--validate'): @@ -64,9 +69,18 @@ if __name__ == '__main__': printhelp() sys.exit(0) - gentypes = {'bsv': bsvgen} - if not gentypes.has_key(output_type): - print "ERROR: output type '%s' does not exist" % output_type - printhelp() - sys.exit(0) - gentypes[output_type](output_dir, validate) + if pinspec: + if not modules.has_key(pinspec): + print "ERROR: spec type '%s' does not exist" % pinspec + printhelp() + sys.exit(1) + module = modules[pinspec] + pinout, bankspec, fixedpins = module.pinspec() + specgen(output_dir, pinout, bankspec, fixedpins) + else: + gentypes = {'bsv': bsvgen} + if not gentypes.has_key(output_type): + print "ERROR: output type '%s' does not exist" % output_type + printhelp() + sys.exit(0) + gentypes[output_type](output_dir, validate) diff --git a/src/spec/__init__.py b/src/spec/__init__.py index e69de29..3a0a257 100644 --- a/src/spec/__init__.py +++ b/src/spec/__init__.py @@ -0,0 +1,9 @@ +import m_class +import c_class +from gen import specgen + +modules = {'m_class': m_class, + 'c_class': c_class + } + + diff --git a/src/spec/gen.py b/src/spec/gen.py new file mode 100644 index 0000000..af42d42 --- /dev/null +++ b/src/spec/gen.py @@ -0,0 +1,2 @@ +def specgen(pinouts, bankspec, fixedpins): + return diff --git a/src/spec/m_class.py b/src/spec/m_class.py index 0d9d2b4..6afee67 100644 --- a/src/spec/m_class.py +++ b/src/spec/m_class.py @@ -2,7 +2,8 @@ from interfaces import jtag, uart, ulpi, uartfull, rgbttl, rgmii from interfaces import flexbus1, flexbus2, sdram1, sdram2, mcu8080 -from interfaces import eint, pwm, gpio +from interfaces import eint, pwm, gpio, spi, i2c, emmc, sdmmc +from interfaces import quadspi, i2s from interfaces import display, display_fns, check_functions from interfaces import pinmerge, display_fixed -- 2.30.2