0% found this document useful (0 votes)
11 views

updated lab manual for coa (1)

The document is a lab manual for the subject COA at Sardar Vallabhbhai Patel Institute of Technology for the academic year 2023-2024. It covers the working and architecture of the 8085 microprocessor, including its functional units, instruction sets, and programming examples for arithmetic and logical operations. Additionally, it provides sample assembly language programs to perform various operations such as addition, subtraction, and logical operations using the 8085 microprocessor.

Uploaded by

22csd7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

updated lab manual for coa (1)

The document is a lab manual for the subject COA at Sardar Vallabhbhai Patel Institute of Technology for the academic year 2023-2024. It covers the working and architecture of the 8085 microprocessor, including its functional units, instruction sets, and programming examples for arithmetic and logical operations. Additionally, it provides sample assembly language programs to perform various operations such as addition, subtraction, and logical operations using the 8085 microprocessor.

Uploaded by

22csd7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY

SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

No. SUBJECT

1 Write the working of 8085 simulator GNUsim8085 and basic architecture of 8085.
8085 is pronounced as "eighty-eighty-five" microprocessor. It is an 8-bit microprocessor designed
by Intel in 1977 using NMOS technology.
It has the following configuration −

 8-bit data bus


 16-bit address bus, which can address upto 64KB
 A 16-bit program counter
 A 16-bit stack pointer
 Six 8-bit registers arranged in pairs: BC, DE, HL
 Requires +5V supply to operate at 3.2 MHZ single phase clock
It is used in washing machines, microwave ovens, mobile phones, etc.
8085 Microprocessor – Functional Units
8085 consists of the following functional units –
Accumulator
It is an 8-bit register used to perform arithmetic, logical, I/O & LOAD/STORE operations. It is
connected to internal data bus & ALU.
Arithmetic and logic unit
As the name suggests, it performs arithmetic and logical operations like Addition, Subtraction,
AND, OR, etc. on 8-bit data.
General purpose register
There are 6 general purpose registers in 8085 processor, i.e. B, C, D, E, H & L. Each register can
hold 8-bit data.
These registers can work in pair to hold 16-bit data and their pairing combination is like B-C, D-E
& H-L.
Program counter
It is a 16-bit register used to store the memory address location of the next instruction to be
executed. Microprocessor increments the program whenever an instruction is being executed, so
that the program counter points to the memory address of the next instruction that is going to be
executed.
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

Stack pointer
It is also a 16-bit register works like stack, which is always incremented/decremented by 2 during
push & pop operations.
Temporary register
It is an 8-bit register, which holds the temporary data of arithmetic and logical operations.
Flag register
It is an 8-bit register having five 1-bit flip-flops, which holds either 0 or 1 depending upon the
result stored in the accumulator.
These are the set of 5 flip-flops −

 Sign (S)
 Zero (Z)
 Auxiliary Carry (AC)
 Parity (P)
 Carry (C)
Its bit position is shown in the following table −
D7 D6 D5 D4 D3 D2 D1 D0

S Z AC P CY

Instruction register and decoder


It is an 8-bit register. When an instruction is fetched from memory then it is stored in the
Instruction register. Instruction decoder decodes the information present in the Instruction register.
Timing and control unit
It provides timing and control signal to the microprocessor to perform operations. Following are
the timing and control signals, which control external and internal circuits −

 Control Signals: READY, RD’, WR’, ALE


 Status Signals: S0, S1, IO/M’
 DMA Signals: HOLD, HLDA
 RESET Signals: RESET IN, RESET OUT
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

Interrupt control
As the name suggests it controls the interrupts during a process. When a microprocessor is
executing a main program and whenever an interrupt occurs, the microprocessor shifts the control
from the main program to process the incoming request. After the request is completed, the
control goes back to the main program.
There are 5 interrupt signals in 8085 microprocessor: INTR, RST 7.5, RST 6.5, RST 5.5, TRAP.
Serial Input/output control
It controls the serial data communication by using these two instructions: SID (Serial input data)
and SOD (Serial output data).
Address buffer and address-data buffer
The content stored in the stack pointer and program counter is loaded into the address buffer and
address-data buffer to communicate with the CPU. The memory and I/O chips are connected to
these buses; the CPU can exchange the desired data with the memory and I/O chips.
Address bus and data bus
Data bus carries the data to be stored. It is bidirectional, whereas address bus carries the location
to where it should be stored and it is unidirectional. It is used to transfer the data & Address I/O
devices.
8085 Architecture
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024


SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

2 1. Write the 8085 program to add two 8 bit numbers stored in registers.
2. Write the 8085 program to add two 16 bit numbers.
3. Write the 8085 program to subtract two 8 bit numbers stored in registers.
4. Write the 8085 program to subtract two 8 bit numbers without using SUB instruction.
Write the 8085 program to add two 8 bit numbers stored in registers.
MVI A,02H ; move 02H in A
MVI B,03H ; move 03H in B
ADD B ; A<-A+B
HLT ; halt

Input: Register Output: Register


A 02H A 05H
B 03H
MVI A, 02H ; Move 02h 8-bit data in Accumulator (A)
STA 4000H ; Store Content of Accumulator (02) at Memory Location 2050
MVI A, 03H ; Move 03h 8-bit data in Accumulator (A)
STA 4001H ; Store Content of Accumulator (03) at Memory Location 2051
LDA 4000H ; Load Data (03) from Memory Location 2050 into A
MOV B, A ; Move Content of Accumulator (03) into Register B
LDA 4001h ; Load Data (02) from Memory Location 2051 into A
ADD B ; Add Content of Register B (03) & Content of A (02)
STA 4002h ; Store Content of Accumulator (05) at Memory Location 2052
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

HLT ; End of Program


Input:

Memory Value
Location
4000H 02
4001H 03

Output:

Memory Value
Location
4000H 02
4001H 03
4002H 05

Write the 8085 program to subtract two 8 bit numbers stored in registers.
MVI A,04H ; move 04H in A
MVI B,02H ; move 02H in B
SUB B ; A<-A-B
HLT ; halt

Input: Register Output: Register


A 04H A 02H
 Subtraction of 8-bit no

MVI A, 03H ; Move 03H 8-bit data in Accumulator (A)


STA 2050H ; Store Content of Accumulator (02) at Memory Location 2050
MVI A, 02H ; Move 02H 8-bit data in Accumulator (A)
STA 2051H ; Store Content of Accumulator (03) at Memory Location 2051
LDA 2050H ; Load Data (03) from Memory Location 2050 into A
MOV B, A ; Move Content of Accumulator (03) into Register B
LDA 2051H ; Load Data (02) from Memory Location 2051 into A
SUB B ; Subtract Content of Register B (03) & Content of A (02).
STA 2052H ; Store Content of Accumulator (01) at Memory Location 2052
HLT ; End of Program

Input:
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

Memory Value
Location
2050H 03
2051H 02

Output:

Memory Value
Location
2052H 01

Write the 8085 program to subtract two 8 bit numbers without using SUB instruction.
MVI A,04H ; move 04H in A
CMA ; compliment value in A
ADI 01 ; add 1 in A
MOV B,A ; move value from A to B
MVI A,05H ; move 05H in A
ADD B ; A<-A+B
HLT ; halt

Input: Register Output: Register


A 04H A 01H
B 05H

Write the 8085 program to add two 16 bit numbers.


 Addition of 16-bit no without using 16-bit Instruction

MVI A, 02H ; Move 02H 8-bit data in Accumulator (A)


STA 2050H ; Store Content of Accumulator (02) at Memory Location 2050
MVI A, 03H ; Move 03H 8-bit data in Accumulator (A)
STA 2051H ; Store Content of Accumulator (03) at Memory Location 2051
MVI A, 04H ; Move 04H 8-bit data in Accumulator (A)
STA 2052H ; Store Content of Accumulator (04) at Memory Location 2052
MVI A, 05H ; Move 05H 8-bit data in Accumulator (A)
STA 2053H ; Store Content of Accumulator (05) at Memory Location 2053
LHLD 2050H ; Load Data (03) from Memory Location 2051 into Register H & Data
(02) from Memory Location 2050 into Register L
XCHG ; Move Content of Register H (03) into Register D & Content of Register
L (02) into Register E
LHLD 2052H ; Load Data (05) from Memory Location 2053 into Register H & Data
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

