- Joined
- Apr 30, 2009
- Messages
- 6
- Reaction score
- 0
Hey
First I want to say hello to everybody since it is my first post in here
I am trying to create a counter which counts up every time you push a specific button as a part of a bigger project.
I have created this register to remember the value:
kr is connected to the count up button, reset to a reset button, and temp is the number of times the button is pressed.
I guess that it should work, but when I use modelSim it seems that the other components which get the out from this will "fail" because it has a non intstatiated input. it means that i get output from these components that is for example XXXX.
So how do I instantiate my value the first time it runs?
I apriciate your help. And please ask if you don't understand my question.
Regards
First I want to say hello to everybody since it is my first post in here
I am trying to create a counter which counts up every time you push a specific button as a part of a bigger project.
I have created this register to remember the value:
Code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity TCC is
port ( kr, reset, clock : in STD_LOGIC;
tempkr : out STD_LOGIC_VECTOR(3 downto 0)
);
end TCC;
architecture Behavioral of TCC is
SIGNAL oldvalue : STD_LOGIC_VECTOR(3 downto 0);
begin
run : process(clock)
begin
if clock'event and clock = '1' then
if reset = '1' then
oldvalue <= "0000";
elsif kr = '1' then
oldvalue <= oldvalue + "0001";
end if;
end if;
end process;
tempkr <= oldvalue;
end Behavioral;
kr is connected to the count up button, reset to a reset button, and temp is the number of times the button is pressed.
I guess that it should work, but when I use modelSim it seems that the other components which get the out from this will "fail" because it has a non intstatiated input. it means that i get output from these components that is for example XXXX.
So how do I instantiate my value the first time it runs?
I apriciate your help. And please ask if you don't understand my question.
Regards