From: Luke Kenneth Casson Leighton Date: Mon, 2 Jul 2018 11:20:58 +0000 (+0100) Subject: add in dummy testing mode X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d4572a8e273f61c78acb116c351fb78ecc5bb481;p=pinmux.git add in dummy testing mode --- diff --git a/src/pinmux_generator.py b/src/pinmux_generator.py index c88146b..e34b4c5 100644 --- a/src/pinmux_generator.py +++ b/src/pinmux_generator.py @@ -19,7 +19,7 @@ import getopt import os.path import sys -from spec import modules, specgen +from spec import modules, specgen, dummytest from bsv.pinmux_generator import pinmuxgen as bsvgen @@ -43,6 +43,7 @@ if __name__ == '__main__': 'o:vht:s:', ['output=', 'validate', + 'test', 'outputtype=', 'spec=', 'help', @@ -58,6 +59,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 +69,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,8 +87,12 @@ 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) else: gentypes = {'bsv': bsvgen} if output_type not in gentypes: diff --git a/src/spec/__init__.py b/src/spec/__init__.py index e03c0e3..e85da79 100644 --- a/src/spec/__init__.py +++ b/src/spec/__init__.py @@ -3,6 +3,7 @@ from spec import c_class from spec import minitest from spec import microtest from spec.gen import specgen +from spec.testing import dummytest modules = {'m_class': m_class, 'c_class': c_class, diff --git a/src/spec/c_class.py b/src/spec/c_class.py index 704eaf9..421d508 100644 --- a/src/spec/c_class.py +++ b/src/spec/c_class.py @@ -4,7 +4,7 @@ from spec.ifaceprint import display, display_fns, check_functions from spec.ifaceprint import display_fixed -def pinspec(of): +def pinspec(): pinouts = {} pinbanks = {'A': 16, diff --git a/src/spec/m_class.py b/src/spec/m_class.py index 6503d56..c122e83 100644 --- a/src/spec/m_class.py +++ b/src/spec/m_class.py @@ -3,7 +3,7 @@ from spec.base import PinSpec -def pinspec(of): +def pinspec(): pinbanks = {'A': 16, 'B': 28, 'C': 24, @@ -512,4 +512,4 @@ def pinspec(of): iot, iot_eint, iot_pwm, descriptions) - return ps.write(of) + return ps diff --git a/src/spec/microtest.py b/src/spec/microtest.py index 0764e78..f4adabf 100644 --- a/src/spec/microtest.py +++ b/src/spec/microtest.py @@ -6,7 +6,7 @@ from spec.ifaceprint import display, display_fns, check_functions from spec.ifaceprint import display_fixed -def pinspec(of): +def pinspec(): pinbanks = { 'A': 4, } @@ -71,7 +71,7 @@ def pinspec(of): 'ULPI1': 'dual USB2 Host ULPI PHY' } - ps.add_scenario("MiniTest", microtest, microtest_eint, microtest_pwm, + ps.add_scenario("MicroTest", microtest, microtest_eint, microtest_pwm, descriptions) - return ps.write(of) + return ps diff --git a/src/spec/minitest.py b/src/spec/minitest.py index 3b70bb5..4ab43c0 100644 --- a/src/spec/minitest.py +++ b/src/spec/minitest.py @@ -6,7 +6,7 @@ from spec.ifaceprint import display, display_fns, check_functions from spec.ifaceprint import display_fixed -def pinspec(of): +def pinspec(): pinbanks = { 'B': 28, } @@ -109,4 +109,4 @@ def pinspec(of): ps.add_scenario("MiniTest", minitest, minitest_eint, minitest_pwm, descriptions) - return ps.write(of) + return ps