- Introduced new scripts for project generation and synthesis (dodo.py, generate_prj.py, generate_scr.py, run_xst.py). - Implemented configuration parsing for VHDL sources and project settings (config.py). - Added default configuration values (defaults.py). - Updated .gitignore to include additional file types. - Created test cases for project generation and configuration parsing (test_generate_prj.py, test_generate_scr.py, test_project_cfg.py).
34 lines
891 B
Python
34 lines
891 B
Python
from tools.config import parse_project_cfg
|
|
from pathlib import Path
|
|
|
|
|
|
def generate_scr(scr_path: Path, cfg_path: Path):
|
|
cfg = parse_project_cfg(cfg_path)
|
|
|
|
project = cfg["PROJECT"]
|
|
top = cfg.get("TOPLEVEL", project)
|
|
target_part = cfg["TARGET_PART"]
|
|
xst_opts = cfg.get("XST_OPTS", "")
|
|
|
|
# SCR-Datei vollständig in einer Zeile, wie im Makefile
|
|
scr_parts = [
|
|
"run",
|
|
f"-ifn {project}.prj",
|
|
f"-ofn {project}.ngc",
|
|
"-ifmt mixed",
|
|
]
|
|
|
|
# Optional: Optionen aus XST_OPTS hinzufügen
|
|
if xst_opts.strip():
|
|
scr_parts += xst_opts.strip().split()
|
|
|
|
scr_parts += [
|
|
f"-top {top}",
|
|
"-ofmt NGC",
|
|
f"-p {target_part}",
|
|
]
|
|
|
|
scr_line = " ".join(scr_parts).replace("\n", " ").replace("\r", " ")
|
|
scr_path.parent.mkdir(parents=True, exist_ok=True)
|
|
scr_path.write_text(scr_line, encoding="utf-8")
|