You are on page 1of 5

EXP NO.

3
Dania Alamen 1/18/2022 Instructor name: Dr. Eljhani

Design of 8-bit Arithmetic Logic Unit (ALU)

Pre-Lab Questions:
1. State the basic units of the computer. Name the subunits that make up the CPU, and give
the function of each of the units

The computer is divided into the following 5 parts:


Input device; output device; memory; CPU; bus.
The basic structure of the central processing unit:
- The arithmetic logic unit is used to perform logic, shift, and arithmetic
operations on data.
- Control unit is used to control the arithmetic logic unit, memory and
input/output unit, control is achieved by signaling from the control unit to
other subsystems.
- Registers are high-speed memories used to store temporary data, divided
into data registers, instruction registers (IR), and program counters (PR).

2. Give the description of computer architecture?


 Computer systems include a CPU that reads and executes programs, memory
that stores programs and data, and input and output subsystems that make it
easier to communication between the CPU and external devices such as
monitors and printers.
 The part of the computer that executes the program is called the CPU.
 Computer performance depends on the CPU, but also on the performance of
other subsystems.

3. What are arithmetic operations?


Commonly used operations are addition¿, subtraction¿, multiplication(×∨∙), division
(÷∨ ∕ ), and sometimes more complex operations such as squares and square roots,
which are also included in the category of arithmetic operations.
4. What are bitwise logical operations.
o Take not
Inverse is a unary operator that performs a logical inverse operation on each bit of a
binary number.
o Bitwise OR (OR)
Bitwise OR processing two binary numbers of the same length, as long as one of the
two corresponding binary bits is 1, the result value of that bit is 1.
o Bitwise exclusive or (XOR)
The bitwise XOR operation performs a logical XOR operation on each bit of an equal-
length binary pattern or binary number.
o Bitwise AND (AND)
The bitwise AND processes two binary numbers of the same length, if both
corresponding binary bits are both 1, and the resulting value of that bit is 1, otherwise
it is 0.

5. What are bit shift operations?

 ≫ Arithmetic (or signed) right-shift operator.


 ⋙ Logical (or unsigned) right-shift operator.
 ≪ Left shift operator, that satisfies both logical shift and arithmetic shift.

6. Design the 4-bit ALU

Table 1: Functions of ALU

Table 1: Functions of ALU


M = 0 Logic
S1 S0 C0 FUNCTION OPERATION (bit wise)
0 0 X Ai B i AND
0 1 X Ai + Bi OR
1 0 X Ai ⨁ B i XOR
1 1 X ( Ai ⨁ B i ) ' XNOR
M = 1 Arithmetic
S1 S0 C0 FUNCTION OPERATION
0 0 0 A Transfer A
0 0 1 A+1 Increment A by 1
0 1 0 A+ B Add A and B
0 1 1 A+ B+1 Increment the sum of A and B by 1
1 0 0 A+ B ' A plus one's complement of B
1 0 1 A−B Subtract B from A (i.e. B' + A +1¿

2
1 1 0 A' + B B plus one's complement of A
1 1 1 B− A B minus A (or A' + B+1)
Through the observation of the ALU function table, and through simple and direct
thinking, it can be known that the ALU can be composed of three sub-modules: AU, LU
and MUX.
The schematic diagram of this scheme is shown below.

Figure 1: 4 bit ALU diagram

7. Implement basic arithmetic operations using ALU

3
Figure 2: Arithmetic Operations

8. Implement bitwise logical operations using ALU

Figure 3: Logical Operations

9. Implement bit shift operations using ALU

4
Figure 4: Shift Operations

You might also like