answersLogoWhite

0

Vhdl code for 4 bit updown counter?

Updated: 12/20/2022
User Avatar

Wiki User

11y ago

Best Answer

UP-DOWN COUNTER

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

use IEEE.STD_LOGIC_ARITH.ALL;

use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity updowncount is

port(reset,c,clk:in std_logic;

s:inout std_logic_vector(3 downto 0));

end updowncount;

architecture Behavioral of updowncount is

begin

process(reset,c,clk,s)

begin

if reset='1' then

s<="0000";

elsif c='1' and rising_edge(clk) then

s<=s+1;

elsif c='0' and rising_edge(clk) then

s<=s-1;

end if;

end process;

end Behavioral;UP-DOWN COUNTER

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

use IEEE.STD_LOGIC_ARITH.ALL;

use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity updowncount is

port(reset,c,clk:in std_logic;

s:inout std_logic_vector(3 downto 0));

end updowncount;

architecture Behavioral of updowncount is

begin

process(reset,c,clk,s)

begin

if reset='1' then

s<="0000";

elsif c='1' and rising_edge(clk) then

s<=s+1;

elsif c='0' and rising_edge(clk) then

s<=s-1;

end if;

end process;

end Behavioral;

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Vhdl code for 4 bit updown counter?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is vhdl code for 2 bit sliced processor?

library ieee;


Vhdl program for a 3 bit ripple counter using flip flops?

library ieee; use ieee.std_logic_1164.all; entity 3bitrc is port(


What is Bit And Bit vector in VHDL programming?

These are predefined words in VHDL standards. Bit indicates that the data type is a bit i. e. 0 or 1. A bit_vector is an array of bits. example: a: in bit; b: in bit_vector(1 downto 0);


What is STD logic in vhdl?

In VHDL, std_logic is a data type. It is assigned to input and / or output variables. It means that the variable is a standard logic type i. e. a logic bit which accepts or provides one bit data, either 1 or 0.


What is the Vhdl code of rake receiver?

vhdl is a hardware definition languega to be run on a dsp. it describes circuits, a logical hardware structure. a rake receiver is a piece of hardware that enables every WCDMA-receiver (e i a mobile working with the umts standard) to handel a cdma-coded bit sequence. i know... cant describe it in an easier way.... ;)


What is 4 bit counter?

it has for bit or states for its output


What is 4-bit counter?

it has for bit or states for its output


No of flip flop in 5 bit ripple counter?

There are five flip-flops in a five-bit ripple counter.


What does watchdog means in terms of technically?

watchdog timer is a 16 bit counter that resets the processor when it rolls over to zero. The processor can reset the counter or turn it off, but, correctly used, it will reset the processor in case of a code crash


What is a 2 bit counter?

a 2 bit counter is a counter which have only 2 bits i.e. the posibble counting states are 00, 01, 10,11,00. It may also be known as MOD 3 counter. It can be realized by using 2 Flip flop.


Designed a sequential circuit that will function as 2 bit-up down counter?

designed a sequential circuit that will function as 2 bit-up down counter


What is meant by BCD ripple counter?

binary coded decimal counter with carry propagated bit to bit by ripple method instead of carry lookahead combinatorial logic method. this is easy to build but has long settling time with invalid codes occurring before it settles. for example these counters will generate a 1010 code between 1001 and 0000.