How to serialize vector data for HDL coder.

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.

Réponses (1)

Produits

Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by