Re: [myhdl-list] Setting of enum values
Brought to you by:
jandecaluwe
From: Christopher F. <chr...@gm...> - 2016-01-21 16:53:59
|
On 1/21/2016 10:38 AM, Henry Gomersall wrote: > On 21/01/16 16:34, Christopher Felton wrote: >> On 1/21/2016 5:15 AM, Marcel Hellwig wrote: >>>> On 21.01.2016 09:47, Thomas Heller wrote: >>>>>> [...] >>>>>> I had the same problem and currently only see these two possibilities: >>>>>> >>>>>> 1. Import each constant and assign it in the myhdl code, like this: >>>>>> >>>>>> from cpumode import CpuMode >>>>>> cpumode_User = CpuMode.User >>>>>> ... >>>> >>>> ugly as hell :D but yeah, it kind of works... >>>> >>>>>> >>>>>> 2. Define the constants as module level constants >>>>>> and use 'from mymodule import *' in the myhdl code. >>>> >>>> I decided myself to this design. Would be nice though to have some kind >>>> of namespace seperation. >>>> >> Disclaimer: I quickly review the previous posts in this >> thread (I might not understand the intent) - if this is >> off base ignore. >> >> You should be able to use constant values in an object, >> this code snip might help: > > Is this a relatively recent fix? > Not sure and it depends on your definition of recent. Yes, there was a fix for constants in an object at some point I don't recall the time frame. Regards, Chris |