Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'questa' to list of supported simulators (VUNIT_SIMULATOR) #834

Closed
tasgomes opened this issue May 30, 2022 · 11 comments · Fixed by #850
Closed

Add 'questa' to list of supported simulators (VUNIT_SIMULATOR) #834

tasgomes opened this issue May 30, 2022 · 11 comments · Fixed by #850

Comments

@tasgomes
Copy link

Currently, if VUNIT_SIMULATOR is set to 'questa' the following error occurs:

RuntimeError: Simulator from VUNIT_SIMULATOR environment variable 'questa' is not supported. Supported simulators are dict_keys(['modelsim', 'rivierapro', 'activehdl', 'ghdl', 'incisive'])

However, both Questa and Modelsim call vsim to run the simulations. In fact, if I set VUNIT_SIMULATOR='modelsim' and VUNIT_MODELSIM_PATH=<path to questa install directory>, I can execute VUnit testbenches with Questa without any problem.

Would it be possible to add the name 'questa' to the current list of supported simulators?

or is there any limitation?

@umarcor
Copy link
Member

umarcor commented May 30, 2022

Would the enhancement include supporting VUNIT_QUESTASIM_PATH as an alias of VUNIT_MODELSIM_PATH?

Context:

def select_simulator(self):
"""
Select simulator class, either from VUNIT_SIMULATOR environment variable
or the first available
"""
available_simulators = self._detect_available_simulators()
name_mapping = {simulator_class.name: simulator_class for simulator_class in self.supported_simulators()}
if not available_simulators:
return None
environ_name = "VUNIT_SIMULATOR"
if environ_name in os.environ:
simulator_name = os.environ[environ_name]
if simulator_name not in name_mapping:
raise RuntimeError(
(
"Simulator from " + environ_name + " environment variable %r is not supported. "
"Supported simulators are %r"
)
% (simulator_name, name_mapping.keys())
)
simulator_class = name_mapping[simulator_name]
else:
simulator_class = available_simulators[0]
return simulator_class

I can execute VUnit testbenches with Questa without any problem

QuestaSim is explicitly supported. However, the procedure is as you guessed.

@tasgomes
Copy link
Author

I guess so in order to keep it consistent with others.

@tasgomes
Copy link
Author

@umarcor There are also some other considerations, example:

lib.set_sim_option("modelsim.vsim_flags", (...))

@std-max
Copy link
Contributor

std-max commented May 31, 2022

I wonder if Modelsim will be discontinued in a near future and be replaced with Questasim? see this reddit thread

If that's the case, maybe it would be better to change all modelsim reference in the code to questasim, and to make modelsim an alias of questasim?

Do you know if modelsim.ini is also named like this with Questasim? or if it's named questasim.ini?

@tasgomes
Copy link
Author

@std-max as far as my experience goes. with Questa-Intel FPGA Edition, the file is still called modelsim.ini.

If I compare the vunit_out folders between Questa and Modelsim:

  • Questa: .\vunit_out\modelsim\modelsim.ini
  • Modelsim: .\vunit_out\questa\modelsim.ini

@LarsAsplund
Copy link
Collaborator

From a maintenance point of view the simplest solution is to just call it modelsim everywhere in the code and very clearly show, in documentation, that it includes Questa as well. Is there something we can do to make this clearer?

@std-max
Copy link
Contributor

std-max commented May 31, 2022

Agree with you @LarsAsplund
This is the simplest way I think. I will try to file a PR that adds a bit of documentation for that point.

@tasgomes
Copy link
Author

tasgomes commented Jun 1, 2022

Currently all my (minor) issues can be solved with workarounds. But I am wondering if we are delaying something that might need to be done in the future.

At the moment, I have a Makefile that allows me to change the simulator (modelsim, questa and ghdl) using a switch. This switch is also used for Vivado to compile the Xilinx libraries where Vivado distinguishes between Modelsim (-simulator modelsim) and Questa (-simualtor questa). Because I compile the libraries to specific folders and use different vunit_out folders depending on the simulator used, I can run the same regression test in any of the simulators at the same time.

At the moment, one of the workarounds in run.py is to overwrite the name of the simulator when questa is select as follow:

if args.simulator == 'questa':
    environ["VUNIT_SIMULATOR"] = 'modelsim'
else:
    environ["VUNIT_SIMULATOR"] = args.simulator

One main difference between Questa and Modelsim, is that Questa has optimizations turned on by default. If you try to disable them, you even get a (suppressible) compilation error that your simulation will run very slowly, etc.. The point is because optimizations are on, if you debug your DUT in GUI mode many internal signals are optimized out and not visible so you need to add some flags to vsim in order to preserve visibility for debugging.

Also, comparing the help menu of vsim and vcom shows that there many new flags in Questa that do not exist in Modelsim so at some point it will make sense to have modelsim.vsim_flags and questa.vsim_flags like we have for ghdl.elab_flags so that new Questa flags are not applied when using Modelsim simulator. Again this can still be solved with the workaround shown above.

@LarsAsplund
Copy link
Collaborator

@tasgomes Can you share some of the flags that are different? Just to get a feel for how "useful" they are.

Some weeks ago a new colleague tried to install free ModelSim from Intel to use that with VUnit. He found out that the free simulator in Quartus is now a variant of Questa which he didn't manage to install. Not sure if it wasn't free after all. Anyway, it was solved by using an older version of Quartus to get access to the free ModelSim.

If there actually is a free Questa from Intel it means that it will be easier for us to verify Questa and also support it as a simulator different from ModelSim. Anyone having experience with this new Questa version?

@tasgomes
Copy link
Author

@LarsAsplund Although there are now new flags in Questa, currently there is none that I used that only exists in one of them. But since I started using Questa, I had to add this one to preserve signal visibility when doing debug activities in GUI mode:

lib.set_sim_option("modelsim.vsim_flags", ["-voptargs=+acc"])

I use Questa Intel FPGA Edition. I believe when you are installing it, you can select the free "Starter Edition" option.

@LarsAsplund
Copy link
Collaborator

@tasgomes If there are no strong reasons in support of differentiating between the two I suggest we postpone it until we find such reasons. Reduces maintenance. Only make the Questa and ModelSim relation very clear in the docs.

In general one cannot not avoid that users have to take special steps to handle their different licenses. For example, you can have several vendor versions of ModelSim installed and VUNIT_SIMULATOR alone cannot be used to differentiate between the two.

Turning off optimization is also something that you have to do with other simulators, for example Riviera-PRO.

Looks like we did something wrong when installing Intel Questa then. Good to know. I should give it another try.

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 a pull request may close this issue.

4 participants