Implementation of Hardware stack

Thread Starter

alwaysneev1991

Joined Oct 10, 2017
2
I need to implement a 4-bit hardware stack of depth N. 4-bit numbers will be pushed onto the stack in parallel and popped out of the stack in parallel. The stack should have a ‘push’ and ‘pop’ control signals and ‘full’ and ‘null’ error signals. I am not sure how to proceed with the implementation. It would really be of help if people could post their ideas related to the implementation. Urgent help is required.
 

WBahn

Joined Mar 31, 2012
32,829
This is pretty clearly an assignment of some kind, probably explaining the need for "urgent help".

You need to post YOUR ideas and best attempt to solve the problem. We can then help steer you in the right direction from there.

For now, forget about the full and null signals. Work on figuring out how to implement a basic stack. Given an N word memory, how might you keep track of where to push a value and what value gets popped next?
 

Thread Starter

alwaysneev1991

Joined Oct 10, 2017
2
This is pretty clearly an assignment of some kind, probably explaining the need for "urgent help".

You need to post YOUR ideas and best attempt to solve the problem. We can then help steer you in the right direction from there.

For now, forget about the full and null signals. Work on figuring out how to implement a basic stack. Given an N word memory, how might you keep track of where to push a value and what value gets popped next?
What is my idea is that to have a stack pointer that will be counting the stack level. Rest is to implement this using a flip flops and shift registers. If there is a push, 4 bits shall be pushed using the shift register and vice versa. Please guide me if this way would be right.
 

WBahn

Joined Mar 31, 2012
32,829
While you can build a stack using shift registers, it is not the only way and perhaps not the best or most intuitive way (depending on the details of how you go about it).

Sketch out a little map of how you expect these shift registers and flip flops to be used (or at least what specific roles they play and what they need to be able to do). You don't need the fine details at this point; the goal is to gain a clear understanding of what needs to be done, before figuring out how to do it.
 

MrChips

Joined Oct 2, 2009
34,809
Usually, the first solution that comes to mind is using memory and address pointer.

I like the SR solution. Since you only need four bits, then all you need are 5 SRs. Simple solution.
 
Top