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

Coa 190106107029

The document is a laboratory manual for a computer engineering student containing experiments related to computer organization and architecture. It includes experiments on implementing Booth's multiplication algorithm, describing the working of the 8085 simulator GNUsim8085 and the basic architecture of the 8085 microprocessor, and writing assembly language codes to perform various operations using GNUsim8085. The manual is certified to verify the student has completed the prescribed laboratory work for the course as part of their degree requirements.

Uploaded by

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

Coa 190106107029

The document is a laboratory manual for a computer engineering student containing experiments related to computer organization and architecture. It includes experiments on implementing Booth's multiplication algorithm, describing the working of the 8085 simulator GNUsim8085 and the basic architecture of the 8085 microprocessor, and writing assembly language codes to perform various operations using GNUsim8085. The manual is certified to verify the student has completed the prescribed laboratory work for the course as part of their degree requirements.

Uploaded by

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

Government Engineering College, Modasa

LABORATORY MANUAL
Computer Engineering Department

Semester IV

Computer Organization and Architecture


(3140707)

Year 2020-21

[Name : Jadav Raviraj Rameshbhai ]


[Enrollmentnumber: 190160107029 ]
Government Engineering College, Modasa

This is to certify that Mr. Jadav Raviraj rameshbhai Enrollment No.


190160107029 of Semester IV Computer Engineering has successfully
completed the prescribed term work/laboratory work of Computer
Organization and Architecture (3140707) course within the four walls of L.
D. College of Engineering. This is required as a partial fulfillment of the said
course of Gujarat Technological University.

Date: 08/01/2021

Course In-Charge HOD


Government Engineering College, Modasa

Exp. Page Initial of Course


Title Date Marks
No. No. In-charge
1 Implement Booth’s Algorithm RNV

2 Write the working of 8085 simulator


GNUsim8085 and basic architecture of 8085
along with small introduction.
3 Write an assembly language code in
GNUsim8085 to store numbers in reverse
order in memory location.
Write an assembly language code in GNUsim8085 to implement arithmetic
4
instruction
5 Write an assembly language code in
GNUsim8085 to find the factorial of a number.
Write an assembly language code in GNUsim8085 to implement logical
6
instructions.
7 Design ALU using Logisim.

8 Implement i) Logic Gates ii) Half Adder and iii)


Full Adder in Verilog HDL
Computer Organization and Architecture […Type your Enrolment Number here…]

Experiment 1

AIM: Implement Booth’s Algorithm

THEORY:

Booth's multiplication algorithm is a multiplication algorithm that multiplies two signed binary numbers
in notation .The Booth's algorithm serves two purposes:
Fast multiplication (when there are consecutive 0's or 1's in the multiplier). And Signed multiplication.
Booth's algorithm is a powerful direct algorithm to perform signed-number multiplication. The algorithm
is based on the fact that any binary number can be represented by the sum and difference of other
binary numbers. Using a signed binary notation, we can represent a multiplier in a unique scheme with
the possibility of fewer add cycles for a given multiplier.

Booth's multiplication algorithm is a multiplication algorithm that multiplies two signed binary numbers
in two's complement notation. Booth's algorithm examines adjacent pairs of bits of the N-bit multiplier Y
in signed two's complement representation, including an implicit bit below the least significant bit, y -1 = 0.
For each bit yi, for i running from 0 to N-1, the bits y i and yi-1 are considered. Where these two bits are
equal, the product accumulator P is left unchanged. Where y i = 0 and yi-1 = 1, the multiplicand times 2i is
added toP; and where yi = 1 and yi-1 = 0, the multiplicand times 2i is subtracted from P. The final value of P
is the signed product.

The representation of the multiplicand and product are not specified; typically, these are both also in
two's complement representation, like the multiplier, but any number system that supports addition and
subtraction will work as well. As stated here, the order of the steps is not determined. Typically, it
proceeds from LSB to MSB, starting at i = 0; the multiplication by 2 i is then typically replaced by
incremental shifting of the P accumulator to the right between steps; low bits can be shifted out, and
subsequent additions and subtractions can then be done just on the highest N bits of P. There are many
variations and optimizations on these details.

The algorithm is often described as converting strings of 1's in the multiplier to a high-order +1 and a low-
order –1 at the ends of the string. When a string runs through the MSB, there is no high-order +1, and the
net effect is interpretation as a negative of the appropriate value.

ALGORITHM:

