Skip to content

[FEATURE] Generate output for a subhierarchy #54

@jamesrbailey

Description

@jamesrbailey

Apologies if there is a good solution to this already.

peakrdl-regblock allows specifying the top addrmap for which to generate RTL - however in practice an addrmap component may sometimes be instantiated and have an instance parameter set.

For example:

addrmap top {

    addrmap bottom #(
        longint unsigned my_param = 1
    ) {
        reg {
            field {sw = rw; hw = r;} my_field;
        } my_reg[my_param];
    };
    
   bottom #(.my_param(2)) u_bottom_1;
   bottom #(.my_param(3)) u_bottom_2;
};

In this case we desire two sets of RTL to be generated, for both u_bottom_1 and u_bottom_2 instances, and they should have my_param set differently according to their instance parameter overrides.

I believe the only way to do this currently is to invoke peakrdl regblock twice with --top bottom the my_param parameter set as a command line argument. This is not ideal because it requires the user to define these parameters for the tool outside of the top RDL definition -- in effect creating a second (error prone) source of truth.

One possible solution is to allow the user to specify the instance hierarchy for which to generate the register block. For example, using an new instance argument:
peakrdl regblock top.rdl --top top --instance top.u_bottom_1 -o top__u_bottom_1
peakrdl regblock top.rdl --top top --instance top.u_bottom_2 -o top__u_bottom_2

If this needs to be done for multiple instances, then it may be desirable to parse and compile the design only once, so specifying multiple instances in a single command may be useful. For example:
peakrdl regblock top.rdl --top top --instance top.u_bottom_1,top.u_bottom_2 -o out

Moreover, this could be extended to instance wildcards to allow automated traversal and regblock generation of the address map.

Happy to discuss and even attempt a PR if you think there is a good solution.

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