Re: [myhdl-list] Setting of enum values
Brought to you by:
jandecaluwe
From: Marcel H. <1he...@in...> - 2016-01-20 22:28:58
|
Hello everyone, As far as I can see, there is no action on this topic anymore. I'm currently encounter a Problem with exactly this. My Problem is, that I have some (cpu-)modes, which I'd like to have in an extra file, because I use them from some points in my code. So I create a file cpumode.py with the following content: cpumode.py: > class CpuMode(object): > User = 0b10000 > FIQ = 0b10001 > IRQ = 0b10010 > Supervisor = 0b10011 > Abort = 0b101111 > Undefined = 0b11011 > System = 0b111111 In the next file, I import it via > from cpumode import CpuMode Now, myhdl tells me: > myhdl.ConversionError: in file xxx.py, line 63: > Unsupported attribute: User line 63: > if mode == CpuMode.User: This is garbage... :/ If I declare User outside of the class, but directly in the cpumode.py, the same error occurs. Only iff I delcare User, FIQ, IRQ, ... in the same file (in this case xxx.py) it will work. Is there any way out or thoughts about implementing a enum with given values? (In the thread, there was a tought about exporting the Enum class and create it via that :/ Greetings, Marcel |