-
Notifications
You must be signed in to change notification settings - Fork 685
Fix crash when comparing queue to scalar (#5570) #5950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
b699682
Improve type check error for array-scalar comparison
hankhsu1996 8c21e07
Add aggregate type comparison in width visitor
hankhsu1996 7e459b8
Apply 'make format'
ce6ec5a
Fix crash on null dtype in aggregate comparison check
hankhsu1996 9b4d91e
Merge branch 'bugfix/queue-compare' of github.com-personal:hankhsu199…
hankhsu1996 e54155c
Fix aggregate comparison to avoid null dtype crash
hankhsu1996 28dcdaa
Remove obsolete slice checks in expandBiOp logic
hankhsu1996 345baad
Refactor aggregate dtype comparison logic and add tests
hankhsu1996 db4a7c5
Apply 'make format'
cd09082
Implement LRM equivalent data types
hankhsu1996 29d28ca
Merge branch 'bugfix/queue-compare' of github.com-personal:hankhsu199…
hankhsu1996 7c703f7
Refactor width visitor to improve aggregate type comparison logic
hankhsu1996 e96ce8b
Fix crash on aggregate compare with missing lhs or rhs
hankhsu1996 c512f7a
Merge remote-tracking branch 'upstream/master' into bugfix/queue-compare
hankhsu1996 87e9b63
Improve error messages for data type comparison mismatches
hankhsu1996 2ee321d
Add isAggregateType method to V3AstNodeDType and update comparisons
hankhsu1996 File filter
Filter by extension
8000
form>
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
%Error: t/t_fuzz_eqne_bad.v:12:23: Slice operator VARREF 't.b' on non-slicable (e.g. non-vector) right-hand-side operand | ||
%Error: t/t_fuzz_eqne_bad.v:12:19: Comparison requires matching data types | ||
: ... note: In instance 't' | ||
: ... Left-hand data type: 'logic$[0:-1]' | ||
: ... Right-hand data type: 'logic' | ||
12 | initial c = (a != &b); | ||
| ^ | ||
| ^~ | ||
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance. | ||
%Error: Exiting due to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// DESCRIPTION: Verilator: Verilog Test module | ||
// | ||
// This file ONLY is placed under the Creative Commons Public Domain, for | ||
// any use, without warranty, 2025 by Wilson Snyder. | ||
// SPDX-License-Identifier: CC0-1.0 | ||
|
||
module t; | ||
// Typedefs | ||
typedef int myint_t; | ||
typedef int myint2_t; | ||
typedef int myq_t[$]; | ||
typedef int myval_t; | ||
typedef string mykey_t; | ||
|
||
initial begin | ||
// Scalar | ||
int a = 1, b = 1; | ||
|
||
// Unpacked array | ||
int u1[2] = '{1, 2}; | ||
int u2[2] = '{1, 2}; | ||
|
||
int m1[2][2] = '{{1, 2}, {3, 4}}; | ||
int m2[2][2] = '{{1, 2}, {3, 4}}; | ||
|
||
// Dynamic array | ||
int d1[] = new[2]; | ||
int d2[] = new[2]; | ||
|
||
// Queue | ||
int q1[$] = '{10, 20}; | ||
int q2[$] = '{10, 20}; | ||
|
||
// Associative array | ||
int aa1[string]; | ||
int aa2[string]; | ||
|
||
// Typedef array | ||
myint_t t1[2] = '{1, 2}; | ||
myint2_t t2[2] = '{1, 2}; | ||
|
||
// Typedef queue | ||
myq_t tq1 = '{1, 2}; | ||
int tq2[$] = '{1, 2}; | ||
|
||
// Typedef associative array | ||
myval_t aa_typedef1[mykey_t]; | ||
int aa_typedef2[string]; | ||
|
||
// Typedef scalar | ||
bit signed [31:0] b1 = 1; | ||
int i1 = 1; | ||
|
||
d1[0] = 5; d1[1] = 6; | ||
d2[0] = 5; d2[1] = 6; | ||
|
||
aa1["a"] = 1; aa2["a"] = 1; | ||
aa1["b"] = 2; aa2["b"] = 2; | ||
|
||
aa_typedef1["foo"] = 123; | ||
aa_typedef2["foo"] = 123; | ||
|
||
if (a != b) $fatal(0, "Scalar comparison failed"); | ||
if (u1 != u2) $fatal(0, "Unpacked 1D array comparison failed"); | ||
if (m1 != m2) $fatal(0, "Unpacked multi-dimensional array comparison failed"); | ||
if (d1 != d2) $fatal(0, "Dynamic array comparison failed"); | ||
if (q1 != q2) $fatal(0, "Queue comparison failed"); | ||
if (aa1 != aa2) $fatal(0, "Associative array comparison failed"); | ||
if (t1 != t2) $fatal(0, "Typedef unpacked array comparison failed"); | ||
if (tq1 != tq2) $fatal(0, "Typedef queue comparison failed"); | ||
if (aa_typedef1 != aa_typedef2) | ||
$fatal(0, "Typedef associative array comparison failed"); | ||
if (b1 != i1) $fatal(0, "bit[31:0] vs int comparison failed"); | ||
|
||
$display("*-* All Finished *-*"); | ||
$finish; | ||
end | ||
endmodule |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.