Yash Coa 5-16
Yash Coa 5-16
Truth Table:-
A3 A2 A1 A0 F3 F2 F1 F0 P F3 F2 F1 F0 P
0 0 0 0 0 0 0 1 0 1 1 1 1 1
0 0 0 1 0 0 1 0 0 0 0 0 1 0
0 0 1 0 0 0 1 1 0 0 0 0 1 0
0 0 1 1 0 1 0 0 0 0 0 0 0 0
0 1 0 0 0 1 0 1 0 0 0 1 1 0
0 1 0 1 0 1 1 0 0 0 1 0 0 0
0 1 1 0 0 1 1 1 0 0 1 1 0 0
0 1 1 1 1 0 0 0 0 0 1 1 1 0
1 0 0 0 1 0 0 1 0 1 0 0 0 0
1 0 0 1 1 0 1 0 0 1 0 0 1 0
1 0 1 1 1 1 0 0 0 1 0 1 1 0
1 1 0 0 1 1 0 1 0 1 1 0 0 0
1 1 0 1 1 1 1 0 0 1 1 0 1 0
1 1 1 0 1 1 1 1 0 1 1 1 0 0
1 1 1 1 0 0 0 0 1 1 1 1 1 0
Circuit/Program Implementation
Experiment-6
Truth Table:-
Truth Table:-
S1 S0 Output Opration
0 0 A*B AND
0 1 A+B OR
1 0 AB XOR
1 1 A NOT
Circuit/Program Implementation
Experiment-8
Truth Table:-
Selector Output
S H0 H1 H2 H3
0 IR A0 A1 A2
1 A1 A2 A3 IL
Circuit/Program Implementation
Experiment-9
AIM:- Design 4 bit Arithmetic Logic Shift Unit.
Theory:-
4-Bit Arithmetic Logic Shift Unit (ALSU)
A 4-bit Arithmetic Logic Shift Unit (ALSU) is a digital circuit that performs arithmetic,
logic, and shift operations on 4-bit binary data. It is a key component of processors and
ALUs, enabling fundamental computations required for digital processing.
Components & Operations
1. Arithmetic Operations
o Addition
o Subtraction (using two’s complement)
2. Logic Operations
o AND
o OR
o XOR
o NOT
3. Shift Operations
o Logical Shift Left (LSL) – shifts bits left, inserting 0 at LSB.
o Logical Shift Right (LSR) – shifts bits right, inserting 0 at MSB.
o Arithmetic Shift Right (ASR) – shifts bits right while preserving the sign bit
(MSB).
Working Principle
• The ALSU takes two 4-bit inputs and a control signal to determine the operation.
• A multiplexer selects between arithmetic, logic, and shift functions based on an
operation code (opcode).
• The output is a 4-bit result along with status flags (e.g., carry, zero, overflow).
This unit is fundamental in microprocessors and digital systems, enabling efficient binary
computations.
Truth Table:-
Operation Select
Cin Operation Function
S3 S2 S1 S0
0 0 0 0 0 F=A Transfer A
0 0 0 0 1 F=A+1 Increment 1
0 0 0 1 0 F=A+B Addition
0 0 0 1 1 F=A+B+1 Add with Carry
0 0 1 0 0 F=A+B’ Subtract with Borrow
0 0 1 0 1 F=A+B’+1 Subtraction
0 0 1 1 0 F=A-1 Decrement A
0 0 1 1 1 F=A Transfer A
0 1 0 0 X F=A^B And
0 1 0 1 X F=AvB Or
0 1 1 0 X F=A XOR B XOR
0 1 1 1 X F=A’ Complement A
1 0 X X X F= shr A Shift right A into F
1 1 X X X F= shl A Shift left A into F
Circuit/Program Implementation
Experiment-10
AIM:- Develop Assembly language program to find out the 2’s complement of the
number.
LDA 2000H ; Load the number from memory (2000H) into Accumulator
AIM:- Develop Assembly language program to find out the subtraction of two
numbers using indirect mode.
.
LDA 2001H ; Load the subtrahend from memory location 2001H into the
Accumulator
INC ; Increment AC
LDA 2000H ; Load the minuend from memory location 2000H into the
Accumulator
AIM:- Develop Assembly language program for the following pseudo code
SUM=0
SUM=SUM+A+B
DIF=DIF-C
SUM=SUM+DIF
HLT ;Halt
*
DEC 23 ;Last operand
HLT
A, -
B, -
RES, -
END
Experiment-15
END
Experiment-16
LDA Y ; Load the value from memory location Y into the accumulator
CIR ; Circular shift right (moves the least significant bit to E and shifts
all bits to the right)
ONE, LDA X ; Load the value from memory location X into the accumulator
ADD P ; Add the value from memory location P (partial product) to the
Accumulator
ZRO, LDA X ; Load the value from memory location X into the accumulator
CIL ; Circular shift left (moves E to the most significant bit and shifts
All bits to the left)
ISZ CTR ; Increment and skip if zero (increments the counter at memory
location CTR and skips the next instruction if it becomes zero)
BUN LOP ; Branch back to label LOP if the counter is not zero