sgherbst / anasymod

A framework for FPGA emulation of mixed-signal systems
BSD 3-Clause "New" or "Revised" License
34 stars 9 forks source link

Synonyms for simulator names #27

Closed sgherbst closed 4 years ago

sgherbst commented 4 years ago

anasymod supports the simulator names icarus, xrun, and vivado, whereas fault calls these simulators iverilog, ncsim, and vivado (ncsim can mean either irun or xrun for that library). For better cross-compatibility, it would be nice if a user could refer to Icarus Verilog as either icarus or iverilog and Cadence Incisive/Xcelium as either xrun or ncsim. I think this change could be made in a localized fashion by re-writing the simulator_name variable in the __init__ method of Analysis near this part of the code: https://github.com/sgherbst/anasymod/blob/fafaa0837388fac4883f0cd4e29de222ba5bced2/anasymod/analysis.py#L53 We could add something like this right after that line:

# regularize simulator names
if self.args.simulator_name in {'ncsim'}:  # could add more synonyms here in the future, like irun or xmsim
    print(f'Changing simulator name from {self.args.simulator_name} to xrun')
    self.args.simulator_name = 'xrun'
elif self.args.simulator_name in {'iverilog'}:
    print(f'Changing simulator name from {self.args.simulator_name} to icarus')
    self.args.simulator_name = 'icarus' 

That way we don't have to go through the code to look for all instances of icarus, xrun, etc., but still provide the user-facing interface with more flexibility.