mirror of
https://git.sr.ht/~kivikakk/niar
synced 2024-12-22 18:52: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"
|
||||
),
|
||||
)
|
||||
if hasattr(np, "cxxrtl_targets"):
|
||||
if np.cxxrtl_targets:
|
||||
cxxrtl.add_arguments(
|
||||
np, subparsers.add_parser("cxxrtl", help="run the C++ simulator tests")
|
||||
)
|
||||
|
|
|
@ -62,6 +62,9 @@ def main(np: Project, args):
|
|||
"yosys_opts": "-g",
|
||||
}
|
||||
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)
|
||||
|
||||
il_fn = f"{np.name}.il"
|
||||
|
|
|
@ -82,7 +82,8 @@ class Project:
|
|||
name: str
|
||||
top: type[Elaboratable]
|
||||
targets: list[type[Platform]]
|
||||
cxxrtl_targets: Optional[list[type[CxxrtlPlatform]]]
|
||||
cxxrtl_targets: list[type[CxxrtlPlatform]] = []
|
||||
externals: list[str] = []
|
||||
|
||||
origin: Path
|
||||
|
||||
|
@ -149,7 +150,7 @@ class Project:
|
|||
raise KeyError(f"unknown target {name!r}")
|
||||
|
||||
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:
|
||||
return t()
|
||||
raise KeyError(f"unknown CXXRTL target {name!r}")
|
||||
|
|
Loading…
Reference in a new issue