flexus / data /output_map.m
introvoyz045's picture
Migrated from GitHub
96c0ff0 verified
Raw History Blame Contribute Delete
1.01 kB
function map = output_map(N)
% output_map generates the output data mapping from each coarse uBF such
% that the data stream can be mapped to the correct coarse uBF within the
% array
% INPUTS:
% N - number of elements in ASIC
% OUTPUTs:
% map - map from ASIC output channels to corresponding coarse uBF
map = zeros(sqrt(N),sqrt(N));
for i=1:sqrt(N)
if(i<=4)
for j=1:sqrt(N)
if(mod(i,4)==1)
map(i,j) = 4*j;
elseif(mod(i,4)==2)
map(i,j) = 4*(j-1)+1;
elseif(mod(i,4)==3)
map(i,j) = 4*(j-1)+3;
else
map(i,j) = 4*(j-1)+2;
end
end
else
for j=1:sqrt(N)
if(mod(i,4)==1)
map(i,j) = 4*(j-1)+34;
elseif(mod(i,4)==2)
map(i,j) = 4*(j-1)+35;
elseif(mod(i,4)==3)
map(i,j) = 4*(j-1)+33;
else
map(i,j) = 4*j+32;
end
end
end
end
end