module traffic_lights; reg clock,red,amber,green; parameter on=1,off=0,red_tics=350,amber_tics=30,green_tics=200;
initial red=off; initial amber=off; initial green=off;
always begin red=on; light(red,red_tics); amber=on; light(amber,amber_tics); green=on; light(green,green_tics); end
task light(tics,color); output color; input[31:0] tics; begin repeat(tics)@(posedge clock); color=off; end endtask
always begin #100 clock=0; #100 clock=1; end endmodule
在编译时提示在19行有语法错误,但没发现什么问题 请高手指点! |