Exp 4vlsi
Exp 4vlsi
Aim: To Write a program for following Logic circuits in Structural modeling using VHDL and verify the
results.
(i)Half adder, (ii) Full adder (iii) Four bit RCA (iv) Parity Generator and (iv)
2X4 decoder
Theory
component component_name is
[port (list-of-interface-ports);]
end component;
The component name may or may not refer to the name of an entity already existing in a library. If it
does not, it must be explicitly bound to entity. The list-of-interface-ports specifies the name , mode and
type of each port of the component in a manner similar to that specified in an entity declaration.
The component-label can be any legal identifier and can be considered as the name of the instance.
The component-name must be the name of a component declared earlier using a component
declaration.
The association-list associates signals in the entity, called actuals, with the ports of a component, called
locals
There are two ways to perform the association of locals with actuals:
Each actual in the component instantiation is mapped by position with each port in the component
declaration.
That is, the first port in the component declaration corresponds to the first actual in the component
instantiation, the second with the second, and so on. Consider an instance of a NAND2 component
. -- Component declaration:
component NAND2
end component;
-- Component instantiation:
local1 => actual1, local2 => actual2, ..., localn => actualn
component NAND2
end component;
-- Component instantiation:
HALF ADDER
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity HALFADD is
Port ( X : in STD_LOGIC;
Y : in STD_LOGIC;
S : out STD_LOGIC;
C : out STD_LOGIC);
end HALFADD;
component xor_gate is
Port ( A : in STD_LOGIC;
B : in STD_LOGIC;
end component;
component and_gate is
Port ( A : in STD_LOGIC;
B : in STD_LOGIC;
end component;
begin
end Behavioral;
FULL ADDER
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity FULLADD is
Y_in: in STD_LOGIC;
Z_in: in STD_LOGIC;
end FULLADD;
component HALFADD is
Port ( X : in STD_LOGIC;
Y : in STD_LOGIC;
S : out STD_LOGIC;
C : out STD_LOGIC);
end component;
component or_gate is
Port ( A : in STD_LOGIC;
B : in STD_LOGIC;
end component;
begin
end Behavioral;
FOUR BIT RCA
Library IEEE;
Use IEEE.STD_LOGIC_1164.all;
entity fourbitRCA is
end fourbitRCA;
--Component declaration
component FULLADD is
Y_in: in STD_LOGIC;
Z_in: in STD_LOGIC;
end component;
-- signal declaration
-- component Instantiation
end RCA_ST;
9 bit Parity Generator
It is combinational circuit that accepts an n-1 bit stream data and generates the additional bit that is
to be transmitted with the bit stream. This additional or extra bit is termed as a parity bit. In even
parity bit scheme, the parity bit is ‘0’ if there are even number of 1s in the data stream and the parity
bit is ‘1’ if there are odd number of 1s in the data stream. In odd parity bit scheme, the parity bit is ‘1’
if there are even number of 1s in the data stream and the parity bit is ‘0’ if there are odd number of 1s
in the data stream. Let us discuss both even and odd parity generators.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity nine_bit_parity is
end nine_bit_parity;
architecture Behavioral of nine_bit_parity is
component xor_gate is
Port ( A : in STD_LOGIC;
B : in STD_LOGIC;
end component;
component not_gate is
Port ( A : in STD_LOGIC;
end component;
begin
end Behavioral;
2X4 Decoder
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity two_four_dec is
Port ( EN : in STD_LOGIC;
end two_four_dec;
component and3in is
Port ( l : in STD_LOGIC;
m : in STD_LOGIC;
n : in STD_LOGIC;
p : out STD_LOGIC);
end component;
component not_gate is
Port ( A : in STD_LOGIC;
end component;
begin
end Behavioral;