Re: [myhdl-list] List Of Constants
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2015-03-17 04:18:13
|
] > > thanks for the attention, > I created a gist: https://gist.github.com/josyb/af6b7809d976b2559ae4 > > The _example_ is distilled from a RGB to YCrCb converter, but the method > will also be useful in convolution filters (edge detectors etc.) and > other matrix-like operations. > 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) @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. Hope that helps, Chris |