Fix V3Premit infinite loop on always read-and-write (#2898).

This commit is contained in:
Wilson Snyder 2021-04-21 09:21:06 -04:00
parent a1cd55225c
commit dd0c2cac9b
4 changed files with 55 additions and 0 deletions

View File

@ -36,6 +36,7 @@ Verilator 4.201 devel
* Fix Cygwin example compile issues (#2856). [Mark Shaw]
* Fix select of with index variable (#2880). [Alexander Grobman]
* Fix cmake version number to be numeric (#2881). [Yuri Victorovich]
* Fix V3Premit infinite loop on always read-and-write (#2898). [Raynard Qiao]
Verilator 4.200 2021-03-12

View File

@ -167,6 +167,7 @@ private:
}
void createDeepTemp(AstNode* nodep, bool noSubst) {
if (nodep->user1()) return;
if (debug() > 8) nodep->dumpTree(cout, "deepin:");
AstNRelinker linker;
@ -224,6 +225,7 @@ private:
{
bool noopt = PremitAssignVisitor(nodep).noOpt();
if (noopt && !nodep->user1()) {
nodep->user1(true);
// Need to do this even if not wide, as e.g. a select may be on a wide operator
UINFO(4, "Deep temp for LHS/RHS\n");
createDeepTemp(nodep->rhsp(), false);

21
test_regress/t/t_premit_rw.pl Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2021 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(
);
#execute(
# check_finished => 1,
# );
ok(1);
1;

View File

@ -0,0 +1,31 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2021 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
typedef struct packed {
logic car_enable;
logic [3-1:0] car_rpv;
logic [2-1:0] car_sn;
} car_s;
module t (/*AUTOARG*/
// Outputs
action,
// Inputs
rsp
);
input rsp;
output action;
car_s rsp;
car_s action;
always @(*) begin
action = rsp;
if (rsp.car_enable == 1'b1) begin
action.car_rpv[ action.car_sn] = 1'b0; // causing problem
// OK
//action.car_rpv[ rsp.car_sn] = 1'b0;
end
end
endmodule