SystemVerilog 可以函数 return 包中定义的类型的值吗?
Can a SystemVerilog function return a value of a type defined in a package?
SystemVerilog 函数可以 return 包中定义的类型的值吗?
如何在声明函数类型之前导入包?
我想你想要 return 一个在包中定义的数据类型值。
这是一个示例代码。
package tmp;
typedef bit[1:0] x;
endpackage
import tmp::*;
module tp();
x a;
initial
begin
a = return_x();
$display("a - %p", a);
end
endmodule
function x return_x();
return_x = 3;
endfunction
// Output
// a = 3
SystemVerilog 函数可以 return 包中定义的类型的值吗? 如何在声明函数类型之前导入包?
我想你想要 return 一个在包中定义的数据类型值。
这是一个示例代码。
package tmp;
typedef bit[1:0] x;
endpackage
import tmp::*;
module tp();
x a;
initial
begin
a = return_x();
$display("a - %p", a);
end
endmodule
function x return_x();
return_x = 3;
endfunction
// Output
// a = 3