Fix performance on large package-scoped structs (#7830)
This commit is contained in:
parent
def1e2ccbc
commit
249608a42f
|
|
@ -302,6 +302,7 @@ Vito Gamberini
|
|||
Wei-Lun Chiu
|
||||
William D. Jones
|
||||
Wilson Snyder
|
||||
Wolfgang Mayerwieser
|
||||
Xi Zhang
|
||||
Yan Xu
|
||||
Yangyu Chen
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ class CUseVisitor final : public VNVisitorConst {
|
|||
iterateConst(nodep->lhsp()->dtypep());
|
||||
}
|
||||
void visit(AstNodeDType* nodep) override {
|
||||
if (nodep->user1SetOnce()) return; // Process once
|
||||
if (nodep->virtRefDTypep()) iterateConst(nodep->virtRefDTypep());
|
||||
if (nodep->virtRefDType2p()) iterateConst(nodep->virtRefDType2p());
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env python3
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of either the GNU Lesser General Public License Version 3
|
||||
# or the Perl Artistic License Version 2.0.
|
||||
# SPDX-FileCopyrightText: 2026 Wilson Snyder
|
||||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
import vltest_bootstrap
|
||||
|
||||
test.scenarios('simulator')
|
||||
|
||||
test.compile()
|
||||
|
||||
test.execute()
|
||||
|
||||
test.passes()
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
// DESCRIPTION: Verilator: Verilog Test module
|
||||
//
|
||||
// This file ONLY is placed under the Creative Commons Public Domain.
|
||||
// SPDX-FileCopyrightText: 2026 Wilson Snyder
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
package pkg;
|
||||
typedef struct {
|
||||
logic [7:0] value;
|
||||
} field_t;
|
||||
typedef struct {
|
||||
field_t f0;
|
||||
field_t f1;
|
||||
} reg_t;
|
||||
typedef struct {
|
||||
reg_t R0;
|
||||
reg_t R1;
|
||||
reg_t R2;
|
||||
} hwif_t;
|
||||
endpackage
|
||||
|
||||
module t (/*AUTOARG*/
|
||||
// Inputs
|
||||
clk
|
||||
);
|
||||
input clk;
|
||||
|
||||
import pkg::*;
|
||||
|
||||
hwif_t hwif_in;
|
||||
hwif_t hwif_out;
|
||||
hwif_t storage;
|
||||
|
||||
integer cyc = 0;
|
||||
|
||||
always_ff @(posedge clk) begin
|
||||
storage.R0.f0.value <= hwif_in.R0.f0.value;
|
||||
storage.R0.f1.value <= hwif_in.R0.f1.value;
|
||||
storage.R1.f0.value <= hwif_in.R1.f0.value;
|
||||
storage.R1.f1.value <= hwif_in.R1.f1.value;
|
||||
storage.R2.f0.value <= hwif_in.R2.f0.value;
|
||||
storage.R2.f1.value <= hwif_in.R2.f1.value;
|
||||
end
|
||||
|
||||
always_comb begin
|
||||
hwif_out.R0.f0.value = storage.R0.f0.value;
|
||||
hwif_out.R0.f1.value = storage.R0.f1.value;
|
||||
hwif_out.R1.f0.value = storage.R1.f0.value;
|
||||
hwif_out.R1.f1.value = storage.R1.f1.value;
|
||||
hwif_out.R2.f0.value = storage.R2.f0.value;
|
||||
hwif_out.R2.f1.value = storage.R2.f1.value;
|
||||
end
|
||||
|
||||
always @(posedge clk) begin
|
||||
cyc <= cyc + 1;
|
||||
if (cyc == 0) begin
|
||||
hwif_in.R0.f0.value <= 8'h11;
|
||||
hwif_in.R0.f1.value <= 8'h22;
|
||||
hwif_in.R1.f0.value <= 8'h33;
|
||||
hwif_in.R1.f1.value <= 8'h44;
|
||||
hwif_in.R2.f0.value <= 8'h55;
|
||||
hwif_in.R2.f1.value <= 8'h66;
|
||||
end
|
||||
else if (cyc == 3) begin
|
||||
if (hwif_out.R0.f0.value !== 8'h11) $stop;
|
||||
if (hwif_out.R0.f1.value !== 8'h22) $stop;
|
||||
if (hwif_out.R1.f0.value !== 8'h33) $stop;
|
||||
if (hwif_out.R1.f1.value !== 8'h44) $stop;
|
||||
if (hwif_out.R2.f0.value !== 8'h55) $stop;
|
||||
if (hwif_out.R2.f1.value !== 8'h66) $stop;
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
Loading…
Reference in New Issue