(04) from Memory Location 2052 into Register L


MOV A, H ; Move Content of Register H (05) into Accumulator
ADD D ; Adds Content of Accumulator (05) with Content of Register D (03) and
result (08) Stores in Accumulator
STA 2054H ; Store Content of Accumulator (08) at Memory Location 2054
MOV A, L ; Move Content of Register L (04) into Accumulator
ADC E ; Add Content of Accumulator (04) with Content of Register E (02) as
well as Carry (1= if it’s generated) and result (06) Stores in Accumulator
STA 2055H ; Store Content of Accumulator (06) at Memory Location 2055
HLT ; End of Program
Input:

Memory Value
Location
2050H 02
2051H 03
2052H 04
2053H 05

Output:

Memory Value
Location
2054H 08
2055H 06
Write an 8085 assembly language program to add two 16-bit numbers stored in memory.

MVI A, 02h ; Move 02h 8-bit data in Accumulator (A)


STA 2050h ; Store Content of Accumulator (02) at Memory Location 2050
MVI A, 03h ; Move 03h 8-bit data in Accumulator (A)
STA 2051h ; Store Content of Accumulator (03) at Memory Location 2051
MVI A, 04h ; Move 04h 8-bit data in Accumulator (A)
STA 2052h ; Store Content of Accumulator (04) at Memory Location 2052
MVI A, 05h ; Move 05h 8-bit data in Accumulator (A)
STA 2053h ; Store Content of Accumulator (05) at Memory Location 2053
LHLD 2050h ; Load Data (03) from Memory Location 2051 into Register H & Data
(02) from Memory Location 2050 into Register L
XCHG ; Move Content of Register H (03) into Register D & Content of Register
L (02) into Register E
LHLD 2052h ; Load Data (05) from Memory Location 2053 into Register H & Data
(04) from Memory Location 2052 into Register L
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

DAD D ; Add Content of Register H (05) with Content of Register D (03) as well
as Content of Register L (04) with Content of Register E (02) (including
carry if it’s generated) and result (08) into Register H and result (06)
into Register L
SHLD 2054h ; Store Content of Register H (08) at Memory Location 2054 and
Register L (06) at Memory Location 2055
HLT ; End of Program

Input:

Memory Value
Location
2050H 02
2051H 03
2052H 04
2053H 05

Output:

Memory Value
Location
2054H 08
2055H 06

3 1. Write the 8085 program to perform all logical operations


2. To perform AND operation of two 8 bit nos. stored on register
3. To perform OR operation of two 8 bit nos. without using ORA instruction.
Write the 8085 program to perform all logical operations
1.ANA

MVI A,02H ; move 02H in register A


MVI B,03H ; move 03H in register B
ANA B ; A<-A.B
HLT ; halt
Input: Register Output: Register
A 02H A 02H
B 03H
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

2.ANI

MVI A,03H ; move 03H in register A


ANI 05H ; A<-A.(05H)
HLT ; halt
Input: Register Output: Register
A 03H A 01H

3. ORA

MVI A,03H ; move 03H in register A


MVI B,03H ; move 03H in register B
ORA B ; A<-A+B
HLT ; halt

Input: Register Output: Register


A 03H A 03H
B 03H
4.ORI

MVI A,02H ; move 02H in register A


ORI 04H ; A<-A+04H
HLT ; halt

Input: Register Output: Register


A 02H A 06H

5.XRA

MVI A,05H ; move 05H in register A


MVI B,02H ; move 02H in register B
XRA B ; A<-A ⊕B
HLT ; halt

Input: Register Output: Register


A 05H A 07H
B 02H
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

6.XRI

MVI A,03H ; move 03H in register A


XRI 02H ; A<-A ⊕B
HLT ; halt

Input: Register Output: Register


A 03H A 01H
7. CMA

MVI A,06H ; move 06H in register A


CMA ; complement value present in A
HLT ; halt

Input: Register Output: Register


