Professional Documents
Culture Documents
NO: 1
DATE : 10.09.09
AIM
To write a program for sorting the given numbers in ascending order by using
8086.
ALGORITHM
ADDRESS MNEMONICS
1006 DEC CH
1020 DEC CH
1024 DEC CL
1028 HLT
OBSERVATION
1201 09 01
1202 35 02
1203 22 04
1204 40 05
1205 05 06
1206 02 07
1207 06 09
1208 07 22
1209 04 35
120A 01 40
RESULT
Thus the program was executed and the result was verified.
AIM
ALGORITHM
i. Initialize the needed registers.
ii. Compare the successive numbers stored in register array.
iii. If lesser go to step v Else go to next step.
iv. Rearrange the array contents and repeat the procedure.
v. If the count is not zero then go to step ii.Else decrement the counter and
repeat the process.
vi. Stop the program.
PROGRAM
ADDRESS MNEMONICS
1006 DEC CH
1020 DEC CH
1024 DEC CL
1028 HLT
OBSERVATION
1201 09 40
1202 35 35
1203 22 22
1204 40 09
1205 05 07
1206 02 06
1207 06 05
1208 07 04
1209 04 02
120A 01 01
RESULT
Thus the program was executed and the result was verified.
EXP.NO: 3
AIM
To write a program for searching a number in the given array using 8086.
ALGORITHM
PROGRAM
ADDRESS MNEMONICS
1016 JE 1024
1018 INC DI
1019 DEC CL
1028 HLT
1800 09
1801 01
1802 02
1803 03
1804 04
12
1805 05
1806 06
1807 07
1808 08
1809 12
RESULT
Thus the program was executed and the result was verified.
LENGTH OF A STRING
AIM
ALGORITHM
i. Initialize the needed registers.
ii. Compute the length of the string and store the result in specified register.
iii. Stop the program.
PROGRAM
ADDRESS MNEMONICS
1000 MOV SI, 1200
1004 MOV DX, 0000H
1008 MOV AH, 00
100B MOV AL, [SI]
100D INC SI
100E CMP AH, AL
1010 JZ 1016
1012 INC DX
1013 JMP 100B
1016 MOV [1300], DX
101A HLT
1200 AB
1201 CD
1202 EE
05
1203 AE
1204 BC
1205 00
RESULT
Thus the program was executed and the result was verified.
AIM
ALGORITHM
i. Initialize the needed registers.
ii. Load the input value.
iii. Clear the MSB.
iv. Rotate LSB 4 times left and move to AL.
v. AND AX with D0F0.
vi. Move the LSB of AX to AL.
vii. Load the input value to the AL.
viii. Add AL&BL.
ix. HLT.
ADDRESS MNEMONICS
1022 HLT
OBSERVATION
1300 03
1302 32
1301 02
ADDRESS MNEMONICS
1028 HLT
OBSERVATION
1301 03
1300 32
1302 02
RESULT
Thus the program was executed and the result was verified.
EXP.NO: 6
DATE : 24.09.09
AIM
To write a program to 1’s & 2’s complement of the given number using 8086.
ALGORITHM
i. Initialize the needed register.
ii. Load AX with the data.
iii. Take NOT of AX.
iv. Move the content in AX to [1400].
v. Stop the program.
ADDRESS MNEMONICS
1004 NOT AX
100A HLT
OBSERVATION
1400 CB
1000 1234
1401 ED
1004 NEG AX
100A HLT
OBSERVATION
1500 DF
1000 4321
1501 BC
RESULT
Thus the program was executed and the result was verified.
EXP.NO:7
AIM
ALGORITHM
i. Initialize the needed registers and load them with the data.
ii. Perform OR operation with BL &BH.
iii. Perform OR operation with AH&BL.
iv. Perform OR operation with AL&AH.
v. Move the content of the AL to AH.
vi. Stop
PROGRAM
ADDRESS MNEMONICS
100C OR BL, BH
1010 OR AL, AH
1016 HLT
F=AB’CDE’+A’BCD (BCD+EFGH)
ADDRESS INPUT
1100 B7
1101 7F
1102 FF
1103 FF
1104 FF
RESULT
Thus the program was executed and the result was verified.
AIM
ALGORITHM
i. Define library.
ii. Declare entity with port list.
iii. Declare architecture.
iv. Define structural modeling of 4-bit full adder.
v. End architecture.
BLOCK DIAGRAM
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
Entity fourbitadder is
cin : in STD_LOGIC;
end fourbitadder;
component singlebitadder
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
cin : in STD_LOGIC;
end component;
begin
end Behavioral;
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
Entity singlebitadder is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
cin : in STD_LOGIC;
end singlebitadder;
begin
end Behavioral;
RESULT
Thus the 4 bit full adder was simulated by using Modelsim simulation tool
with Xilinx ISE.
AIM
ALGORITHM
i. Define library.
ii. Declare entity with port list.
iii. Declare architecture.
iv. Define structural modeling of 4-bit subtractor.
v. End architecture.
BLOCK DIAGRAM
A3 B3 A2 B2 A1 B1 A0 B0
C=1
3
2
3
2
1
FA FA FA FA
BORROW
D3 D2 D1 D0
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity subtractor is
c:in std_logic;
borrow:out std_logic);
end subtractor;
signal cbar,b0bar,b1bar,b2bar,b3bar:std_logic;
signal b1,b2,b3:std_logic;
component fulladder is
port(A,B,Cin:in std_logic;
S,Co:out std_logic);
end component;
begin
cbar<=not(c);
b0bar<=not(b(0));
b1bar<=not(b(1));
b2bar<=not(b(2));
b3bar<=not(b(3));
end Behavioral;
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
Entity singlebitadder is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
cin : in STD_LOGIC;
end singlebitadder;
begin
end Behavioral;
RESULT
Thus the 4 bit subtractor was simulated by using Modelsim simulation tool
with Xilinx ISE.
AIM
ALGORITHM
i. Define library.
ii. Declare entity with port list.
iii. Declare architecture.
iv. Define structural modeling of 8-bit ripple carry adder..
v. End architecture.
BLOCK DIAGRAM
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
Entity ripplecounter is
cin : in STD_LOGIC;
end ripplecounter;
component fulladder
Port ( x : in STD_LOGIC;
y : in STD_LOGIC;
z : in STD_LOGIC;
c : out STD_LOGIC;
s: out STD_LOGIC);
end component;
begin
end generate;
end generate;
cout<=c(7);
end Behavioral;
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
Entity fulladder is
Port ( x : in STD_LOGIC;
y : in STD_LOGIC;
z : in STD_LOGIC;
c : out STD_LOGIC;
s : out STD_LOGIC);
end fulladder;
begin
end Behavioral
RESULT
EXP.NO: 11
DATE : 08.10.09
AIM
ALGORITHM
i. Define library.
ii. Declare entity with port list.
iii. Declare architecture.
iv. Define dataflow modeling of multiplexer and demultiplexer.
v. End architecture.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity FOURTOONE is
port(a,b,c,d:IN STD_LOGIC;
s0,s1:IN STD_LOGIC;
e:OUT STD_LOGIC);
end FOURTOONE;
architecture DATAFLOW of FOURTOONE is
signal s0bar,s1bar:STD_LOGIC;
begin
s1bar<=not(s1);
s0bar<=not(s0);
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity demux is
port(D,s1,s0:in std_logic;
y0,y1,y2,y3:out std_logic);
end demux;
RESULT
EXP.NO: 12
DATE : 08.10.09
ENCODER
AIM
ALGORITHM
i. Define library.
ii. Declare entity with port list.
iii. Declare architecture.
iv. Define behavioral modeling of encoder.
v. End architecture.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use IEEE.NUMERIC_STD.ALL;
entity encoder is
port(A:in std_logic_vector(7 downto 0);
Y:out std_logic_vector(2 downto 0));
end encoder;
OUTPUT WAVEFORM:
Thus the Encoder was simulated by using Modelsim simulation tool with Xilinx ISE.
EXP.NO: 13
DATE : 22.10.09
DECODER
AIM
ALGORITHM
i. Define library.
ii. Declare entity with port list.
iii. Declare architecture.
iv. Define behavioral modeling of decoder.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use IEEE.NUMERIC_STD.ALL;
entity decoder is
port(A:in integer range 0 to 7;
Y:out std_logic_vector(7 downto 0));
end decoder;
architecture Behavioral of decoder is
begin
end case;
end process;
end Behavioral;
OUTPUT WAVEFORM
RESULT
Thus the Decoder was simulated by using Modelsim simulation tool with
Xilinx ISE.
EXP.NO: 14
DATE : 22.10.09
FOUR-BIT COMPARATOR
AIM
ALGORITHM
i. Define library.
ii. Declare entity with port list.
iii. Declare architecture.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity comparator is
port(a3,a2,a1,a0,b3,b2,b1,b0:in std_logic;
e,gt,lt:out std_logic);
end comparator;
OUTPUT WAVEFORM
Thus the 4-bit Comparator was simulated by using Modelsim simulation tool
with Xilinx ISE.
EXP.NO: 15
DATE : 29.10.09
SYNCHRONOUS COUNTER
AIM
ALGORITHM
i. Define library.
ii. Declare entity with port list.
iii. Declare architecture.
STATEDIAGRAM
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity counter is
port(rst,clk:in std_logic; updown:in std_logic;
count:out std_logic_vector(15 downto 0));
end counter;
OUTPUT WAVEFORM
EXP.NO: 16
DATE : 29.10.09
AIM
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use IEEE.NUMERIC_STD.ALL;
entity asynccounter is
port(clk,reset:in std_logic;
y:out std_logic);
end asynccounter;
signal div2,div4,div8,div16:std_logic;
begin
process (clk,reset,div2,div4,div8)
begin
if(reset='0')then
elsif rising_edge(clk)then
div2<=not div2;
end if;
if(reset='0')then
div4<='0';
elsif rising_edge(div2)then
div4<=not div4;
end if;
if(reset='0')then
div8<='0';
elsif rising_edge(div4)then
div8<=not div8;
end if;
if(reset='0')then
div16<='0';
elsif rising_edge(div8)then
div16<=not div16;
end if;
if(reset='0')then
y<='0';
elsif rising_edge(clk)then
y<=div16;
end if;
end process;
end Behavioral;
RESULT
EXP.NO: 17
DATE : 02.11.09
AIM
ALGORITHM
i. Define library.
ii. Declare entity with port list.
iii. Declare architecture.
iv. Define behavioral modeling of Moore machine.
v. End architecture.
STATE DIAGRAM:
VHDL Code
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
Entity moore is
rst : in STD_LOGIC;
w : in STD_LOGIC;
z : out STD_LOGIC);
end moore;
signal y:state_type;
begin
process(rst,clk)
begin
if (rst='0')then
y<=a;
case y is
when a=>
if(w='0')then
y<=a;
else
y<=b;
end if;
if(w='0')then
y<=a;
else
y<=c;
end if;
when c=>
if(w='0')then
y<=a;
else
y<=c;
end if;
end case;
end if;
end process;
end Behavioral;
RESULT
Thus the Moore machine was simulated by using Modelsim simulation tool
with Xilinx ISE.
EXP.NO: 18
DATE : 02.11.09
AIM
ALGORITHM
i. Define library.
ii. Declare entity with port list.
iii. Declare architecture.
iv. Define behavioral modeling of mealy machine.
v. End architecture.
STATE DIAGRAM
VHDL Code
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
Entity mealy is
rst : in STD_LOGIC;
z : out STD_LOGIC);
end mealy;
signal y:state_type;
begin
process(rst,clk)
begin
if (rst='0')then
y<=a;
case y is
when a=>
if(w='0')then
y<=a;
else
y<=b;
end if;
when b=>
if(w='0')then
y<=a;
else
y<=b;
end if;
end case;
end process;
process(y,w)
begin
case y is
end case;
end process;
end Behavioral;
OUTPUT WAVEFORM
RESULT
Thus the Mealy machine was simulated by using Modelsim simulation tool
with Xilinx ISE.
EXP.NO: 19
DATE : 14.11.09
AIM
To design and simulate the NMOS and CMOS INVERTER circuit using
Pspice AD.
ALGORITHM
i. Define NMOS INVERTER and CMOS INVERTER..
ii. Define corresponding voltage as input.
iii. Design the value of resistance between each node.
iv. Declare models with corresponding length to width ratio.
v. Check the output.
PROGRAM
VDD 1 0 DC 5V
VIN1 3 0 DC 0V
RL 2 0 500K
.OP
.PROBE
.END
CMOS INVERTER
VDD 1 0 DC 5V
VIN1 2 0 DC 5V
RL 3 0 500K
.OP
.PROBE
.END
RESULT
Thus the NMOS and CMOS INVERTER circuit was designed and simulated
using Pspice AD.
AIM
To design and simulate the NMOS and CMOS NAND gate using Pspice AD.
ALGORITHM
i. Define NMOS and CMOS NAND gate.
ii. Define corresponding voltage as input.
iii. Design the value of resistance between each node.
iv. Declare models with corresponding length to width ratio.
v. Check the output.
PROGRAM
VDD 6 0 DC 5V
VIN1 1 0 DC 0V
VIN2 2 0 DC 5V
RL 5 0 500K
R1 2 3 5K
.OP
.PROBE
.END
VDD 5 0 DC 5V
VIN1 1 0 DC 5V
VIN2 6 0 DC 5V
RL 4 0 500K
R1 6 2 5K
.OP
.PROBE
.END
RESULT
Thus the NMOS and CMOS NAND gate was designed and simulated using
Pspice AD.
EXP.NO: 21
DATE : 23.11.09
AIM
To design and simulate the NMOS AND CMOS NOR gate using Pspice AD.
ALGORITHM
i. Define NMOS and CMOS NOR gate.
ii. Define corresponding voltage as input.
iii. Design the value of resistance between each node.
iv. Declare models with corresponding length to width ratio.
v. Check the output.
PROGRAM
VDD 5 0 DC 5V
VIN1 1 0 DC 0V
VIN2 2 0 DC 5V
RL 4 0 500K
R1 2 3 5K
.OP
.PROBE
.END
CMOS NOR
VDD 5 0 DC 5V
VIN1 1 0 DC 5V
VIN2 6 0 DC 5V
RL 3 0 500K
R1 6 2 5K
.OP
.PROBE
.END
RESULT
Thus the NMOS and CMOS NOR gate was designed and simulated using
Pspice AD.
EXP.NO: 22
DATE : 03.12.09
AIM
ALGORITHM
i. Start the program.
ii. Get the two sequence x(n) and h(n) in matrix form.
iii. Find the length of sequence x(n) and denote it as ‘L’.
iv. Find the length of sequence h(n) and denote it as ‘M’.
v. Find the value of N ,where N = L + M -1 samples.
vi. The convolved sequence is denoted as y(n).
vii. y(n) is given by the formula,
y(n) =∑ {x(k) h(n-k) } where n =0 to N
viii. Terminate the process.
PROGRAM
#include<stdio.h>
main( )
int m=4;
int n=4;
int i=0,j;
int x[10]={1,2,3,4,0,0,0,0};
int h[10]={1,2,3,4,0,0,0,0};
int y[10];
for(i=0;i<m+n-1;i++)
y[i]=0;
for(j=0;j<=i;j++)
y[i]=x[j]*h[i-j];
for(i=0;i<m+n-1;i++)
printf(“%d\n”,y[i]);
OUTPUT
10
20
25
36
16
RESULT
Thus the program for Linear convolution using C language was implemented
and its result was verified.
EXP.NO: 23
DATE : 04.12.09
AIM
ALGORITHM
i. Start the program.
ii. Get the two sequence x(n) and h(n) in matrix form.
iii. Find the length of sequence x(n) and denote it as ‘L’.
iv. Find the length of sequence h(n) and denote it as ‘M’.
v. Find the value of N ,where N = L + M -1 samples.
vi. The convolved sequence is denoted as y(n).
vii. y(n) is given by the formula,
y(n) =∑ {x(k) h(n-k) } where n =0 to N
viii. Terminate the process.
PROGRAM
#include<stdio.h>
int m,n,x[30],h[30],y[30],i,j,temp[30],k,x2[30],a[30];
void main()
scanf(“%d”,&m);
scanf(“%d”,&n);
for(i=0;i<m;i++)
scanf(“%d”,&x[i]);
for(j=0;j<n;j++)
scanf(“%d”,&h[j]);
if(m-n!=0)
if(m>n)
for(i=n;i<m;i++)
h[i]=0;
n=m;
x[i]=0;
m=n;}
y[0]=0;
a[0]=h[0];
for(j=1;j<n;j++)
a[j]=h[n-j];
for(i=0;i<n;i++)
y[0]+=x[i]*a[i];
for(k=1;k<n;k++)
y[k]=0;
for(j=1;j<n;j++)
x2[j]=a[j-1];
x2[0]=a[n-1];
for(i=0;i<n;i++)
a[i]=x2[i];
y[k]=x[i]*x2[i];
for(i=0;i<n;i++)
printf(“%d\t”,y[i]);
M=4
N=4
3210
1100
OUTPUT
3531
RESULT
Thus the program for circular convolution using C language was implemented
and its result was verified.