You are on page 1of 38

CSEN402: Computer Organization

Microoperations III & Basic Computer I

Nada Sharaf

Spring Semester 2020

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 1 / 38
Arithmetic Circuit

One composite arithmetic circuit


The basic component is the parallel adder
Only by controlling inputs, different operations could be carried out

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 2 / 38
Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 3 / 38
Arithmetic Circuit

Two 4-bit inputs: A and B


Cin as the carry to the full-adder
in the lease significant location
One 4-bit output: D
A bits go directly to the adder
Multiplexers have as data
inputs:
I B bits
I Complement of the B bits
I Logic 0
I Logic 1

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 4 / 38
Arithmetic Circuit II

Simulate A + B: Sli.do Code


8361 S1 = 0, S0 = 0, Cin = 0
Simulate A - B:
I B’
I Cin = 1
S1 = 0, S0 = 1, Cin = 1

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 5 / 38
Arithmetic Circuit III

Output = A + Y + Cin
S1 S0 Cin Y D Micro operation
0 0 0 B A+B Addition
0 0 1 B A+B+1 Addition with carry
0 1 0 B’ A+B’ Subtract with Borrow
0 1 1 B’ A+B’+1 Subtraction
1 0 0 0 A Transfer A
1 0 1 0 A+1 Increment A
1 1 0 1(1111) A-1 Decrement A
1 1 1 1(1111) A(A-1+1) Transfer A

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 6 / 38
Logic Microoperations

Binary operations
For bits stored inside the registers
Bit-Wise: consider bits separately
Each bit is treated as a binary variable
Examples: ∧, ∨, ⊕
+ vs ∨
I ∨ represent the oring microoperation
I + is used as the arithmetic addition when used as a microoperation
I + is used as the or boolean function when used as part of the control
function

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 7 / 38
Examples

P : R1 ← R1 ⊕ R2
1010 Contents of R1
1100 Contents of R2
--------
0110 Contents of R1 after P=1
P + Q : R1 ← R2 + R3, R4 ← R5 ∨ R6

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 8 / 38
Possible Logic Microoperations

If we have two inputs, how many logic functions can we have


16
Why?
x y F0 F1 F2 F3 F4 ... F13 F14 F15
0 0 0 0 0 0 0 ... 1 1 1
0 1 0 0 0 0 1 ... 1 1 1
1 0 0 0 1 1 0 ... 0 1 1
1 1 0 1 0 1 0 ... 1 0 1

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 9 / 38
16 Logic Microoperations

Boolean Function Microoperation Name Boolean Function Microoperation Name

F0=0 F ←0 Clear F8=(x+y)’ F ←A∨B


F1=xy F ←A∧B AND F9=(x⊕y)’ F ←A⊕B

F2=xy’ F ←A∧B F10=y’ F ←B Complement B


F3=x F ←A Transfer A F11=x+y’ F ←A∨B
F4=x’y F ←A∧B F12=x’ F ←A Complement A
F5=y F ←B Trasfer B F13=x’+y F ← A0 ∨ B
F6=x⊕y F ←A⊕B XOR F14=(xy)’ F ←A∧B NAND
F7=x+y F ←A∨B OR F15=1 F ← all10 s Set all to 1’s

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 10 / 38
Implementation of Logic Microoperations

Logic function should be performed for every two pairs of bits


Mots computers usually implement only AND ∧, OR ∨, XOR ⊕,
Complement
Other operations could be derived from them

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 11 / 38
Hardware Implementation II

S1 S0 Output Operation
0 0 A∧B AND
0 1 A∨B OR
1 0 A⊕B XOR
1 1 A Complement

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 12 / 38
Applications

Manipulating part of a register


Manipulating individual bits
In the following examples we will try to manipulate parts of the bits
of register A

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 13 / 38
Selective Set

We want to set a group of bits in register A i.e. change then to 1


Use a B register with the same size
Whenever a bit in B has the value 1, the corresponding bit in A is set
The other bits of A are left unchanged
Example:
1010: A before
1100: B (logic operand)
------------
1110: A after
The operations is ∨
A←A∨B

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 14 / 38
Selective Complement

We want to complement a group of bits in register A


Use a B register with the same size
Whenever a bit in B has the value 1, the corresponding bit in A is
complemented
The other bits of A are left unchanged
Example:
1010: A before
1100: B (logic operand)
------------
0110: A after
The operations is ⊕
A←A⊕B

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 15 / 38
Selective Clear

We want to clear a group of bits in register A i.e. change to 0


