SystemVerilog函数是否可以返回包中定义的类型的值? 在声明函数类型之前如何导入包?
答案 0 :(得分:0)
我认为您想要返回一个数据类型值,该值是在包中定义的。
以下是它的示例代码。
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