标签:
按键仿真模型
`timescale 1ns/1ns
//仿真模型的建立
module key_model(press,key);
output reg key;
input press;
initial begin
key = 1‘b1;
end
always@(posedge press)
key_task;
reg [15:0] myrand; //16位
task key_task;
begin
repeat(50)begin
myrand = {$random}%65536;
#myrand;
key = ~ key;
end
key = 0;//按下按键
#13_000_000;
repeat(50)begin
myrand = {$random}%65536;
#myrand;
key = ~ key;
end
key = 1;//松开按键
#13_000_000;
end
endtask
endmodule
标签:
原文地址:http://www.cnblogs.com/xinshuwei/p/5647836.html