add aditional else if for MR_GREEN_1 state

This commit is contained in:
Imants Pulkstenis
2020-02-23 19:18:36 +02:00
parent e6cbc865aa
commit c42e0654da
+6 -2
View File
@@ -47,7 +47,7 @@
///////////////////////////////////////////////////////////////////
module smart_tl_ctl #( parameter
PARAMETER = 45,
PARAMETER = 45,
MR_GREEN_TIME = 30,
SR_GREEN_TIME = 10,
YELLOW_TIME = 3
@@ -105,10 +105,14 @@ always@(posedge clk) begin
r_cnt = 0;
r_next = MR_GREEN_1;
end
else if (r_cnt >= MR_GREEN_TIME) & (MR_cars != 0) begin
else if (r_cnt >= MR_GREEN_TIME) & (MR_cars < PARAMETER) begin
r_cnt = 0;
r_next = MR_GREEN_2;
end
else if (r_cnt >= MR_GREEN_TIME) & (MR_cars >= PARAMETER) begin
r_cnt = 0;
r_next = MR_YELLOW;
end
end
MR_GREEN_2: begin
r_MR_ctl = 'b11;