Macros
m_sign_ext

For sign extension from A bits to B bits, converts an A-bits wide signed number to a B-bits wide signed number.  A: 1 - 32 B: 8, 16, 24, 32

PEAK cycles: 3 cycle

Pseudo code:

if (18th bit == 1)
set(bits 18 to 32 HIGH)
Parameters
A

Datawidth of input number

B

Required datawidth

data_reg

Input number

CONFIG

clears upper bits also if = EXTEND_0, else only extends 1

Returns
data_reg

Output sign extended number

m_sign_ext_32bit

For sign extension from 18 to 32 bits

PEAK cycles: 3 cycle

Pseudo code:

if (18th bit == 1)
set(bits 18 to 32 HIGH)
Parameters

sample_reg

Returns

sample_reg

m_sign_ext_16bit

For sign extension from 14 to 16 bits

PEAK cycles: 2 cycle

Pseudo code:

if (14th bit == 1)
set(bits 14 to 16 HIGH)
Parameters

sample_reg

Returns

sample_reg

m_sign_ext_16to32_bits

For sign extension from 16 to 32 bits

PEAK cycles: 2 cycle

Pseudo code:

if (16th bit == 1)
set(bits 17 to 32 HIGH)
Parameters

sample_reg

Returns

sample_reg

m_sign_ext_24to32_bits

For sign extension from 24 to 32 bits

PEAK cycles: 2 cycle

Pseudo code:

// set(bits 25 to 32 LOW)
if (24th bit == 1)
set(bits 25 to 32 HIGH)
Parameters

sample_reg

Returns

sample_reg