|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
最近需要用到DPI进行C代买和verilog的仿真验证,工具限定为modelsim(没办法)。参照ModelSim? SE User’s ManualSoftware Version 6.5f,应用DPI有5个step如下:
- 1. Run vlog to generate a dpiheader.h file.
- This file defines the interface between C and ModelSim for exported and imported tasks and functions. Though the dpiheader.h is a user convenience file rather than a requirement, including dpiheader.h in your C code can immediately solve problems
- caused by an improperly defined interface. An example command for creating the header file would be:
- vlog -dpiheader <dpiheader>.h files.v
- 2. Required for Windows only; Run a preliminary invocation of vsim with the-dpiexportobj switch.Because of limitations with the linker/loader provided on Windows, this additional step is required. You must create the exported task/function compiled object file (exportobj) by running a preliminary vsim command, such as:vsim -dpiexportobj exportobj top3. Include the dpiheader.h file in your C code.ModelSim recommends that any user DPI C code that accesses exported tasks/functions, or defines imported tasks/functions, should include the dpiheader.h file. This allows the C compiler to verify the interface between C and ModelSim.4. Compile the C code into a shared object.Compile your code, providing any .a or other .o files required.For Windows users — In this step, the object file needs to be bound together with the.obj that you created using the -dpiexportobj switch, into a single .dll file.5. Simulate the design.
复制代码
其他步骤都还好,但STEP4的For Windows user部分,该如何将C源文件编译生成的.o和第二部生成的.obj链接成为一个.dll文件呢??
查了好多资料都没搞定,同学也没有这方面的经验。还请懂的前辈们多多赐教啊!! |
|