computer organization and architecture
TRANSCRIPT
Computer Organization Computer Organization and Architectureand Architecture
Introduction to computer Introduction to computer System and its sub modulesSystem and its sub modules
There are two basic types of electrical signals, namely, analog and digital. The analog signals are continuous in nature and digital signals are discrete in nature.
The electronic device that works with continuous signals is known as analog device and the electronic device that works with discrete signals is known as digital device.
We use ‘0’ to represent LOW and ‘1’ to represent HIGH.
Computer ArchitectureComputer ArchitectureComputer architecture refers to those
parameters of a computer system that are visible to a programmer or those parameters that have a direct impact on the logical execution of a program.
Examples of architectural attributes include the instruction set, the number of bits used to represent different data types, I/O mechanisms, and techniques for addressing memory.
Department of ECE, K L University
Computer OrganizationComputer OrganizationComputer organization refers to the
operational units and their interconnections that realize the architectural specifications.
Examples of organizational attributes include those hardware details transparent to the programmer, such as control signals, interfaces between the computer and peripherals, and the memory technology used.
Basic Computer Model and Basic Computer Model and different units of Computerdifferent units of ComputerCentral Processor Unit, Input Unit, Output Unit, Memory Unit
Number System & Number System & RepresentationRepresentationDecimal Number System (0-9)Octal Number System (0-7)Hexa-Decimal Number System
(0-F)Binary Number System (0, 1)
Representation of Real Number
Binary representation of 41.6875 is 101001.1011
Therefore any real number can be converted to binary number system
There are two schemes to represent real number :
1)Fixed-point representation
2) Floating-point representation
Fixed-point representation:
Binary representation of 41.6875 is 101001.1011
To store this number, we have to store two information,
-- the part before decimal point and
-- the part after decimal point.
This is known as fixed-point representation where the position of decimal point is fixed and number of bits before and after decimal point are also predefined.
Floating-point representation:
In this representation, numbers are represented by a mantissa comprising the significant digits and an exponent part of Radix R. The format is:
Numbers are often normalized, such that the decimal point is placed to the right of the first non zero digit.
For example, the decimal number,
To store this number in floating point representation, we store 5236 in mantissa part and 3 in exponent part.
Signed IntegerSigned IntegerRange of natural numbers is 0 to 2n-1By including –ve numbers -2n-1-1 to 2n-
1-1If we consider 8-bit number, then
range of natural number is from 0-255For signed integer range is from -127
to 127
Signed Magnitude FormIf MSB = 0 then it is +ve and if MSB = 1 then it is –ve
Representation of Signed Integer in 1’s Representation of Signed Integer in 1’s complement formcomplement form
010111001010001111111111By adding ‘1’ to the result, it is ‘0’
Representation of Signed Integer in 2’s complement form
0101110010100100100000000
Arithmetic & Logical UnitArithmetic & Logical UnitConsider an ALU which can perform four
arithmetic operations and four logical operations To distinguish between arithmetic and logical operation, we may use a signal line,
0 - in that signal, represents an arithmetic operation and
1 - in that signal, represents a logical operation.
MemoryMemory1. Concept of Memory.2. Cache Memory.3. Memory Management4. Virtual memory
The memory of computer is broadly categories into two categories:
•Internal Memory or Primary Memory
•External Memory or Secondary Memory
Primary MemoryPrimary MemoryRAM: Random Access Memories are volatile
in nature. As soon as the computer is switched off, the contents of memory are also lost.
Types: SRAM, DRAM
ROM: Read only memories are non volatile in nature. The storage is permanent, but it is read only memory. We can not store new information in ROM.
Types: PROM, EPROM, EEPROM, UVPROM
Main Memory OrganizationMain Memory Organization16X4 Means 16 Locations & 4 bits in each
Location
Read – Retrieve data from memory to CPU registers
Write – Store data to memory from CPU registers
To transfer data we require data bus
To specify or to identify a particular memory location we require address bus
The data transfer between main memory and the CPU takes place through two CPU registers.
MAR : Memory Address Register
MDR : Memory Data Register.
If the MAR is k-bit long, then the total addressable memory location will be 2k.
If the MDR is n-bit long, then the n bit of data is transferred in one memory cycle.
Binary Storage CellBinary Storage Cell
Depending on the technology used to construct a RAM, there are two types of RAM –
SRAM: Static Random Access Memory.
DRAM: Dynamic Random Access Memory
DRAM SRAMSRAM & DRAM both are volatile
DRAM packing density is more & Less expensive
DRAM requires supporting refresh circuitry
SRAM is faster than DRAM
Cache MemoryCache MemoryIt is the fact that CPU is a faster device and memory is a relatively slower device.
Memory access is the main bottleneck for the performance efficiency. If a faster memory device can be inserted between main memory and CPU, the efficiency can be increased.
The faster memory that is inserted between CPU and Main Memory is termed as Cache memory.
Memory ManagementMemory Management
In an Uni-programming system, main memory is divided into two parts : one part for the operating system and the other part for the program currently being executed.
In multiprogramming system, the user part of memory is subdivided to accommodate multiple processes.
The task of subdivision is carried out dynamically by the operating system and is known as memory management.
To utilize the idle time of CPU, some of the process must be off loaded from the memory and new process must be brought to this memory place. This is known swapping.
Partitioning1) Fixed size partitions2) Variable size partitions
PagingPaging
The memory is partitioned into equal fixed size chunks that are relatively small. This chunk of memory is known as frames or page frames.
Each process is also divided into small fixed chunks of same size. The chunks of a program is known as pages.
At a given point of time some of the frames in memory are in use and some are free. The list of free frame is maintained by the operating system.
Virtual MemoryVirtual MemoryThe virtual address space is used to develop a process. The special hardware unit , called Memory Management Unit (MMU) translates virtual address to physical address. When the desired data is in the main memory, the CPU can work with these data. If the data are not in the main memory, the MMU causes the operating system to bring into the memory from the disk.
Control UnitControl Unit
To generate the control signal in proper sequence, a wide variety of techniques exist. Most of these techniques, however, fall into one of the two categories,
Hardwired Control :
Microprogrammed Control :
To execute an instruction, the control unit of the CPU must generate the required control signal in the proper sequence.
Hardwired Control : In this hardwired control techniques, the control signals are generated by means of hardwired circuit. The main objective of control unit is to generate the control signal in proper sequence.
Eg: Programmable Logic ArrayEg: Programmable Logic Array
Microprogrammed Microprogrammed ControlControl
There is an alternative approach by which the control signals required inside the CPU can be generated . This alternative approach is known as microprogrammed control unit.
In microprogrammed control unit, the logic of the control unit is specified by a microprogram.
A microprogrammed control unit is a relatively simple logic circuit that is capable of (1) sequencing through microinstructions and (2) generating control signals to execute each microinstruction.
Control Word (CW) :Control Word (CW) :
Control word is defined as a word whose individual bits represent the various control signal.
The individual control words in this microprogram are referred to as microinstructions.
Instruction SetThe operation of a CPU is determine
by the instruction it executes, referred to as machine instructions or computer instructions. The collection of different instructions is referred as the instruction set of the CPU.
Each instruction must contain the information required by the CPU for execution.
It is difficult to deal with binary representation of machine instructions. Thus, it has become common practice to use a symbolic representation of machine instructions.
Opcodes are represented by abbreviations, called mnemonics, that indicate the operations
A simple instruction format
The instruction set of a CPU can be categorized as follows:
1. Data Processing:
2. Data Storage:
3. Data Movement:
4. Control:
Types of Operands
1. Addresses:
2. Numbers:
3. Characters:
4. Logical Data:
Types of OperationsTypes of OperationsData TransferArithmeticLogicalConversionInput Output [ I/O ]System ControlTransfer Control
A.A. Data TransferData TransferMove (Transfer) --------Transfer word or block from source to destination
Store ----------------------Transfer word from processor to memory
Load (fetch) -------------Transfer word from memory to processor
Exchange ----------------Swap contents of source and destination
Clear (reset)------------- Transfer word of 0s to destination
Set -------------------------Transfer word of 1s to destination
Push -----------------------Transfer word from source to top of stack
Pop -------------------------Transfer word from top of stack to destination
B. ArithmeticB. ArithmeticAdd --------------Compute sum of two operands
Subtract --------Compute difference of two operands
Multiply ---------Compute product of two operands
Divide -----------Compute quotient of two operands
Absolute --------Replace operand by its absolute value
Negate ----------Change sign of operand
Increment ------Add 1 to operand
Decrement -----Subtract 1 from operand
Logical:Logical:AND -----------------------Performs the logical operation AND bitwiseOR--------------------------Performs the logical operation OR bitwiseNOT -----------------------Performs the logical operation NOT bitwiseExclusive OR -------------Performs the specified logical operation Exclusive-OR bitwiseTest --------------------------Test specified condition; set flag(s) based on outcomeCompare -------------------Make logical or arithmetic comparison Set flag(s) based on outcomeSet Control Variables------Class of instructions to set controls for protection purposes, interrupt handling, timer control etc.Shift -----------------------Left (right) shift operand, introducing constant at endRotate --------------------Left (right) shift operation, with wraparound end
Input/output :Input/output :Input (Read)----- Transfer data from specified I/O port or device to destination (e.g., main memory or processor register)
Output (Write)----Transfer data from specified source to I/O port or device.
Start I/O------------ Transfer instructions to I/O processor to initiate I/O operation.
Test I/O --------------Transfer status information from I/O system to specified destination
System Control:System Control:
System control instructions are those which are used for system setting and it can be used only in privileged state.
Typically, these instructions are reserved for the use of operating systems.
Transfer of Control:Transfer of Control:The most common transfer-of-
control operations found in instruction set are:
Branch
Skip
Procedure call.
BRP X ----Branch to location X if result is positiveBRN X ---- Branch to location X if result is negativeBRZ X----- Branch to location X is result is zeroBRO X----- Branch to location X if overflow occurs
Jump (branch) Unconditional transfer, load PC with specific addressJump conditional Test specific condition; either load PC with specific address or do nothing, based on condition
Jump to subroutine Place current program control information in known location; jump to specific address
Return Replace contents of PC and other register from known location
Skip Increment PC to skip next instruction
Skip Conditional Test specified condition; either skip or do nothing based on condition
Halt Stop program execution
Instruction Format:
Design of ALU
Machine LanguageMachine LanguageA processor can understand and
execute machine instructions. Such instructions are simply binary numbers stored in the computer.
If a programmer wished to program directly in machine language, then it would be necessary to enter the program as binary data.
1. Load the contents of location 201 into the AC.
2. Add the contents of location 202 to the AC.
3. Add the contents of location 203 to the AC.
4. Store the contents of the AC in location 204.
N = I + J + K
Assembly LanguageAssembly Language
I1: Move R3, R7 /R3 ← (R7)
I2: Load R8, (R3) /R8 ← Memory (R3)
I3: Add R3, R3, 4 /R3 ← (R3) + 4
I4: Load R9, (R3) /R9 ← Memory (R3)
I5: BLE R8, R9, L3 /Branch if (R9) > (R8)
Assembly language is a programming language that is one step away from machine language.
Typically, each assembly language instruction is translated into one machine instruction by the assembler.
Assembly language is hardware dependent, with a different assembly language for each type of processor
Compiler: It is a program which translates a high level language program into a machine language program.
Interpreter: An interpreter is a program which translates statements of a program into machine code. It translates only one statement of the program at a time.
Linker: In high level languages, some built in header files or libraries are stored. These libraries are predefined and these contain basic functions which are essential for executing the program. These functions are linked to the libraries by a program called Linker.
Loader: Loader is a program that loads machine codes of a program into the system memory. In Computing, a loader is the part of an Operating System that is responsible for loading programs.