Conversation
whitepau
left a comment
There was a problem hiding this comment.
I like this tutorial as well. I like this method of partitioning different kernels into simple functions.
| @@ -0,0 +1,260 @@ | |||
| # Using the Algorithmic C Fixed Point Data-type 'ac_fixed' | |||
|
|
|||
| This FPGA tutorial demonstrates how to use the Algorithmic C (AC) Data-type `ac_fixed` and some best practices. | |||
There was a problem hiding this comment.
| This FPGA tutorial demonstrates how to use the Algorithmic C (AC) Data-type `ac_fixed` and some best practices. | |
| This FPGA tutorial demonstrates how to use the Algorithmic C (AC) datatype `ac_fixed` and some best practices. |
I believe the word 'datatype' is not hyphenated.
|
|
||
| This FPGA tutorial shows how to use the `ac_fixed` type with some simple examples. | ||
|
|
||
| This data-type can be used in place of native floating point types to generate area efficient and optimized designs for the FPGA. For example, operations which do not utilize all of the bits the native types are good candidates for replacement with `ac_fixed` type. |
There was a problem hiding this comment.
| This data-type can be used in place of native floating point types to generate area efficient and optimized designs for the FPGA. For example, operations which do not utilize all of the bits the native types are good candidates for replacement with `ac_fixed` type. | |
| This data-type can be used in place of native floating point types to generate area efficient and optimized designs for the FPGA. Operations which do not utilize the full dynamic range of the native types are good candidates for using `ac_fixed` types. For example: multiplying by a number in the range of `(-1.0, 1.0)`. |
|
|
||
| This data-type can be used in place of native floating point types to generate area efficient and optimized designs for the FPGA. For example, operations which do not utilize all of the bits the native types are good candidates for replacement with `ac_fixed` type. | ||
|
|
||
| This tutorials shows the recommended method for constructing an `ac_fixed` number, some examples of using the fixed point math library functions and how they can be used to reduce the area of the hardware generated by the compiler by trading-off accuracy of the mathematical operations. |
There was a problem hiding this comment.
| This tutorials shows the recommended method for constructing an `ac_fixed` number, some examples of using the fixed point math library functions and how they can be used to reduce the area of the hardware generated by the compiler by trading-off accuracy of the mathematical operations. | |
| This tutorial shows the recommended method for constructing an `ac_fixed` number, some examples of using the fixed point math library functions and how they can be used to reduce the area of the hardware generated by the compiler by trading-off accuracy of the mathematical operations. |
There was a problem hiding this comment.
I also think that 'trading-off' doesn't need to by hyphenated.
| ```cpp | ||
| ac_fixed<W, I, S> a; | ||
| ``` | ||
| Here W specifies the width and S specifies the sign of the number. One of the W bits is used to store the sign information. The second parameter I is an integer that specifies the location of the fixed point relative to the most significant bit. |
There was a problem hiding this comment.
W and S are parameters and should be monospaced.
| ``` | ||
| Here W specifies the width and S specifies the sign of the number. One of the W bits is used to store the sign information. The second parameter I is an integer that specifies the location of the fixed point relative to the most significant bit. | ||
|
|
||
| The type also provides two more optional parameters for controlling the overflow and rounding modes. For more details on the type, rounding and overflow modes and the range of values supported with different width parameterization please refer to the file `ac_data_types_ref.pdf`. |
There was a problem hiding this comment.
where is ac_data_types_ref.pdf? mention that it's included in this tutorial.
sidenote: do we have permission to distribute it like this?
|
|
||
| - Emulation vs Simulation for fixed point math operations | ||
|
|
||
| Due to the differences in the internal math implementations, the results from `ac_fixed` math functions in simulation and emulation might not always be bit-accurate. In this example you can observe the difference between emulation and simulation. |
There was a problem hiding this comment.
When this tutorial releases, will simulation be supported? Is this limitation still present in oneAPI? Having a computational difference between emulation and hardware sounds like it will defeat the purpose of emulation :(
|
|
||
| 1. Input Bit Width and Input Value Range Limits | ||
|
|
||
| The fixed-point math functions have bit width and input value range requirements. All bit width and input value range requirements are documented at the top of the ac_fixed_math.hpp file. For example, the `sin_fixed` and `cos_fixed` functions require the integer part's bit width to be 3, and the input value range to be within [-pi, pi]. |
There was a problem hiding this comment.
| The fixed-point math functions have bit width and input value range requirements. All bit width and input value range requirements are documented at the top of the ac_fixed_math.hpp file. For example, the `sin_fixed` and `cos_fixed` functions require the integer part's bit width to be 3, and the input value range to be within [-pi, pi]. | |
| The fixed-point math functions have bit width and input value range requirements. All bit width and input value range requirements are documented at the top of the ac_fixed_math.hpp file. For example, the `sin_fixed` and `cos_fixed` functions require the integer part's bit width to be <exactly> 3, and the input value range to be within [-pi, pi]. |
I assume this is the same as for HLS
|
|
||
| 2. Return Types | ||
|
|
||
| For fixed-point functions, each function has a default return type. Assigning the result to a non-default return type triggers a type conversion and can cause an increase in logic use or a loss of accuracy in your results. All return types are documented at the top of the ac_fixed_math.hpp file. For example, for `sin_fixed` and `cos_fixed`, the input type is `ac_fixed<W, 3, true>`, and the output type is `ac_fixed<W-1, 2, true>`. |
There was a problem hiding this comment.
you have not consistently monospaced filenames. Either always, or never.
|
|
||
| ## Key Concepts | ||
| * Constructing an `ac_fixed` from a `float` or `double` value will be much more area intensive than constructing one from another `ac_fixed`. | ||
| * The `ac_fixed` math library provides a set of functions for various math operations. |
There was a problem hiding this comment.
| * The `ac_fixed` math library provides a set of functions for various math operations. | |
| * The `ac_fixed` math library provides a set of functions for various math operations that are optimized for `ac_fixed` types. |
|
|
||
| ### Include Files | ||
|
|
||
| The included header `dpc_common.hpp` is located at `%ONEAPI_ROOT%\dev-utilities\latest\include` on your development system. |
There was a problem hiding this comment.
is there a reason that this uses the Windows path?
Internal review of ac_fixed tutorial. This is a port of the HLS ac_fixed tutorials.
Testing:
[DONE] Linux Local compile
[TODO] Linux Local compile with CMAKE
[TODO] Linux Regtest
[TODO] Windows Local compile with CMAKE
[TODO] Windows Regtest