How to serialize vector data for HDL coder.

2 views (last 30 days)
Awais Khan
Awais Khan on 28 Jun 2020
Answered: Kiran Kintali on 19 Oct 2020
I have an HDL coder function, whose task is to gather serial data based on a valid bit and buffer it and then send the buffered data serially by giving a valid bit high.
function [out_y,valid_out]= buffer(x,start,give_out)
persistent y
if isempty(y)
y = zeros(1, 8192);
end
if (start == 1)
for ii = 1 : 1: 8192
y(ii) = x;
end
end
if (give_out == '1')
for jj=1:1:8192
out_y = y(jj);
valid_out = 1;
end
end
--- Its test bench is given below,
load('xc_estim2.mat');
xc_E =xc_estim2(1:8192);
out_y = zeros(1,8192);
for kk = 1: 1 : 8192
start = 1;
give_out = 1;
data=xc_E(kk);
[out_y(kk),valid_out]=...
buffer(data,start,give_out);
end
Please guide me. I am new to hdl coder function.

Answers (1)

Kiran Kintali
Kiran Kintali on 19 Oct 2020
You can find some common techniques to create buffered data in this example.
>> type mlhdlc_heq

Categories

Find more on Code Generation in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!