Skip to content

Commit

Permalink
Add flop naming test
Browse files Browse the repository at this point in the history
  • Loading branch information
povik committed Oct 22, 2024
1 parent 773b9fd commit f85c8b5
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions tests/various/flop_naming.ys
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
design -reset
read_slang <<EOF
module top(input wire clk, input wire [3:0] d, output reg [3:0] q);
typedef struct packed {
logic [4:0] field0;
logic [3:0] field1;
} test_t;

test_t a, b;

always_ff @(posedge clk)
a <= b;
endmodule
EOF
select -assert-count 2 t:$*ff*
select -assert-any t:$*ff* c:$driver$a.field1 %i
select -assert-any t:$*ff* c:$driver$a.field0 %i

design -reset
read_slang <<EOF
module top(input wire clk, input wire [3:0] d, output reg [3:0] q);
typedef struct packed {
logic [4:0] field0;
logic [3:0] field1;
} test_t;

test_t a, b;

always_ff @(posedge clk)
a[6:2] <= b[6:2];
endmodule
EOF
select -assert-count 2 t:$*ff*
select -assert-any t:$*ff* c:$driver$a.field1[3:2] %i
select -assert-any t:$*ff* c:$driver$a.field1[3:2] %i

design -reset
read_slang <<EOF
module top(input wire clk, input wire [3:0] d, output reg [3:0] q);
typedef struct packed {
logic [4:0] field0;
logic [3:0] field1;
} test_t;

test_t a[3], b[3];

always_ff @(posedge clk)
a <= b;
endmodule
EOF
select -assert-count 6 t:$*ff*
select -assert-any t:$*ff* c:$driver$a[2].field1 %i
select -assert-any t:$*ff* c:$driver$a[2].field0 %i
select -assert-any t:$*ff* c:$driver$a[1].field1 %i
select -assert-any t:$*ff* c:$driver$a[1].field0 %i
select -assert-any t:$*ff* c:$driver$a[0].field1 %i
select -assert-any t:$*ff* c:$driver$a[0].field0 %i

0 comments on commit f85c8b5

Please sign in to comment.