Use a B register with the same size
Whenever a bit in B has the value 1, the corresponding bit in A is
cleared
The other bits of A are left unchanged
Example:
1010: A before
1100: B (logic operand)
------------
0010: A after
The operations is A ← A ∧ B 0

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 16 / 38
Mask Operation

We want to clear a group of bits in register A i.e. change to 0


Use a B register with the same size
Whenever a bit in B has the value 0, the corresponding bit in A is
cleared
The other bits of A are left unchanged
Example:
1010: A before
1100: B (logic operand)
------------
1000: A after
The operations is ∧
A←A∧B

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 17 / 38
Introducing a Pattern

If we need to insert a pattern into some bits of a register


Assume Register A having bits: 0110 1010
We want to have the pattern 1001 as the left-most 4 bits
How can we do it?
1 A mask operation (AND) to clear the desired bits
01101010 Original A
00001111 Mask
---------------
00001010 A after masking
2 A selective set (OR) operation to insert the pattern
00001010 A after masking
10010000 A Pattern
---------------
10011010 A after masking

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 18 / 38
Example

Given A: 11011001. What is the operand (B) and the microoperation that
converts A to
11000001 Use sli.do Code: 8361
I Selective Clear
I B: 00011000
I A ← A ∧ B0

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 19 / 38
References

Chapter 4

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 20 / 38
Basic Computer

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 21 / 38
Basic Computer

Processing systems and processors differ in their specifications.


This include
I Registers
I Operations
I Available buses and their connections
I etc
Current processors are complex
I Multiple arithmetic units
I Different types of arithmetic units
I Interleaving/Pipeling of operation execution

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 22 / 38
Basic Computer

Introduced by Morris Mano


Provides the perfect medium to
introduce
I the organization of computers
I How RTL models are linked to
the higher level computer
processor

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 23 / 38
Digital System Organization

A basic computer is defined by:


I Internal Registers
I Timing and control structure
I Set of Instructions/Operations allowed
The internal organization is defined by the sequence of
microoperations the processor is able to perform on the data inside
the registers
A general purpose computer can perform different types of tasks.
How do we control it? By using a program

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 24 / 38
Program

Set of instruction
Specify the operations
Specify the operans
Specify the sequence in which
processing should happen

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 25 / 38
Computer Instruction

A group of bits
Informs the system on what
action to be carried out
Data and instructions are saved
inside memory

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 26 / 38
Basic Computer Structure

Memory unit with 4096 words


(212 )
How many bits are needed to
specify an address
I 12
Each word is 16 bits
One processor register (AC:
Accumulator)
How many bits do we have for
one instruction
I 16

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 27 / 38
How does a program work?

CPU reads the instruction from memory


The read instruction is saved in a special place
I Instruction Register (IR)
Each computer has its own instructions set
What Next: The control unit interprets the binary code of the
instruction

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 28 / 38
Computer Operation vs. Microoperation

Control Unit receives the instruction from memory


Instruction should now get executed. But how?
A sequence of control signals are generated
These signals control different microoperations needed to carry out
the instruction
Thus the control issues a sequence of microoperations needed
This differs according to the hardware implementation of the required
instruction/operation.
Example Multiplication

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 29 / 38
Instruction Code

Format of the instruction


Has specific parts with specific meanings
1 Op Code
F Bits specifying the instruction that should be carried out
F The number of bits of the opcode reflects the number of available
instructions
F If we have 3 bits, what is the maximum number of instructions can we
have? 8
2 Address
F Registers/ addresses used for the operation for knowing the operands
or for storing back the results

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 30 / 38
Instruction Format in the Basic Computer

Bit 15 specifies the addressing mode


I 0: direct addressing
I 1: indirect addressing
Address is 12 bits
How many bits does the opcode take? 3 bits

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 31 / 38
Direct vs Indirect Addressing

I Direct address: the address of the operand


I Indirect address: the address of the address of the data to use
Second operand is in AC

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 32 / 38
Available Registers in the Basic Computer I

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 33 / 38
Available Registers in the Basic Computer II

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 34 / 38
Remarks on Registers

Program Counter (PC) holds the address of the next instruction to


be read
PC is always incremented by a fixed value (1) except in branching
cases

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 35 / 38
Common Bus System

Selection lines determine what


selected to be written on the bus
S2=1, S1=1, S0=1 means that
the memory output lines will be
written on the bus (if its read
control is activated)
DR ← AC AC ← DR

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 36 / 38
References

Chapter 5

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 37 / 38
Thank you :)

Nada Sharaf Lecture 3: Microoperations III & Basic Computer I Spring Semester 2020 38 / 38

You might also like