A 06H A F9H
To perform AND operation of two 8 bit nos. stored on register
ANA
MVI A,02H ; move 02H in register A
MVI B,03H ; move 03H in register B
ANA B ; A<-A.B
HLT ; halt
Input: Register Output: Register
A 02H A 02H
B 03H
To perform OR operation of two 8 bit nos. without using ORA instruction.
1. A+B = (A’.B’)’

MVI A,03H ; move 03H in A


CMA ; complement the value in A
MOV B,A ; move A into B
MVI A,05H ; move 05H in A
CMA ; complement the value in A
ANA B ; A<-A.B
CMA ; complement the value in A
HLT ; halt

Input: Register Output: Register


A 03H A 07H
B 05H
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

2. A.B = (A’+B’)’

MVI A,03H ; move 03H in A


CMA ; complement the value in A
MOV B,A ; move A into B
MVI A,05H ; move 05H in A
CMA ; complement the value in A
ORA B ; A<-A+B
CMA ; complement the value in A
HLT ; halt
Input: Register Output: Register
A 03H A 01H
B 05H

4 1. Write the 8085 program to mask lower four bits of an 8 bit number stored in
A register
2. Write the 8085 program to set all upper four bits of an 8 bit number stored in
A register
Write the 8085 program to mask lower four bits of an 8 bit number stored in
A register
LDA 2050H ; load accumulator with value in 2050H
ANI 0F0H ; A<-A.0F0H
STA 2051H ; store value in 2051H from A
HLT ; halt

Input: Memory Output: Memory


2050H 05H 2051H F0H

Write the 8085 program to set all upper four bits of an 8 bit number stored in
A register
LDA 2050H ; load accumulator with value in 2050H
ORI 0F0H ; A<-A+0F0H
STA 2051H ; store value in 2051H from A
HLT ; halt

Input: Memory Output: Memory


2050H 05H 2051H
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

mask lower four bits


LDA 2050 ; Load the content of memory location 2050 in accumulator A
MOV B, A ; Move the content of A to B
ANI 0F ; Perform AND operation of A with 0F and store the result back to A
STA 3050 ; Store content of A in memory location 3050
MOV A, B ; Moves the content of B in A
ANI 0F ; Perform AND operation of A with 0F and store the result back to A
RLC ; Rotate content of A left by 1 bit without carry. Use this instruction 4 times to
reverse the content of A
STA 3051 ; Store the content of A in memory location 3051
HLT ; End of program

Input:

Memory Value
Location
2050H 14

Output:

Memory Value
Location
3050H 04
3051H 01
5 1. Write the 8085 program to add two 8 bit numbers stored in memory locations.
2. To perform XOR operation of two 8 bit nos. stored on memory location 2000H and 2001H.
3. Write the 8085 program to transfer block of data from one address to another.
4. Write the 8085 program to transfer block of data from one address to another In reverse order.
5. Write the 8085 program to add all the elements of the given array.
Write the 8085 program to add two 8 bit numbers stored in memory locations
MVI A, 02H ; Move 02h 8-bit data in Accumulator (A)
STA 4000H ; Store Content of Accumulator (02) at Memory Location 2050
MVI A, 03H ; Move 03h 8-bit data in Accumulator (A)
STA 4001H ; Store Content of Accumulator (03) at Memory Location 2051
LDA 4000H ; Load Data (03) from Memory Location 2050 into A
MOV B, A ; Move Content of Accumulator (03) into Register B
LDA 4001h ; Load Data (02) from Memory Location 2051 into A
ADD B ; Add Content of Register B (03) & Content of A (02)
STA 4002h ; Store Content of Accumulator (05) at Memory Location 2052
HLT ; End of Program
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

Input:

Memory Location Value


4000H 02
4001H 03

Output:

Memory Location Value


4000H 02
4001H 03
4002H 05

To perform XOR operation of two 8 bit nos. stored on memory location 2000H and 2001H.
MVI A, 02H ; Move 02h 8-bit data in Accumulator (A)
STA 2000H ; Store Content of Accumulator (02) at Memory Location 2050
MVI A, 03H ; Move 03h 8-bit data in Accumulator (A)
STA 2001H ; Store Content of Accumulator (03) at Memory Location 2051
LDA 4000H ; Load Data (03) from Memory Location 2050 into A
MOV B, A ; Move Content of Accumulator (03) into Register B
LDA 2001h ; Load Data (02) from Memory Location 2051 into A
XRA B ; Add Content of Register B (03) & Content of A (02)
STA 2002h ; Store Content of Accumulator (05) at Memory Location 2052
HLT ; End of Program

