From 35426ab1cf20e2be3c5f6a213d61768a04430b02 Mon Sep 17 00:00:00 2001 From: Davide Date: Thu, 20 Mar 2025 22:57:31 +0100 Subject: [PATCH] Fix KittCar.vhd --- LAB1/src/KittCar.vhd | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/LAB1/src/KittCar.vhd b/LAB1/src/KittCar.vhd index 2b25a62..8da3ccd 100644 --- a/LAB1/src/KittCar.vhd +++ b/LAB1/src/KittCar.vhd @@ -1,7 +1,3 @@ --- File: KittCar_v1.vhd --- Description: Better asyncronous logic handling & unsigned n_period --- Known problem: Not yet tested - ---------- DEFAULT LIBRARY --------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; @@ -37,7 +33,7 @@ ARCHITECTURE Behavioral OF KittCar IS CONSTANT MIN_KITT_CAR_STEP_NS : UNSIGNED(46 DOWNTO 0) := to_unsigned(MIN_KITT_CAR_STEP_MS * 1000000, 47); SIGNAL leds_sr : STD_LOGIC_VECTOR(led'RANGE) := (OTHERS => '0'); - SIGNAL n_period : UNSIGNED(sw'RANGE) := to_unsigned(1, sw'LENGTH); + SIGNAL n_period : UNSIGNED(NUM_OF_SWS DOWNTO 0) := to_unsigned(1, NUM_OF_SWS + 1); SIGNAL up : STD_LOGIC := '1'; BEGIN @@ -82,7 +78,7 @@ BEGIN -- Handle the switch PROCESS (sw) BEGIN - n_period <= unsigned(sw) + 1; + n_period <= unsigned('0' & sw) + 1; END PROCESS; led <= leds_sr;