1
Computer Organization and Architecture […Type your Enrolment Number here…]

FLOWCHART OF BOOTH’S ALGORITHM:

2
Computer Organization and Architecture […Type your Enrolment Number here…]

IMPLEMENTATION OF BOOTH’S ALGORITHM:

3
Computer Organization and Architecture […Type your Enrolment Number here…]

CONCLUSION:

EVALUATION:

Program Design of Correctness of Total Signature of


Execution Logic Output Faculty with Date
2 4 4 10

4
Computer Organization and Architecture […Type your Enrolment Number here…]

Experiment 2

AIM: Write the working of 8085 simulator GNUsim8085 and basic architecture of 8085 along with small
introduction.

1.1 ARCHITECTURE OF MICROPROCESSOR 8085

5
Computer Organization and Architecture […Type your Enrolment Number here…]

List of registers used in 8085 to perform various operations:

Accumulator:-It is a 8-bit register which is used to perform arithmetical and logical operation. It stores
the output of any operation. It also works as registers for i/o accesses.
It can be one of the operand in the instruction.

Temporary Register:-It is a 8-bit register which is used to hold the data on which the accumulator is
computing operation. It is also called as operand register because it provides operands to ALU.

Registers:-These are general purposes registers. Microprocessor consists 6 general purpose registers of
8-bit each named as B,C,D,E,H and L. Generally theses registers are not used for storing the data
permanently. It carries the 8-bits data. These are used only during the execution of the instructions.
These registers can also be used to carry the 16 bits data by making the pair of 2 registers. The valid
register pairs available are BC,DE HL. We cannot use other pairs except BC,DE and HL. These registers are
programmed by user.

Flag Registers:-It consists of 5 flip flop which changes its status according to the result stored in an
accumulator. It is also known as status registers. It is connected to the ALU. There are five flip-flops in the
flag register are as follows:

The bit position of the flip flop in flag register is:

All of the three flip flop set and reset according to the stored result in the accumulator.
1.Sign- If D7 of the result is 1 then sign flag is set otherwise reset. As we know that a number on the D7
always desides the sign of the number.
if D7 is 1: the number is negative.
if D7 is 0: the number is positive.
2.Zeros(Z)-If the result stored in an accumulator is zero then this flip flop is set as 1 otherwise it is reset
and also if the result of any arithmetic or logical operation is zero its set as 1( The result of this operation
can be in any registers).
3.Auxiliary carry(AC)-If any carry goes from D3 to D4 in the output then it is set otherwise it is reset.
4.Parity(P)-If the no of 1's is even in the output stored in the accumulator then it is set otherwise it is
reset for the odd.
5.Carry(C)-If the result stored in an accumulator generates a carry in its final output then it is
setotherwise it is reset.
Instruction registers(IR):-It is a 8-bit register. When an instruction is fetched from memory then it is
stored in this register.

Description of other components of 8085:


Instruction Decoder: - Instruction decoder identifies the instructions. It takes the information from
instruction register and decodes the instruction to be performed.

Program Counter:-It is a 16 bit register used as memory pointer. It stores the memory address of the next
instruction to be executed. So we can say that this register is used to sequencing the program. Generally
the memory have 16 bit addresses so that it has 16 bit memory. The program counter is set to 0000H.

6
Computer Organization and Architecture […Type your Enrolment Number here…]

Stack Pointer:-It is also a 16 bit register used as memory pointer. It points to the memory location called
stack. Generally stack is a reserved portion of memory where information can be stores or taken back
together.

Timing and Control Unit:-It provides timing and control signal to the microprocessor to perform the
various operation. It has three control signals. It controls all external and internal circuits. It operates with
reference to clock signal. It synchronizes all the data transfers. There are three control signal:
1.ALE-Airthmetic Latch Enable, It provides control signal to synchronize the components of
microprocessor. 2.RD- This is active low used for reading operation.
3.WR-This is active low used for writing operation.

There are three status signal used in microprocessor S0, S1 and IO/M. It changes its status according the
provided input to these pins.

Serial Input Output Control-There are two pins in this unit. This unit is used for serial data
communication.

Interrupt Unit-There are 6 interrupt pins in this unit. Generally an external hardware is connected to
these pins. These pins provide interrupt signal sent by external hardware to microprocessor and
microprocessor sends acknowledgement for receiving the interrupt signal. Generally INTA is used for
acknowledgement.

1.2 INTRODUCTION TO GNU Simulator 8085


8085 simulator is software on which instructions are executed by writing the programs in assembly
language.
GNUSim8085 is a 8085 microprocessor simulator with following features.
 A simple editor component with syntax highlighting.
 A keypad to input assembly language instructions with appropriate arguments.
 Easy view of register contents.
 Easy view of flag contents.
 Hexadecimal <--> Decimal converter.
 View of stack, memory and I/O contents.
 Support for breakpoints for programming debugging.
 Stepwise program execution.
 One click conversion of assembly program to opcode listing.
 Printing support (known not to work well on Windows).
 UI translated in various languages.

Writing a program in assembly language: -

Format of the instruction is as follows: -


Label Operation Operands Comments
Its optional Necessary Necessary Its optional

A basic assembly program consists of 4 parts.


7
Computer Organization and Architecture […Type your Enrolment Number here…]

1. Labels
2. Operations :- these operations can be specified as

Machine operations (mnemonics):- used to define operations in the form of opcode as mention in the
instruction set of microprocessor 8085.
Pseudo operations (like preprocessor in C):- these are assembly directives.
3. Operands
4. Comments

In addition, you have constants in an assembly program. Unless otherwise specified, a constant which is
always numeric is in decimal form. If appended with a character h it is assumed to be in hexadecimal
form. If a hex constant starts with an alpha-char don't forget to include thenumber 0 in the beginning,
since that will help the assembler to differentiate between a label and a constant.

Labels:-
When given to any particular instruction/data in a program, takes the address of that instruction or data
as its value. But it has different meaning when given to EQU directive. Then it takes the operand of EQU
as its value. Labels must always be placed in the first column and must be followed by an instruction (no
empty line). Labels must be followed by a : (colon), to differentiate it from other tokens.

Operations:-
As mentioned above the operations can be specified in two ways that are mnemonics and pseudo
operation.
Pseudo operations can be defined by using following directives:-
There are only 3 directives currently available in our assembly language.
1. DB - define byte ( 8 bits )
2. DS - define size (no. of bytes)
3. EQU - like minimalistic #define in C

DB is used to define space for an array of values specified by comma separated list. And the label (if given
to the beginning of DB) is assigned the address of the first data item.
DS is used to define the specified number of bytes to be assigned and initialize them to zero. To access
each byte you can use the + or -operator along with label.
EQU behaves similar to #define in C. But it is simple. It can be used to give names only to numeric
constants. Nesting of EQU is not allowed. You can use EQU only in operands for pseudo ops and
mnemonics.

Operands:-
Operands are specified according to the user. The register set specified in the architecture of 8085 (A, B,
C, D, H and L) are used to access and store data. These registers are specified as operand. In case of
accessing data or storing data in the memory ‘m’ is specified as an operand and the address of this
memory location is taken from the HL pair (data in HL pair).

START WITH GNU Simulator 8085:-

TASK: Write a program to add two numbers stored at A anc B and store the result at A.
Example:

8
Computer Organization and Architecture […Type your Enrolment Number here…]

Input
A=12h , B=18h
Output
A=2Ah
Step1:open GNU Sim 8085 above window will open. Now click on close button highlighted in the above
screen shot.

Step2: start writing the code after start: nop in load me at 10 that is at load me at 11.

9
Computer Organization and Architecture […Type your Enrolment Number here…]

Step 3: click on reset and reset all the registers by clicking on reset all.

Step 4: click on the highlighted button to execute the code

10
Computer Organization and Architecture […Type your Enrolment Number here…]

Step 5: after you execute the code mention the name your program by writing the name in the name section as
mentioned in the screen shot in below picture and the drive where you want to save it. After that click on save.

Step 6: after this you will see the result of the instructions in the respective registers as seen in the below
picture.

11
Computer Organization and Architecture […Type your Enrolment Number here…]

Program:
Memory Address Machine Code Mnemonics Operands Command

Input Data:

Output Data:

CONCLUSION:

EVALUATION:

Program Design of Correctness of Total Signature of


Execution Logic Output Faculty with Date
2 4 4 10

12
Computer Organization and Architecture […Type your Enrolment Number here…]

Experiment 3

AIM: Write an assembly language code in GNUsim8085 to store numbers in reverse order in memory
location.

Program:
Memory Address Machine Code Mnemonics Operands Command

Input Data:

Output Data:

CONCLUSION:

EVALUATION:

Program Design of Correctness of Total Signature of


Execution Logic Output Faculty with Date
2 4 4 10

13
Computer Organization and Architecture […Type your Enrolment Number here…]

Experiment 4

AIM: Write an assembly language code in GNUsim8085 to implement arithmeticinstruction.

Opcode Operand Explanation Example


ADD R A=A+R ADD B
ADD M A = A + Mc ADD 2050
ADI 8-bit data A = A + 8-bit data ADD 50
ADC R A = A + R + prev. carry ADC B
ADC M A = A + Mc + prev. carry ADC 2050
A = A + 8-bit data + prev.
ACI 8-bit data ACI 50
carry
SUB R A=A–R SUB B
SUB M A = A – Mc SUB 2050
SUI 8-bit data A = A – 8-bit data SUI 50
SBB R A = A – R – prev. carry SBB B
SBB M A = A – Mc -prev. carry SBB 2050
SBI 8-bit data A = A – 8-bit data – prev. carry SBI 50
INR R R=R+1 INR B
INR M M = Mc + 1 INR 2050
INX r.p. r.p. = r.p. + 1 INX H
DCR R R=R–1 DCR B
DCR M M = Mc – 1 DCR 2050
DCX r.p. r.p. = r.p. – 1 DCX H
DAD r.p. HL = HL + r.p. DAD H

Task1: Add the contents of memory locations 4000H and 4001H and place the result in memory location
4002H.

Program:
Memory Address Machine Code Mnemonics Operands Command

Input Data:

14
Computer Organization and Architecture […Type your Enrolment Number here…]

Output Data:

Task2:Subtract the contents of memory location 4001H from the memory location 2000H and place
the result in memory location 4002H.

Program:
Memory Address Machine Code Mnemonics Operands Command

Input Data:

Output Data:

15
Computer Organization and Architecture […Type your Enrolment Number here…]

Task3:Add the 16-bit number in memory locations 4000H and 4001H to the 16-bit number in memory
locations 4002H and 4003H. The most significant eight bits of the two numbers to be added are in
memory locations 4001H and 4003H. Store the result in memory locations 4004H and 4005H with
the most significant byte in memory location 4005H

Program:
Memory Address Machine Code Mnemonics Operands Command

Input Data:

Output Data:

Task4:Add the contents of memory locations 40001H and 4001H and place the result in the memory
locations 4002Hand 4003H.

Program:
Memory Address Machine Code Mnemonics Operands Command

16
Computer Organization and Architecture […Type your Enrolment Number here…]

Input Data:

Output Data:

CONCLUSION:

EVALUATION:

Program Design of Correctness of Total Signature of


Execution Logic Output Faculty with Date
2 4 4 10

17
Computer Organization and Architecture […Type your Enrolment Number here…]

Experiment 5

AIM: Write an assembly language code in GNUsim8085 to find the factorial of a number.

Program:
Memory Address Machine Code Mnemonics Operands Command

18
Computer Organization and Architecture […Type your Enrolment Number here…]

Input Data:

Output Data:

CONCLUSION:

EVALUATION:

Program Design of Correctness of Total Signature of


Execution Logic Output Faculty with Date
2 4 4 10

19
Computer Organization and Architecture […Type your Enrolment Number here…]

Experiment 6

AIM: Write an assembly language code in GNUsim8085 to implement logicalinstructions.

OPCODE OPERAND DESTINATION EXAMPLE


ANA R A = A AND R ANA B
ANA M A = A AND Mc ANA 2050
ANI 8-bit data A = A AND 8-bit data ANI 50
ORA R A = A OR R ORA B
ORA M A = A OR Mc ORA 2050
ORI 8-bit data A = A OR 8-bit data ORI 50
XRA R A = A XOR R XRA B
XRA M A = A XOR Mc XRA 2050
XRI 8-bit data A = A XOR 8-bit data XRI 50
CMA none A = 1’s compliment of A CMA
CMP R Compares R with A and triggers the flag register CMP B
CMP M Compares Mc with A and triggers the flag register CMP 2050
CPI 8-bit data Compares 8-bit data with A and triggers the flag register CPI 50
RRC none Rotate accumulator right without carry RRC
RLC none Rotate accumulator left without carry RLC
RAR none Rotate accumulator right with carry RAR
RAL none Rotate accumulator left with carry RAR
CMC none Compliments the carry flag CMC
STC none Sets the carry flag STC

Task1:Find the 2's complement of the number stored at memory location 4200H and store the
complemented number at memory location 4300H.

Program:
Memory Address Machine Code Mnemonics Operands Command

Input Data:

20
Computer Organization and Architecture […Type your Enrolment Number here…]

Output Data:

Task2:Find the l's complement of the number stored at memory location 4400H and store the
complemented number at memory location 4300H.

Program:
Memory Address Machine Code Mnemonics Operands Command

Input Data:

Output Data:

Task3:Write a program to shift an eight bit data four bits right. Assume that data is in register C.

Program:
21
Computer Organization and Architecture […Type your Enrolment Number here…]

Memory Address Machine Code Mnemonics Operands Command

Input Data:

Output Data:

Task4:Program to shift a 16-bit data 1 bit left. Assume data is in the HL register pair.

Program:
Memory Address Machine Code Mnemonics Operands Command

22
Computer Organization and Architecture […Type your Enrolment Number here…]

Input Data:

Output Data:

CONCLUSION:

EVALUATION:

Program Design of Correctness of Total Signature of


Execution Logic Output Faculty with Date
2 4 4 10

Experiment 7

AIM: Design ALU using Logisim.

23
Computer Organization and Architecture […Type your Enrolment Number here…]

ALU Block Diagram

Task1: Design 4 bit ALU in Logisim

Circuit Diagram:

Design in Logisim:

24
Computer Organization and Architecture […Type your Enrolment Number here…]

CONCLUSION:

EVALUATION:

Program Design of Correctness of Total Signature of


Execution Logic Output Faculty with Date
2 4 4 10

25
Computer Organization and Architecture […Type your Enrolment Number here…]

Experiment 8
AIM: Implement i) Logic Gates ii) Half Adder and iii) Full Adder in Verilog HDL

i) Logic Gates

THEORY:

AND GATE:
The AND gate performs logical multiplication which is most commonly known as the AND junction.
The operation of AND gate is such that the output is high only when all its inputs are high and when
any one of the inputs is low the output is low.

Y=a&b

OR GATE:
The OR gate performs logical addition which is most commonly known as the OR junction. The
operation of OR gate is such that the output is high only when any one of its input is high and when
both the inputs are low the output is low.

Y=a|b

NOT GATE:
The Inverter performs a basic logic gate function called Inversion or Complementation. The purpose of
an inverter is to change one logic level to opposite level. When a high level is applied top an inverter,
the low level will appear at the output and vice versa.

Y = ~a

NAND GATE:
The term NAND is derived from the complement of AND. It implies the AND junction with an
inverted output. The operation of NAND gate is such that the output is low only when all its inputs are
high and when any one of the inputs is low the output is high.

Y = ~(a & b)

NOR GATE:
The term NOR is derived from the complement of OR. It implies the OR junction with an inverted
output. The operation of NOR gate is such that the output is high only when all its inputs are low and
when any one of the inputs is high the output is low.

Y = ~(a | b)

EX-OR GATE:
The output is high only when the inputs are at opposite level.

Y=a^b

EX-NOR GATE:
The output is high only when the inputs are at same level.

Y = ~(a ^ b)

26
Computer Organization and Architecture […Type your Enrolment Number here…]

Program:

27
Computer Organization and Architecture […Type your Enrolment Number here…]

ii) Half Adder

THEORY:

The half adder consists of two input variables designated as Augends and Addend bits. Output variables
produce the Sum and Carry. The ‘carry’ output is 1 only when both inputs are 1 and ,sum’ is 1 if any
one input is 1. The Boolean expression is given by,

sum = x ^ y carry = x & y

Circuit Diagram:

Truth Table:

28
Computer Organization and Architecture […Type your Enrolment Number here…]

Program:

iii) Full Adder

THEORY:

A Full adder is a combinational circuit that focuses the arithmetic sum of three bits. It consists of 3
inputs and 2 outputs. The third input is the carry from the previous Lower Significant Position. The two
outputs are designated as Sum (S) and Carry (C). The binary variable S gives the value of the LSB of
the Sum. The output S=1 only if odd number of 1’s are present in the input and the output C=1 if two or
three inputs are 1.

sum = x ^ y ^ z
carry= (x & y) | (y & z) | (x & z)

Circuit Diagram:

29
Computer Organization and Architecture […Type your Enrolment Number here…]

Truth Table:

Program:

CONCLUSION:

EVALUATION:

Program Design of Correctness of Total Signature of


Execution Logic Output Faculty with Date
2 4 4 10

30

You might also like