- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello friends...
I want to know what is the efficient code to implement this equation : 1/4 ( x+y) + 1/2 However, inputs are integers , and the output will be also rounded to integer. But the intermediate calculations needs to use 1/4 and 1/2. Kindly inform me about the best way to code this equation. Thanks...:)Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
use fixed point. Its just integer with an offset (so easily implemented in an FPGA).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PS: (x+y)/4 + 1/2 is identical to the equation (x+y + 2) /4. divides by 2^n are just a bit shift.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- use fixed point. Its just integer with an offset (so easily implemented in an FPGA). --- Quote End --- yes use fixe point. just add x + y then add half of result and truncate 2 LSBs I am assuming you want to add x+y, divide by 4 then round
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much. I am coding it right now to see how it is going. Best regards.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page