-import os, argparse
+import os, sys
from migen.fhdl.std import *
from migen.fhdl.structure import _Fragment
from migen.genlib.record import Record
from migen.fhdl import verilog, edif
+from migen.util.misc import autotype
from mibuild import tools
def build(self, fragment):
raise NotImplementedError("GenericPlatform.build must be overloaded")
- def add_arguments(self, parser):
- pass # default: no arguments
-
- def build_arg_ns(self, ns, *args, **kwargs):
- self.build(*args, **kwargs)
-
def build_cmdline(self, *args, **kwargs):
- parser = argparse.ArgumentParser(description="FPGA bitstream build system")
- self.add_arguments(parser)
- ns = parser.parse_args()
- self.build_arg_ns(ns, *args, **kwargs)
+ arg = sys.argv[1:]
+ if len(arg) % 2:
+ print("Missing value for option: "+sys.argv[-1])
+ sys.exit(1)
+ argdict = dict((k, autotype(v)) for k, v in zip(*[iter(arg)]*2))
+ kwargs.update(argdict)
+ self.build(*args, **kwargs)
_run_ise(build_name, ise_path, source, isemode, ngdbuild_opt)
os.chdir("..")
-
- def build_arg_ns(self, ns, *args, **kwargs):
- for n in ["build_dir", "build_name", "ise_path"]:
- attr = getattr(ns, n)
- if attr is not None:
- kwargs[n] = attr
- if ns.no_source:
- kwargs["source"] = False
- if ns.no_run:
- kwargs["run"] = False
- self.build(*args, **kwargs)
-
- def add_arguments(self, parser):
- parser.add_argument("--build-dir", default=None, help="Set the directory in which to generate files and run ISE")
- parser.add_argument("--build-name", default=None, help="Base name for the generated files")
- parser.add_argument("--ise-path", default=None, help="ISE installation path (without version directory)")
- parser.add_argument("--no-source", action="store_true", help="Do not source ISE settings file")
- parser.add_argument("--no-run", action="store_true", help="Only generate files, do not run ISE")