task语句在Verilog和SystemVerilog中都能使用,但在SystemVerilog中它的功能更加强大,并且添加了一些新的特性。
module ExampleTask;
// 定义任务
task myTask;
input [7:0] a, b;
output [15:0] result;
begin
result = a + b;
end
endtask
// 主模块
initial begin
// 调用任务
myTask(8'h0A, 8'h05, result);
$display("Result: %d", result);
end
endmodule
956

被折叠的 条评论
为什么被折叠?