Input:

Memory Location Value


2000H 02
2001H 03

Output:

Memory Location Value


2000H 02
2001H 03
2002H 02
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

Write the 8085 program to transfer block of data from one address to another.
LXI H, 2000H ; Store the source address in H
LXI D, 4000H ; Store the destination address in D
MVI B, 05H ; Set the counter value to 5
NEXT:MOV A, M ; Move the value from memory to A
STAX D ; Store the value at destination
INX H ; Increment H
INX D ; Increment D
DCR B ; Decrement B
JNZ NEXT ; Jump to NEXT if not zero
HLT ; End of program
Input:

Register/ Memory Value


address
H 2000H
D 4000H
B 05H
2000H 1
2001H 2
2002H 3
2003H 4
2004H 5

Output:

Register/ Memory Value


address
H 0007H
D 0013H
B 00H
4000H 1
4001H 2
4002H 3
4003H 4
4004H 5
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

Write the 8085 program to transfer block of data from one address to another In reverse
order
LXI H, 2000H ; Load starting address in H
LXI D, 4000H ; Load destination address in D
MVI B, 05H ; Initialize the value of counter
NEXT: MOV A, M ; Move the value from Memory to A
STAX D ; Store at the destination
DCX H ; Decrement H by 1
INX D ; Increment D by 1
DCR B ; Decrement B by 1
JNZ NEXT ; Jump to label NEXT if not zero
HLT ; End of program
Input:

Register/ Memory Value


address
H 2000H
D 4000H
B 05H
2000H 1
2001H 2
2002H 3
2003H 4
2004H 5

Output:

Register/ Memory Value


address
H 1999H
D 4005H
B 00H
4000H 5
4001H 4
4002H 3
4003H 2
4004H 1
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

Write the 8085 program to add all the elements of the given array
XRA A ; Clean A to save sum
MOV B, A ; Clean B to save carry
MVI C, 05H ; Counter
LXI H, 0005H ; Load H with 0005H
NXTBYT: ADD M ; Add
JNC NXTMEM ; If no carry do not increment carry register
INR B ; Increment B by 1
NXTMEM: INX H ; Increment H by 1
DCR C ; Decrement C by 1
JNZ NXTBYT ; Jump if not zero
STA 0002H ; Store in 0002H
MOV A, B ; Move value from B to A
STA 0001H ; Store in 0001H
HLT ; End
LXI H, 000AH ; Store 000AH in H register
MOV A, M ; Store the value from A in memory
INX H ; Increment H by 1
MOV A, B ; Store the value from B in memory
HLT ; End of Program

Input:

Memory address Value


0005H 1
0006H 1
0007H 1
0008H 1
0009H 1

Output:

Memory address Value


0002H 5
6 Write 8085 program to multiply two 8-bit numbers.( Ex: 3 X 4= 3+3+3+3)
MVI A,03H ; move 03H in register A
MVI B,03H ; move03H in register B
MVI C,03H ; counter
Next: ADD B ; A<-A+B
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

DCR C ; decrement value of C


JNZ Next ; jump if not zero
HLT ; halt

Input: Register Output: Registter


A 03H A 0C
B 04H

7 1. Write 8085 program to shift given 8- bit no. using shift instruction and subroutine.
2. Write 8085 program to find the factorial of the number using subroutine.
Write 8085 program to shift given 8- bit no. using shift instruction and subroutine
MVI A,04H ; move 04H in register A
CALL Shift ; call subroutine
HLT ; halt

Shift: RLC ; rotate left the content of AC


RLC
RET ; return to next line of subroutine call

Input: Register Output: Register


