Skip to content

Commit

Permalink
Units(SystemVerilog): add test for void function
Browse files Browse the repository at this point in the history
  • Loading branch information
hirooih committed Dec 1, 2020
1 parent aa0057a commit 49b9d23
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ attr input.sv /^ task automatic attr ( (* my_attr *) const ref foo, enum { s0,
foo input.sv /^ task automatic attr ( (* my_attr *) const ref foo, enum { s0, s1 } sel_e );$/;" p task:task_func.attr
sel_e input.sv /^ task automatic attr ( (* my_attr *) const ref foo, enum { s0, s1 } sel_e );$/;" p task:task_func.attr
C input.sv /^class C;$/;" C
M input.sv /^module M (output a, input b, c, d);$/;" m
a input.sv /^module M (output a, input b, c, d);$/;" p module:M
b input.sv /^module M (output a, input b, c, d);$/;" p module:M
c input.sv /^module M (output a, input b, c, d);$/;" p module:M
d input.sv /^module M (output a, input b, c, d);$/;" p module:M
myprint input.sv /^ function void myprint (int a);$/;" f module:M
a input.sv /^ function void myprint (int a);$/;" p function:M.myprint
x input.sv /^ logic x;$/;" r function:M.myprint
foo input.sv /^package foo;$/;" K
uvm_object input.sv /^ typedef logic uvm_object;$/;" T package:foo
bar input.sv /^ function logic bar (uvm_object baz);$/;" f package:foo
Expand Down
12 changes: 12 additions & 0 deletions Units/parser-verilog.r/systemverilog-task-function.d/input.sv
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ class C;
typedef class fwd_type_class;
endclass

// LRM 13.4.1 Return values and void functions
module M (output a, input b, c, d);
always_comb begin
a = b + myfunc1(c, d); // call myfunc1 (defined above) as an expression
myprint(a); // call myprint (defined below) as a statement
end

function void myprint (int a);
logic x;
endfunction
endmodule

// from UVM-1.2
package foo;
import "DPI-C" context function int import_func (string str);
Expand Down

0 comments on commit 49b9d23

Please sign in to comment.