Re: [myhdl-list] Setting of enum values
Brought to you by:
jandecaluwe
From: Jan C. <jen...@mu...> - 2016-01-21 00:48:31
|
On Wed, 20 Jan 2016 23:11:46 +0100 Marcel Hellwig <1he...@in...> wrote: > As far as I can see, there is no action on this topic anymore. Agreed, it is a complex one, and I accept the reasons for not pursuing this. Where I want to have close control of bits I import values. These are created using simple assignments, which are sometimes shortened using range(x,y,z) > 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: I had this type of problem with VHDL, something like 'data not locally static' but have not seen it with MyHDL. Perhaps this is because simple named constant values are just converted into numbers in the Verilog or VHDL files. In one large processor design most of the ~24 source files import basic configuration parameters, like buss width, and perhaps a third import opcode constants. There seems to be no problem using this method. Hope this helps, else, for sample code email me directly. Regards, Jan Coombs. |