Need a VHDL code for 16 bit counter with up range and low range

Status
Not open for further replies.

seemagoyal44

Member level 1
Joined
Oct 20, 2007
Messages
39
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,535
i want a vhdl code for 16 bit counter with uprange and low rangei.e input are reset,count enable,considering with up range and low range.
 

Re: vhdl for counter

very confusing question?
state it clearly
 

Re: vhdl for counter

do you men to say an up/down counter of 16 bit?
 

Re: vhdl for counter

You can modify for need by adding a signal say "Up_down".

--------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity counter is
port
(
clk:in std_logic;
enable:in std_logic;
clear:in std_logic;
count_outut std_logic_vector(15 downto 0)
);
end counter;


architecture n_counter of counter is

signal s_count : std_logic_vector(15 downto 0);

begin

counting: process(clear ,clk)
begin

if(clear='1')then
s_count<= (others=>'0');
elsif(clk'event and clk='1') then
if (enable ='1') then
s_count <= s_count + 1 ;
end if;
end if;
end process;

count_out <= s_count;

end n_counter;
 

vhdl for counter

yes,nitin_ndg is right ,you only need add up_down signal,and write a sub counter in the code.
 

Re: vhdl for counter

Plz tellme ......is it ans ur question or not....
may i help u any more...
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…