3.1 过程语句
3.3任务和函数的概述
3.3.1 begin...end可不加
task/endtask,function/endfunction
3.4 子程序参数
3.4.1 参数声明:logic
task mytask1(output logic [31:0] x,input logic y);
3.4.3 使用ref和const传递数组
const ref bit [31:0] a[];
ch=a[i];
ref参数:向子程序传递数组,可以修改变量,修改结果随时可见,应用于带自动存储的子程序中
const修饰符:不能修改数组的值
P55 多线程间使用ref ??
3.4.4 缺省值:调用时不指明参数,则使用缺省值
3.4.5 采用名字进行参数传递
(1)对部分参数进行设置,通过指定子程序参数名字的方式来指定一个自集
(2)task many(input int a=1,b=2,c=3,d=4); endtask
initial begin // a b c d
many(6,7,8,9); // 6 7 8 9
many(); // 1 2 3 4 使用缺省值
many(.c(5)); // 1 2 5 4
many(,6,.d(8)); // 1 6 3 8 混合
end
3.4.6 常见的代码错误
(1)在缺省的情况
System Verilog总结 第三章 过程语句和子程序
最新推荐文章于 2022-08-08 15:53:47 发布