Forum Discussion
Altera_Forum
Honored Contributor
14 years agoI have a problem....
Hi.. i am beginner in quartus..
i learned the integer method.. so i used it! the code is this and this works very well. ------------------------------------------------------ Library ieee; use ieee.std_logic_1164; Entity adder_4b is port( cin : in integer range 0 to 1; astring : in integer range 0 to 15; bstring : in integer range 0 to 15; sum_string : out integer range 0 to 31 ); end adder_4b; architecture arc of adder_4b is begin sum_string <= astring + bstring + cin; end arc; ------------------------------------------------------- the problem is .... when i simulate this file, i can't increase my input numer one by one. ( radix is hexadecimal , clock - cin = 100, astring = 200, bstring = 400 and i don't touch anything.) how can i increase my input numer one by one...? i attach the simulation ficture.. ( i am foreigner so.. i am not good at english.. sorry.)1 Reply
- Altera_Forum
Honored Contributor
you need to make a synchrnous counter. What you have is just an adder. You will need to store the previous value of the counter in a signal, and have a clock input.
heres an example:
;use ieee.numeric_std.all; signal count : unsigned(7 downto 0); process(clk, reset) begin if reset = '1' then count <= (others => '0'); elsif rising_edge(clk) then count <= count + 1; end if; end process;