Neural Network Data Conversion Functions

void riscv_q7_to_q15_no_shift(const q7_t *pSrc, q15_t *pDst, uint32_t blockSize)
void riscv_q7_to_q15_reordered_no_shift(const q7_t *pSrc, q15_t *pDst, uint32_t blockSize)
void riscv_q7_to_q15_with_offset(const q7_t *src, q15_t *dst, uint32_t block_size, q7_t offset)
void riscv_q7_to_q7_no_shift(const q7_t *pSrc, q7_t *pDst, uint32_t blockSize)
void riscv_q7_to_q7_reordered_no_shift(const q7_t *pSrc, q7_t *pDst, uint32_t blockSize)
group nndata_convert

Perform data type conversion in-between neural network operations.

Functions

void riscv_q7_to_q15_no_shift(const q7_t *pSrc, q15_t *pDst, uint32_t blockSize)

Converts the elements of the Q7 vector to Q15 vector without left-shift.

Converts the elements of the q7 vector to q15 vector without left-shift.

The equation used for the conversion process is:

Return

none.

Description:

Parameters
  • [in] *pSrc: points to the Q7 input vector

  • [out] *pDst: points to the Q15 output vector

  • [in] blockSize: length of the input vector

void riscv_q7_to_q15_reordered_no_shift(const q7_t *pSrc, q15_t *pDst, uint32_t blockSize)

Converts the elements of the Q7 vector to reordered Q15 vector without left-shift.

Converts the elements of the q7 vector to reordered q15 vector without left-shift.

This function does the q7 to q15 expansion with re-ordering

Return

none.

Parameters
  • [in] *pSrc: points to the Q7 input vector

  • [out] *pDst: points to the Q15 output vector

  • [in] blockSize: length of the input vector

is converted into:

This looks strange but is natural considering how sign-extension is done at assembly level.

The expansion of other other oprand will follow the same rule so that the end results are the same.

The tail (i.e., last (N % 4) elements) will still be in original order.

void riscv_q7_to_q15_with_offset(const q7_t *src, q15_t *dst, uint32_t block_size, q7_t offset)

Converts the elements from a q7 vector to a q15 vector with an added offset.

The equation used for the conversion process is:

Return

none.

Description:

Parameters
  • [in] *src: points to the q7 input vector

  • [out] *dst: points to the q15 output vector

  • [in] block_size: length of the input vector

  • [in] offset: q7 offset to be added to each input vector element.

void riscv_q7_to_q7_no_shift(const q7_t *pSrc, q7_t *pDst, uint32_t blockSize)

Converts the elements of the Q7 vector to Q7 vector without left-shift.

The equation used for the conversion process is:

Return

none.

Description:

Parameters
  • [in] *pSrc: points to the Q7 input vector

  • [out] *pDst: points to the Q7 output vector

  • [in] blockSize: length of the input vector

void riscv_q7_to_q7_reordered_no_shift(const q7_t *pSrc, q7_t *pDst, uint32_t blockSize)

Converts the elements of the Q7 vector to reordered Q7 vector without left-shift.

This function does the q7 to q7 expansion with re-ordering

Return

none.

Parameters
  • [in] *pSrc: points to the Q7 input vector

  • [out] *pDst: points to the Q7 output vector

  • [in] blockSize: length of the input vector

is converted into:

This looks strange but is natural considering how sign-extension is done at assembly level.

The expansion of other other oprand will follow the same rule so that the end results are the same.

The tail (i.e., last (N % 4) elements) will still be in original order.