EmbDev.net

Forum: FPGA, VHDL & Verilog Simple calculator with FPGA


von Hosein Poorhoseini (Guest)


Rate this post
useful
not useful
Dear Experts, I'm a student and have a FPGA project that should be 
implement a simple calculator with FPGA. I'm beginner and I don'n know 
that how to implement it. I search in google but not found any thing 
about cal project.
please help me that how can I implement it.

von Christian B. (casandro)


Rate this post
useful
not useful
The Sinclair Scientific runs on typical calculator hardware which is a 
bit simpler than more general purpose microcontrollers. I's recently 
been reverse engineered.

http://webcache.googleusercontent.com/search?q=cache:vSwSiigXvvsJ:www.righto.com/sinclair+&cd=2&hl=de&ct=clnk&gl=de

Essentially that's implementing a 4 bit Microcomputer and programming it 
as a calculator.


If you want points for originality, you could implement an electronic 
version of a mechanical calculator. That involves having one or more 
"registers" which are essentially counters. One architecture would be 
one main register, which is also displayed at all times, as well as one 
that holds your input value. Make it so you can add the input number to 
your display register, but sending a series of impulses to it.
For example if you want to add 1337, you send
7 impulses to the 10^0 digit of your display counter,
3 impulses to the 10^1 digit of your display counter,
3 impulses to the 10^2 digit of your display counter and
1 impulse  to the 10^3 digit of your display counter.

If you add a possibility to shift those lines, you can also easily make 
it able to multiply things. That way you can add the 10^0 digit of the 
input register to the 10^5 digit of the display counter, giving you a 
multiplication of 10^5.
So multiplying 1234 times 5678 is fairly simple:
You enter 5678 into your input register and make sure your display 
register is zero.
Add your input register to your display register 4 times with no shift.
Add your input register to your display register 3 times shifted 1 
digit.
Add your input register to your display register 2 times shifted 2 
digits.
Add your input register to your display register 1 times shifted 3 
digits.

What you get is:
     0000
+    5678
+    5678
+    5678
+    5678
+   56780
+   56780
+   56780
+  567800
+  567800
+ 5678000
===========
whatever

It's like on a Curta.
https://www.youtube.com/watch?v=ZDn_DDsBWws

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
Hosein Poorhoseini wrote:
> that should be implement a simple calculator with FPGA
What experience do you have with FPGA? Did you do the flashing led? Did 
you do simple IO? Did you control a 7-segment display? What input device 
do you have? Where do you display the numbers?


> I search in google but not found any thing about cal project.
I think the purpose of YOUR project and the intention of your teacher is 
that you learn how to use FPGA, not that you learn how to find some code 
somewhere and copy some code and present it as yours. Am I right?

: Edited by Moderator
von Gorgonzola (Guest)


Rate this post
useful
not useful
Seems one of those useless projects, were things are implemented in an 
FPGA which should be better done in software. Students should learn to 
solve hardware issues with FPGAs in the first place, because we have 
enough "FPGA experts" thinking in software clouds only, because they 
were beginning with software thinking.

Otherways poor Lothar et. all. will be overwhelmed by beginner's 
questions one time.

von Hosein Poorhoseini (Guest)


Rate this post
useful
not useful
Thanks for your reply.
I have a teacher that no helped me and we haven't lab in our university.
I searching and reading some documents but can't simulate it in Quartos 
software. I know some VHDL code. but I don't know about select chip 
model or create board for simulate.

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
Hosein Poorhoseini wrote:
> but can't simulate it in Quartos software.
So start fixing this. Get the simulator running an just implement a 
simple counter and simulate it. Don't even try to start with "the big 
thing" e.g. your desired calculator.

> but I don't know about select chip model or create board for simulate.
You can select the hardware yourself? Or ist there a hardware platform 
at school (e.g. a devboard)? If so: which one?

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.