Re: [myhdl-list] Restrictions for conversion
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2012-02-20 12:03:48
|
On 2/18/2012 3:05 PM, Norbo wrote: > About: (More general support of indexed constants) > http://www.myhdl.org/doku.php/dev:tasks > ok this post maybe gets a bit long, but it may be helpful to further > eliminate this conversion limitation: > > i first present a simple myhdl example which is victim to such an > conversion limitation. > then i show three slightly different ways how it can be implemented in > vhdl (i dont no verilog). > > the myhdl example: > > ########################################################################## > from myhdl import * > > def somedut(inData,out_data,data_index,LENGTH): > TWIDDEL_WIDTH=10 > real_Vals=[Signal(intbv(0,min=-2000,max=2000)) for i in range(LENGTH)] > Table=tuple([i for i in range(LENGTH)]) > > @always_comb > def comb_logic(): > for i in range(LENGTH): > real_Vals[i].next=inData*Table[i] ###this line cannot be > converted to vhdl > @always_comb > def output_logic(): > out_data.next=real_Vals[data_index] > > return comb_logic,output_logic #real_alu_insts,imag_alu_insts, > comb_logic,seq_logic > Norbo, For this particular example, the description can be changed so that it does convert. I do not understand why the realVals array (list of signals) is used since only one element is used at a time. def SomeDut(inData, outData, dataIndex, LENGTH=4): Table = tuple([ii for ii in range(LENGTH)]) tableVal = Signal(intbv(0, min=-2000, max=2000)) @always_comb def hdl_get_table_value(): tableVal.next = Table[int(dataIndex)] @always_comb def hld_output(): outData.next = inData*tableVal return hld_output, hdl_get_table_value I believe the limitation you are trying to demonstrate is when the tuple (ROM) access is mixed in other statements, instead of being its own statement, i.e. rather than a separate generator to describe the ROM it is embedded in the statements directly, e.g. @always_comb def hld_output(): outData.next = inData*Table[int(dataIndex)] For this second case to be convertible the converting code needs to do some extra work which it does not and it is not clear if it should. The conversion code will need to do the same conversion as the previous (above) example, hence it will have to infer more. This has been debated in the past (level of inference) and there are different opinions on the level of inference that should be supported. Regards, Chris |