Re: [myhdl-list] Problem converting list of intbv
Brought to you by:
jandecaluwe
From: Pedro P. <ped...@gm...> - 2014-07-08 10:07:38
|
Guy, thanks for your response. Unfortunately I can't use tuples because I acually write to the "array" as well. So allow me to modify my example. Now I have 4 counters and the one selected with signal s will get incremented and tranfered to the output. Shouldn't list of intbvs be supported? from myhdl import Signal, always_comb, intbv, toVerilog def uint(width, val = 0): return intbv(val, 0, 2 ** width) def u32(val = 0): return uint(32, val) def counters(s, o): m = [ u32(0xaaaaaaaa), u32(0xbbbbbbbb), u32(0xcccccccc), u32(0xdddddddd) ] @always_comb def logic(): m[s] += 1 o.next = m[s] return logic s = Signal(intbv(0)[2:]) o = Signal(intbv(0)[32:]) toVerilog(counters, s, o) ızznɹpǝԀ oɹpǝԀ On Tue, Jul 8, 2014 at 5:46 AM, Guy Eschemann <gu...@no...> wrote: > Hello Pedro, > > here's how I would do it: > > def mux(s, o): > i = (0xaaaaaaaa, 0xbbbbbbbb, 0xcccccccc, 0xdddddddd) > > > @always_comb > def logic(): > o.next = i[s] > return logic > > Regards, > Guy. > > On Jul 8, 2014, at 1:16 AM, Pedro Pedruzzi wrote: > > Hello, > > I am new to this list. > > I am getting the following exception while trying to convert a simple mux > to Verilog. > > myhdl.ConversionError: in file list-of-intbv.py, line 12: Not supported: > list > > I know I could use tuple of int (since I am using constants), but I want > to use lists to implement array of registers and the docs says it is > possible. > > Here is the design: > > from myhdl import Signal, always_comb, intbv, toVerilog > > def uint(width, val = 0): > return intbv(val, 0, 2 ** width) > > def u32(val = 0): > return uint(32, val) > > def mux(s, o): > @always_comb > def logic(): > i = [ u32(0xaaaaaaaa), u32(0xbbbbbbbb), u32(0xcccccccc), > u32(0xdddddddd) ] > o.next = i[s] > return logic > > s = Signal(intbv(0)[2:]) > o = Signal(intbv(0)[32:]) > > toVerilog(mux, s, o) > > > Any help is appreciated. Thanks. > > ızznɹpǝԀ oɹpǝԀ > > ------------------------------------------------------------------------------ > Open source business process management suite built on Java and Eclipse > Turn processes into business applications with Bonita BPM Community Edition > Quickly connect people, data, and systems into organized workflows > Winner of BOSSIE, CODIE, OW2 and Gartner awards > > http://p.sf.net/sfu/Bonitasoft_______________________________________________ > myhdl-list mailing list > myh...@li... > https://lists.sourceforge.net/lists/listinfo/myhdl-list > > > > > ------------------------------------------------------------------------------ > Open source business process management suite built on Java and Eclipse > Turn processes into business applications with Bonita BPM Community Edition > Quickly connect people, data, and systems into organized workflows > Winner of BOSSIE, CODIE, OW2 and Gartner awards > http://p.sf.net/sfu/Bonitasoft > _______________________________________________ > myhdl-list mailing list > myh...@li... > https://lists.sourceforge.net/lists/listinfo/myhdl-list > > |