Professional Documents
Culture Documents
Page 1 of 10
In a Full stack, the stack pointer points to the topmost item in the stack, i.e. the location of the
last item to be pushed onto the stack.
We will implement our stack as a Full ascending stack. We will create a design entity (entity
architecture pair) which we can initially test and subsequently use as a component in our calculator.
The stack consists of some RAM memory, a register which stores the current stack pointer (a
memory address) and logic which controls the updating of the stack pointer and asserts the full and
empty flags. Refer to the block diagram (attached).
The following is a description of the signals: (Blue = input, Green= output)
Din:
Dout:
Enable:
When asserted data can be pushed or popped on the next rising edge of the clock.
Push_PopN:
When 1 a push occurs on the next clock edge if enable is asserted when 0 a pop
occurs on the next clock edge if enable is asserted.
Reset:
When reset occurs the current_sp is reset it then points to the bottom of the stack.
Clock:
Page 2 of 10
Full:
Flag - asserted when the current_sp = the last address in memory. (top of stack)
Empty:
Flag - asserted when the current_sp = the first address in memory. (bottom of stack)
4) Select Block memory generator from the RAMs and ROMs tab.
Page 3 of 10
5) Accept the default setting (native) for the interface type on the first page.
6) For memory type select single port RAM - for other options use defaults.
7) For Memory width select 8, depth 16, write first and use ENA pin.
Page 4 of 10
Page 5 of 10
8) For optional output registers accept default as shown below. No registers or init file.
10)
Page 6 of 10
13) We now need to add Stack RAM as a component to the stack. First use file open in ISE to
open the file Stack_RAM.VHO which is in the ipcore_dir sub directory.
The file contains templates for the component and its instantiation
Copy the component template and past it into the architecture for the stack
Page 7 of 10
16) Now it is over to you add a process and concurrent statements that will implement the
register and logic required to implement the stack.
17) Write a testbench to test the stack.
Make sure nothing is pushed on when full and nothing is popped off when empty.
Page 8 of 10
Page 9 of 10
Page 10 of 10