zangman / de10-nano

Absolute beginner's guide to the de10-nano
Apache License 2.0
195 stars 44 forks source link

Simple Adder convert decimal? #23

Closed lmz0528 closed 1 year ago

lmz0528 commented 1 year ago

Hi, Thank you for this tutorial,it's very useful for me. I want to ask a question about"Simple Adder". It seems that program will automatically convert input a and b from decimal to 64-bit binary format. But I don't see any program about converting "sum" from 64-bit binary back to decimal format. Would you please explain this? For some reason I want to see "sum" in 64-bit binary format in putty. Sorry I am bad at English.

Any help would be much appreciated.

kirkster96 commented 1 year ago

Well, the simple adder operands are expected to be unsigned integers. A different logic circuit implementation is required

You have a couple of options to pursue if you would like to be able to handle decimal point data.

The common way most distributed systems perform decimal-point operations is by using the IEEE floating point standard

You could look into finding a open source IP core that provides you with something to get you started. Of course, IEEE standard has it's limitations.

You could also look into fixed-point, something that is a little simpler and also comes with it's advantages and disadvantages.

Here is a video reference talking about how you might implement that: #8 lab 2 -- ODE solver (Bruce Land YouTube)

(the video link includes the time stamp where he starts talking about fixed-point addition)

lmz0528 commented 1 year ago

Thank you so much! I will refer to the way you provided. :)