commit 582dd2dd362582f7caef06b1c82b963902f98650
parent af9b53d2a233e10b6d073607e67772a4b0332701
Author: Martin Klöckner <mjkloeckner@gmail.com>
Date: Fri, 17 Apr 2026 23:32:37 -0300
Try to fix Vivado synth warnings
Diffstat:
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/tps/1/src/intersection_ctrl.vhd b/tps/1/src/intersection_ctrl.vhd
@@ -39,18 +39,18 @@ begin
rst => rst,
clk_ms => clk_ms);
- process(clk_ms, rst) is
+ process(rst, clk_ms, ms_tick_cnt, state) is
begin
if rst = '1' then
state <= state_0;
ms_tick_cnt <= (others => '0');
else
- ms_tick_cnt <= ms_tick_cnt + 1;
case state is
when state_0 =>
- if ms_tick_cnt = RED_TIME_MS then
-
+ if ms_tick_cnt < RED_TIME_MS then
+ ms_tick_cnt <= ms_tick_cnt + 1;
+ else
ms_tick_cnt <= (others => '0');
state <= state_1;
@@ -60,11 +60,11 @@ begin
red_2 <= '0';
yel_2 <= '1';
gre_2 <= '0';
-
end if;
when state_1 =>
- if ms_tick_cnt = YEL_TIME_MS then
-
+ if ms_tick_cnt < YEL_TIME_MS then
+ ms_tick_cnt <= ms_tick_cnt + 1;
+ else
ms_tick_cnt <= (others => '0');
state <= state_2;
@@ -74,11 +74,11 @@ begin
red_2 <= '1';
yel_2 <= '0';
gre_2 <= '0';
-
end if;
when state_2 =>
- if ms_tick_cnt = YEL_TIME_MS then
-
+ if ms_tick_cnt < YEL_TIME_MS then
+ ms_tick_cnt <= ms_tick_cnt + 1;
+ else
ms_tick_cnt <= (others => '0');
state <= state_3;
@@ -88,11 +88,11 @@ begin
red_2 <= '1';
yel_2 <= '0';
gre_2 <= '0';
-
end if;
when state_3 =>
- if ms_tick_cnt = GRE_TIME_MS then
-
+ if ms_tick_cnt < GRE_TIME_MS then
+ ms_tick_cnt <= ms_tick_cnt + 1;
+ else
ms_tick_cnt <= (others => '0');
state <= state_4;
@@ -102,11 +102,11 @@ begin
red_2 <= '1';
yel_2 <= '0';
gre_2 <= '0';
-
end if;
when state_4 =>
- if ms_tick_cnt = YEL_TIME_MS then
-
+ if ms_tick_cnt < YEL_TIME_MS then
+ ms_tick_cnt <= ms_tick_cnt + 1;
+ else
ms_tick_cnt <= (others => '0');
state <= state_5;
@@ -116,11 +116,11 @@ begin
red_2 <= '1';
yel_2 <= '1';
gre_2 <= '0';
-
end if;
when state_5 =>
- if ms_tick_cnt = YEL_TIME_MS then
-
+ if ms_tick_cnt < YEL_TIME_MS then
+ ms_tick_cnt <= ms_tick_cnt + 1;
+ else
ms_tick_cnt <= (others => '0');
state <= state_0;
@@ -130,7 +130,6 @@ begin
red_2 <= '0';
yel_2 <= '0';
gre_2 <= '1';
-
end if;
end case;
end if;