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

View File

@@ -0,0 +1,47 @@
import tempfile
from pathlib import Path
from tasks.generate_prj import generate_prj
def write_file(path: Path, content: str):
path.write_text(content.strip(), encoding="utf-8")
def test_generate_prj_single_lib(tmp_path):
cfg_path = tmp_path / "project.cfg"
toml_path = tmp_path / "vhdl_ls.toml"
prj_path = tmp_path / "working" / "MyProject.prj"
write_file(cfg_path, "PROJECT = MyProject\nTARGET_PART = dummy\nXILINX = /some/path")
write_file(toml_path, """
[libraries.lib]
files = ["src/main.vhd"]
""")
generate_prj(prj_path, cfg_path, toml_path)
assert prj_path.exists()
content = prj_path.read_text()
assert "vhdl work ../src/main.vhd" in content
def test_generate_prj_multiple_libs(tmp_path):
cfg_path = tmp_path / "project.cfg"
toml_path = tmp_path / "vhdl_ls.toml"
prj_path = tmp_path / "working" / "MyProject.prj"
write_file(cfg_path, "PROJECT = MyProject\nTARGET_PART = dummy\nXILINX = /some/path")
write_file(toml_path, """
[libraries.lib]
files = ["src/A.vhd", "src/B.vhd"]
[libraries.otherlib]
files = ["src/C.vhd"]
""")
generate_prj(prj_path, cfg_path, toml_path)
content = prj_path.read_text()
assert "vhdl work ../src/A.vhd" in content
assert "vhdl work ../src/B.vhd" in content
assert "vhdl otherlib ../src/C.vhd" in content