Re: [myhdl-list] List Of Constants
Brought to you by:
jandecaluwe
From: Josy B. <jos...@gm...> - 2015-03-17 09:15:09
|
> I looked at your code a little closer, first > you want to create a `tuple` of ints or `tuple` > of `intbv`. Because we are using a ROM and you > want to access multiple index at a time you need > to access first: > > def simplefunc( Coeff, Clk, DA, DB, Q): > ''' a simple operation, just for the effect ... ''' > > Coeff = tuple(Coeff) > <at> always_seq( Clk.posedge, reset = None) > def calc(): > c0 = Coeff[0] > c1 = Coeff[1] > Q.next = c0 * DA + c1 * DB > > The converter doesn't detect the constant/literal > index value so it doesn't replace the const with > the explicit value (this could possibly be a MEP). > > To use the ROM structure you need to capture with > a variable first, the generated code will be kinda > odd (optimized away) because it is generate for a > variable index instead of a const. > > You could use a list-of-signals with initial values > but initial values support has not been enabled because > support was inconsistent between various synthesis tools: > http://dev.myhdl.org/ideas/initial-values.html > > At one point someone had a patch that enabled initial > value support for list-of-signals (i.e. RAM) but we > never finished verifying support across the major > synthesis tools. > <snip> Chris, I tried that code, and although it functions, the VHDL code doesn't get any prettier. Also the method stays cumbersome for large(r) coefficient arrays. I can live with my workaround (spelling out every coefficient in the call) and put my hopes on future improvements on the conversion process. You indirectly answer my question: initial values are not supported - so my workaround of embedding the constant in a Signal can't work. Close but no cigar :) Regards, Josy |