Re: [myhdl-list] TypeError: Unexpected type with toVerilog
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2012-05-25 12:55:17
|
On 5/25/2012 6:09 AM, Jan Decaluwe wrote: > On 05/24/2012 10:53 PM, Christopher Felton wrote: >> On 5/24/2012 3:23 PM, Thoma HAUC wrote: >>> @always_comb >>> def outputenable(): >>> if ((state == StateEnum.HSYNC) or (state == StateEnum.SYNC) >> >> I believe this is the issue. There was a recent thread on this. It >> looks like enums fail in an always_comb. A simple test case was >> submitted recently. > > No, it was something else. Can you point me to the > post/author of the other problem(s). I lost track a little > but I will look into it with priority. > > Also, I propose to start using the bug tracker again, for > formal bug reporting (after discussing it here preferably). > Note that you can attach files to bug reports. I have > done this for the bug that was just reported. > There have been a couple possible bugs reported. It was my intent to submit patches with tests that exposed the issues. Ah, such dreaming, time to work on fun things :) Here is a snip from the a previous thread, using the enum in a always_comb didn't appear to work. I tested quickly there could be a mistake on my part. > 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. Regards, Chris |