Ya, a stack pointer is a register. A register is anything which stores it value. Most registers also have an 'increament' line along with a clear and set. The stack pointer is just a register which will add 1 or subtract 1 when you want. This was done in the last lab.
You can use any circuts you want which are in the libraries, so you could use a counter if one exists which will also decrement on command. I am told that there are some of those in the libraries. You will need to add additional logic to make sure your stackpointer/register/counter does not go from 1111 to 0000 or 0000 to 1111 (or 11 to 00 and 00 to 11 depending on how many bits you are using)
As for the memory, we bascilly use 4 registers. As you remember we had a read/write, clear, and clock, and of course 4 data bits. So lets just draw it like this....
| | | | Data In
_____|_|_|_|_______
r/w--| |
clk--| |
clr--|___________________|
| | | |
| | | | Data Out
And hook it up like this.....
____
|1234|-----------------------------------,
|5678|---------------------------------, |
|90AB|-------------------------------, | |
|CDEF|-----------------------------, | | |
```` | | | | Data In
_______ ______ _____|_|_|_|_______
| | | |--r/w--| |
| Stack |-----| | clk--| R0 |
|Pointer| |Dcoder| clr--|___________________|
| |-----| | | | | |
| | | | | | | | Data Out
| | | |--
| | | |--
|_______| |______|--
__ || |
| \_||___________|
|__/ | Push
__ |
| \__|____
|__/ Pop
Notice only that one of the 4 registers are shown here in the memory.
The Data In lines would go to each register, as well as one decoder
line per register into the read/write port.
So here the stack pointer gets decoded IF the push button is pressed since only when it is pressed does the enable light up. Also remember that the push and pop buttons are connected to 2 D flip flops as was shown in the lab and not drawn here. Clocks have not been drawn here either and if you remember we had lots of clock signals going into most everything. I beleive there was also some logic comming from the push/pop buttons before entering the stack pointer as well, (going though 2 MUXs) but that logic could be combined in the pointer. A slight variation on this would be to hook the strobe signal from the keypad into the push button (that is remove the button and just connect the signal line) Thus you do not need to hit a keypad then his a push button, but it may be advantageous to do it this way. Also, instead of running the clock to the stackpointer you can use the strobe signal as the clock. Though this may cause asyncronous signal problems, also the strobe signal may not last long enough in all cases.
So we have the write part down, but we still need to work on the read. Since we have 16 data out lines now, we need to choose the correct 4 lines to send out to the hex display.
__|||||||||||||||__
| |
|___________________|
||||
It will look something like that.