mirror of
https://git.sr.ht/~kivikakk/niar
synced 2024-12-22 18:12:24 +00:00
build: add externals to build plan.
This commit is contained in:
parent
99273cb385
commit
2e4b50cce1
|
@ -17,7 +17,7 @@ def cli(np: Project):
|
||||||
"build", help="build the design, and optionally program it"
|
"build", help="build the design, and optionally program it"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
if hasattr(np, "cxxrtl_targets"):
|
if np.cxxrtl_targets:
|
||||||
cxxrtl.add_arguments(
|
cxxrtl.add_arguments(
|
||||||
np, subparsers.add_parser("cxxrtl", help="run the C++ simulator tests")
|
np, subparsers.add_parser("cxxrtl", help="run the C++ simulator tests")
|
||||||
)
|
)
|
||||||
|
|
|
@ -62,6 +62,9 @@ def main(np: Project, args):
|
||||||
"yosys_opts": "-g",
|
"yosys_opts": "-g",
|
||||||
}
|
}
|
||||||
prepare_kwargs.update(getattr(platform, "prepare_kwargs", {}))
|
prepare_kwargs.update(getattr(platform, "prepare_kwargs", {}))
|
||||||
|
for p in np.externals:
|
||||||
|
with open(np.path(p), 'rb') as f:
|
||||||
|
platform.add_file(p, f)
|
||||||
plan = platform.prepare(design, np.name, **prepare_kwargs)
|
plan = platform.prepare(design, np.name, **prepare_kwargs)
|
||||||
|
|
||||||
il_fn = f"{np.name}.il"
|
il_fn = f"{np.name}.il"
|
||||||
|
|
|
@ -82,7 +82,8 @@ class Project:
|
||||||
name: str
|
name: str
|
||||||
top: type[Elaboratable]
|
top: type[Elaboratable]
|
||||||
targets: list[type[Platform]]
|
targets: list[type[Platform]]
|
||||||
cxxrtl_targets: Optional[list[type[CxxrtlPlatform]]]
|
cxxrtl_targets: list[type[CxxrtlPlatform]] = []
|
||||||
|
externals: list[str] = []
|
||||||
|
|
||||||
origin: Path
|
origin: Path
|
||||||
|
|
||||||
|
@ -149,7 +150,7 @@ class Project:
|
||||||
raise KeyError(f"unknown target {name!r}")
|
raise KeyError(f"unknown target {name!r}")
|
||||||
|
|
||||||
def cxxrtl_target_by_name(self, name: str) -> CxxrtlPlatform:
|
def cxxrtl_target_by_name(self, name: str) -> CxxrtlPlatform:
|
||||||
for t in self.cxxrtl_targets or []:
|
for t in self.cxxrtl_targets:
|
||||||
if t.__name__ == name:
|
if t.__name__ == name:
|
||||||
return t()
|
return t()
|
||||||
raise KeyError(f"unknown CXXRTL target {name!r}")
|
raise KeyError(f"unknown CXXRTL target {name!r}")
|
||||||
|
|
Loading…
Reference in a new issue