Re: [myhdl-list] TypeError: Unexpected type with toVerilog
Brought to you by:
jandecaluwe
From: Jan D. <ja...@ja...> - 2012-05-25 21:00:19
|
On 05/25/2012 02:54 PM, Christopher Felton wrote: > >> I think your issue with using the enum() is in combination with the >> always_comb decorator. The enums don't seem to work in an always_comb? >> I didn't realize this limitation existed. The following is the simple >> example I used (one of your previous questions) to see if this was true >> or not. >> >> from myhdl import * >> >> def case_ex1(clk, key, led): >> tKey = enum('UP', 'DOWN', 'LEFT', 'RIGHT') >> @always(clk.posedge) >> def hdl(): >> if key==tKey.UP: led.next = 0xDE >> elif key==tKey.DOWN: led.next = 0xCA >> elif key==tKey.LEFT: led.next = 0xFB >> elif key==tKey.RIGHT: led.next = 0xAD >> else: led.next = 0x00 >> >> return hdl >> >> def case_ex2(key, led): >> tKey = enum('UP', 'DOWN', 'LEFT', 'RIGHT') >> @always_comb >> def hdl(): >> if key==tKey.UP: led.next = 0xDE >> elif key==tKey.DOWN: led.next = 0xCA >> elif key==tKey.LEFT: led.next = 0xFB >> elif key==tKey.RIGHT: led.next = 0xAD >> else: led.next = 0x00 >> >> return hdl >> >> In the above, the second does not convert correctly and fails the >> freevar check in the _analyzeGens, determines the enum is an unsupported >> type. How can key be defined, if the enum is defined inside the module? Can you or Jan C provide me with a short but complete example (including signal defs and conversion call) that fails? I'll start thinking after that :-) -- Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com Python as a HDL: http://www.myhdl.org VHDL development, the modern way: http://www.sigasi.com World-class digital design: http://www.easics.com |