I am using CPU Sim to change wombat1 to wombat2 by adding stack.

I have done adding a Stack RAM and a Stack pointer SPR.

I have implemented a push instruction as such:

acc->mdr
mdr->Stack[SPR]
End

The implementation is able to push the acc value to Stack but not able to point to the next location to store the next value. For incrementing am I suppose to use Inc2-pc?

And the pop instruction is popping out the address of the value instead of the value. The implementation of pop is:

ir(4-15)->mar
Stack[SPR]->mdr
mdr->acc
End

Can anyone point out what I am doing wrong? Or any suggestions?

Recommended Answers

All 9 Replies

Where does your microcode update the SPR?
Hm, maybe I need to check out this wombat-processor organization.

Also, what does this do:
"ir(4-15)->mar"
Is this an immediate instruction, or maybe registers are memory-mapped?

Looked at it, and I wonder where the "Stack" and SPR came from.
Didn't find them in neither wombat1 nor wombat2.

Basically the idea of push (post decrementing) should be:
1) moving SPR (address) to MAR
2) moving data to MDR
3) writing MDR to memory
// If the registers are not counters
4) moving SPR to ACC
5) decrementing ACC by two
6) moving ACC to SPR
// If needed
7) getting next instruction

Your POP is ... erm ...
1) mess up MAR with immediate parameter
2) read from memory to MDR without using MAR
3) move MDR to ACC without touching the SPR
... I don't come up with a name for instruction like this.

The processor is not wombat1 nor wombat2 or even very close to wombats.
I can't help if I don't get to know the processor organization.

Hello thanks for the reply. Actually I was able to implement the push and pop instructions successfully.

The "Stack" and "SPR" were created by me into the Wombat machine(Read the 2nd line in my post). "SPR" was the pointer address to "Stack".

The processor is not wombat1 nor wombat2 or even very close to wombats.

What do you mean by the processor is not wombat 1 nor wombat 2?

What do you mean by the processor is not wombat 1 nor wombat 2?

If you change the instruction set, it's no more wombat1 or wombat2.
Also, it's not possible to know if push and pop would work, if the "SPR" and "Stack" implementations are not shown.

I guess your new architecture is supposed to have two memory buses. One for data, one for stack.

We were given wombat1 and we were suppose to convert wombat1 to wombat2 by adding a Stack and Stack pointer with push and pop implementations.

I guess your new architecture is supposed to have two memory buses. One for data, one for stack.

Yup you are correct.

I forgot to mark this thread solved after I had found the solution.

Soooo whats the answer?

Hey can u help me out please .. I have the same issue.. I have to implement 2 new instructions to wombat 1 which is push and pop.. Can u write a detailed description as to how about u did this... It will be really appreciated. Thanks

Did anyone manage to solve this problem?

commented: See if they completed it. Example: https://github.com/Lothav/wombat2 +15

For push :

acc->mdr
mdr->Stack[SPR]
SPR-inc
End

For pop:

SPR-dec
Stack[SPR]-mdr
mdr->acc
End

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.