add comments for decoding functions to help debugging the frame-based decoders

This commit is contained in:
tangxifan 2020-05-28 18:46:47 -06:00
parent bdc9efb38f
commit b8c449d520
1 changed files with 21 additions and 0 deletions

View File

@ -14,6 +14,21 @@ namespace openfpga {
/********************************************************************
* Convert an integer to an one-hot encoding integer array
* For example:
* Input integer: 3
* Binary length : 4
* Output:
* index | 0 | 1 | 2 | 3
* ret | 0 | 0 | 0 | 1
*
* If you need all zero code, set the input integer same as the binary length
* For example:
* Input integer: 4
* Binary length : 4
* Output:
* index | 0 | 1 | 2 | 3
* ret | 0 | 0 | 0 | 0
*
********************************************************************/
std::vector<size_t> ito1hot_vec(const size_t& in_int,
const size_t& bin_len) {
@ -33,6 +48,12 @@ std::vector<size_t> ito1hot_vec(const size_t& in_int,
/********************************************************************
* Converter an integer to a binary vector
* For example:
* Input integer: 4
* Binary length : 3
* Output:
* index | 0 | 1 | 2
* ret | 0 | 0 | 1
********************************************************************/
std::vector<size_t> itobin_vec(const size_t& in_int,
const size_t& bin_len) {