Add project configuration and build tools

- 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).
This commit is contained in:
2025-04-20 11:32:37 +00:00
parent 5d4cd3e315
commit 2fce367686
15 changed files with 530 additions and 1 deletions

33
tasks/generate_scr.py Normal file
View File

@@ -0,0 +1,33 @@
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")