Re: Setting of enum values
Marcel Hellwig <[email protected]> Wed, 20 Jan 2016 23:11:46 +0100
| Newsgroups | gmane.comp.python.myhdl |
|---|---|
| Message-ID | <[email protected]> |
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 ------------------------------------------------------------------------------ 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 _______________________________________________ myhdl-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/myhdl-list
signature.asc
(application/pgp-signature, 819 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCgAGBQJWoAYiAAoJEIROXYQnkAHpSh8P/RDbNW7TY2D+NHSDfiHszdwV A524AEMsNThaSzCY3/ZMomm7kxqBaC5pZZQYe+6pLSznrb7gt8d1WRIyloO+4Bsz jtGbDd7zoPXfOtJICKckOdaDST5/EHQeyvjA/RSz26p69S8Y5ySbbwZvQRgei93U 59wmdSTwS0hbn2trMndEXQ2bkU8nJSKiXrjwHVWfX2Qp5R+HosBzjn1+VcztYUKN FiQA3EO9CmFHyKDCaEwNexdfvyVG+VPRG5wvW+iLSJwXr+PrKxEgFyQd2ytLcfbJ xm19QEYzKtz8YQB2B3OJKf8p065cPkI22fJqMtgqdt/mfsi+OpVhb5I45KRxJ5p3 L3TeUBAXXIJ8ooSOW8I7mQBUMtKkG+dssOCRzOGnsHtykvO+FKEE9WwARwXLO9xx aXs0pIjQ3KEytEDcB4eJWLWgBRRTszCxLTg/Y0FRzxRbkzla/aopOv1s0HIezFW9 malUsujTh31sHPzbXCrpqv0K2hJWqXITFR2rxK7QBIZ5fNmlI67dlOvOLMwVo5dH Mqj8//I+LAeEQemA430VBKniE6R86GFT3ECQtiQpZuZOLBFf95q3EspgNglYhOUk xGibM/nhSNRL5HLDJomimVLsfpOPiF5Tp3nINAt0ZArOFIpCrjtqGzuwhhle4HTg t81oQh6FlaKK8YZjAXUj =fOA6 -----END PGP SIGNATURE-----