cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Observer
Observer
7,283 Views
Registered: ‎06-27-2015

Sysgen : How to read the input port data type, width and rate dynamically in a masked subsystem ?

Hello everybody,

     I am designing a general purpose block in system generator. I pass the user parameters to the block through masking it. Some user parameters can change the block configuration. The input port data type, width and rate can also affect the block configuration.

     The problem is that these values (input port data type, width and rate) are subject to change. So I should read them dynamically, then change the block configuration through programming the "Initialization Commands" field. But unfortunately there is no straight way to read the input port information.

     There are some methods in for example the "Black Box". these are:

input_width = this_block.port('din').width;
input_rate = this_block.port('din').rate;

 

But these methods are not applicable to a masked subsystem.

I have tried other ways also. You can find them below. None of them worked.

Does anybody know how can I solve this problem?

 

Other ways I tried:

1)

design_name([],[],[],'compile')                                       
q=get_param(gcb,'PortHandles');
get_param(q.Inport,'CompiledPortDataType')
get_param(q.Inport,'CompiledPortWidth')
get_param(q.Inport,'CompiledPortDimensions')
design_name([],[],[],'term')

 

2)

ssGetInputPortDataType

 

3)
ts = Simulink.Block.getSampleTimes([gcb '/Input'])

 

0 Kudos
2 Replies
Highlighted
Xilinx Employee
Xilinx Employee
7,069 Views
Registered: ‎08-01-2008

Today we rely on Simulink to perform parameterization of your designs in two ways:

  1. Parameterizable Subsystems and Blocks : Parameters themselves can be MATLAB expressions that need to be evaluated for which we need the MATLAB interpreter
  2. The very useful Rate and Type propagation or Simulink compilation that allows us to specify types & rates in one location that gets systematically propagated to all.

 

To truly make the HDL Netlist that is generated from SysGen parameterizable, we would have to implement some of this capability in the HDL netlist itself by:

  1. Using Generics(VHDL) or Parameters(Verilog) - We would have to capture the bit width(type) propagation through levels of hierarchies and finally parameterize the IP itself based on this value
    1. Since IP itself does not have this capability through generics, we would have to package a separate tcl script that updates the IP parameterization appropriately in response to top level parameters(or GUI parameters)
  2. Interpreting MATLAB expressions and translating them into VHDL/Verilog expressions (alternatively tcl expressions of IP). In simulink, mask parameters can be passed from one level to the next. Also parameterization of a block can be composed of Matlab expressions using variables from ancestor masks & the MATLAB interpreter – so we will need to somehow capture that as well.

 

Thanks and Regards
Balkrishan
--------------------------------------------------------------------------------------------
Please mark the post as an answer "Accept as solution" in case it helped resolve your query.
Give kudos in case a post in case it guided to the solution.
0 Kudos
Highlighted
Observer
Observer
7,042 Views
Registered: ‎06-27-2015

Thanks Balkris for your help.

But still the problem is unsolved.

I have seen this topic around on the internet and none of them have been answered properly. You can find them in the following links:

 

http://www.mathworks.com/matlabcentral/answers/91284-how-to-get-port-data-type-inside-a-masked-block

 

http://www.mathworks.com/matlabcentral/answers/8679-how-to-get-the-port-types-and-dimensions-for-a-block

 

http://it.mathworks.com/matlabcentral/answers/30644-accessing-port-data-types-during-complilation

 

 

0 Kudos