Fix unpacked structure upper bit cleaning (#4978).

This commit is contained in:
Wilson Snyder 2024-03-15 21:56:24 -04:00
parent 65c3cb4708
commit e82c9db6da
4 changed files with 57 additions and 0 deletions

View File

@ -31,6 +31,7 @@ Verilator 5.023 devel
* Fix DFG removing forceable signals (#4942). [Geza Lore]
* Fix null characters in shortened identifiers (#4946). [Abdul Hameed]
* Fix assignment of null into struct member (#4952).
* Fix unpacked structure upper bit cleaning (#4978).
Verilator 5.022 2024-02-24

View File

@ -224,6 +224,11 @@ class CleanVisitor final : public VNVisitor {
iterateChildren(nodep);
setClean(nodep, true);
}
void visit(AstConsPackMember* nodep) override {
iterateChildren(nodep);
ensureClean(nodep->rhsp());
setClean(nodep, true);
}
void visit(AstSel* nodep) override {
operandTriop(nodep);
setClean(nodep, nodep->cleanOut());

View File

@ -0,0 +1,22 @@
#!/usr/bin/env perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2023 by Wilson Snyder. 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-License-Identifier: LGPL-3.0-only OR Artistic-2.0
scenarios(simulator => 1);
compile(
verilator_flags2=>["--x-assign unique --x-initial unique -Wno-WIDTH -O0"]
);
execute(
check_finished => 1,
);
ok(1);
1;

View File

@ -0,0 +1,29 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2023 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
typedef struct {
logic [4:0] w5;
} Data_t;
module t;
reg en;
reg [7:0] r_id;
Data_t ts;
initial begin
en = 1;
r_id = 42;
ts = '{w5: en ? r_id[4:0] : 5'b0};
$display("ts.w5 = %h", ts.w5);
if ($c32(ts.w5) != 5'h0a) $stop;
$write("*-* All Finished *-*\n");
$finish;
end
endmodule