1

Wanted to try out VUnit, thus followed the Getting Started 1-2-3.

For blog 1, I installed Python ver. 3.6 and using ModelSim ver. 10.5a.

For blog 2, I downloaded example project udp_ip_stack-master.zip example project, but when I run:

python run.py --compile

the result is the error shown below:

C:\work\udp_ip_stack-master>python run.py --compile
  ERROR - Cannot add library named work. work is a reference to the current library. http://www.sigasi.com/content/work-not-vhdl-library
Traceback (most recent call last):
  File "C:\Python36\lib\site-packages\vunit\ui.py", line 728, in main
    all_ok = self._main()
  File "C:\Python36\lib\site-packages\vunit\ui.py", line 765, in _main
    return self._main_compile_only()
  File "C:\Python36\lib\site-packages\vunit\ui.py", line 820, in _main_compile_only
    self._compile(simulator_if)
  File "C:\Python36\lib\site-packages\vunit\ui.py", line 855, in _compile
    continue_on_error=self._keep_compiling)
  File "C:\Python36\lib\site-packages\vunit\simulator_interface.py", line 133, in compile_project
    self.setup_library_mapping(project)
  File "C:\Python36\lib\site-packages\vunit\modelsim_interface.py", line 143, in setup_library_mapping
    project.add_library(library_name, library_dir, is_external=True)
  File "C:\Python36\lib\site-packages\vunit\project.py", line 68, in add_library
    self._validate_library_name(logical_name)
  File "C:\Python36\lib\site-packages\vunit\project.py", line 60, in _validate_library_name
    raise RuntimeError("Illegal library name 'work'")
RuntimeError: Illegal library name 'work'

This project should not define any library named work, and as example project I would expect that it worked out of the box. What can be the problem?

EquipDev
  • 5,573
  • 10
  • 37
  • 63
  • Try somewhere other than `c:\work` perhaps? –  Mar 06 '17 at 15:05
  • Just tried at "C:\tryout>", but same result. I have also tried with ModelSim ver. 10.4 EDU, and Python ver. 2.7.x, but these give the error. – EquipDev Mar 06 '17 at 15:08
  • 1
    OK. There's a gitter channel linked to the vunit github website, I've found it helpful. –  Mar 06 '17 at 15:10
  • Thanks Brian; your indication that it should work made me dig deeper, this found the reason and posted it in an answer below. – EquipDev Mar 06 '17 at 15:19

1 Answers1

1

The "modelsim.ini" file contained:

work = work

and this made VUnit break with the mentioned error.

I suspect that quite a number of simulations uses work as an actually library name, doing for example vlib work in ModelSim, and this actually works fine, so maybe worth allowing this in VUnit, unless there is a substantial reason for not allowing this.

EquipDev
  • 5,573
  • 10
  • 37
  • 63
  • In VHDL, `work` is a reference to the current library, much like `self` in Python and `this` in Java and C. You can use the `work` library inside your VHDL to refer to the current library, but it is considered a bad practice to use `work` to name libraries. I have cloned the repo (https://github.com/LarsAsplund/udp_ip_stack) and couldn't reproduce the problem. Which VUnit version are you using? – suoto Mar 06 '17 at 19:09
  • Using latest VUnit, but as I wrote in this answer, the problem was solved by removing the `work = work` line in the "modesim.ini" file used for Modelsim setup. So if you really want to reproduce the problem, you should try to insert a `work = work` line in your "modelsim.ini" file. – EquipDev Mar 07 '17 at 07:23
  • It has been a long-lasting frustration to 'advanced' VHDL users that ModelSim uses `work` as a standard name for a library, or that you can use it as a nema _at all_. As souto says, `work` is actually a VHDL **keyword** that refers to the _current_ library. – JHBonarius Mar 21 '17 at 11:04