Skip to content

Handle Packed Structs and Unions Correctly #2

Description

@polyee13

The idv_doxyfilter_sv.pl doesn't handle structs and unions that are declared as Packed, which also implies that it doesn't handle when they are handled as signed either.

For example, here is the output of the tool with some typedef struct signed, unsigned, packed declared.
image

Per the SystemVerilog spec this is the syntax for Structs, Unions, Packed Structs and Unions. There are also tagged unions but for the purpose of conversion, the same methodology should be followed.
image

image

image
image

image

Proposed solution:
Just like what is done for a typedef enum (see below), something very similar in Strategy needs to be done for typedef struct and unions
Enumerated Typedef
SV Enumerated Typedef looks exactly like C++ enum
Except that C++ enums are always of type int
SV: typedef enum [type] {...} enumtypename
C++: typedef enum [optional enumtypename] [: type] {...} enumtypename
Current Strategy:
- get rid of any optional type information
- note when in an enum body
if (/typedef enum/) {
if (/\benum\b\s+{/) {}
else {
s/\benum\b(.?){/enum {/;
}
}
else {
if (/\benum\b\s+{/) {}
else {
s/\benum\b(.
?){/enum {/;
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions