design of calculator in verilog

S

Sunita Jain

Guest
Hello all,
I need to design a calculator in verilog for 4 operations: +, -, *, /.
It is 8-bit calculator.
I have designed all the four operating modules and they are working
fine. The calculator also does operations on 2 operands. Now what I am
not able to figure out is if i press on the keypad (this is going to
be an fpga with keypad connected) say 1+2=...+3.
I mean I expect an answer 3 the first time I say = and then the same
thing needs to be considered as one of the operands in the next
calculation so that the final answer is 6. Can somebody give me an
idea as to how to figure this out in verilog...I am pretty much
confused...
Regards.
Sunita
 
sunitajain@gmail.com (Sunita Jain) wrote in message news:<9bfc40d7.0411070448.603c7047@posting.google.com>...
Hello all,
I need to design a calculator in verilog for 4 operations: +, -, *, /.
It is 8-bit calculator.
I have designed all the four operating modules and they are working
fine. The calculator also does operations on 2 operands. Now what I am
not able to figure out is if i press on the keypad (this is going to
be an fpga with keypad connected) say 1+2=...+3.
I mean I expect an answer 3 the first time I say = and then the same
thing needs to be considered as one of the operands in the next
calculation so that the final answer is 6. Can somebody give me an
idea as to how to figure this out in verilog...I am pretty much
confused...
One way to do it is by having two stacks, one for operands and one for
operators. As this sounds like homework/an assignment, I'll let you
figure out the rest.

Cheers,
Jon
 
Thanks for the idea.I actually implemented it with FSM. I will try out
this idea of using a stack.

Regards,
Sunita.


jon@beniston.com (Jon Beniston) wrote in message news:<e87b9ce8.0411080949.1ddbf704@posting.google.com>...
sunitajain@gmail.com (Sunita Jain) wrote in message news:<9bfc40d7.0411070448.603c7047@posting.google.com>...
Hello all,
I need to design a calculator in verilog for 4 operations: +, -, *, /.
It is 8-bit calculator.
I have designed all the four operating modules and they are working
fine. The calculator also does operations on 2 operands. Now what I am
not able to figure out is if i press on the keypad (this is going to
be an fpga with keypad connected) say 1+2=...+3.
I mean I expect an answer 3 the first time I say = and then the same
thing needs to be considered as one of the operands in the next
calculation so that the final answer is 6. Can somebody give me an
idea as to how to figure this out in verilog...I am pretty much
confused...

One way to do it is by having two stacks, one for operands and one for
operators. As this sounds like homework/an assignment, I'll let you
figure out the rest.

Cheers,
Jon
 

Welcome to EDABoard.com

Sponsor

Back
Top