```systemverilog //定义在另一个文件中的函数 extern function int add(int a, int b); module top; //使用extern函数 int sum; initial begin sum = add(3, 5); $display("Sum: %d", sum); end endmodule ``` 在上面的示例中,`add`函数在另一个文件中定义,使用`extern`关键字在当前文件中进行...
class packet; //function prototype extern static function void display (int a, b);endclass //function body outside the class static function void packet :: display (int a, b); $display("packet values a=%0d b=%0d",a, b); endfunction 这个extern方法可以访问类中的一些属性声明。
extern static function void display (int a, b); endclass static function void packet::display (int a, b); $display("packet values a=%0d b=%0d",a,b); endfunction class eth_packet extends packet; function new; packet::addr = 'hff; // Can access non-static members in derived clas...
SystemVerilog 'extern' 类定义可能会变得很长,因为class和endclass之间有很多界限。 这使得很难理解类中所有功能和变量都存在什么,因为每个功能和任务都占用很多行。 在方法声明中使用extern限定符表示实现是在此类的主体之外完成的。 Example classABC;// 让此函数在此处声明,然后由“ extern”限定符定义externfunct...