Can the HDL coder simulate with existing verilog/VHDL codes?

1 visualizzazione (ultimi 30 giorni)
HDL coder is very convenient for hardware code generation. But now I want to reuse my previous Verilog/VHDL codes, is it possible to do that in HDL coder? Can I do co-simulation? For example, now I have the HDL code for displaying images on the LCD screen, now I want to reuse that code for displaying after the processing blocks in HDL coder.
Thanks!

Risposta accettata

Tim McBrayer
Tim McBrayer il 22 Mar 2016
Yes, this is possible and easily implemented. If you want to bring existing HDL code into a HDL Coder subsystem, you can do so by using a Subsystem block and setting its HDL Architecture to "BlackBox". (Right click on the Subsystem>HDL Code>HDL Block Properties, choose the BlackBox architecture.)
Once this is done you can configure the control signals that are necessary by using the HDL Block properties dialog. The data input and output ports will be whatever the Subsystem block's interface is; you will need to match the interface of your existing code in Simulink.
For HDL code generation, you don't need anything inside the BlackBox Subsystem. HDL Coder treats it as a black box and expects the associated HDL code to exist separately. If you want to be able to simulate the full design in Simulink or use HDL Coder's testbench or cosimulation capabilities, you will need to provide a matching Simulink behavior inside the black box subsystem.
Another approach from the Simulink simulation perspective is to place your HDL code into your Simulink model with a HDL Verifier cosimulation block inside the BlackBox subsystem. This will let you test your existing code in place via cosimulation, together with the rest of the Simulink model that you are generating code for. This avoids needing to build a parallel subsystem for your existing code.
  3 Commenti
Tim McBrayer
Tim McBrayer il 25 Mar 2016
The top subsystem is restricted to the 'module' implementation. To import HDL code with a black box, the imported code must exist underneath a top level of code that is generated by HDL Coder.
Bo Zhang
Bo Zhang il 28 Mar 2016
Modificato: Bo Zhang il 28 Mar 2016
According to your suggestion, it works right now. Then how can I assign the physical IO pins to the simulink so that I can control the IO during simulation?Now I can do that using turnkey mode, but is it possible to do pin assignment during the FPGA-in-the-loop?
Best regards from Tony~

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by