Re: [myhdl-list] Problem converting list of intbv
Brought to you by:
jandecaluwe
From: Guy E. <gu...@no...> - 2014-07-08 09:03:52
|
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 |