3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-06 06:03:23 +00:00

Handling of attributes for struct / union variables

(* nowrshmsk *) on a struct / union variable now affects dynamic
bit slice assignments to members of the struct / union.

(* nowrshmsk *) can in some cases yield significant resource savings; the
combination of pipeline shifting and indexed writes is an example of this.

Constructs similar to the one below can benefit from (* nowrshmsk *), and
in addition it is no longer necessary to split out the shift assignments
on separate lines in order to avoid the error message "ERROR: incompatible
mix of lookahead and non-lookahead IDs in LHS expression."

    always_ff @(posedge clk) begin
        if (rotate) begin
            { v5, v4, v3, v2, v1, v0 } <= { v4, v3, v2, v1, v0, v5 };

            if (res) begin
                v0.bytes <= '0;
            end else if (w) begin
                v0.bytes[addr] <= data;
            end
        end
    end
This commit is contained in:
Dag Lem 2023-03-02 19:02:30 +01:00
parent cee3cb31b9
commit ad437c178d
5 changed files with 33 additions and 8 deletions

View file

@ -1809,7 +1809,12 @@ enum_decl: enum_type enum_var_list ';' { delete $1; }
// struct or union
//////////////////
struct_decl: struct_type struct_var_list ';' { delete astbuf2; }
struct_decl:
attr struct_type {
append_attr($2, $1);
} struct_var_list ';' {
delete astbuf2;
}
;
struct_type: struct_union { astbuf2 = $1; } struct_body { $$ = astbuf2; }