Vlsi Labmanual
Vlsi Labmanual
The main objective of VLSI lab is to enhance the knowledge in designing combinational and
sequential digital circuits using Very High Speed Integrated Circuit Hardware Description Language
(VHDL).In this lab uses Xilinx ISE (Integrated Software Environment) software tool produced by
Xilinx for synthesis and analysis of HDL designs, enabling the developer to synthesize ("compile")
their design, simulate the outputs, examine RTL diagrams and configure the target device with the
programmer.
.
Contents
1. Design of Adder/Subtractor
Aim
Apparatus required
Theory
Procedure:
1. A VHDL program source code for the 4bit adder circuit is written and typed in the workspace.
2. It is implemented in xilinxISE simulator and Simulated.
3. Signals are provided and Output Waveforms are viewed.
4. Results are verified using FPGA trainer kit.
Four-Bit Adder/Subtractor
Waveform:
A
4’b1001 4’b0101 4’b1000
S
4’b0001 4’b0010 4’b1111
Cout
Program
Library ieee;
use ieee.std_logic_1164.all;
entity addsub is
m: in std_logic;
end addsub;
component logic_xor is
end component;
component fulladder is
end component;
begin
end structural;
- -submodule logic_xor
library ieee;
use ieee.std_logic_1164.all;
entity logic_xor is
end logic_xor;
begin
z < = a xor b;
end behavioral;
- -submodule fulladder
Library ieee;
use ieee.std_logic_1164.all;
entity fulladder is
end fulladder;
Result
The four-bit adder/subtractor is designed using VHDL and its functionality has been verified
2. Design of BCD Adder
Aim
Apparatus required
Theory
A BCD (Binary Coded Decimal) adder consists of two binary 4-bit parallel adders and a few
combinational gates. The first 4-bit adder sums the two BCD inputs, resulting in a binary representation of this
sum. The second 4-bit adder and combinational logic converts the output of the first 4-bit adder from binary to
BCD. The highest possible value that can result from summing two BCD numbers and a carry bit is 19 (1001 +
1001 + 1 = 1910). Table 2.1 lists the possible binary outputs from the first 4-bit adder, along with the desired
BCD correction.
• If the sum is between 0 and 9, then no correction is needed, i.e nothing is added to binary sum.
• If the sum is between 10 and 19, then the carry bit becomes a ‘1’ and binary value 0110 is added to binary sum
through the bottom 4-bit binary adder.
The output carry can be expressed in Boolean function cout = s4 + s3s2 + s3s1
Procedure:
1. A VHDL program source code for the 4bit adder circuit is written and typed in the workspace.
2. It is implemented in xilinxISE simulator and Simulated.
3. Signals are provided and Output Waveforms are viewed.
4. Results are verified using FPGA trainer kit.
Possible sum outputs of BCD addition of two four bit numbers
S4 S3 S2 S1 S0 Z4 Z3 Z2 Z1 Z0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0 0 1 1
0 0 0 1 0 0 0 0 1 0 2
0 0 0 1 1 0 0 0 1 1 3
0 0 1 0 0 0 0 1 0 0 4
0 0 1 0 1 0 0 1 0 1 5
0 0 1 1 0 0 0 1 1 0 6
0 0 1 1 1 0 0 1 1 1 7
0 1 0 0 0 0 1 0 0 0 8
0 1 0 0 1 0 1 0 0 1 9
0 1 0 1 0 1 0 0 0 0 10
0 1 0 1 1 1 0 0 0 1 11
0 1 1 0 0 1 0 0 1 0 12
0 1 1 0 1 1 0 0 1 1 13
0 1 1 1 0 1 0 1 0 0 14
0 1 1 1 1 1 0 1 0 1 15
1 0 0 0 0 1 0 1 1 0 16
1 0 0 0 1 1 0 1 1 1 17
1 0 0 1 0 1 1 0 0 0 18
1 0 0 1 1 1 1 0 0 1 19
Four bit BCD adder
Waveform:
Cin
Cout
Program
Library ieee;
use ieee.std_logic_1164.all;
entity bcdadder is
cin: in std_logic;
end bcdadder;
component fulladder is
end component;
component logic_and is
end component;
component logic_or is
end component;
signal s0, s1, s2, s3, s4, s5, s6, s7, c0, c1, c2, c3, c4, c5, c6 : std_logic;
begin
cout<=s5;
end structural;
- -submodule Fulladder
library ieee;
use ieee.std_logic_1164.all;
entity fulladder is
end fulladder;
begin
end behavioral;
- -submodule logic_and
library ieee;
use ieee.std_logic_1164.all;
entity logic_and is
end logic_and;
begin
z < = a and b;
end behavioral;
- -submodule logic_or
library ieee;
use ieee.std_logic_1164.all;
entity logic_or is
end logic_or;
begin
z <= a or b or c;
end behavioral;
Result
The four-bit BCD adder is designed using VHDL and its functionality has been verified
3. a ) Design of Multiplexer
Aim
Apparatus required
Theory
A Digital multiplexer is a combinational circuit that selects binary information from one of many input
lines and directs it to a single output line. Multiplexing in the sense is transmitting a large number of
information units over a smaller number of channels or lines. The selection of a particular input line is
controlled by a set of selection lines. Normally there are 2n input lines and n selection lines whose bit
combinations determine which input is to be selected. Multiplexer circuits may have an enable input to control
the operation of the unit. The enable input (sometimes called strobe) can be used to expand two or more
multiplexers to digital multiplexers with larger number of inputs. The size of the multiplexer is specified by the
number of input lines and the single output line. The Boolean functions for the output of 4 to 1 multiplexer is
Procedure:
1. The 4 to 1 multiplexer circuit is designed and the Boolean function is found out.
2. The VHDL program source code for the circuit is written.
3. It is implemented in ISE simulator and Simulated.
4. Signals are provided and Output Waveforms are viewed.
5. Results are verified in Spartan FPGA.
4 TO 1 MULTIPLEXER
Block Diagram
Truth Table
S1 S0 E
X X 0 0
0 0 1 I0
0 1 1 I1
1 0 1 I2
1 1 1 I3
LOGIC DIAGRAM FOR 4 TO 1 MULTIPLEXER
Waveform
S1
S0
I0
I1
I2
I3
Y
Program
Library ieee;
use ieee.std_logic_1164.all;
entity multiplexer is
y :out std_logic);
end multiplexer;
component logic_invt is
end component;
component logic_and is
end component;
component logic_or is
end component;
begin
end structural;
- -submodule logic_invt
library ieee;
use ieee.std_logic_1164.all;
entity logic_invt is
end logic_invt ;
begin
sbar< = not s;
end behavioral;
- -submodule logic_and
library ieee;
use ieee.std_logic_1164.all;
entity logic_and is
end logic_and;
architecture behavioral of logic_and is
begin
end behavioral;
- -submodule logic_or
library ieee;
use ieee.std_logic_1164.all;
entity logic_or is
end logic_or;
begin
z < = a or b or c or d;
end behavioral;
Result
The 4 to 1 multiplexer is designed using VHDL and its functionality has been verified.
3. b) Realiztion of De-Multiplexer
Aim
Apparatus required
Theory
The De-multiplexer performs the reverse operation of a multiplexer. It is a combinational circuit which
accepts a single input and distributes it overall several outputs. The selection of a particular output line is
controlled by a set of selection lines. Normally, there are 2n output lines and n selection lines. De-multiplexer
circuit may have an enable input to control the operation of the unit. The circuit functions as normal de-
multiplexer only if the enable or strobe input line is activated. The size of the de-multiplexer is specified by the
single input line and the number 2n of its output lines. The Boolean functions for the outputs of 1 to 4 De-
multiplexer are
Procedure:
1. The 1 to 4 demultiplexer circuit is designed and the Boolean function is found out.
2. The VHDL program source code for the circuit is written.
3. It is implemented in xilinxISE simulator and Simulated.
4. Signals are provided and Output Waveforms are viewed.
5. Results are verified in Spartan FPGA.
1 to 4 De-multiplexer
Block Diagram
Truth Table
S1 S0 E D0 D1 D2 D3
X X 0 0 0 0 0
0 0 1 I 0 0 0
0 1 1 0 I 0 0
1 0 1 0 0 I 0
1 1 1 0 0 0 I
LOGIC DIAGRAM FOR 1 TO 4 DE-MULTIPLEXER
Waveform:
S1
S0
I0
Y0
Y1
Y2
Y3
Program
Library ieee;
use ieee.std_logic_1164.all;
entity demultiplexer is
end demultiplexer;
component logic_invt is
end component;
component logic_and is
end component;
begin
end structural;
- -submodule logic_invt
library ieee;
use ieee.std_logic_1164.all;
entity logic_invt is
end logic_invt ;
begin
sbar<= not s;
end Behavioral;
- -submodule logic_and
library ieee;
use ieee.std_logic_1164.all;
entity logic_and is
end logic_and;
begin
end behavioral;
Result
The 1 to 4 de-multiplexer is designed using VHDL and its functionality has been verified.
4. Design of 4-bit magnitude comparator
Aim
Requirements
Theory
A Four-bit comparator compares two four-bit binary words, A and B, and asserts outputs indicating
whether the decimal equivalent of word A is less than, greater than, or equal to that of word B. A four-bit
comparator can be implemented from two two-bit comparators with additional logic to generate the appropriate
outputs that result from comparing four-bit binary words. The logic for connecting the two-bit comparators is
based on the observation that a strict inequality in the higher order bit pairs determines relative magnitude of the
four-bit words; on the otherhand, if the high order bit pairs are equal, the lower–order bit pairs determine the
output. The simplified Boolean equations for the three outputs of two-bit comparator are
Procedure:
1. The VHDL program source code for the comparator circuit is written and typed in the workspace.
2. It is implemented in xilinxISE simulator and Simulated.
3. Signals are provided and Output Waveforms are viewed.
4. Results are verified in Spartan FPGA.
Truth Table for 2-bit comparator
INPUTS OUTPUTS
Library ieee;
Use ieee.std_logic_1164.all;
entity comparator is
end comparator;
component twobit_comp is
end component;
component logic_and is
end component;
component logic_or is
end component;
begin
c1: twobit_comp port map(a(3), a(2), b(3), b(2), h0, h1, h2);
end structural;
- -submodule twobit_comp
Library ieee;
Use ieee.std_logic_1164.all;
entity twobit_comp is
end twobit_comp;
begin
xgty < = (x1 and y1bar) or (x0 and y1bar and y0bar) or (x1 and x0 and y0bar);
xlty < = (x1bar and y1) or (x0bar and y1 and y0) or (x1bar and x0bar and y0);
end behavioral;
- -submodule logic_and
library ieee;
use ieee.std_logic_1164.all;
entity logic_and is
end logic_and;
begin
z < = a and b ;
end behavioral;
- -submodule logic_or
library ieee;
use ieee.std_logic_1164.all;
entity logic_or is
end logic_or;
begin
z < = a or b ;
end behavioral;
Waveform
a
4’b1001 4’b1010 4’b1010
b
4’b1100 4’b1010 4’b0010
a_lt_b
a_gt_b
a_eq_b
Result
The four-bit magnitude comparator is designed using VHDL and its functionality has been verified.
5. Design of Array Multiplier
Aim:
To design an array multiplier circuit for 4 inputs and 8 outputs using VHDL.
Apparatus required
Theory:
Binary multiplication can be accomplished by several approaches. The approach presented here is
realized entirely with combinational circuits. Such a circuit is called an array multiplier.
The term array is used to describe the multiplier because the multiplier is organized as an array
structure. Each row, called a partial product, is formed by a bit-by-bit multiplication of each operand.
For example, a partial product is formed when each bit of operand ‘a’ is multiplied by b0, resulting
in a3b0, a2b0,a1b0, a0b0. The binary multiplication table is identical to the AND truth table.
Each product bit {o(x)}, is formed by adding partial product columns. The product equations,
including the carry-in {c(x)}, from column c(x-1), are (the plus sign indicates addition not OR).
Each product term, p(x), is formed by AND gates and collection of product terms needed for the
multiplier. By adding appropriate p term outputs, the multiplier output equations are realized, as shown in
figure.
a3 a2 a1 a0 x b3 b2 b1 b0
a3 b0 a2 b0 a1b0 a0b0
O7 O6 O5 O4 O3 O2 O1 O0
Partial Products
Each row, called partial product, is formed by bit-by-bit multiplication of each operand. For example a partial
product is formed when each bit of operand a is multiplied by b0 resulting in a3 b0, a2 b0, a1b0 and a0b0. Each
product bit Ox is formed by adding partial product columns. The product equations including the carry-in, C x
from column (x-1), are
O0 = a0b0
O1 = a1b0 + a0b1 + C0
O5 = a3b2 + a2b3 + C4
O6 = a3b3 + C5
O7 = C6
Each product term Px is formed by AND gates. By adding appropriate product term outputs the multiplier
equations are realized. The adders are arranged in a carry-save chain where, the carry-out bits are fed to the next
available adder in the column to the left.
Procedure
1. A VHDL program source code for the multiplier circuit is typed in the workspace.
2. It is implemented in ISE simulator and Simulated.
3. Signals are provided and Output Waveforms are viewed.
4. Results are verified in Spartan FPGA.
FA – Full Adder
HA – Half Adder
Program
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity ary4x4multiplier is
b : in STD_LOGIC_vector(0 to 3);
end ary4x4multiplier;
component halfadder is
end component;
component fulladder is
end component;
begin
end Behavioral;
- -submodule halfadder
library ieee;
use ieee.std_logic_1164.all;
entity halfadder is
end halfadder;
begin
end behavioral;
- -submodule Fulladder
Library ieee;
use ieee.std_logic_1164.all;
entity fulladder is
end fulladder;
begin
end behavioral;
Waveform:
Result:
Aim
Apparatus required
Theory
The Flip-flop is an electronic circuit (bi-stable multivibrator) that has two stable states and therefore
they are commonly used memory devices in sequential circuits. The flip-flop can be realized using NAND or
NOR gates. The flip-flop is usually controlled by one or two control signals and/or gate or clock signal. The
output often includes the complement as well as the normal output. The names flip-flops and latches are
sometimes used interchangeably; however, the term flip-flop is more appropriately associated with devices that
change state only on a clock edge or pulse whereas latches change state without being clocked. Four types of
flip-flops are commonly considered: SR, JK, D and T.
i) S-R flip-flop
An S-R flip-flop is similar to an S-R latch in that S=1 sets the Q output to 1, and R=1 resets Q
output to 0. The essential difference is that the flip-flop has clock input and the Q output can change
only after an active clock edge. When both S and R inputs are 0 the state of the flip-flop output Q
does not change. When both S and R inputs are high, state of the flip-flop output Q is
indeterminate. The characteristic equation for S-R flip-flop is Q t+1 = S+R’Qt .
ii) J-K flip-flop
The J-K flip-flop does not have an indeterminate input combination as in the S-R flip-flop. The J
and K inputs are analogous to the S (set) and R (reset) inputs respectively of S-R flip-flop. The
indeterminate input condition of the R-S latch causes the J-k flip-flop to toggle; when J=K=1
then . This toggling phenomenon is accomplished by connecting Q’ and Q outputs back to J and K
excitation inputs. The characteristic equation for J-K flip-flop is Q t+1 =JQt’+K’Qt.
iii) D flip-flop
The data or D fip-flophas two inputs D and clock. The output changes only in response to the clock
edge. The state of the flip-flop after the active clock edge (Q t +1) is equal to the input (D) before the
active edge. The characteristic equation of the D flip-flop is Q t+1 = D.
iv) T flip-flop
In the T flip-flop also called the toggle flip-flop, when T = 1 the flip-flop changes the state after the
active edge of clock. When T = 0 no change of state occurs. The characteristic equation for T flip-
flop is Qt+1 = T Qt ..
Procedure
1. The VHDL program source code for the flipflops are typed in the workspace.
2. It is implemented in xilinxISE simulator and Simulated.
3. Signals are provided and Output Waveforms are viewed.
4. Results are verified in Spartan FPGA.
S-R FLIP-FLOP
Truth table
CLK S R Qt Qt+1
^ 0 0 0 0 NO CHANGE
^ 0 0 1 1 NO CHANGE
^ 0 1 0 0 RESET
^ 0 1 1 0 RESET
^ 1 0 0 1 SET
^ 1 0 1 1 SET
^ 1 1 0 X INDETERMINATE
^ 1 1 1 X INDETERMINATE
0 X X 0 0 NO CHANGE
0 X X 1 1 NO CHANGE
Logic Diagram
J-K FLIP-FLOP
Truth Table
Qt J K Qt+1
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 0
Logic Diagram
D FLIP-FLOP
Truth table
CLK D Qt Qt+1
^ 0 X 0 RESET
^ 1 X 1 SET
0 X X Qt NO
CHANGE
Logic Diagram
T FLIP-FLOP
Truth table
STATE
Qt T Qt+1
0 0 0
0 1 1
1 0 1
1 1 0
Logic Diagram
Program
VHDL code for D-flipflop
Library ieee;
Use ieee.std_logic_1164.all;
entity d_flipflop is
port (d, clock, reset : in std_logic; q, qbar: inout std_logic);
end d_flipflop ;
Library ieee;
Use ieee.std_logic_1164.all;
entity t_flipflop is
port (t, clock, reset : in std_logic; q, qbar: inout std_logic);
end t_flipflop ;
Library ieee;
Use ieee.std_logic_1164.all;
entity sr_flipflop is
port (s ,r , clock, reset : in std_logic; q, qbar: inout std_logic);
end sr_flipflop ;
begin
process(clock,reset)
begin
q < = '0';
case s_r is
when "00" = > q < = q;
end case;
end if;
end process;
end behavioral;
VHDL CODE FOR JK- FLIPFLOP
Library ieee;
Use ieee.std_logic_1164.all;
entity jk_flipflop is
port (j ,k , clock, reset : in std_logic; q, qbar: inout std_logic);
end jk_flipflop ;
begin
process(clock,reset)
begin
q < = '0';
j_k := j & k;
case j_k is
when "00" = > q < = q;
end case;
end if;
end process;
end behavioral;
Result: The S-R, J-K, D and T flip-flops are designed using VHDL and their functionalities have been
verified.
7.Design of Synchronous Counters
Aim
Apparatus required
Theory
In Synchronous counters, all the flip-flops are triggered by same clock pulse thus all the flip-flops
change their states simultaneously. Synchronous counters have regular pattern and can be easily constructed
with complementing flip-flops (J-K with J and K tied or T type) and logic gates. Synchronous binary counter
can be classified into two types: up-counter, which increments its output by one for every clock transition and
down-counter, which decrements its output by one for every clock transition. In up-counters, the flip-flop in the
LSB position is complemented for every clock whereas other flip-flops are complemented only when all their
lower order bits are equal to 1. Similarly, for down-counters the flip-flop in the LSB position is complemented
for every clock whereas other flip-flops are complemented only when all their lower order bits are equal to 0.
Procedure:
1. A VHDL program source code for the circuit is typed in the workspace.
2. It is implemented in xilinxISE simulator and Simulated.
3. Signals are provided and Output Waveforms are viewed.
Excitation table for three-bit synchronous up-counter
0 0 0 0 0 1 0 0 1
0 0 1 0 1 0 0 1 1
0 1 0 0 1 1 0 0 1
0 1 1 1 0 0 1 1 1
1 0 0 1 0 1 0 0 1
1 0 1 1 1 0 0 1 1
1 1 0 1 1 1 0 0 1
1 1 1 0 0 0 1 1 1
Waveform
Excitation table for three-bit synchronous down-counter
Waveform
Program
Library ieee;
Use ieee.std_logic_1164.all;
Entity upcounter is
end upcounter;
component t_flipflop is
end component;
component logic_and is
end component;
begin
end structural;
- -submodule t-flipflop
Library ieee;
Use ieee.std_logic_1164.all;
entity t_flipflop is
end t_flipflop ;
begin
begin
q < = '0';
case t is
end case;
end if;
end process;
end behavioral;
- -submodule logic_and
library ieee;
use ieee.std_logic_1164.all;
entity logic_and is
end logic_and;
begin
z < = a and b ;
end behavioral;
VHDL Code For 3-Bit Synchronous Down-Counter
Library ieee;
Use ieee.std_logic_1164.all;
Entity downcounter is
end downcounter;
component t_flipflop is
end component;
component logic_and is
end component;
begin
end structural;
- -submodule t_flipflop
Library ieee;
Use ieee.std_logic_1164.all;
entity t_flipflop is
end t_flipflop ;
begin
begin
q < = '0';
case t is
end case;
end if;
end process;
end behavioral;
- -submodule logic_and
library ieee;
use ieee.std_logic_1164.all;
entity logic_and is
end logic_and;
begin
z <= a and b ;
end behavioral;
Result
The three-bit synchronous up and down binary counters are designed using VHDL and their
functionalities have been verified.
8. Design of Scrambler and De-Scrambler
Aim
Apparatus required
Theory
Scramblers are circuits that pseudo-randomly change the values of some bits in a data block with the
purpose of whitening (that is spread it so that no strong spectral component will exist, thus reducing
electromagnetic interference) or to introduce security. In addition to its use as a stream cipher, a scrambler is
commonly used to avoid long strings of 0’s and 1’s which are responsible for DC wander and synchronization
problems in communication circuits. Scramblers can be implemented using a linear feedback shift register
(LFSR). An LFSR is a simple register composed of memory elements (flip-flops) and modulo-2 adders (XOR
gates). Feedback is taken from two or more memory elements, which are XOR ed and feedback to the first stage
of the LFSR. There are two types of scramblers, additive scramblers and multiplicative scramblers. Additive
scramblers are also called synchronous (because they require the initial state of both scrambler and descrambler
to be same) or non-recursive (because they do not have feedback loops) transform the input data stream by
applying pseudo-random binary sequence. For synchronous operation transmitting and receiver LFSR, sync-
word must be used. Multiplicative scramblers are also called asynchronous (because they do not need LFSR
synchronization) or recursive (they have feedback loops) the input signal by scrambler’s transfer function. They
are discrete time-invariant systems. Multiplicative scramblers/descramblers are self- synchronizing, that they do
not need to start from the same initial state.
Procedure
1. A VHDL code for scrambler and descrambler are typed in the work space.
2. It is implemented in xilinxISE simulator and Simulated.
3. Signals are provided and Output Waveforms are viewed using test bench wave form.
Scrambler
DATA OUT
DATA IN
De-scrambler
DATA IN
DATA OUT
Library ieee;
Use ieee.std_logic_1164.all;
entity scrambler is
end scrambler;
component d_flipflop is
end component;
component logic_xor is
end component;
signal s: std_logic;
begin
g: for i in 1 to 7 generate
end generate g;
begin
end if;
end process;
end structural;
- -submodule d_flipflop
Library ieee;
Use ieee.std_logic_1164.all;
entity d_flipflop is
port (d, clock, reset : in std_logic; q: out std_logic);
end d_flipflop ;
library ieee;
use ieee.std_logic_1164.all;
entity logic_xor is
end logic_xor;
begin
z <= a xor b ;
end behavioral;
VHDL code for de-scrambler
Library ieee;
Use ieee.std_logic_1164.all;
entity descrambler is
end descrambler;
component d_flipflop is
end component;
component logic_xor is
end component;
signal s: std_logic;
begin
g: for i in 1 to 7 generate
end generate g;
begin
end if;
end process;
end structural;
- -submodule d_flipflop
Library ieee;
Use ieee.std_logic_1164.all;
entity d_flipflop is
port (d, clock, reset : in std_logic; q: out std_logic);
end d_flipflop ;
library ieee;
use ieee.std_logic_1164.all;
entity logic_xor is
end logic_xor;
begin
z <= a xor b ;
end behavioral;
Result
The logic circuit for Scrambler and De-scrambler is designed using VHDL and its functionality has been
verified.
Additional Programs
Design of HALF ADDER
Aim
Apparatus Required:
Theory:
A combinational circuit that performs the addition of two bits is called a half-adder. This circuit needs
two binary inputs and produces two binary outputs. One of the input variables designates the augend and other
designates the addend. The output variables produce the sum and the carry.
The simplified Boolean functions of the two outputs can be obtained as below:
Carry C = a.b
Procedure:
1. The half-adder circuit is designed and the Boolean function is found out.
2. The VHDL program source code for the circuit is written.
3. It is implemented in ISE simulator and Simulated.
4. Signals are provided and Output Waveforms are viewed.
Truth Table:
HALF ADDER
INPUT OUTPUT
A B SUM CARRY
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
Logic Diagram:
Waveform
VHDL code for Half adder
library ieee;
use ieee.std_logic_1164.all;
entity halfadder is
end halfadder;
begin
end behavioral;
Result
Aim
Apparatus Required
Theory
A combinational circuit that performs the addition of three bits is called a half-adder. This circuit needs
three binary inputs and produces two binary outputs. One of the input variables designates the augend and other
designates the addend. Mostly, the third input represents the carry from the previous lower significant position.
The output variables produce the sum and the carry.
The simplified Boolean functions of the two outputs can be obtained as below:
Sum S = a + b + c
Procedure:
1. The full-adder circuit is designed and the Boolean function is found out.
2. The VHDL program source code for the circuit is written.
3. It is implemented in ISE Simulator and Simulated.
4. Signals are provided and Output Waveforms are viewed.
.
FULL ADDER
Truth table
INPUT OUTPUT
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
Logic Diagram:
Waveform:
Program
library ieee;
use ieee.std_logic_1164.all;
entity fulladder is
end fulladder;
begin
end my_arch;
Result
Aim
Apparatus Required
Theory
A half subtractor is a combinational circuit that subtracts two binary inputs and produces their
difference. It also has an output to specify if a 1 has been borrowed. The circuit has two inputs, one representing
the Minuend bit and the other Subtrahend bit. The circuit produces two outputs, the difference and borrow. The
Boolean functions for the tow outputs can be written as
Borrow = a’b
Procedure
1. The half subtractor circuit is designed and the Boolean function is found out.
2. The VHDL program source code for the circuit is written.
3. It is implemented in ISE simulator and Simulated.
4. Signals are provided and Output Waveforms are viewed.
Truth Table:
HALF SUBTRACTOR
INPUT OUTPUT
A B Difference Borrow
D
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
Logic Diagram:
Waveform:
Program:
library ieee;
use ieee.std_logic_1164.all;
entity halfsub is
end halfsub;
begin
end halfsubarch;
Result
Aim
Apparatus required
Theory
A full subtractor is a combinational circuit that subtraction between two binary inputs, taking into
account that a 1 may have been borrowed by a lower significant sage. The circuit has three inputs, representing
the minuend bit, the Subtrahend bit and the previous borrow bit respectively. The two outputs, d and b represent
the difference and output borrows. The Boolean functions for the tow outputs can be written as
Borrow = a’b+a’b+ab.
Procedure:
1. The full subtractor circuit is designed and the Boolean function is found out.
2. The VHDL program source code for the circuit is written.
3. It is implemented in ISE simulator and Simulated.
4. Signals are provided and Output Waveforms are viewed.
Truth Table:
FULL SUBTRACTOR
INPUT OUTPUT
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 0 1
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1
Logic Diagram:
Waveform:
Program:
library ieee;
use ieee.std_logic_1164.all;
entity fullsub is
end fullsub;
begin
end fulsubarch;
Result
Aim
Apparatus Required
Theory
An Arithmetic logic unit is a logic circuit that performs various Boolean and arithmetic
operations on n-bit operands. In this design, ALU has 2 four-bit data inputs, A and B, a three-bit select input, S
and a four-bit output F.F is defined by various arithmetic or Boolean operations on the inputs A & B as shown
in the below table.
OR 101 A OR B
Procedure:
VHDL Coding
library ieee;
use ieee.std_logic_1164.all;
entity alu is
end alu;
begin
process(s,a,b)
begin
if (s = "0000") then
begin
f <= "0000";
else if (s == "001")then
f <= b - a;
else if (s == "010")then
f <= a - b;
else if (s == "011")then
f <= a + b;
else if (s == "100")then
f <= a xor b;
else if (s == "101")then
f <= a or b;
else if (s == "110")then
f <= a and b;
else if (s == "111")then
f <= "1111";
end if;
end if;
end;
end if;
end process;
end arch_alu;
Result:
Aim
Apparatus required
Theory
In a ripple counter, the flip-flop output transition serves as a source for triggering other flip-
flops. In other words, the Clock Pulse inputs of all flip-flops (except the first) are triggered not by the incoming
pulses, but rather by the transition that occurs in other flip-flops. A binary ripple counter consists of a series
connection of complementing flip-flops (JK or T type), with the output of each flip-flop connected to the Clock
Pulse input of the next higher-order flip-flop. The flip-flop holding the LSB receives the incoming count pulses.
All J and K inputs are equal to 1. The small circle in the Clock Pulse /Count Pulse indicates that the flip-flop
complements during a negative-going transition or when the output to which it is connected goes from 1 to 0.
The flip-flops change one at a time in rapid succession, and the signal propagates through the counter in a ripple
fashion. A binary counter with reverse count is called a binary down-counter. In binary down-counter, the
binary count is decremented by 1 with every input count pulse.
Procedure:
Program
library ieee;
use ieee.std_logic_1164.all;
entity asyncbinripcount is
end asyncbinripcount;
component jkflipflop
end component;
begin
a1 : jkflipflop port map (high,high,clk,clr,q(0),qbar(0));
end asyncbinripcountarch;
--submodule jkflipflop
library ieee;
use ieee.std_logic_1164.all;
entity jkflipflop is
end jkflipflop;
begin
process (clr,clk)
begin
q <= q ;
q <= '1' ;
q <= '0' ;
end if;
end if;
q <= '0';
end if;
end process;
end behavioral;
Result:
The asynchronous ripple counter is designed in VHDL and the output is verified.