Altera_Forum
Honored Contributor
14 years agoPosition-Counter VHDL in Quartus II question
Hi there, I'm new to this site and also new to using vhdl. I was wondering if I could have some help/suggestions for this question. Please and thank you!!:(
the question of my assignment: 1a)The counter has a 6 bit input. It counts up to 64 positions and then counts back down. Whenever the counter equals something, it stores a 12 bit input into a position. Write a VHDL for this part. (This is what I did, but I'm not sure if I did it right >__< ) LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_unsigned.all; USE ieee.std_logic_arith.all; ENTITY counterANDposition IS PORT( Clock, Reset, Up : IN STD_LOGIC; Count : OUT STD_LOGIC_VECTOR(5 DOWNTO 0); Position : OUT STD_LOGIC_VECTOR(11 DOWNTO 0) ); END; ARCHITECTURE behavioural OF counterANDposition IS SIGNAL Count_Temp: STD_LOGIC_VECTOR(5 DOWNTO 0); SIGNAL Position_Temp: STD_LOGIC_VECTOR(11 DOWNTO 0); BEGIN PROCESS(Clock, Reset) BEGIN IF(rising_edge(Clock)) THEN IF(Reset='1') THEN Count_Temp<="000000"; ELSE Count_Temp<=Count_Temp+1; END IF; END IF; END PROCESS; Count<=Count_Temp; Position<=Position_Temp; END;