Skip to content

Make simulator version objects more useful#5530

Open
zeel2104 wants to merge 1 commit intococotb:masterfrom
zeel2104:make-sim-version-objects-useful
Open

Make simulator version objects more useful#5530
zeel2104 wants to merge 1 commit intococotb:masterfrom
zeel2104:make-sim-version-objects-useful

Conversation

@zeel2104
Copy link
Copy Markdown

Make simulator version objects more useful by replacing the current LooseVersion-style behavior with simulator-aware parsing and comparison.

This change adds common constructors for building version objects from cocotb.SIM_VERSION and from simulator command output, including a zero-argument from_commandline() path that invokes the simulator automatically when possible. It also updates existing call sites to use the new convenience API.

The main motivation is that several supported simulators use version strings that do not compare correctly with the current implementation, especially when they include release metadata, development tags, suffix letters, or train names. This patch makes those comparisons behave more like users expect and makes the version helpers easier to use in tests.

Changes:

  • add a SimulatorVersion base with explicit parsing/comparison behavior
  • add from_sim_version() and improved from_commandline() constructors
  • implement simulator-specific parsing for Icarus, Verilator, Questa, VCS, Xcelium, GHDL, and NVC
  • update existing runner/test call sites to use the convenience constructors
  • add focused pytest coverage for known simulator version string formats

Testing:

  • $env:PYTHONPATH='d:\cocotb\src'; python -m pytest tests\pytest\test_sim_versions.py

I could not exercise the zero-argument subprocess path against real simulator executables in this shell because no supported simulators were installed on PATH, but the parsing and comparison behavior is covered by unit tests.

Closes #5520

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
2 pipeline(s) were filtered out due to trigger conditions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make simulation version objects useful

1 participant