how to pass(or link) ' fixed- point values' to the (root inport mapper-connect inputs) in the 'HDL inport block'

2 ビュー (過去 30 日間)
THIS IS THE ERROR THTA SHOWS WHEN I LINK THE 'FIXED POINT VALUE' TO INPORT BLOCK, USING THE OTHER SIMULINK BLOCK TYPES WHICH ARE USED PASS THE INPUT FROM WORKSPACE, CANNOT GENERATE HDL CODE. THATS WHY IM USING HDL INPORT BLOCK.
ARE THERE ANY OTHER SOLUTION BLOCK THAT CAN THE FIXED POINT VALUE INORDER TO GENERATE THE HDL CODE
PLEASE GIVE A GUIDANCE

採用された回答

Andy Bartlett
Andy Bartlett 2023 年 7 月 10 日
編集済み: Andy Bartlett 2023 年 7 月 10 日
The problem is that the model is configured such that root inport is getting one data type, but the external data is using a different data type.
There are two solution routes that depend on what you determine is right for your model.
One route is to change the model to have the same data types as the external data.
The other route is to change the external data to use the same data types as the model wants.
Assuming the former is right for your situation, I've attached files that provide an example similar to this published example, but with non-default data types. This example covers the case of simple signals, not-Buses.
The attached script create_data_set_2 creates some typed data
sampleTime = 0.01;
endTime = 10;
numberOfSamples = endTime * 1/sampleTime +1;
timeVector = (0:numberOfSamples) * sampleTime;
% Create data with non-default data types
% single, uint8, fixed-point fixdt(0,8,5)
%
v1 = single( sin(timeVector)*25 );
signal_1 = timeseries(v1, timeVector);
v2 = uint8(randi([0,255],size(timeVector)));
signal_2 = timeseries(v2,timeVector);
fixedExponent = -5;
nt3 = numerictype(0,8,-fixedExponent);
v3 = fi( nt3.Slope*randi([0,255],size(timeVector)), nt3 );
signal_3 = timeseries(v3,timeVector);
The key next task is to set these data types on the model.
The attached utility getOutDataTypeStrForBlockParam helps get the strings needed to set the data types on the model.
% Use a utility to get string needed to
% set the data types on the corresponding inpports.
%
dtstr1 = getOutDataTypeStrForBlockParam(signal_1.Data)
dtstr1 = 'single'
dtstr2 = getOutDataTypeStrForBlockParam(signal_2.Data)
dtstr2 = 'uint8'
dtstr3 = getOutDataTypeStrForBlockParam(signal_3.Data)
dtstr3 = 'fixdt(0,8,5)'
Next, we set the data types on the route inports of the model.
% Set the data types of the input ports
%
% BIG ASSUMPTION
% Name of the timeseries variable is the same
% as the name of the block
%
% If that assumption is not true, then you'll
% need to customize this code to find the right
% block to set the data type on
%
set_param([mdl,'/signal_1'],'OutDataTypeStr',dtstr1)
set_param([mdl,'/signal_2'],'OutDataTypeStr',dtstr2)
set_param([mdl,'/signal_3'],'OutDataTypeStr',dtstr3)
You'll probably need to customize this step for your model.
Note: Setting the data types on your model may cause your model to break due to type incompatibilities inside the model. If that is the case, the simplest approach is to drop in Data Type Conversion blocks after the root inports whose types have changed. Set the output data types of the Conversion blocks to agree with the original data type of the root inports.
After setting the data types on the model to agree with the data types of the external data, you should be able to proceed with Root Inport Mapper.
In summary, to run the attached example,
  • get the attached files
  • study the script create_data_set_2
  • run the script create_data_set_2
  • Follow the Root Inport Mapper steps as shown in this published example.
Cheers
  3 件のコメント
Fayaz
Fayaz 2023 年 7 月 11 日
i have another question related to pass the input to NCO hdl block which is already been mentioned in my question list with the frequency shifting matlab code.
So, can give a guidance accordance to my code how to pass the input to NCO with LUT-lookup table inorder to generate verilogHDL code for custom IP core generation using the Xilinx vivado workflow advisor platfrom
Fayaz
Fayaz 2023 年 7 月 11 日
sir you are great sir, it is working wonderfully. it takes the fixed point extrenal input to the root mapper. it is like a magic that function you have created and it is called for fixedpoint values. great sir. thank you so much

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeHDL Coder についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by