mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-23 00:55:32 +00:00
sv: allow typenames as function return types
This commit is contained in:
parent
6a0d1e117d
commit
4f4e70876f
3 changed files with 46 additions and 0 deletions
35
tests/verilog/func_typename_ret.sv
Normal file
35
tests/verilog/func_typename_ret.sv
Normal file
|
@ -0,0 +1,35 @@
|
|||
typedef logic [1:0] T;
|
||||
|
||||
package P;
|
||||
typedef logic [3:0] S;
|
||||
endpackage
|
||||
|
||||
module gate(
|
||||
output wire [31:0] out1, out2
|
||||
);
|
||||
function automatic T func1;
|
||||
input reg signed inp;
|
||||
func1 = inp;
|
||||
endfunction
|
||||
assign out1 = func1(1);
|
||||
function automatic P::S func2;
|
||||
input reg signed inp;
|
||||
func2 = inp;
|
||||
endfunction
|
||||
assign out2 = func2(1);
|
||||
endmodule
|
||||
|
||||
module gold(
|
||||
output wire [31:0] out1, out2
|
||||
);
|
||||
function automatic [1:0] func1;
|
||||
input reg signed inp;
|
||||
func1 = inp;
|
||||
endfunction
|
||||
assign out1 = func1(1);
|
||||
function automatic [3:0] func2;
|
||||
input reg signed inp;
|
||||
func2 = inp;
|
||||
endfunction
|
||||
assign out2 = func2(1);
|
||||
endmodule
|
5
tests/verilog/func_typename_ret.ys
Normal file
5
tests/verilog/func_typename_ret.ys
Normal file
|
@ -0,0 +1,5 @@
|
|||
read_verilog -sv func_typename_ret.sv
|
||||
proc
|
||||
equiv_make gold gate equiv
|
||||
equiv_simple
|
||||
equiv_status -assert
|
Loading…
Add table
Add a link
Reference in a new issue