Up-Down Counter VHDL Code
![Image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNyIG1HfHacQ_v5VQQcL0_qLMiIu_mo4SuL1w1AtomI7Isf-dPiSYW8SvUeW8z1RuqDnemMFubVRTgCQ-NkP170-Ho79SpfDPFAsp8toIFUeXQP7OhLd9GUiZrk_2x5tOS80gV5ADaLW8qg_DjO-k0BQIsbOrVvMopCOWvuv7U0L0_UUDvkEiy7AZ5Rg/w605-h189/download.png)
In digital design, a counter is a device which stores the number of times a particular event has occurred, often with respect to a clock signal. The most common type is a sequential digital logic circuit with an input line called the clock and multiple output lines representing the count. The values on the output lines represent a number in the binary or BCD number system. Each pulse applied to the clock input increments or decrements the number in the counter. VHDL Code: library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_unsigned.ALL; entity U_DCOUNTER is Port ( RESET : in STD_LOGIC; U_D : in STD_LOGIC; CLK : in STD_LOGIC; Cout : out STD_LOGIC_VECTOR (3 downto 0)); end U_DCOUNTER; architecture U_DCOUNTER of U_DCOUNTER is begin process(CLK,RESET) variable temp:STD_LOGIC_VECTOR (3 downto 0):="0000"; begin if (RESET='1')then temp:="0000"; elsif(CLK'event and CLK='1'