//`timescale 1 ps/ 1 psmodule traffic_lights(clk,red,amber,green);input clk;output red;output amber;output green;reg red;reg amber;reg green;////dedine the parameterparameter on=1,off=0,red_tics=350,amber_tics=30,green_tics=200;//initialinitial red=off;initial arber=off;initial green=off;///the main progressalways beginred=on; //打開(kāi)light(red,red_tics); //等待green=on;light(green,green_tics);amber=on;light(amber,amber_tics);end //類似C語(yǔ)言的函數(shù)調(diào)用////define tasktask light(color,tics); //定義交通燈的開(kāi)啟時(shí)間taskoutput color; //輸出 控制信號(hào)input [31:0] tics; //輸入 延時(shí)時(shí)鐘beginrepeat (tics) @(posedge clock);color=off;endendtask//// produce the clock// always @ (posedge clk)// beginendmodule
使用Verilog寫(xiě)task函數(shù)時(shí)候,卻出現(xiàn)下面的報(bào)錯(cuò),請(qǐng)問(wèn)該怎么解決?
慕的地6264312
2021-07-23 19:15:13