3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-23 00:55:32 +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

@ -1,3 +1,4 @@
/*.log
/*.out
/run-test.mk
/temp

View file

@ -4,7 +4,7 @@ module range_shift_mask(
input logic [2:0] addr_o,
output logic [7:0] data_o
);
// (* nowrshmsk = 0 *)
(* nowrshmsk = 0 *)
struct packed {
logic [7:0] msb;
logic [0:3][7:0] data;
@ -24,7 +24,7 @@ module range_case(
input logic [2:0] addr_o,
output logic [7:0] data_o
);
// (* nowrshmsk = 1 *)
(* nowrshmsk = 1 *)
struct packed {
logic [7:0] msb;
logic [0:3][7:0] data;

View file

@ -1,4 +1,8 @@
! mkdir -p temp
read_verilog -sv struct_dynamic_range.sv
write_rtlil temp/struct_dynamic_range.il
! grep -F -q ' cell $shift ' temp/struct_dynamic_range.il
! grep -F -q ' switch $mul' temp/struct_dynamic_range.il
prep -top top
flatten
sat -enable_undef -verify -prove-asserts