Replies: 1 comment
-
C64/C64+ are fixed-point devices that do not have actual floating-point arithmetic instructions. For differences between fixed- and floating-point DSPs, check Comparing Fixed- and Floating-Point DSPs for further details. Afaik, fixed-point DSPs could utilize an entire register or an even/odd register pair to store a 32 bits SP or 64 bits DP floating number respectively. Refer to Section 7.2 in TMS320C6000 Optimizing Complier v7.4 User's Guide for how data objects are represented. However, the functional units can only perform fixed-point operations. So how could floating-point arithmetic be performed using C/C++?
The compiler would automatically add the appropriate arithmetic routines and the linker would link the program with the correct rts library. The source code of these functions is available but it's written in C anyway, and they are not intended to be called by the program directly. A better approach to the problem is to abandon the idea of floating-point number in linear assembly code. Transferring all floating-point operations to fixed-point forms is possible since the pixel values were only 8 bits. With 32 bits registers, we can shift everything left and use integer arithmetic functions on them, shift the result back in the final step. When I was browsing through the source code of OpenCV for bilinear interpolation implementation, I found the OpenCL's implementation of the resize function. It demonstrates the aforementioned idea pretty well. We just need to implement it using linear assembly. |
Beta Was this translation helpful? Give feedback.
-
When floating-point numbers are involved in actual processing, how can the program be converted into fixed-point numbers for calculation (such as multiplication)?
Can you introduce the main ideas?
Beta Was this translation helpful? Give feedback.
All reactions