Verilog Code For Traffic Lights
Verilog Code For Traffic Lights
output reg [2:0] La,Lb; // in the lights - 001 for green; 010 for yellow; 100 for
red
endmodule
// Ashish Rai
// 180102014
module test_traffic;
reg clk, reset, Ta, Tb;
wire [2:0]La,Lb;
traffic_controller junction(clk, reset, Ta, Tb, La, Lb);
initial
begin
clk = 0;
forever #2.5 clk = ~clk;
end
initial
fork
reset = 0;
#7 Ta=0;Tb=0;
#12 Ta=1;
#17 Ta=0;Tb=1;
#22 Ta=1;
#27 Tb=0;
#32 Ta=1;Tb=1;
#37 Tb=0;
#50 $finish;
join
endmodule
// Ashish Rai
// 180102014