-
Notifications
You must be signed in to change notification settings - Fork 529
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #980 from sifferman/argumentless-functions-fix
Argumentless functions fix
- Loading branch information
Showing
6 changed files
with
87 additions
and
5 deletions.
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,63 @@ | ||
|
||
module test; | ||
|
||
function automatic [7:0] test_func; | ||
test_func = 8'h1; | ||
endfunction | ||
|
||
parameter test_parameter = test_func(); | ||
|
||
logic [7:0] test_alwayscomb; | ||
always_comb test_alwayscomb = test_func(); | ||
|
||
// logic [7:0] test_assign; | ||
// assign test_assign = test_func(); | ||
|
||
// wire [7:0] test_wire = test_func(); | ||
|
||
logic [7:0] test_alwaysff; | ||
logic clk; | ||
always_ff @(posedge clk) test_alwaysff <= test_func(); | ||
|
||
initial begin | ||
if (test_func() !== 8'h1) begin | ||
$display("FAILED -- test_func()=%h, expect %h", test_func(), 8'h1); | ||
$finish; | ||
end | ||
|
||
if (test_parameter !== test_func()) begin | ||
$display("FAILED -- test_parameter=%h, expect %h", test_parameter, test_func()); | ||
$finish; | ||
end | ||
|
||
#1; | ||
|
||
if (test_alwayscomb !== test_func()) begin | ||
$display("FAILED -- test_alwayscomb=%h, expect %h", test_alwayscomb, test_func()); | ||
$finish; | ||
end | ||
|
||
// if (test_assign !== test_func()) begin | ||
// $display("FAILED -- test_assign=%h, expect %h", test_assign, test_func()); | ||
// $finish; | ||
// end | ||
|
||
// if (test_wire !== test_func()) begin | ||
// $display("FAILED -- test_wire=%h, expect %h", test_wire, test_func()); | ||
// $finish; | ||
// end | ||
|
||
clk = 0; | ||
#1; | ||
clk = 1; | ||
#1; | ||
if (test_alwaysff !== test_func()) begin | ||
$display("FAILED -- test_alwaysff=%h, expect %h", test_alwaysff, test_func()); | ||
$finish; | ||
end | ||
|
||
$display("PASSED"); | ||
$finish; | ||
end | ||
|
||
endmodule |
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,5 @@ | ||
{ | ||
"type" : "normal", | ||
"source" : "sv_argumentless_func.v", | ||
"iverilog-args" : [ "-g2012" ] | ||
} |
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