A 04H A 40H
Write 8085 program to find the factorial of the number using subroutine.
LXI H,2000H ; load data from memory
MOV B,M ; move from M to B
MVI D,01H ; move 01H in register D
Fact: CALL Mul ; call subroutine
DCR B ; decrement B
JNZ Fact ; jump if not zero
INX H ; increment memory
MOV M,D ; store result in memory
HLT ; halt
Mul: MOV E,B ; move value from B to E
MVI A,00H ; move 00H in register A
Mul1: ADD D ; add contents of D to A
DCR E ; decrement value of E
JNZ Mul1 ; jump if not zero
MOV D,A ; move value from A to D
RET ; return to next line of subroutine call

Input: Memory Output: Memory


2000H 4 2001H 24
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

8 Implement Booth’s Algorithm


MVI C,00H ; move 00H in register C
LDA 4000H ; load accumulator with value in 4000H
MOV B,A ; move value from A to B
LDA 4001H ; load accumulator with value in 4001H
MOV A,D ; move value from A to D
MVI A,00H ; move 00H in register A
Next: ADD B ; A<-A+B
DCR D ; decrement value of D by 1
JNZ Next ; jump if not zero
JNC Loop ; jump if not carry
INR C ; increment value of C by 1
Loop: STA 4002H ; store value of A at 4002H
MOV A,C ; move value from C to A
STA 4003H ; store value of A at 4003H
HLT ; halt

Input: Memory Output: Memory


4000H 4 4002H 8
4001H 2 4003H 0

9 Design ALU using Logisim.


SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

10 Implement 16-bit single-cycle MIPS processor in Verilog HDL


What is MIPS ?
MIPS isdeveloped by several Stanford researchers in the mid 1980s.. MIPS is a reduced
instruction set computer instruction set architecture developed by MIPS Computer Systems,

What is 16 bit processor :


Processors are divided into 3 categories:- 8-bit, 16-bit and 32-bit processor. 16-bit processors have
high performance and power than 8- bit processor and low power consumption than 32-bit
processor.The 16-bit fully functional single cycle processor is applicable for real tasks and also
used for assembly language programming.
Architecture :
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

Internal architecture of 16-bit processor


The general architecture of 16-bit teaching processor is shown in figure
It contains number of basic pieces. There is a register array of 8-bit and 16- bit, a 16-bit ALU, a 16-
bit shifter, a program counter, an instruction register, a 16-bit comparator, an address register and
control unit. All of these units communicate through a common 16-bit tri-state data bus.
The top level design consists of the processor block and a memory block communicatingthrough a
bi-directional data bus, an address bus, and few control lines. The processor fetches instructions
from external memory and executes these instructions to run a program. These instructions are
stored in instruction register and decoded by control unit. The control unit causes the appropriate
signal interaction for processor unit to execute the instruction.
Control unit causes the memory data to be written into the instruction register. The control unit is
now access and decodes the instruction. The decoded instruction executes, and process starts over
again.

Single Cycle Processor :


In a basic single-cycle implementation all operations take the same amount of time—a single
cycle.
A simple MIPS-based instruction set supporting just the following operations
SARDAR VALLABHBHAI PATEL INSTITUTE OF TECHNOLOGY
SVIT-VASAD

LAB MANUAL

Subject Name: COA Academic Year: 2023 -2024

The R-type instructions include add, sub, and, or, and slt.R-type instructions must access registers
and an ALU
Executing an R-type instruction
1. Read an instruction from the instruction memory
2. The source registers, specified by instruction fields rs and rt, should be read from the register file
3. The ALU performs the desired operation
4. Its result is stored in the destination register, which is specified by field rd of the instruction
word
The lw, sw and beq instructions are all I-type encoding
The steps in executing al- type
1. Fetch the instruction, like beq
2. Read the source registers
3. Compare the values by subtracting them in the ALU , if needed
Instruction fetching :-
The CPU is always in an infinite loop, fetching instructions from memory and executing them The
program counter or PC register holds the address of the current instruction

MIPS Applications:
MIPS processors are used in embedded systems such as residential gateways and routers.
Originally, MIPS was designed for general-purpose computing.

MIPS advantages:

 All opcodes are single micro-operations that can be more easily pipelined
 All opcodes are 4 bytes which simplifies the instruction decoder a lot
 Probably doesn’t need a micro-op cache (x86 cores have this)

You might also like