r/logisim • • Mar 09 '22

How do I make a stack?

I am trying to reverse a user entered string up to 64 characters.

I think the easiest way to do this is to use a stack, push in all the chars, and then pop them out. But I can't figure out how to create a stack, with the push and pop operations.

1 Upvotes

2 comments sorted by

1

u/Violet_Aer Mar 09 '22

Use a RAM chip as your stack and use a few registers as stack pointers. With a push signal, store char at base address plus stack pointer and increment the stack pointer. With a pop signal, decrement the stack pointer and output from base address plus pointer.

1

u/HyperKingK Mar 09 '22

Yeah that's pretty much what I ended up doing. I used a counter with the load input acting as my push/pop functions.

Thanks for the answer!