Matlab HDL cosimulation for Lattice CPLD

조회 수: 23 (최근 30일)
_asdf_
_asdf_ 2024년 8월 6일
댓글: Marc Erickson 2024년 8월 6일
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