DSPRelated.com
Forums

Re: Mathworks, System Generator and Mcode problem

Started by omer...@gmail.com February 17, 2010
This is probably because all your multiplies, add/sub within MCode block are all combinational, creating a long critical path. You may want add register stages using persistent and xl_state function. e.g.

function multout = mutiplier(a, b)

ar = xl_arith(a);
n = xl_nbits(a);
p = xl_binpt(a);
prec = {ar, 2*n, 2*p, xlTruncate, xlWrap};

persistent mult_q, mult_q = xl_state(0, prec);
multout = mult_q;

mult_q = a * b;

>
>
>Hi..is anyone here an expert on System Generator and the mcode block?
>
>I have a fairly simple Matlab code (just some multiplies, assignments,
>add, subtract compares) about 20 lines in all. Unfortunately, when I
>generate the mcode HDL I incurr 220 levels of logic resulting in a
>huge delay. Matlab's help says use a delay block before the mcode with
>"register retiming turned on". I have done that. In fact all my
>inputs to the mcode have a delay block with latency 10, but this
>didn't help either. (I did make sure that the register retiming
>option is turned on in the ISE tools).
>
>Any suggestions guys?
>
>Any help will me much appreciated.
>thanks
>Nandan
>
>
>
>
>
>
>
>
>