I'm trying to do a load "counter", that works counting up the value from my input when load = 1, but i am having problems in the output, it seems to be a trash value on the output. I've used the partial solution from my old question here
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
USE IEEE.std_logic_unsigned.ALL;
use IEEE.std_logic_arith.ALL;
ENTITY tot IS
PORT (
i_CLK : IN STD_ULOGIC;
i_CLR : IN STD_LOGIC;
i_DINL : IN STD_LOGIC ;
i_DINK : IN INTEGER;
o_DOUTK : OUT INTEGER
);
END tot;
ARCHITECTURE arch_1 OF tot IS
signal w_K : integer;
BEGIN
PROCESS(i_CLK)
BEGIN
IF rising_edge(i_CLK) THEN
IF (i_CLR = '1') THEN
w_K <= 0;
END IF;
IF (i_DINL = '1') THEN
w_K <= i_DINK;
w_K <= w_K +1;
ELSE
w_K <= w_K;
END IF;
END IF;
END PROCESS;
o_DOUTK <= w_K;
END arch_1;
My output error:
Why I am having an error if I clear the outputs in the beggining?