1

I'm on Linux, I'm using questasim 2012.2b. I wrote in VHDL the following:

dsp: entity work.dsp_c -- a*b+c, 12bit
port map 
(
    clk         => clk_i,
    a           => a_dsp,   
    b           => b_dsp,
    c           => c_dsp,
    p           => p_dsp  -- full precision 
);

Everytime I try to simulate the above with questasim, it throws up an error when compiling saying:

# Error in macro ./mkProject.tcl line 11
# /software/CAD/Mentor/2013_2014/Questa/HDS_2012.2b/questasim/linux_x86_64/vcom failed.
#     while executing
# "vcom hdl/calc.vhd"
#  quit

# ** Error: Library xbip_dsp48_macro_v3_0 not found.
# ** Error: Unknown identifier "xbip_dsp48_macro_v3_0".
# ** Error: VHDL Compiler exiting

It refers to the code above on the line it fails on.

When rummaging around, I did find a file called : dsp_c.vhd which looks like a simulation wrapper for the .xci file.

I then try to locate the library, I found a folder called xbip_dsp48_macro_v3_0 with two files inside: xbip_dsp48_macro_v3_0.vhd xbip_dsp48_macro_v3_0_vh_rfs.vhd

So I include those in the project too, it gives me the error:

xbip_dsp48_macro_v3_0.vhd(46)): in protected region

Any idea what could be going wrong or what I might need to include? Is my questasim perhaps too old?

MORE INFO

Tried getting the compiled files this way via tcl:

compile_simlib -simulator questa

Produces a folder of all the IPs with their corresponding compiled blocks. Now I though initially I could just add to the .dep:

src ../cgn/dsp_c/dsp_c.vhd

I get this when running make project:

dsp_c/dsp_c.vhd(56): Library xbip_dsp48_macro_v3_0 not found.

So I tried including the libraries:

src ../cgn/dsp_c/xbip_dsp48_macro_v3_0/hdl/xbip_dsp48_macro_v3_0_vh_rfs.vhd
src ../cgn/dsp_c/xbip_dsp48_macro_v3_0/hdl/xbip_dsp48_macro_v3_0.vhd

Says it’s protected:

dsp_c/xbip_dsp48_macro_v3_0/hdl/xbip_dsp48_macro_v3_0.vhd(46)): in protected region.

More More Info

I got vivado to generate the library, located in the folder dsp_c:

dsp_c.dcp   dsp_c_funcsim.vhdl  dsp_c_stub.v     dsp_c.xci  synth   xbip_dsp48_wrapper_v3_0  xbip_utils_v3_0
dsp_c_funcsim.v  dsp_c_ooc.xdc      dsp_c_stub.vhdl  dsp_c.xml  xbip_dsp48_macro_v3_0   xbip_pipe_v3_0

My tcl script looks like this:

source firmware/cfg/lib_mappings.tcl

vlib work
vcom firmware/hdl/mydsp_c.vhd

Results

Modified to this:

vlib work
vlib dsp_c/xbip_dsp48_macro_v3_0
vmap dsp_c/xbip_dsp48_macro_v3_0

Then ran it ...

# do mkProject.tcl 
# Modifying modelsim.ini
# ** Warning: (vlib-34) Library already exists at "work".
# ** Warning: (vlib-34) Library already exists at "dsp_c/xbip_dsp48_macro_v3_0".
# Reading modelsim.ini
# "dsp_c/xbip_dsp48_macro_v3_0" maps to directory ./dsp_c/xbip_dsp48_macro_v3_0. (Default mapping)

..........

# -- Loading package NUMERIC_STD
# ** Error: firmware/cgn/dsp_c/dsp_c.vhd(56): Library xbip_dsp48_macro_v3_0 not found.
# ** Error: firmware/cgn/dsp_c/dsp_c.vhd(57): (vcom-1136) Unknown identifier "xbip_dsp48_macro_v3_0".
# ** Error: firmware/cgn/dsp_c/dsp_c.vhd(59): VHDL Compiler exiting
# ** Error: vcom failed.
fiz
  • 906
  • 3
  • 14
  • 38
  • I think the actual error message is on the next line (or maybe previous) –  Jul 09 '15 at 19:42
  • no, this really is the error =P It fails on that piece of code! Giving those errors. It says it can't find the libraries, then when I source the libraries it says they are protected! – fiz Jul 09 '15 at 20:10
  • Have you compiled Xilinx macros and IPCores for QuestaSim and included the compiled libraries into QuestaSim? – Paebbels Jul 09 '15 at 23:38
  • How do you usually go about doing that? For reference I have used questasim but not with .xci files before – fiz Jul 10 '15 at 06:37

1 Answers1

3

An xci file is a Xilinx specific IP description file and will not be recognized by any simulator. To be able to perform behavioral simulation of the IP described by the xci file a simulation model has to be generated first. The simulation model will consist of a number of VHDL files which have to be compiled into specific libraries.

With ISE/Coregen it used to be that there was only one VHDL file generated for an IP and the IP had only dependencies on the pre-compiled XilinxCoreLib library. With Vivado however there is no longer a XilinxCoreLib library and every time a simulation model of a specific IP is generated every dependency is also generated into the same folder.

