Matlab HDL cosimulation for Lattice CPLD

14 次查看(过去 30 天)
I regularly develop VHDL code for controllers that is supposed to run on FPGAs/CPLDs and I'm looking for possibilities to co-simulate this code in a closed-loop simulation environment that mimics the behavior of the controlled system. So what I would like to have is that I can define a dyamic model in Matlab (e.g., as a state-space model or a transfer function) and to simulate this model together with the controller's HDL implementation using the outputs of the models as stimuli for the controller and the output of the controller as input for the dynamic model. Is there any way I can accomplish this with Matlab? If so, what do I have to look for?
What I found so far is apparently called HDL verifier and seems to be pretty much what I want. However, I'm currently using Lattice MachXO2 CPLDs and Lattice diamond comes with "ModelSim Lattice FPGA Edition" as a simulator. According to this post
HDL verifier requires a FLI (foreign language interface), which the Lattice Edition of ModelSim does not provide. Is there any way I can use HDL verifier, e.g., by using a different simulator?
  1 个评论
Marc Erickson
Marc Erickson 2024-8-6
Yes, as you surmised, our product requires a PLI to integrate the HDL simulation kernel with the Simulink simulation kernel. We support four major simulators: ModelSim/Questa, Xcelium, VCS, and Vivado Simulator.

请先登录,再进行评论。

回答(1 个)

Ayush
Ayush 2024-8-6
编辑:Ayush 2024-8-6
Hello @_asdf_,
As you have clearly mentioned and found out that ModelSim Lattice FPGA Edition is not support by the HDL verifier as they do not provide a FLI (foreign language interface). The best way forward as a workaround is to try out popular supported simulators like the ModelSIM Special Edition, Questa Prime or the others mentioned in the MATLAB Answer community post.
As a workaround, you could try to manually create a co-simulation bridge that interfaces between ModelSim for simulation and MATLAB/Simulink for the analysis of the data fetched from the simulation. This could be complex and would require a good understanding of both environments, but can be done using socket programming where you can host a MATLAB server and a ModelSim client. You can refer to the following documentation to know more about socket programming in MATLAB:
Hope it helps!

产品


版本

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by