Fix BLKANDNBLK for for VARXREFs (#5569)

This commit is contained in:
Todd Strader 2024-10-29 07:27:40 -04:00 committed by GitHub
parent 68e0cf5523
commit 0f2a8c6c22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 57 additions and 1 deletions

View File

@ -127,7 +127,7 @@ class UnknownVisitor final : public VNVisitor {
AstNodeExpr* const selExprp = prep->cloneTree(true);
AstNodeExpr* currentExprp = selExprp;
while (AstNodeExpr* itrSelExprp = VN_AS(currentExprp->op1p(), NodeExpr)) {
if (AstVarRef* const selRefp = VN_CAST(itrSelExprp, VarRef)) {
if (AstNodeVarRef* const selRefp = VN_CAST(itrSelExprp, NodeVarRef)) {
// Mark the variable reference as READ access to avoid assignment issues
selRefp->access(VAccess::READ);
break;

View File

@ -0,0 +1,18 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 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
import vltest_bootstrap
test.scenarios('simulator')
test.compile()
test.execute()
test.passes()

View File

@ -0,0 +1,38 @@
// DESCRIPTION: Verilator: Demonstrate struct literal param assignment problem
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2024 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
interface intf
#(
parameter int write_data_width) ();
logic [write_data_width-1:0] writedata;
endinterface
module t( /*AUTOARG*/
clk
);
input clk;
generate
genvar num_chunks;
for (num_chunks = 1; num_chunks <= 2; num_chunks++) begin : gen_n
localparam int decoded_width = 55 * num_chunks;
intf #(
.write_data_width(decoded_width))
the_intf ();
always @(posedge clk) begin
for (int i = 0; i < decoded_width; i++)
the_intf.writedata[i] <= '1;
$display("%0d", the_intf.writedata);
end
end
endgenerate
// finish report
always @ (posedge clk) begin
$write("*-* All Finished *-*\n");
$finish;
end
endmodule