0

I'm running automated testbenches with ghdl (0.32rc1). Some of my testbenches require unisim primitives from Xilinx ISE.

I have prepared two external files, if one would like to test my example. To run my example, you'll need a Xilinx ISE or Vivado installation, so you can find the MUXCY primitive. It's located in the folder <InstallDir>\ISE_DS\ISE\vhdl\src\unisims\primitive.

I analyzed the three files with the following ghdl commands:

PS D:\Temp\ghdl> C:\Tools\GHDL\0.32RC1\bin\ghdl.exe -a --work=work C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\unisims\primitive\MUXCY.vhd
PS D:\Temp\ghdl> C:\Tools\GHDL\0.32RC1\bin\ghdl.exe -a --work=poc .\arith_prefix_and.vhdl
PS D:\Temp\ghdl> C:\Tools\GHDL\0.32RC1\bin\ghdl.exe -a --work=test .\arith_prefix_and_tb.vhdl
.\arith_prefix_and_tb.vhdl:96:16:warning: universal integer bound must be numeric literal or attribute

So far no errors.
Now I started the simulation, which is just ghdl.exe -r on Windows (Linux: -e and -r):

PS D:\Temp\ghdl> C:\Tools\GHDL\0.32RC1\bin\ghdl.exe -r --work=test arith_prefix_and_tb
.\arith_prefix_and.vhdl:79:40:warning: 'mux' is not bound
.\arith_prefix_and.vhdl:43:14:warning: (in default configuration of arith_prefix_and(rtl))

Now ghdl reports that mux could not be bound.
I also tried the parameters --syn-binding and -P., but nothing changed.

What do I have to do to bind the MUXCY component?

P.S. Can someone create a 'ghdl' tag? I don't have enough reputation :)

Paebbels
  • 15,573
  • 13
  • 70
  • 139

1 Answers1

2

Here is how I would fix this:

First, analyze the MUXCY in the unisim library as it is intended to be, like so:

ghdl -a --work=unisim C:\Xilinx\14.7\ISE_DS\ISE\vhdl\src\unisims\primitive\MUXCY.vhd

Note the --work=unisim in that command.

Then, make sure you add library UNISIM; at the top of your arith_prefix_and.vhdl file.

That should do it.

What I think is happening here is that, since you are overwriting the name of the work library to poc with the --work=poc when analyzing arith_prefix_and.vhdl, it does not see the the MUXCY entity analyzed in the actual library named work, and so it cannot find a default entity to which to bind the MUXCY component.

Philippe Aubertin
  • 1,031
  • 1
  • 9
  • 22
  • These files should slso compile for e.g. Altera which uses modelsim. You can try this by changing VENDOR to Altera. In that case a generic carrychain implementation is used. Because modelsim does not know unisim, I can't add a library reference to it. I know I could compile the Xilinx primitives for ModelSim but not every user of our library has XST or Vivado installed. – Paebbels Jan 13 '15 at 19:31
  • @Paebbels I see your point. What about creating an empty `UNISIM` library on systems without Vivado or ISE, is that acceptable for your use case? If VENDOR is set to Altera, you don't need anything in the library, you just need it to exist. – Philippe Aubertin Jan 13 '15 at 19:52
  • I consider this answer as a solution... (Waiting for further answers) – Paebbels Jan 13 '15 at 21:01