verilator/test_regress/t/t_struct_unpacked_array.v

40 lines
745 B
Systemverilog
Raw Normal View History

// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2023 Wilson Snyder
// SPDX-License-Identifier: CC0-1.0
2026-03-10 02:38:29 +01:00
typedef struct {logic a;} Data_t;
2026-03-10 02:38:29 +01:00
module t (
input clk
);
2026-03-10 02:38:29 +01:00
int cyc = 0;
2026-03-10 02:38:29 +01:00
localparam int SIZE = 20;
reg [$clog2(SIZE)-1 : 0] ptr;
Data_t buffer[SIZE];
Data_t out;
reg out1;
always_ff @(posedge clk) begin
int i;
cyc <= cyc + 1;
if (cyc == 0) begin
for (i = 0; i < SIZE; i = i + 1) begin
buffer[i].a <= 0;
end
end
else begin
ptr <= (ptr + 1);
out <= buffer[ptr];
out1 <= buffer[ptr].a;
$write("*-* All Finished *-*\n");
$finish;
end
2026-03-10 02:38:29 +01:00
end
endmodule