Search Project from this blog

Wednesday, 19 October 2016

Stack Organisation

 Download project report now

To download project report press "GO" button


ID ca-pub-2509859738788173
 Introduction of computer architecture and  organization:

Computer architecture refers to the aspects with which a programmer is concerned. The most obvious one is the design of an instruction set for the computer .For  example should the  processor understand the instruction to process multimedia data? The answer is depend on the intended use of system. Clearly, if the target applications involve multimedia, adding multimedia instructions will help improve the performance.
                                             
          Computer architecture, in a sense, describe the computer system at a logical level, form the programmer’s view point. It  deals with the selection of the basic functional unit  such as processor  and  memory  and  how  they  should  be interconnected  into  a  computer  system. Hence computer
Organization  is concerned with how the various hardware components operate and how they are interconnected to implement  the  architectural  specifications.

The computer organization describes operational units
and  their  interconnections   that  realize the  architectural  specifications. The  organizational  attributes  include  those  hardware  details  transparent  to the programmer,such as, control signals , peripherals and memory technology used.

Stack  Based Organization:


A  useful  feature  that is included in the  CPU of most computers  is a stack or last in,  first  out (LIFO)  list. 
A  stack is a storage device that stores information in such
a  manner hat  the  item stored last is the  first  item  retrieved.  The  operation of  a  stack  can  be  compared  to    
a stack of  trays. The last  tray placed  on top of the  stack  is the first  to be taken off.
             The  stack  in  digital  computers is  essentially a memory  unit  with an  address  register  that can  only (after an initial value is loaded in to it). The  register that  hold  the
address  for the  stack  is  called  a  stack  pointer (SP) because its  value always  points  at the top item in stack. Contrary to a stack of trays where the tray it self may be taken out or inserted, the physical registers of a stack are always available for reading or writing.
The two operation of stack are the insertion and deletion of items. The operation of insertion is called Push because it can be thought of as the result of pushing a new item on top.
The operation of deletion is called Pop because it can bethought of as the result of removing one item so that the stack pop’s up.
How ever, nothing is pushed or popped in a computer stack.
These operations are simulated by incrementing or decrementing the stack pointer register.

Operations on Stack:
1. PUSH-  insertion of element into stack.
2. POP   - deletion   of element into stack.


 Uses of  Stack:

1. Mordern  computers are designed with the need of high level languages in mind. The most important by high level languages is the procedure or function.
2. The stack is also used to dynamically allocate the local variables used in functions, and to return values from the function  in computer programs.
3.  stack in digital computers  is a group of memory locations with a register that holds the address of top of the element of the stack called as “Stack Pointer”.
4. Stack is a storage device that stores information in the way that the element is stored last is the first to be retrieved (LIFO). Stack in computer is actually is a memory unit with the address  register (stack pointer  ‘SP’) that can count only.
SP value always  point at top element in the stack.


Types of Stack:
1.Register Stack
2.Memory Stack


 Register Stack:

 A  stack  can  be  placed  in  a  portion  of  a  large memory or it can be organized as a collection of  a finite number of memory words or registers. The stack pointer register SP contains a binary number whose value is equal to the address of the word that is currently on top of the stack.

In a 64-word stack, the stack pointer contains 6 bits because 26=64. since SP has only six bits, it cannot exceed a number grater than 63(111111 in binary). When 63 is incremented by 1, the result is 0 since 111111 + 1 =1000000 in binary, but SP can accommodate only the six least significant bits. Similarly, when 000000 is decremented by 1, the result is 111111. The one bit register Full is set to 1 when the stack is full, and the one-bit register empty is set to 1 when the stack is empty of items. DR is the data register that holds the binary data to be written in to or read out of the stack.



Initially,  SP=0,   EMPTY=1,   FULL=0



 Procedure for Pushing the Stack:

SP SP + 1(Increment stack pointer)
M(SP) DR                       (Write item on top of the stack)
if (sp=0) then (Full 1) (Check if stack is full)
EMPTY0 ( Marked the stack not empty)

NOTE-Always we use  DR to pass word into stack
-M[SP]memory word specified by address currently in SP
-First element stored in stack is at address 1
-Last element stored in stack is at address 0. i.e. FULL=0
            -Any push to stack means EMPTY=0




     Procedures  for Poping Stack:

DRM[SP]                         Read item from the top of stack
SP SP-1                            Decrement stack Pointer
if( SP=0) then (EMPTY 1)         Check if stack is empty
FULL 0                                               Mark the stack not full

NOTE-Top stack is read into  DR
            -If  SP reached 0 then EMPTY=1.That when SP                                           was 1 then pop occurred.No more pop can happen from here
            -Any pop from stacks means FULL=0


  
Stack Based Execution Of Instruction











*Memory Stack:

A stack can be implemented in a random access memory(RAM) attached to the CPU. The implemention of stack in the CPU is done by assigning a portion  and using  a processor register as a stack pointer. The stating memory location of the stack is specified by the processor register as stack pointer.

It is mainly divided into 3 segments:
1.PC
2.AR
3.SP

The programs counter PC points at the address of the next  instruction in the programe. The addresses register AR points at an array of data. The stack pointer SP points at the top of the stack. We assume that the elements in the stack connected  with a data register DR.




As show in figure the initial value of SP is 4001 and the stack grows with decreasing addresses. Thus the first item stored in the stack is at address 4000, the second item is stored at address 3999, and the last address hat can be used for the
stack is 3000. No previous are available for stack limit checks. We assume that the items in the stack
communicate with a data register DR. A new item is inserted with the push operation as follows
SPSP-1
M[SP] DR
The stack pointer is decremented so that it points at the address of the next word. A memory write operation insertion the word from DR into the top of the stack. A new item is deleted with a pop operation as follows.
DRM[SP]
SPSP + 1
The top item is read from the stack in to DR. The stack pointer is then incremented to point at the next item in the stack. Most computer do not provide hardware to check for stack overflow (FULL) or underflow (Empty). The stack limit can be checked by using two prossor register :
one to hold upper limit and other hold the lower limit. after the pop or push operation
SP is compared with lower or upper limit register.

  Advantages of Stack Base Organization:

-The instruction  set does not change if the size of register file changes.
- This mean that programs written for a stack based processor can be run on future version of the processor that have more registers,and they will see performance improvements because they are able to keep more of the stack in the registers.
- Stack based organization is also very easy to compile.
- Instuctions read their operands from,and write their results to a stack ,it has last In First Out data structure.
- Automatic  management of stack registers.

  Applications of Stack:


- To store  data  in  memory in LIFO manner.
- To  store  return  address during instruction                
execution.
- to transfer parameters  to the instructions which are performed in the stack.


REFERENCES

  •     From Textbook of SYBSC (comp.sci)

1.Techmax  Publication’s
Digital  Electronics (sem. first)
2. Vision Publication’s
Digital Electronics (sem. first)

  • From internet sources


See our another projects:

THANK  YOU FOR VISIT MY BLOG 

Hi friends if you want to share your project or seminar with other students to help them into there project or seminar then plese kindly share with us .

To share your  projects send attachments of  project to chaudharimohit39@gmail.com




Project prepared by a creative student,

Name: Harshavardhan Chavanke.
A student of B.sc (computer science) at K.T.H.M. college, Nashik, Maharashtra, India.

for any queries ask to Harshavardhan at harshchavanke@gmail.com



No comments:

Post a Comment