# How to separate decimals and integers on the FPGA side?

## Recommended Posts

Please give me some advice and help, thanks guys!

##### Link to comment

This question can be interpreted a bunch of ways. Can you explain with a bit more detail? Maybe show us some pictures?

##### Link to comment
On 4/19/2024 at 5:09 AM, Neil Pate said:

This question can be interpreted a bunch of ways. Can you explain with a bit more detail? Maybe show us some pictures?

Firstly thank you very much for your reply! My idea is simple, input a fixed point number and how to output its integer part separately from its decimal part. For example, if the input is 1.5, the output will be 1 and 0.5.🤪

##### Link to comment
On 4/19/2024 at 5:09 AM, Neil Pate said:

This question can be interpreted a bunch of ways. Can you explain with a bit more detail? Maybe show us some pictures?

I seem to have implemented this feature. Using the module round toward-infinity. That should do it, right?🤨

##### Link to comment

No, that probably doesn't work how you expect for negative numbers. Fortunately, for fixed point numbers, the decimals are just the least significant bits. The cool thing about that approach is that the code is just a wiring operation and thus uses ~0 resources and 0 time to calculate.

##### Link to comment
7 hours ago, infinitenothing said:

No, that probably doesn't work how you expect for negative numbers. Fortunately, for fixed point numbers, the decimals are just the least significant bits. The cool thing about that approach is that the code is just a wiring operation and thus uses ~0 resources and 0 time to calculate.

If my requirement does not include the case of negative numbers, can I use the procedure I wrote above.

##### Link to comment

Yes, I think that should work fine for positive numbers. It's probably less efficient than my method though.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×