PeakRDL-regblock icon indicating copy to clipboard operation
PeakRDL-regblock copied to clipboard

[BUG] reg after external mem is only generated if not in regfile or addrmap

Open paul-demo opened this issue 7 months ago • 0 comments

In an addrmap with some external memories followed by some registers, peakRDL-regblock only generates the registers if they are "loose" members of the addrmap scope. If the registeres are nested inside a regfile or addrmap scope, as shown below, then they quietly do not get generated!

See the example here (please correct me if I am wrapping bah and baz registers incorrectly in a regfile). The syntax is allowed but nothing gets generated after the external memory interfaces. If you comment out regfile my_regfile{} surrounding bah and baz, then it generates all four elements as expected (foo, bar, bah, baz).


addrmap reg_after_exteranl_mem_issue #(
    longint N = 64,
    longint W = 32
) {
    desc = "https://github.com/SystemRDL/PeakRDL-regblock/issues/115";

    default regwidth = W;
    default accesswidth = W;
    default addressing = compact;
    default reset = 0;
    default sw = rw;
    default hw = rw;
    default memwidth = W;
    default mementries = N;

    // External mems
    external mem {
        reg {
            desc = "foo";
            field {} value[W];
        } queue[N];
    } foo %= 0x1000;

    external mem {
        reg {
            desc = "bar";
            field {} value[W];
        } queue[N];
    } bar %= 0x1000;

    // Registers
    // WRAPPING THESE REGISTERS IN A REGFILE OR ADDRMAP CAUSES THEM NOT TO BE GENERATED
    // THEY ONLY GET GENERATED IF YOU COMMENT OUT `regfile my_regfile{}` ENCAPSULATION.
    regfile my_regfile {
    
    reg {
        desc = "bah";
        field {
            hw = r;
            desc = "bah";
        } value[W];
    } bah[2] @ 0xF000;

    reg {
        desc = "baz";
        field {
            hw = r;
            desc = "baz";
        } value[W];
    } baz[2] %= 0x80;

    };
};

paul-demo avatar Jul 10 '24 23:07 paul-demo