UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor malgassim
Visitor
2,688 Views
Registered: ‎12-20-2011

error in M block ?

I wrote this code inside the M Blcok (one of Xilinx blockstes in Simulink):


function z= discreatcorr(x,y)
t=zeros(12288,1);
i=zeros(1,12288);
i(1,4096:8191)=x(1:4096,1); %output of the image filter
t(4096:8191,1)=y(1:4096,1); %output of the tamplate filter
for n=1:8191
k=zeros(12288,1);
k(n:n+4095,1)=t(4096:8191,1);
z(n,1)=i*k;
end
end

 

 ----------------------

Its telling me:

Error("discreatcorr.m"): output z is not assigned through all possible paths. A misspelling or a switch statement without otherwise statement may cause this error.
Error occurred during "Rate and Type Error Checking".

 

Any Ideas??

(model is attached)

Tags (2)
0 Kudos
1 Reply
Xilinx Employee
Xilinx Employee
2,673 Views
Registered: ‎08-01-2007

Re: error in M block ?

I'm not exactly sure what the problem is on this, but it seems that you are trying to do array operations on vector data.

 

Remember that you get one sample at a time through a gate way, not a whole array.  If you want to do an array operation, then you need to buffer up the data and then operate on it.

 

In your example, you have x and y comming into the m-code block, but you try to do an array assignment to I and T.

 

What you might want to try doing is doing this through a loop that assignes one value at each "clock cycle".

 

It may even may more sense to build this circuit out of descrete blocks, rather than trying to infer it via m-code.

 

In system Generator, the support for m-code is pretty limited, and mostly targeted at control logic, rather than full circuit implemenations.  I recommend you review the m-code support section of the System Generator for DSP User Guide.

Chris
Video Design Hub | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos