register organization, stack
TRANSCRIPT
CLASS PRESENTATION
UNIT-1
Mohammad Asif IqbalAssistant Professor, Deptt of ECE,JETGI, Barabanki
CLASS TEST
Q1:-HOW CAN YOU DROP A RAW EGG ONTO A CONCRETE SURFACE WITHOUT CRACKING IT.
WHAT WE WILL STUDY IN THIS CLASS….
1 General Register Organization
2 Stack Organization
General Register Organization
REGISTERSSmall units of memory to hold data/instructions temporally during execution. There are 2 kind of register in the CPU.
1. Special purpose register
2. General purpose register
SPECIAL PURPOSE REGISTER
These are used for the specific purpose by the control hardwarePROGRAM CONTROL (PC): used to remember the location in memory of the instructions currently being executed.INSTRUCTION REGISTER (IR): Used to remember that instruction.PROCESSOR STATUS REGISTER: used to remember status information about current state of processor, e.g. whether an arithmetic overflow has occurred.
GENERAL PURPOSE REGISTER
Available for use by the programmerUseful for remembering the useful dataWhy is it a good idea to do this?
WHY USE GENERAL PURPOSE REGISTERS?
There is a large speed disparity between the processor and the memory where instructions and data are storedConsider a 1 GHz processor
oThis frequency corresponds to a 1 nanosecond time scale.oMilli (10-3), micro (10-6) nano (10-9)oG (giga) 230 for memory ; 109 for frequency, disk size.
Memory : 100 nanosecond time scaleAside: More on nanosecond
ospeed of light: 300,000km/sec or 0.3 m/nsec
GENERAL PURPOSE REGISTER
Available for use by the programmerUseful for remembering the useful dataA typical processor today has 32 GPRs, say R0, R1,….R31The operands to an instruction could come either from registers or from main memory.
StackOrganization
PART TWO
STACK ORGANIZATIONStack or LIFO(Last-In, First-Out)
o A storage device that stores information • The item stored last is the first item retrieved = a stack of tray
o Stack Pointer (SP)• The register that holds the address for the stack• SP always points at the top item in the stack
o Two Operations of a stack : Insertion and Deletion of Items• PUSH : Push-Down = Insertion• POP : Pop-Up = Deletion
TYPES OF STACK
1) Register Stack (Stack Depth: LIMITED) oA finite number of memory words or
register(stand alone)2) Memory Stack (Stack Depth: FLEXIBLE) oA portion of a large memory
REGISTER STACK
0)1()0(
][1
EMTYFULLthenSPIf
DRSPMSPSP Increment SP
: Write to the stack: Check if stack is full: Mark not empty
Push Operation
The first item is stored at address 1, and the last item is stored at address 0
Pop Operation
0)1()0(
1][
FULLEMTYthenSPIf
SPSPSPMDR : Read item from the of stack
: Decrement Stack Pointer: Check if stack is empty: Mark not full
EXAMPLE OF PUSH& POP OPERATION.
D
C
B
A
A
00
10
DR
FULL EMTY PUSH A
01
PUSH B
10PUSH C
11
1 0
FULL EMTY
PUSH D
POP D
D
DR
MEMORY STACK Push Operation
The first item is stored at address 4000
Pop Operation
DRSPMSPSP
][
1
1][
SPSP
SPMDR
Program(instruc tions)
Data(operands)
Stac k
SP
PC
AR
DR
1000
2000
4001
3000
4000399939983997
AddressMemory unit
Start Here
RPN (Reverse Polish Notation)
The common mathematical method of writing arithmetic expressions imposes difficulties when evaluated by a computer
A stack organization is very effective for evaluating arithmetic expressions A * B + C * D AB * CD * +
( 3 * 4 ) + ( 5 * 6 ) 34 * 56 * +
3 12
6
5
42
30
12
5
1212
4
3
43 +*65*
HERE IS YOUR ANSWER….ANY WAY YOU WANT, BECAUSE A CONCRETE FLOOR IS VARY HARD TO CRACK.
THANK YOU!