forked from verilator/verilator
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support queue's assignment
push_back/push_front('{})
(verilator#5585)…
… (verilator#5586) Co-authored-by: Udaya Raj Subedi <075bei047.udaya@pcampus.edu.np>
- Loading branch information
1 parent
87bd8fe
commit e47208d
Showing
3 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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 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,41 @@ | ||
// DESCRIPTION: Verilator: Verilog Test module | ||
// | ||
// This file ONLY is placed under the Creative Commons Public Domain, for | ||
// any use, without warranty, 2024 by PlanV GmbH. | ||
// SPDX-License-Identifier: CC0-1.0 | ||
|
||
module t_queue_assignment; | ||
typedef int T_QI[$]; | ||
T_QI jagged_array[$]; // int jagged_array[$][$]; | ||
initial begin | ||
jagged_array = '{ {1}, T_QI'{2,3,4}, {5,6} }; | ||
// jagged_array[0][0] = 1 -- jagged_array[0] is a queue of 1 int | ||
// jagged_array[1][0] = 2 -- jagged_array[1] is a queue of 3 ints | ||
// jagged_array[1][1] = 3 | ||
// jagged_array[1][2] = 4 | ||
// jagged_array[2][0] = 5 -- jagged_array[2] is a queue of 2 ints | ||
// jagged_array[2][1] = 6 | ||
jagged_array.push_back('{7}); | ||
jagged_array.push_back('{8, 9, 10}); | ||
jagged_array.push_front('{0, 1}); | ||
print_and_check(); | ||
|
||
$write("*-* All Finished *-*\n"); | ||
$finish; | ||
end | ||
|
||
task automatic print_and_check(); | ||
integer i, j; | ||
int expected_values[][] = '{ '{0, 1}, '{1}, '{2, 3, 4}, '{5, 6}, '{7}, '{8, 9, 10} }; | ||
|
||
for (i = 0; i < jagged_array.size(); i++) begin | ||
for (j = 0; j < jagged_array[i].size(); j++) begin | ||
// $display("jagged_array[%0d][%0d] = %0d", i, j, jagged_array[i][j]); | ||
if (jagged_array[i][j] !== expected_values[i][j]) begin | ||
$stop; | ||
end | ||
end | ||
end | ||
endtask | ||
|
||
endmodule |