Re: Setting of enum values
Christopher Felton <[email protected]> Thu, 21 Jan 2016 10:53:40 -0600
| Newsgroups | gmane.comp.python.myhdl |
|---|---|
| Message-ID | <[email protected]> |
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 ------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140