0% found this document useful (0 votes)
2 views

Computer Organization and Architecture

The document discusses various classes of computers, including personal computers, servers, supercomputers, and embedded systems, along with the emergence of personal mobile devices and cloud computing. It explains key concepts in computer organization and architecture, such as instruction set architecture (ISA), memory hierarchy, and performance optimization techniques. The document also covers MIPS architecture, assembly language, and instruction formats, emphasizing the importance of simplicity and efficiency in design.

Uploaded by

jexijeg969
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Computer Organization and Architecture

The document discusses various classes of computers, including personal computers, servers, supercomputers, and embedded systems, along with the emergence of personal mobile devices and cloud computing. It explains key concepts in computer organization and architecture, such as instruction set architecture (ISA), memory hierarchy, and performance optimization techniques. The document also covers MIPS architecture, assembly language, and instruction formats, emphasizing the importance of simplicity and efficiency in design.

Uploaded by

jexijeg969
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Computer Organization and

Architecture
By Ghaleb alotaibi

Chapter 1

Classes of Computers:
Personal Computers(PC) :
General purpose, variety of software

Subject to cost/performance tradeoff

Server computers:
Networks based

High capacity, performance, reliability

Range from small servers to building sized

Supercomputers:
High-end scientific and engineering calculations

Highest capability

Embedded Computers:
Hidden as components of systems

Stringent power-performance /cost constraints

Computer Organization and Architecture 1


The Post PC Era:
Personal Mobile Device (PMD):
Battery operated

Connected to the Internet

Hundreds of dollars

Smart phones, tablets, electronic glasses

Cloud Computing:
Warehouse Scale Computers (WSX)

Software as a service (SaaS)

Portion of software run on a PMD and a portion run in the Cloud

Amazon and Google

Understanding Performance:
Algorithm : Determines number of operations executed

Programming language, compiler, architecture: Determine number of machine


instructions executed per operation

Processor and memory system : Determine how fast instructions are executed

I/O system (including OS) : Determine how fast I/O operations are executed

Eight Great Ideas:

Computer Organization and Architecture 2


Design for Moore’s Law :
Integrated circuit resources double every 18-24 months

Computer architects must anticipate where the technology will be when the
design finishes rather than design for where it starts

Use abstraction to simplify design :


Both computer architects and programmers use this techniques to make
themselves more productive.

Abstraction is a major productivity techniques for hardware and software.

Lower-level details are hidden to offer a simpler model at higher levels.

Make the common case fast :


The common case is often simpler than the rare case and hence is often
easier to enhance.

This common sense advice implies that you know the common case is which
is only possible with careful experimentation and measurement

Performance via pipelining :


A particular pattern of parallelism is so prevalent in computer architecture

A way of speeding up execution of instructions

Key idea: overlap execution of multiple instructions

Performance via prediction :

Computer Organization and Architecture 3


In some cases it can be faster on average to guess and start working rather
than wait until you know for sure, assuming that the mechanism to recover
from a misprediction is not too expensive and your prediction is relatively
accurate.

Hierarchy of memories:
Programmers want memory to be fast, large and cheap

There are conflicting demands to memory speed, capacity, cost

Hierarchy of memories, with the fastest, smallest, and most expensive


memory per bit at the top of the hierarchy and the slowest, largest and
cheapest per bit at the bottom

Dependability via redundancy :


Computers not only need to be fast, they need to be dependable.

Since any physical device can fail, we make systems dependable by including
redundant components, These extra components can take over when a failure
occurs and to help detect failures.

Levels of program Code:


High-level language:
Level of abstraction closer to problem domain

Provides for productivity and portability. portability = ‫قابلية النقل‬

Assembly language:
textual representation of instruction

Computer Organization and Architecture 4


Hardware representation
Binary digits (bits)

encoded instructions and

data

Components of a computer:
‫في اصغر المستويات في الكمبيوتر يتكون الجهاز من ثالث مكونات رئيسية وهي‬

‫المعالج لكي يترجم و ينفذ البرامج‬

‫الذاكرة لتحفظ البيانات والبرامج‬

‫الآليات التي تنقل البيانات من المستخدم الى الكمبيوتر‬

Organization and Architecture:

Computer architecture refers to those attributes of a system visible to a


programmer or, put another way, those attributes that have a direct impact on the
logical execution of a program.

Computer organization refers to the operational units and their interconnections


that realize the architectural specifications.

Computer architecture= Instruction Set Architecture + Computer Organization

Instruction Set Architecture (ISA) = WHAT the computer does (Logical view)

