MATLAB Answers

How can I use vhdl generics when I generate a matlab system object from my vhdl code with HDL verifier?

4 views (last 30 days)
I want to generate a matlab system object from my vhdl code with HDL verifier, for using it as FPGA in the loop. Following matlab documentation's steps is quite easy to do it. The problem is that my code contains vhdl generics. So, once matlab generates the system object, I would like to be able to change the value of the generics, but I don´t know how to do it.

Accepted Answer

Tao Jia
Tao Jia on 21 Sep 2016
With FPGA-in-the-Loop, once you have generated the FPGA Programming File, the values of generics are fixed. You cannot change it just like you cannot change the FPGA circuit dynamically.
To change the generics, you need to go though FIL Wizard to regenerate the FPGA programming file, and this will give you a new System object. You should use the new System object instead of just modifying the old one.
Hope this helps, Tao

More Answers (1)

Tim McBrayer
Tim McBrayer on 19 Sep 2016
It sounds like you are trying to model existing handwritten VHDL that uses generics in its interface, in Simulink, and using a System Object. And, the HDL Coder implementation of System Objects don't support generics.
One thing you could try is to wrap the System Object block inside a subsystem. This may help in one of two ways depending on your circumstances. If you are trying to black-box your existing VHDL code into a larger Simulink design, you can set the HDL Architecture of the Subsystem to a black box and connect the generics up through that interface. Alternatively, you can investigate using a masked subsystem and setting 'mask parameters as generics' in HDL Coder.
  1 Comment
Eduardo Lasarte
Eduardo Lasarte on 19 Sep 2016
Well, I don't want to use the system object in Simulink. I want to use it in matlab code using the step method as it's explained in the system object generated from the vhdl code:
classdef fft8_fil < hdlverifier.FILSimulation
%fft8_fil is a filWizard generated class used for FPGA-In-the-Loop
% simulation with the 'fft8' DUT.
% fft8_fil connects MATLAB with a FPGA and cosimulate with it by
% writing inputs in the FPGA and reading outputs from the FPGA.
% MYFIL = fft8_fil
% Step method syntax:
% [out1, out2, ...] = step(MYFIL, in1, in2, ...) connect to the FPGA,
% write in1, in2, ... to the FPGA and read out1, out2, ... from
% the FPGA
So, I'm looking for a way of changing the values of the generics in a .m file, without using Simulink.
Thanks for your answer!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!