Chapter 2 Basic Computer Organization and Design ملخص by Eng Emad
Chapter 2 Basic Computer Organization and Design ملخص by Eng Emad
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
Chapter 2 content
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
5-1 Instruction Codes
سجالت مختلفة ▪
تعليمات مختلفة ▪
.إلخ ▪
العديد من السجالت ▪
.القدرة على توجيه عدة تعليمات متتالية لتسريع التنفيذ وما إلى ذلك ▪
However, to understand how processors work, we will start with a simplified processor model.
This is similar to what real processors were like ~25 years ago.
. سنبدأ بنموذج معالج مبسط، لفهم كيفية عمل المعالجات، علي الرغم من ذلك
. عا ًما تقريبًا25 هذا مشابه لما كانت عليه المعالجات الحقيقية منذ
M. Morris Mano introduces a simple processor model he calls the Basic Computer
قدم لنا العالم موريس مانو نموذج معالج بسيط و سماه الكمبيوتر األساسي
. بمعالج الكمبيوترRTL سوف نستخدم هذاالنموذج المبسط لفهم تركيب المعالج وعالقة نموذج
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
By Eng. Emad Mahdy
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
The Instruction Format
(Machine) Instruction: group of bits that tell the computer to perform a specific operation (a sequence of micro-operation)
▪ The instructions of a program, along with any needed data are stored in memory.
▪ The CPU reads the next instruction from memory and place it in an Instruction Register (IR)
▪ Control circuitry in control unit then translates the instruction into the sequence of microoperations necessary to implement it.
In the Basic Computer, bit 15 of the instruction specifies the addressing mode:
0: direct addressing
1: indirect addressing
Since the memory words, and hence the instructions, are 16-bits long, that leaves 3 bits for the instruction’s opcode.
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
Addressing Modes
Addressing
Mode
Direct Indirect
address address
Effective Address (EA) The address, that can be directly used without modification to access an operand for a computation-type instruction, or as the target address
for a branch-type instruction.
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
5-2 Computer Registers
Register Description
Program Counter (PC) ▪ Program Counter (PC) that holds the memory address of the next instruction to get.
▪ Since the memory in the Basic Computer only has 4096 locations, the PC only needs 12 bits.
Address Register (AR) ▪ In a direct or indirect addressing, the processor needs to keep track of what locations in memory it is addressing:
▪ The Address Register (AR) is used for this.
▪ The AR is a 12-bit register in the Basic Computer
Data Register (DR) ▪ When an operand is found, using either direct or indirect addressing, it is placed in the Data Register (DR).
▪ The processor then uses this value as data for its operation.
Accumulator (AC) The Basic Computer has a single general-purpose register – the Accumulator (AC)
Temporary Register (TR) ▪ Often a processor will need a scratch register to store intermediate results or other temporary data.
▪ in the Basic Computer this is the Temporary Register (TR)
▪ The Basic Computer uses a very simple model of input/output (I/O) operations.
I/O registers (INPR- OUTR) ▪ Input devices are considered to send 8 bits of character data to the processor.
▪ The processor can send 8 bits of character data to output devices.
▪ The Input Register (INPR) holds an 8-bit character gotten from an input device.
▪ The Output Register (OUTR) holds an 8-bit character to be send to an output device.
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
Common Bus System
The registers in the Basic Computer are connected using a bus and this gives savings in circuitry over complete connections between registers.
. باستخدام ناقل موحد وهذا يوفر في الدوائر و التوصيالت بين السجالتbasic computer يتم توصيل السجالت في ال
▪ Three control lines, 𝐒𝟐 , 𝐒𝟏 , and 𝐒𝟎 control which register the bus selects as its input.
▪ Either one of the registers will have its load signal activated, or the memory will have its read signal activated will determine where the data from the bus gets loaded.
▪ The 12-bit registers, AR and PC, have 0’s loaded onto the bus in the high order 4-bit positions.
▪ When the 8-bit register OUTR is loaded from the bus, the data comes from the low order 8 bits on the bus.
• LD (load)
• INR (increment)
• CLR (clear)
▪ the result of an addition is transferred to AC and the end carry-out of the addition is transferred to flip-flop E (extended AC bit).
▪ The input data and output data of the memory are connected to the common bus, but the memory address is connected to AR . Therefore, AR must
always be used to specify a memory address
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
5-3 Computer instructions
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
5-4 Timing and Control
• Control unit (CU) of a processor translates from machine instructions to the control signals for the microoperations that implement them.
Note: We will consider a hardwired implementation of the control unit for the Basic Computer
Timing Signals
▪ The outputs of the counter are decoded into 16 timing signals T0 through T15•
▪ The sequence counter SC can be incremented or cleared synchronously
▪ Most of the time, the counter is incremented to provide the sequence of timing signals out of the 4 x 16 decoder.
▪ Once in a while, the counter is cleared to 0, causing the next active timing signal to be T0.
▪ As an example
o consider the case where SC is incremented to provide timing signals T0, T1 T2, T3, and T4 in sequence.
o At time T4, SC is cleared to 0 if decoder output D3 is active.
o This is expressed symbolically by the statement
𝑫𝟑𝑻𝟒: 𝑺𝑪 ← 𝟎
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
5-5 Instruction Cycle
𝐃𝟕 𝐈 𝐓𝟑
̅̅̅̅
𝑫𝟕 ̅𝑰 𝑻𝟑 : 𝟎 𝟎 𝟏 𝐍𝐨𝐭𝐡𝐢𝐧𝐠
̅̅̅̅
𝑫𝟕 𝑰 𝑻𝟑 : 𝟎 𝟏 𝟏 𝐀𝐑 ← 𝐌[𝐀𝐑]
𝑫𝟕 𝑰̅ 𝑻𝟑 : 𝟏 𝟎 𝟏 Execute a register-reference instruction.
𝑫𝟕 𝑰 𝑻𝟑 : 𝟏 𝟏 𝟏 Execute an input-output instruction.
• Initially, the program counter PC is loaded with the address of the first instruction in the program.
• The sequence counter SC is cleared to 0, providing a decoded timing signal To
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
Register Reference Instructions
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
5-6 Memory Reference instructions
AND D0 AC AC M[AR]
ADD D1 AC AC + M[AR], E Cout
LDA D2 AC M[AR]
STA D3 M[AR] AC
BUN D4 PC AR
BSA D5 M[AR] PC, PC AR + 1
ISZ D6 M[AR] M[AR] + 1, if M[AR] + 1 = 0 then PC PC+1
BUN Branch D4 PC AR
Unconditionally
BSA Branch and Save D5 M[AR] PC, PC AR + 1
Return Address
ISZ Increment and D6 M[AR] M[AR] + 1,
Skip-if-Zero if M[AR] + 1 = 0
then PC PC+1
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
By Eng. Emad Mahdy
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
Flowchart For Memory Reference Instructions
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
5-7 Input-Output and Interrupt
𝐩 = 𝐃 𝟕𝐈𝐓𝟑
𝐁𝐢 = 𝐈𝐑(𝐢), 𝐢 = 𝟔, … , 𝟏𝟏
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
By Eng. Emad Mahdy
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
5-8 Complete Computer Description
(Flowchart of operations):
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
Complete Computer Description (Microoperations)
Control function
Memory-Reference
Register-Reference
Input-Output Reference
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
5-9 Design of Basic Computer
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
Control of registers and memory
❖ Address Register; AR
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com
5-10 Design of Accumulator Logic
Control of ac register
❖ Gate structures for controlling the LD, INR, and CLR of AC
https://www.youtube.com/@eng.emadmahdy
https://si-manual.com