Skip to content

Generate register file size in C headers #1

@colluca

Description

@colluca

Consider the following RDL description:

    regfile perf_regs {
                 perf_cnt_en            perf_cnt_en[NumPerfCounters];
        external perf_cnt_sel           perf_cnt_sel[NumPerfCounters];
        external perf_cnt               perf_cnt[NumPerfCounters];
    };

PeakRDL does not generate any macro or variable with the NumPerfCounters information, which would be useful to e.g. loop over all performance counters.

While this can be calculated as follows, it is quite convoluted and ugly:

#define SNRT_NUM_PERF_CNTS \
    (sizeof(((perf_regs_t){}).perf_cnt) / sizeof(((perf_regs_t){}).perf_cnt[0]))

It would be really nice if PeakRDL or this plugin could directly generate a NUM_PERF_COUNTERS macro from the respective RDL parameter.

Note: the reference code is taken from this PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions