Professional Documents
Culture Documents
Practical-1 AIM: Implement Register Transfer Operation in Logisim Simulator
Practical-1 AIM: Implement Register Transfer Operation in Logisim Simulator
Practical-1
L. D. College of Engineering
Computer Engineering 200280107139
Practical-2
L. D. College of Engineering
Computer Engineering 200280107139
L. D. College of Engineering
Computer Engineering 200280107139
Practical-3
AIM: Implement Common Bus System in Logisim simulator.
A typical digital computer h a s many registers, and paths must b e
provided to transfer information from one register to another. The
number of wires will be excessive if separate lines are used
between each register and all other registers in the system. A more
efficient scheme for transferring information between registers in a
multiple-register configuration is a common bus system. A bus
structure consists of a set of common lines, one for each bit of a
register, through which binary information is transferred one at
a time. Control signals determine which register is selected by the
bus during each particular register transfer.
L. D. College of Engineering
Computer Engineering 200280107139
Practical-4
Instructions:
LDA 2050H
MOV B,A
LDA 2051H
CMA
INR A
ADD B
STA 2052H
HLT
L. D. College of Engineering
Computer Engineering 200280107139
L. D. College of Engineering
Computer Engineering 200280107139
Practical-5
Aim: Write Assembly language Program to implement
Multiplication Algorithm between two numbers - in GNU Simulator
(Using Circular Right and Circular Left Instruction)
Theory:
1. Set the Multiplicand and Multiplier binary bits as M and Q,
respectively.
2. Initially, we set the AC and Qn + 1 registers value to 0.
3. SC represents the number of Multiplier bits (Q), and it is a
sequence counter that is continuously decremented till equal to the
number of bits (n) or reached to 0.
4. A Qn represents the last bit of the Q, and the Qn+1 shows the
incremented bit of Qn by 1.
5. On each cycle of the booth algorithm, Qn and Qn + 1 bits will
be checked on the following parameters as follows:
0. When two bits Qn and Qn + 1 are 00 or 11, we simply
perform the arithmetic shift right operation (ashr) to the partial
product AC. And the bits of Qn and Qn + 1 is incremented by 1 bit.
i. If the bits of Qn and Qn + 1 is shows to 01, the multiplicand
bits (M) will be added to the AC (Accumulator register). After that,
we perform the right shift operation to the AC and QR bits by 1.
ii. If the bits of Qn and Qn + 1 is shows to 10, the multiplicand
bits (M) will be subtracted from the AC (Accumulator register).
After that, we perform the right shift operation to the AC and QR
bits by 1.
6. The operation continuously works till we reached n - 1 bit in
the booth algorithm.
7. Results of the Multiplication binary bits will be stored in the
AC and QR registers.
L. D. College of Engineering
Computer Engineering 200280107139
Instructions:
MVI C,08H
LXI H,2052H
UP: STC
CMC
LDA 2051H
RAR
STA 2051H
JNC ZRO
LDA 2050H
ADD M
STA 2052H
STC
CMC
ZRO: LDA 2050H
RAL
STA 2050H
DCR C
JNZ UP
HLT
L. D. College of Engineering
Computer Engineering 200280107139
L. D. College of Engineering
Computer Engineering 200280107139
Practical-6
L. D. College of Engineering
Computer Engineering 200280107139
• The two magnitudes are subtracted if the signs are different for
an add operation or identical for a subtract operation. The
magnitudes are subtracted by adding A to the 2's complemented B.
No overflow can occur if the numbers are subtracted so AVF is
cleared to 0.
• 1 in E indicates that A >= B and the number in A is the correct
result. If this numbs is zero, the sign A must be made positive to
avoid a negative zero.
• 0 in E indicates that A < B. For this case it is necessary to take
the 2's complement of the value in A. The operation can be done
with one microoperation A A' +1.
• However, we assume that the A register has circuits for
microoperations complement and increment, so the 2's complement
is obtained from these two microoperations.
• In other paths of the flowchart, the sign of the result is the same
as the sign of A. so no change in A is required. However, when A <
B, the sign of the result is the complement of the original sign of A.
It is then necessary to complement A, to obtain the correct sign.
• The final result is found in register A and its sign in As. The
value in AVF provides an overflow indication. The final value of E
is immaterial.
• Figure shows a block diagram of the hardware for implementing
the addition and subtraction operations.
• It consists of registers A and B and sign flip-flops As and Bs.
• Subtraction is done by adding A to the 2's complement of B.
• The output carry is transferred to flip-flop E , where it can be
checked to determine the relative magnitudes of two numbers.
• The add-overflow flip-flop AVF holds the overflow bit when A
and B are added.
• The A register provides other microoperations that may be
needed when we specify the sequence of steps in the algorithm.
L. D. College of Engineering
Computer Engineering 200280107139
Practical-7
Aim: Implement the flowchart of signed magnitude multiplication
in logisim Simulator
L. D. College of Engineering
Computer Engineering 200280107139
L. D. College of Engineering
Computer Engineering 200280107139
Practical-8
L. D. College of Engineering
Computer Engineering 200280107139
L. D. College of Engineering
Computer Engineering 200280107139
Practical-9
1. Implied Mode
Operands are specified implicitly in the definition of the
instruction.
For example, the instruction “complement accumulator (CMA)” is
an implied-mode instruction because the operand in the accumulator
register is implied in the definition of the instruction. In fact, all
L. D. College of Engineering
Computer Engineering 200280107139
2. Immediate Mode
Operand is specified in the instruction itself. In other words, an
immediate-mode instruction has an operand field rather than
an address field. The operand field contains the actual operand to be
used in conjunction with the operation specified in the instruction.
Immediate mode of instructions is useful for initializing register to
constant value. E.g. MOV R1, 05H instruction copies immediate
number 05H to R1 register.
3. Register Mode
Operands are in registers that reside within the CPU. The
particular register is selected from a register field in the instruction.
E.g. MOV AX, BX move value from BX to AX register
L. D. College of Engineering
Computer Engineering 200280107139
L. D. College of Engineering
Computer Engineering 200280107139
MVI A, 09H
; Immediate Mode of Addressing
MVI B, 10H
ADD B
; Register Mode of Addressing
STA 2050H
; Direct Mode of Addressing
MVI A, 99H
MVI D, 50H
MVI E, 00H
STAX D
; Indirect Mode of Addressing
LXI H, 3000H
MOV A, M
; Register Indirect Mode of Addressing
INX H
L. D. College of Engineering
Computer Engineering 200280107139
MOV B, M
; Register Indirect Mode of Addressing
ADD B
HLT
L. D. College of Engineering
Computer Engineering 200280107139
Practical-10
1. Sign Flag (S) - After any operation if the MSB (B(7)) of the
result is 1, it indicates the number is negative and the sign flag
becomes set, i.e. 1. If the MSB is 0, it indicates the number is
positive and the sign flag becomes reset i.e. 0. from 00H to 7F, sign
flag is 0 from 80H to FF, sign flag is 1 1- MSB is 1 (negative) 0 -
MSB is 0 (positive) Example: MVI A 30 (load 30H in register A)
MVI B 40 (load 40H in register B) SUB B (A = A - B) These set of
instructions will set the sign flag to 1 as 30 - 40 is a negative
number. MVI A 40 (load 40H in register A) MVI B 30 (load 30H in
register B) SUB B (A = A - B) These set of instructions will reset
the sign flag to 0 as 40 - 30 is a positive number.
SIGN Flag
MVI A, 80H
MVI B, 09H
ADD B
HLT
ZERO Flag
MVI A, 10H
L. D. College of Engineering
Computer Engineering 200280107139
MVI B, 10H
SUB B
HLT
PARITY Flag
MVI A, 80H
L. D. College of Engineering
Computer Engineering 200280107139
MVI B, 08H
ADD B
HLT
Carry Flag
MVI A, 80H
MVI B, 99H
ADD B
HLT
L. D. College of Engineering