question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Function for comparing simulator version strings?

See original GitHub issue

Icarus Verilog master, reporting SIM_VERSION “11.0 (devel)”, now supports bit selects (see https://github.com/steveicarus/iverilog/issues/323). Thus, we need a way to selectively expect an error in our tests based on the version.

While I could compare with either the “11.0” string part, or the “10.” string of the released version (and assume nobody uses a version before 10), or treat the number part as a float etc., this gets all ugly for the general case. Since we have to support more such older/newer comparisons in the future (e.g. for upcoming GHDL improvements), does it make sense to provide a version comparison function that would gradually be extended to handle more simulators as needed?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
cmarqucommented, Jul 10, 2020

Interestingly, LooseVersion doesn’t like Aldec Active-HDL version numbers (taken from https://github.com/VUnit/vunit/pull/585/files#diff-8e7169ad9a827f7ebe5cb68193d01c63R423-R437):

Failed example:
    ActivehdlVersion("10.5a.12.6914") > ActivehdlVersion("10.5.216.6767")
Exception raised:
    Traceback (most recent call last):
      File "/tools/anaconda/2019.10-python3.7/Linux-x86_64/lib/python3.7/doctest.py", line 1329, in __run
        compileflags, 1), test.globs)
      File "<doctest __main__.ActivehdlVersion[0]>", line 1, in <module>
        ActivehdlVersion("10.5a.12.6914") > ActivehdlVersion("10.5.216.6767")
      File "/tools/anaconda/2019.10-python3.7/Linux-x86_64/lib/python3.7/distutils/version.py", line 64, in __gt__
        c = self._cmp(other)
      File "/tools/anaconda/2019.10-python3.7/Linux-x86_64/lib/python3.7/distutils/version.py", line 337, in _cmp
        if self.version < other.version:
    TypeError: '<' not supported between instances of 'str' and 'int'

This bug is still present in Python 3.9-dev: https://travis-ci.org/github/cocotb/cocotb/jobs/707016738

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compare two version strings in Swift - Stack Overflow
Using Swift 3, application version strings can be compare using the compare function with the option set to numeric.
Read more >
How to compare two app version strings in Swift - Sarunw
To compare app version strings, you can use compare(_:options:range:) with an option of .numeric . let version1 = "1.0.0" let version2 ...
Read more >
Compare two Version numbers - GeeksforGeeks
Method to compare two versions. // Returns 1 if v2 is smaller, -1. // if v1 is smaller, 0 if equal. int versionCompare(string...
Read more >
Simulink.sdi.compareRuns - MathWorks
This MATLAB function compares the data in the runs that correspond to runID1 and runID2 and returns the result in the Simulink.sdi.
Read more >
versioning - Comparing two software versions in C#
As a solution to this problem, I propose a simple set of rules and requirements that dictate how version numbers are assigned and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found