Compare commits

...

3 Commits

Author SHA1 Message Date
308de700a2 Bump version from 0.2.0 to 0.3.0 in pyproject.toml
All checks were successful
Build Wheels / build (push) Successful in 4m1s
2025-04-27 12:02:20 +00:00
f1315dc458 Refactors testbench build and execution logic
Updates `build_testbench` to use a shared tool execution utility, improving maintainability and consistency.
Refactors `run_testbench` to accept project configurations, enabling better customization and handling of tool options.

Enhances modularity and reduces redundancy in the simulation workflow.
2025-04-27 12:02:05 +00:00
ba8cc2ef94 Adds ISim support to tool options
Extends tool configuration to include ISim options by adding a new field to the model and example configuration file. Supports specifying ISim arguments for enhanced simulation workflows.
2025-04-27 12:01:38 +00:00
5 changed files with 26 additions and 22 deletions

View File

@@ -56,3 +56,6 @@ tool_options:
- "3"
fuse: []
isim:
- "-gui"

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "hdlbuild"
version = "0.2.0"
version = "0.3.0"
description = "Flexible FPGA Build System"
authors = ["0xMax42 <Mail@0xMax42.io>"]
license = "MIT"

View File

@@ -44,7 +44,7 @@ def test(args):
"""Starts the test process."""
console_utils.print("Starting test process...")
build_testbench(project, args.target)
run_testbench(args.target)
run_testbench(project, args.target)
def main():

View File

@@ -14,6 +14,7 @@ class ToolOptions(BaseModel):
bitgen: List[str] = Field(default_factory=list)
trace: List[str] = Field(default_factory=list)
fuse: List[str] = Field(default_factory=list)
isim: List[str] = Field(default_factory=list)
class Dependency(BaseModel):
name: Optional[str] = None # Name ist jetzt optional

View File

@@ -4,6 +4,7 @@ from typing import List
from hdlbuild.models.project import ProjectConfig
from hdlbuild.models.config import DIRECTORIES
from hdlbuild.dependencies.resolver import DependencyResolver
from hdlbuild.tools.xilinx_ise.common import run_tool
from hdlbuild.utils.console_utils import ConsoleTask
from hdlbuild.utils.source_resolver import expand_all_sources, expand_testbenches
@@ -86,28 +87,24 @@ def build_testbench(project: ProjectConfig, testbench_name: str):
testbench_name=testbench_name
)
# 2. Befehl bauen
xilinx_path = project.xilinx_path
xilinx_bin_dir = os.path.join(xilinx_path, "bin", "lin64") # oder nt64 bei Windows
fuse_executable = os.path.join(xilinx_bin_dir, "fuse")
cmd = [
fuse_executable,
"-intstyle", "xflow",
# 2. FUSE-Befehl ausführen mit `run_tool`
mandatory_arguments = [
"-prj", f"{project.name}_sim.prj",
"-o", isim_exe_name,
f"work.{testbench_name.replace('.vhd', '').replace('.v', '')}",
"work.glbl"
]
# 3. Ausführen mit Konsole
task = ConsoleTask(prefix="hdlbuild", title=f"FUSE {testbench_name}")
result = task.run_command(cmd, cwd=DIRECTORIES.build)
run_tool(
project=project,
tool_executable_name="fuse",
tool_option_attr="fuse",
mandatory_arguments=mandatory_arguments,
working_dir=DIRECTORIES.build,
silent=False
)
if result != 0:
raise RuntimeError(f"FUSE fehlgeschlagen für Testbench {testbench_name}")
def run_testbench(testbench_name: str):
def run_testbench(project: ProjectConfig, testbench_name: str):
"""
Führt eine gebaute Testbench-Executable aus (ISim Simulation).
@@ -116,7 +113,6 @@ def run_testbench(testbench_name: str):
"""
# Pfade
isim_exe_name = f"isim_{testbench_name.replace('.vhd', '').replace('.v', '')}"
isim_exe_path = os.path.join(DIRECTORIES.build, isim_exe_name)
isim_cmd_file = os.path.join(DIRECTORIES.build, f"{isim_exe_name}.cmd")
@@ -124,13 +120,17 @@ def run_testbench(testbench_name: str):
with open(isim_cmd_file, "w") as f:
f.write("")
cmd = [f"./{isim_exe_name}"]
tool_opts = getattr(project.tool_options, "isim", [])
if tool_opts:
cmd.extend(tool_opts)
# 2. Kommando bauen
cmd = [
f"./{isim_exe_name}",
"-gui",
cmd.extend([
"-tclbatch",
f"{isim_exe_name}.cmd"
]
])
# 3. Ausführen
task = ConsoleTask(prefix="hdlbuild", title=f"RUN {testbench_name}")