VHDL Report
VHDL Report
VHDL Report
Gate level modeling allows us to design any digital logic circuit using basic logic gates. If
you know the gate level circuit representation of any logic circuit, you can easily write the
Verilog code for it using this modeling style. Verilog supports coding circuits using basic
logic gates as predefined primitives. These primitives are simple commands that are
understandable by the compiler. For example, the and command is available for
implementing AND logic.
Logic Level on NAND Gate
The NAND gate is the complement of AND function. Its graphic symbol consists of an AND
gate’s graphic symbol followed by a small circle. Here’s the logical representation of the
NAND gate.
entity mux is
port(S1,S0,D0,D1,D2,D3:in bit; Y:out bit);
end mux;
begin
dut: DOWN_COUNTER port map (clk => clk, reset=>reset, counter => counter);
-- Clock process definitions
clock_process :process
begin
clk <= '0';
wait for 10 ns;
clk <= '1';
wait for 10 ns;
end process;
-- Stimulus process
stim_proc: process
begin
-- hold reset state for 100 ns.
reset <= '1';
wait for 20 ns;
reset <= '0';
wait;
end process;
end Behavioral;
Simulation waveform
VHDL code for the up-down counter:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
-- FPGA projects using Verilog code VHDL code
-- fpga4student.com: FPGA projects, Verilog projects, VHDL projects
-- VHDL project: VHDL code for counters with testbench
-- VHDL project: VHDL code for up-down counter
entity UPDOWN_COUNTER is
Port ( clk: in std_logic; -- clock input
reset: in std_logic; -- reset input
up_down: in std_logic; -- up or down
counter: out std_logic_vector(3 downto 0) -- output 4-bit counter
);
end UPDOWN_COUNTER;