It is possible to generate simulation model and an associated a list of files and libraries to compile using Vivado TCL scripting: https://github.com/LarsAsplund/vunit/blob/master/examples/vhdl/vivado/tcl/extract_compile_order.tcl

The above TCL script is part of an example shipped with the VUnit VHDL testing tool that demonstrates how to automatically generate models of and simulate Vivado IPs. The project and output_file variables are set from the command line to the script as the complete example calls the script via Python but can be replaced by hard coded values. The output is a text file with LIBRARY, FILE_NAME of all files in the order they need to be compiled. In my previous projects I have used this method to generate and compile behavioral models of an entire Vivado project.

kraigher
  • 629
  • 4
  • 9
  • I'll try this but I'm not sure it will work. I have a feeling there is a problem with Xilinx encrypting their libraries. – fiz Jul 13 '15 at 09:55
  • I'm pretty sure I have the order right but it complains about the libraries being "in a protected region": `src ../cgn/dsp_c/dsp_c.vhd src ../cgn/dsp_c/xbip_dsp48_macro_v3_0/hdl/xbip_dsp48_macro_v3_0_vh_rfs.vhd src ../cgn/dsp_c/xbip_dsp48_macro_v3_0/hdl/xbip_dsp48_macro_v3_0.vhd` – fiz Jul 13 '15 at 09:56
  • 1
    Have you vmap:ed unisim, unimacro, secureip etc before compiling? It is likely that the error is due to instantiating a primitive from unisim. When the instantiating code is encrypted the error message is always useless. – kraigher Jul 13 '15 at 10:11
  • 1
    To clarify "in a protected region" is emitted when a compile error occurs in part of an encrypted file. It is not the cause of the error but an obfuscated error message to hide encrypted details. – kraigher Jul 13 '15 at 11:33
  • so I managed to use the above tcl command I've inserted into my answer above. That's how I get the folders and files. Could it be that I can't actually do this because these sim files are encrypted? I mean I figured there would be some wrapper I could source but I don't think I can. I'm trying instead to instantiate instead with a DSP48E1 block. To clarify, I'm not in any way wanting to launch modelsim via vivado. – fiz Jul 14 '15 at 14:47
  • And I also don't understand what you mean by using "vmap"? I've tried including the unisim libraries as I would normally do at the top of a .vhdl file but that does nothing. – fiz Jul 14 '15 at 14:57
  • By vmap - if you mean having the library directories in the system variables then I've done that. I've used unisim libraries elsewhere in the design e.g FIFO36E1 – fiz Jul 14 '15 at 14:59
  • 1
    Modelsim/Questa needs a mapping between logical library names to actual folder locations. This mapping is stored, among other things, in a modelsim.ini file. Each modelsim command vlib/vmap/vcom/vsim references a modelsim.ini file either implicitly in the current wokring directory or explicitly by looking at the -modelsimini flag or the MODELSIM environment variable. The vmap command creates a new mapping from a logical library name to its actual folder. You need to ensure that all dependent libraries have been mapped in the modelsim.ini file that is in use when compiling. – kraigher Jul 14 '15 at 15:37
  • 1
    A compile script typically consists of vlib to create a new library folder followed by vmap to create a mapping followed by vcom to compile a design unit into the library followed by vsim to simulate a design unit. All commands must reference the same modelsim.ini file to have a consistent view of the library mapping – kraigher Jul 14 '15 at 15:40
  • does anyone have a document describing this? I'm on Linux so I can try and translate any commands if they're for windows. – fiz Jul 14 '15 at 20:06
  • 1
    The methods and commands I describe are the same in both Linux and Windows. The tool reference manual should describe this in more detail. In ModelSim/Questa you can access the PDF documentation by pressing the Help menu in the GUI. – kraigher Jul 15 '15 at 05:14
  • I can't use the GUI for this. I just found this: http://forums.xilinx.com/t5/Simulation-and-Verification/modelsim-simulation-of-Vivado-encrypted-IP/td-p/330391/page/3 So I have generated the library files, I'll post them above. I just need to use vmap properly in my tcl script – fiz Jul 15 '15 at 15:32
  • Edit added, I'll play around with vmap now – fiz Jul 15 '15 at 15:55
  • My boss says it isn't possible, it's encrypted. – fiz Jul 15 '15 at 18:15
  • It is posssible to achieve what you want by a series of vlib, vmap and vcom/vlog commands, the encryption has nothing to do with your issues other than obfuscating the error. I suggested using the GUI to navigate the tool documentation only and the GUI is not necessary to solve your original problem. You should really read up on how vlib/vmap etc works in the modelsim user guide, found through the GUI, to avoid misusing them. – kraigher Jul 16 '15 at 11:56
  • For instance I spot that you seem to misuse the vmap command, you just invoke it with a path and not also a logical library name causing the mapping to be incorrect. As I previously wrote any dependent library must be correctly mapped in the modelsim.ini file that is in use. The modelsim.ini file is pure text and can be opened to debug any incorrect mappings in its library section. – kraigher Jul 16 '15 at 11:56