Computer Organization = HOW the ISA is implemented (Physical view)

Computer Organization and Architecture 5


Structure and Function:

Structure: The way in which the components are interrelated. interrelated = ‫ترابط‬

Function: The operation of each individual component as part of the structure.

The Computer: Top-Level Structure:


Control unit: Controls the operation of the CPU and hence the computer

Arithmetic and logic unit (ALU): Performs the computer’s data processing
functions

Registers: Provides storage internal to the CPU

CPU interconnection: Some mechanism that provides for communication among


the control unit, ALU, and registers = ‫بكل بساطة النقطة هذي تربط بين كل الثالث نقاط‬
‫الي فوق‬

Measurements :

Byte = a unit of storage

Disk storage is measured in GB for small systems, TB for large systems.

Millisecond = 1 thousandth of a second

Nanosecond = 1 billionth of a second

Micron (micrometer) = 1 millionth of a meter

‫ احسن‬33 ‫ الى‬30 ‫هذي اهم المعلومات بخصوص القياسات بس لو تقراء من ساليد‬

Computer Organization and Architecture 6


Non-von Neumann Models:
Multicore architectures have multiple CPUs on a single chip.

Dual-core and quad-core chips are commonplace in desktop systems.

Multi-core systems provide the ability to multitask

Multithreaded applications spread mini-processes, threads, across one or


more processors for increased throughput.

Chapter 2

Instruction Set Architecture (ISA)


The ISA serves as the boundary between software and hardware.

The repertoire of instructions of a computer

The ISA defines the CPU, or a CPU family (e.g. x86)

Not only a collection of instructions,

Includes the CPU view of memory, registers number and roles, etc.

The ISA is the contract between s/w and h/w , ‫هي عبارة عن طبقة بين الهاردوير‬
‫والسوفت وير‬

ISA ≠ CPU architecture, CPU architecture is the implementation of ISA

ISA Categories
1. Operand Storage in the CPU

2. Number of explicit named operands

Computer Organization and Architecture 7


3. Operand location

4. Operations

5. Type and size of operands

MIPS (Microprocessor without Interlocked Pipelined Stages) is A Reduced


Instruction Set Computer (RISC) microprocessor

Design principles :
1. Simplicity favors regularity

Simplicity enables higher performance at lower cost

2. Smaller is faster

3. Make the common case fast

MIPS General-Purpose Registers :


MIPS has a 32 * 32-bit register file (Smaller is faster)

32-bit data called a “word”

Assembler can refer to registers by name or by number ($ notation)

$t0, $t1,…., $t9, for temporary values

$s0, $s1,…., $s7, for saved variables

Add and subtract, three operands Two sources and one destination

Register Zero:

Computer Organization and Architecture 8


we define register zero ($0 or $zero) to always have the value 0

Often used to move values or set constant values

$zero defined in hardware

MIPS General-Purpose Registers :


$zero Always 0 (forced by hardware)

$t0 – $t7 Temporary Values


$s0 – $s7 Saved registers (preserved across
$t8 – $t9 call)

More temporaries

Instruction Formats :
All instructions in MIPS are 32 wide

R-Type:

Rs is the first source register

Rt is the second source Register

Rd is the distination register

Sa is the shift amount

Func is the bit respresentation of the function eg. 011010

Immediate (l-type)

16-it Immediate constant is part in the instruction

Computer Organization and Architecture 9


‫)‪Jump (J-Type‬‬

‫‪Byte Ordering‬‬
‫‪ :‬عندنا نوعين ترتيب الترتيب الاول‬
‫‪Little Endian‬‬
‫وهو بكل بساطة الرجستر تقراء البياتات فيه من اليمين الى اليسار (اول بايت باليمين واخر‬
‫واحد باليسار)‬
‫ومن ناحية المومري تقراء البيانات فيه من اليسار الى اليمين (اول بايت باليسار واخر بايت‬
‫باليمين)‬

‫‪Big Endian‬‬
‫كل الرجستر والمومري تبداء من اليمين الى اليسار‬

‫ومبس هو بيق اندين‬

‫‪Computer Organization and Architecture‬‬ ‫‪10‬‬


Memory Operands:
Main memory used for composite data

Arrays, structures,, dynamic data

To apply arithmetic operations

Load values from memory into registers

Store result from register to memory

Memory is byte addressed

Each address identifies an 8-bits byte

Words are aligned in memory

Address must be a multiple of 4

MIPS: Main Types of Instructions:


Arithmetic logical/shift/comparison

Integer

Floating Point

Memory access instructions

Load & Store

Control flow

Jump

Conditional Branch

Call & Return

Recap:

Computer Organization and Architecture 11


Registers replace C variables

One instruction (simple operation) per line

Simpler is better

Smaller is faster

MIPS is a Big-Endian Byte Ordering

Chapter 3:

MIPS General-Purpose Registers:


All registers are 32-bit wide in the MIPS 32-bit architecture

Software defines names for registers to standardize their use

Assembler can refer to registers by name or by number ($ notation)

What is Assembly Language?

Computer Organization and Architecture 12


Low-level programming language for a computer

Assembly language is specific to a given processor

Assembler: converts assembly program into machine code

Assembly language uses:

Labels: to represent the names of variables or memory addresses

Macros: to facilitate the inline expansion of text into other code

Assembly Language Statements

Three types of statements in assembly language


Typically, one statement should appear on a line

1. Executable Instructions

Generate machine code for the processor to execute at runtime

Instructions tell the processor what to do

2. Pseudo-Instructions and Macros

Translated by the assembler into real instructions

Simplify the programmer task

3. Assembler Directives

Used to define segments, allocate memory variables, etc.

Assembly Language Instructions :

Mnemonic: Identifies the operation (e.g. add, sub, etc.)

Computer Organization and Architecture 13


Operands: Operands can be registers, memory variables, or constants, Most
instructions have three operands

Comments:

Begins with a hash symbol # and terminates at end of line

.DATA, .TEXT, & .GLOBL Directives:


.DATA directive

Defines the data segment of a program containing data (program's


variables)

Assembler will allocate and initialize the storage of variables

.TEXT directive

Defines the code segment of a program containing instructions

.GLOBL directive

Global symbols can be referenced from other files and main function

Data Definition Statement:


‫اذا جينا نعرف متغير مثل ماقلنا فوق انه نحتاج اننا نعرفه داخل‬
.data
‫ وطريقة التعريف عبارة عن‬:

‫نوع المتغير قيمة المتغير‬. :‫اسم المتغير‬

VarName: .DataType value

Computer Organization and Architecture 14


Data Directives
‫الأسم‬ ‫الحجم‬
.BYTE 8-bit (byte)

.HALF 16-bit (2 bytes)


.WORD 32-bit (4 bytes)

.FLOAT Stores the listed values as single-


precision floating point

.DOUBLE Stores the listed values as double-


precision floating point

.ASCII
Allocates a sequence of bytes for an
ASCII (string)

Same as .ASCII directive, but adds a


.ASCIIZ NULL char at end of string \0
.SPACE ‫يحدد مساحة فاضية بالعديد الي تعطيه‬

Memory Alignment:
Memory is viewed as an addressable array of bytes

Memory Alignment:

Computer Organization and Architecture 15


‫من ناحية المومري خلنا نقول انها زي المسطرة ومقسمينها بالطول بحيث انه كل‬
‫شيء نبي نحفظه في هذي المسطرة لابد يكون فوق بعض واذا عندك مادة هياكل‬
‫بيانات اكيد درست موضوع الستاك وفعال المومري عبارة عن ستاك‪ ,‬ويزيد حجم‬
‫المومري كل مرة ب ‪ 4‬بايت‬

‫مثل مانشوف بالصورة انه كل مربع بالستاك له عنوان ويبدا ب ‪ 0‬وثم الي فوقه زاد‬
‫‪..‬عنه ب ‪ 4‬بايتس والي فوق زاد ب اربع وصار ‪ 8‬والخ‬

‫‪Word address should be a multiple of 4‬‬

‫‪Double-word address should be a multiple of 8‬‬

‫‪Syscall Services:‬‬
‫مهم ذا الجدول مرا‬

‫‪Computer Organization and Architecture‬‬ ‫‪16‬‬


Instruction Categories:
Integer Arithmetic

Arithmetic, logic, and shift instructions

Data Transfer

Load and store instructions that access memory

Data movement and conversions

Jump and Branch

Flow-control instructions that alter the sequential sequence

Floating Point Arithmetic

Instructions that operate on floating-point registers

Miscellaneous

Instructions that transfer control to/from exception handlers

Computer Organization and Architecture 17


‫‪Memory management instructions‬‬

‫‪R-Type Instruction Format:‬‬


‫كذا معلومة بسيطة هنا والي هي مقسمة الى قسمين والاول عبارة عن كيف اننا نحول‬
‫التعليمات الى باينري بكل بساطة التعليمة تتقسم الى عدة اقسام والي هي الـ اوب كود و‬
‫الـ ار اس و الـ ار تي والـ ار دي والـ اس اي و الفنك او الفنكشن‬

‫طيب الان عرفنا اقسامها ف خلونا الان نجرب على هذي التعليمة ونبي بس نحدد وشهو ال‬
‫اوب كود و الـ ار اس والـ ار تي والـ ال ار دي‬
‫‪add $t1, $t2, $t3‬‬
‫الاوب عبارة عن ال ادد‬

‫ال ار اس عبارة عن ال تي ‪2‬‬


‫وال ار تي عبارة عن ال تي ‪3‬‬
‫وال ار دي عبارة عن ال تي ‪1‬‬

‫ويوم نجي نحول الى باينري نكتب بالبداية الاوب كود وثم مسافة و الار اس وثم مسافة وثم‬
‫الار تي ومسافة وثم الار دي ومسافة وثم الشفت ومسافة وثم الفنك‬

‫وزي مانشوف بالصورة الي فوق انه كل جزء فوقه رقم وهذا عبارة عن طول الجزء‬

‫حلوين الان عرفنا اهم الاشياء الان نجي ونستعمل الجدول الي معطينا اياه الدكتور بالبالكبورد‬
‫ونشوف وشهو قيمة الباينري حقت ال اوب كود حق الادد‬

‫مثل مانشوف بالي مأشر بالاحمر انه الاد عبارة عن ستة اصفار ف نبداء التحويل حقنا ب ‪ 6‬اصفار‬

‫‪Computer Organization and Architecture‬‬ ‫‪18‬‬


‫‪000000‬‬

‫وثم نجي عند الار اس و الارتي والار دي‬


‫وذي نجيبها من جدول الرجسترز‬

‫‪Computer Organization and Architecture‬‬ ‫‪19‬‬


Computer Organization and Architecture 20
‫واحنا استعملنا بالار اس الرجستر تي ‪ 2‬وبالجدول يقولنا قيمته عبارة عن ‪ 10‬ف نحول العشرة‬
‫الى باينري‬

‫‪1010‬‬

‫ولكن طول رقم العشرة عبارة عن ‪ 4‬ارقام وبالصورة الي فوق حقة الا ار اس تقول ‪ 5‬ف نزيد ‪0‬‬
‫باليسار على شان ماناثر على قيمته‬

‫‪01010‬‬

‫والان نخطها مع الادد‬

‫‪000000 01010‬‬

‫ونكمل على الار تي الي هو ‪ 11‬وبالباينري ‪1011‬‬

‫‪000000 01010 01011‬‬

‫ونكمل على الار دي لين نوصل للشفت او ال اس اي‬

‫‪000000 01010 01011 01001‬‬

‫الي فوق قيمة الباينري من الاوب كود الى الار دي ونجي عند الشفت بالجدول والي هو مأشر‬
‫بالاخضر وهو عبارة عن اصفار ف نحطها بشكل مباشر‬

‫‪000000 01010 01011 01001 00000‬‬

‫ونفس الدعوة الفنك المأشرة بالبنفسجي‬

‫‪000000 01010 01011 01001 00000 100000‬‬

‫ومثل مانالحظ انه طول البتات ذي ‪ 32‬مثل ماقرينا فوق انه مبس التعليمات حقتها عبارة عن‬
‫‪ 32‬بت‬

‫‪Computer Organization and Architecture‬‬ ‫‪21‬‬


‫ من يوم‬,‫حلوين الان خلصنا شرح التحويل والان بعطيك معلومة على الطاير ولكن مرا مهمه‬
‫ماتشوف حرف ال يو موجود بتعليمه مثل‬
addu‫ و‬subu
‫هذي عبارة عن انه يتم تجاهل الفيضان‬
(overflow)

‫والي مافي تعليمتها حرف يو ذي ماتتجاهل الفيضان‬

Logic Bitwise Operations:


‫مراجعة بسيطة للبوابات المنطقية‬

AND instruction is used to clear bits: x and 0 - > 0

OR instruction is used to set bits: x or 1 - > 1

XOR instruction is used to toggle bits: x xor 1 - > not x

NOT instruction is not needed, why?

not $t1, $t2 is equivalent to: nor $t1, $t2, $t2

Shift Operations:
Shifting is to move the 32 bits of a number left or right

sll means shift left logical (insert zero from the right)

srl means shift right logical (insert zero from the left)

sra means shift right arithmetic (insert sign-bit)

Computer Organization and Architecture 22

You might also like