Re: [myhdl-list] Beginner Question: Loop Unrolling & Use of Tuple Elements
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2015-06-28 19:32:00
|
Hey Collin, how are things going? On 6/28/15 12:59 PM, co...@ne... wrote: > Hello, > > I was attempting to make a simple FIR filter to compare MyHDL to previous > work I'd done using Vivado C-based HLS. I'm basing this entirely on > Christopher Felton's IIR example from > https://bitbucket.org/cfelton/examples/src/tip/siir/siir.py . > > Two things have tripped me up, and I'm not sure if it's some limitation of > MyHDL or my own failures? The first is as part of the FIR I'd like to have a > line like this: > > @always(clk.posedge) > def rtl_fir(): > for i in range(0, len(B-1)): > ffd[i+1].next = ffd[i] > ffd[i].next = x > > But I can't seem to find references to loop unrolling anywhere? There was a > few threads from ~2008 was all I saw. Instead I end up having to do > something like this: The MyHDL converter will not un-roll the loops (currently). The loops will be converted as loops to the target HDL - where they will be un-rolled by the synthesizer. This post: http://www.fpgarelated.com/showarticle/631.php shows a "naive" (non-target-optimized) FIR implementation using loops. <snip> > The second problem is for the accumulator (which again I'm manually > unrolling), the most straight-forward definition to me would look like this: > > @always_comb > def rtl_acc(): > # Double precision accumulator > yacc.next = B[0]*ffd[0] + B[1]*ffd[1] + B[2]*ffd[2] + B[3]*ffd[3] + > B[4]*ffd[4] I think the above link will help here as well, when you create a tuple of ints, it is converted as a ROM [1], what you need to do is: def rtl_acc(): for ii in range(4): btmp = B[ii] yacc.next = btmp + fdd[ii] Hope that helps, Chris [1] http://docs.myhdl.org/en/latest/manual/conversion_examples.html#rom-inference |