Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help with codeing

Status
Not open for further replies.

nealmurray

Programmer
Apr 30, 2008
1
US
I'm working on this project for school and I can't seem to get it to work properly heres the first part of my code i think the error is in this somewhere but if not i'll show the rest of my code


LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE work.INT_TYPES.all;


-- Entity Declaration

ENTITY COUNTER IS
-- {{ALTERA_IO_BEGIN}} DO NOT REMOVE THIS LINE!
PORT
(
CLK : IN STD_LOGIC;
RN : IN STD_LOGIC;
START : IN STD_LOGIC;
Q : BUFFER count
);
-- {{ALTERA_IO_END}} DO NOT REMOVE THIS LINE!

END COUNTER;


-- Architecture Body

ARCHITECTURE COUNTER_architecture OF COUNTER IS
BEGIN
PROCESS (CLK, RN, START)
BEGIN

IF RN = '0' THEN
Q <= 0;
else IF START = '1'THEN
IF (CLK'event AND CLK='1' and Q < 9300) THEN
Q <= Q + 1;
end if;
end if;
end if;
END PROCESS;
END COUNTER_architecture;
 
Hello Nealmurray,

I think the problem is in the following line.

IF (CLK'event AND CLK='1' and Q < 9300) THEN

I dont think you can have the Q condition check
within a clk event.

Better is to sepperate them.

IF (CLK'event AND CLK='1') THEN
IF Q<9300 THEN
Q<=Q+1;

Good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top