systemrdl-compiler icon indicating copy to clipboard operation
systemrdl-compiler copied to clipboard

Enum parsing

Open markcohen32 opened this issue 2 years ago • 5 comments

Hi,

I've been trying recently to import ipxact files that contain enums. I get the following error: "names are reserved for future Enum use" I've tried Python 3.6 & Python 3.9. Is it an issue related to the importer?

markcohen32 avatar Jun 28 '22 11:06 markcohen32

Interesting I suspect your IP-XACT file contains enumeration names have an underscore prefix & suffix like: _something_

Internally, the RDL compiler will cast imported enumerations into a Python Enum object. It looks like Python's implementation of enumerations imposes some restrictions on what enum member names can be used so that they do not collide with the built-in (and future) "sunder names": https://docs.python.org/3/library/enum.html#supported-sunder-names

I'll have to think about what the proper fix for this is. For now, I'd recommend editing the IP-XACT file and editing the names that have leading & trailing suffixes.

I will move this issue to the systemrdl-compiler project since the fix will ultimately be there.

amykyta3 avatar Jun 28 '22 14:06 amykyta3

Found this bug two.

tsyw avatar Jul 01 '22 07:07 tsyw

Hi, is there an update regarding this bug?

markcohen32 avatar Jul 10 '22 07:07 markcohen32

Was on vacation. Will look into it more now that I am back

amykyta3 avatar Jul 19 '22 05:07 amykyta3

Hi, any new? :)

markcohen32 avatar Aug 07 '22 06:08 markcohen32

I have a plan on how to fix this, but it is more intrusive than I had hoped. The plan is to migrate away from the use of Python's Enum objects to represent user-defined enumerations. This would address this issue, as well as other quirks that result from this (inability to pickle register models). Instead of Enum classes, RDL enumerated types would be represented by more specialized class instances. A similar change would be done for RDL struct representations, but i expect they are less often used.

The biggest challenge is that I need to build a migration path that is not intrusive to the community and do my best to not break compatibility with current usages. I have a general plan for this, but still need to think through some details.

amykyta3 avatar Aug 18 '22 05:08 amykyta3

~~See planned rework details in #132.~~ (changed my mind. fixing a different way) I hope to get this fixed in the next few weeks.

amykyta3 avatar Aug 23 '22 05:08 amykyta3

Fixed in v1.24.0

amykyta3 avatar Sep 08 '22 04:09 amykyta3