taskdemo.v
来自「一些自己编写的verilog代码」· Verilog 代码 · 共 42 行
V
42 行
module TaskDemo;
// Illustrates use of a task in a testbench.
//
// The task "CycleB" causes the signal "b" to
// oscillate for a specified number of pulses.
// For example, "CycleB(3)" will cause "b"
// to pulse three times.
reg a,b;
initial begin
a = 0;
CycleB ( 7 );
#30 a = 1;
CycleB ( 3 );
#40 a = 0;
CycleB ( 5 );
#20 a = 1;
#50 $finish;
end
task CycleB;
input [3:0] cnt;
integer k;
begin
for (k=0; k<cnt; k=k+1) begin
#5 b=1;
#5 b=0;
end
end
endtask
endmodule
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?