DSP Tools
[Physical Layer Reference Implementation]


Detailed Description

This section deals with various DSP tools used by various blocks in the PHY.

Specifically,


Data Structures

struct  complexf
struct  complex16
struct  complex32

Functions

int mult_cpx_vector (short *x1, short *x2, short *y, unsigned int N, unsigned short output_shift)
int mult_cpx_vector_norep (short *x1, short *x2, short *y, unsigned int N, unsigned short output_shift)
int mult_cpx_vector_norep_conj (short *x1, short *x2, short *y, unsigned int N, unsigned short output_shift)
int mult_cpx_vector2 (short *x1, short *x2, short *y, unsigned int N, unsigned short output_shift)
int mult_cpx_vector_add (short *x1, short *x2, short *y, unsigned int N, unsigned short output_shift)
int mult_cpx_vector_h_add32 (short *x1, short *x2, short *y, unsigned int N, short sign)
int mult_cpx_vector_add32 (short *x1, short *x2, short *y, unsigned int N)
int mult_vector32 (short *x1, short *x2, short *y, unsigned int N)
int mult_vector32_scalar (short *x1, int x2, short *y, unsigned int N)
int mult_cpx_vector32_conj (short *x, short *y, unsigned int N)
int mult_cpx_vector32_real (short *x1, short *x2, short *y, unsigned int N)
int shift_and_pack (short *y, unsigned int N, unsigned short output_shift)
int mult_cpx_vector_h (short *x1, short *x2, short *y, unsigned int N, unsigned short output_shift, short sign)
int mult_cpx_matrix_h (short *x1[2][2], short *x2[2][2], short *y[2][2], unsigned int N, unsigned short output_shift, short hermitian)
int mult_cpx_matrix_vector (int *x1[2][2], int *x2[2], int *y[2], unsigned int N, unsigned short output_shift)
void init_fft (unsigned short size, unsigned char logsize, unsigned short *rev)
 Initialize the FFT engine for a given size.
void fft (short *x, short *y, short *twiddle, unsigned short *rev, unsigned char log2size, unsigned char scale, unsigned char input_fmt)
int rotate_cpx_vector (short *x, short *alpha, short *y, unsigned int N, unsigned short output_shift, unsigned char format)
int rotate_cpx_vector2 (short *x, short *alpha, short *y, unsigned int N, unsigned short output_shift, unsigned char format)
int rotate_cpx_vector_norep (short *x, short *alpha, short *y, unsigned int N, unsigned short output_shift)
int add_cpx_vector (short *x, short *alpha, short *y, unsigned int N)
int add_cpx_vector32 (short *x, short *y, short *z, unsigned int N)
int add_real_vector64 (short *x, short *y, short *z, unsigned int N)
int sub_real_vector64 (short *x, short *y, short *z, unsigned int N)
int add_real_vector64_scalar (short *x, long long int a, short *y, unsigned int N)
int add_vector16 (short *x, short *y, short *z, unsigned int N)
int complex_conjugate (short *x1, short *y, unsigned int N)
void bit8_txmux (int length, int offset)
void bit8_rxdemux (int length, int offset)
char dB_fixed (unsigned int)
int write_output (const char *fname, const char *vname, void *data, int length, int dec, char format)
 Write output file from signal data.
void Zero_Buffer (void *, unsigned int)
void Zero_Buffer_nommx (void *buf, unsigned int length)
void mmxcopy (void *dest, void *src, int size)
int signal_energy (int *, unsigned int)
 Computes the signal energy per subcarrier.
int iSqrt (int value)
unsigned char log2_approx (unsigned int)
unsigned char log2_approx64 (unsigned long long int x)
short invSqrt (short x)
int phy_phase_compensation_top (unsigned int pilot_type, unsigned int initial_pilot, unsigned int last_pilot, int ignore_prefix)
void phy_phase_compensation (short *ref_sch, short *tgt_sch, short *out_sym, int ignore_prefix, int aa, struct complex16 *perror_out)


Function Documentation

int mult_cpx_vector ( short *  x1,
short *  x2,
short *  y,
unsigned int  N,
unsigned short  output_shift 
)

This function performs optimized componentwise multiplication of two Q1.15 vectors in repeated format.

Parameters:
x1 Input 1 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
x2 Input 2 in the format |Re0 -Im0 Im0 Re0|,......,|Re(N-1) -Im(N-1) Im(N-1) Re(N-1)|
y Output in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
N Length of Vector WARNING: N must be a multiple of 8 (4x loop unrolling and two complex multiplies per cycle)
output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause overflow!!
The function implemented is : $\mathbf{y} = \mathbf{x_1}\odot\mathbf{x_2}$

int mult_cpx_vector_norep ( short *  x1,
short *  x2,
short *  y,
unsigned int  N,
unsigned short  output_shift 
)

This function performs optimized componentwise multiplication of two Q1.15 vectors with normal formatted output.

Parameters:
x1 Input 1 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
x2 Input 2 in the format |Re0 -Im0 Im0 Re0|,......,|Re(N-1) -Im(N-1) Im(N-1) Re(N-1)|
y Output in the format |Re0 Im0 Re1 Im1|,......,|Re(N-2) Im(N-2) Re(N-1) Im(N-1)|
N Length of Vector WARNING: N must be a multiple of 8 (4x loop unrolling and two complex multiplies per cycle)
output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause overflow!!
The function implemented is : $\mathbf{y} = \mathbf{x_1}\odot\mathbf{x_2}$

int mult_cpx_vector_norep_conj ( short *  x1,
short *  x2,
short *  y,
unsigned int  N,
unsigned short  output_shift 
)

int mult_cpx_vector2 ( short *  x1,
short *  x2,
short *  y,
unsigned int  N,
unsigned short  output_shift 
)

This function performs optimized componentwise multiplication of two Q1.15 vectors.

Parameters:
x1 Input 1 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
x2 Input 2 in the format |Re0 -Im0 Im0 Re0|,......,|Re(N-1) -Im(N-1) Im(N-1) Re(N-1)|
y Output in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
N Length of Vector WARNING: N must be a multiple of 2 (2 complex multiplies per cycle)
output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause overflow!!
The function implemented is : $\mathbf{y} = \mathbf{x_1}\odot\mathbf{x_2}$

int mult_cpx_vector_add ( short *  x1,
short *  x2,
short *  y,
unsigned int  N,
unsigned short  output_shift 
)

This function performs optimized componentwise multiplication of two Q1.15 vectors. The output IS ADDED TO y. WARNING: make sure that output_shift is set to the right value, so that the result of the multiplication has the comma at the same place as y.

Parameters:
x1 Input 1 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
x2 Input 2 in the format |Re0 -Im0 Im0 Re0|,......,|Re(N-1) -Im(N-1) Im(N-1) Re(N-1)|
y Output in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
N Length of Vector WARNING: N>=4
output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause overflow!!
The function implemented is : $\mathbf{y} += \mathbf{x_1}\odot\mathbf{x_2}$

int mult_cpx_vector_h_add32 ( short *  x1,
short *  x2,
short *  y,
unsigned int  N,
short  sign 
)

int mult_cpx_vector_add32 ( short *  x1,
short *  x2,
short *  y,
unsigned int  N 
)

int mult_vector32 ( short *  x1,
short *  x2,
short *  y,
unsigned int  N 
)

int mult_vector32_scalar ( short *  x1,
int  x2,
short *  y,
unsigned int  N 
)

int mult_cpx_vector32_conj ( short *  x,
short *  y,
unsigned int  N 
)

int mult_cpx_vector32_real ( short *  x1,
short *  x2,
short *  y,
unsigned int  N 
)

int shift_and_pack ( short *  y,
unsigned int  N,
unsigned short  output_shift 
)

int mult_cpx_vector_h ( short *  x1,
short *  x2,
short *  y,
unsigned int  N,
unsigned short  output_shift,
short  sign 
)

This function performs optimized componentwise multiplication of the vector x1 with the conjugate of the vector x2. The output IS ADDED TO y. WARNING: make sure that output_shift is set to the right value, so that the result of the multiplication has the comma at the same place as y.

Parameters:
x1 Input 1 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
x2 Input 2 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
y Output in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
N Length of Vector (complex samples) WARNING: N>=4
output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause overflow!!
sign +1..add, -1..substract
The function implemented is : $\mathbf{y} = \mathbf{y} + \mathbf{x_1}\odot\mathbf{x_2}^*$

int mult_cpx_matrix_h ( short *  x1[2][2],
short *  x2[2][2],
short *  y[2][2],
unsigned int  N,
unsigned short  output_shift,
short  hermitian 
)

This function performs optimized componentwise matrix multiplication of the 2x2 matrices x1 with the 2x2 matrices x2. The output IS ADDED TO y (i.e. make sure y is initilized correctly). WARNING: make sure that output_shift is set to the right value, so that the result of the multiplication has the comma at the same place as y.

Parameters:
x1 Input 1 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
x2 Input 2 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
y Output in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
N Length of Vector (complex samples) WARNING: N>=4
output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause overflow!!
hermitian if !=0 the hermitian transpose is returned (i.e. A^H*B instead of A*B^H)

int mult_cpx_matrix_vector ( int *  x1[2][2],
int *  x2[2],
int *  y[2],
unsigned int  N,
unsigned short  output_shift 
)

This function performs optimized componentwise matrix-vector multiplication of the 2x2 matrices x1 with the 2x1 vectors x2. The output IS ADDED TO y (i.e. make sure y is initilized correctly). WARNING: make sure that output_shift is set to the right value, so that the result of the multiplication has the comma at the same place as y.

Parameters:
x1 Input 1 in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
x2 Input 2 in the format |Re0 -Im0 Im0 Re0|,......,|Re(N-1) -Im(N-1) Im(N-1) Re(N-1)|
y Output in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)| WARNING: y must be different for x2
N Length of Vector (complex samples) WARNING: N>=4
output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause overflow!!

void init_fft ( unsigned short  size,
unsigned char  logsize,
unsigned short *  rev 
)

Initialize the FFT engine for a given size.

Parameters:
size Size of the FFT
logsize log2(size)
rev Pointer to bit-reversal permutation array

void fft ( short *  x,
short *  y,
short *  twiddle,
unsigned short *  rev,
unsigned char  log2size,
unsigned char  scale,
unsigned char  input_fmt 
)

This function performs optimized fixed-point radix-2 FFT/IFFT.

Parameters:
x Input
y Output in format: [Re0,Im0,Re0,Im0, Re1,Im1,Re1,Im1, ....., Re(N-1),Im(N-1),Re(N-1),Im(N-1)]
twiddle Twiddle factors
rev bit-reversed permutation
log2size Base-2 logarithm of FFT size
scale Total number of shifts (should be log2size/2 for normalized FFT)
input_fmt (0 - input is in complex Q1.15 format, 1 - input is in complex redundant Q1.15 format)

int rotate_cpx_vector ( short *  x,
short *  alpha,
short *  y,
unsigned int  N,
unsigned short  output_shift,
unsigned char  format 
)

This function performs componentwise multiplication of a vector with a complex scalar.

Parameters:
x Vector input (Q1.15) in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
alpha Scalar input (Q1.15) in the format |Re0 Im0|
y Output (Q1.15) in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
N Length of x WARNING: N>=4
output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause overflow!!
format Format 0 indicates that alpha is in shuffled format during multiply (Re -Im Im Re), whereas 1 indicates that input is in this format (i.e. a matched filter)
The function implemented is : $\mathbf{y} = \alpha\mathbf{x}$

int rotate_cpx_vector2 ( short *  x,
short *  alpha,
short *  y,
unsigned int  N,
unsigned short  output_shift,
unsigned char  format 
)

This function performs componentwise multiplication of a vector with a complex scalar.

Parameters:
x Vector input (Q1.15) in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
alpha Scalar input (Q1.15) in the format |Re0 Im0|
y Output (Q1.15) in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
N Length of x WARNING: N must be multiple of 2 (the routine performs two complex multiplies per cycle)
output_shift Number of bits to shift output down to Q1.15 (should be 15 for Q1.15 inputs) WARNING: log2_amp>0 can cause overflow!!
format Format 0 indicates that alpha is in shuffled format during multiply (Re -Im Im Re), whereas 1 indicates that input is in this format (i.e. a matched filter) The function implemented is : $\mathbf{y} = \alpha\mathbf{x}$

int rotate_cpx_vector_norep ( short *  x,
short *  alpha,
short *  y,
unsigned int  N,
unsigned short  output_shift 
)

int add_cpx_vector ( short *  x,
short *  alpha,
short *  y,
unsigned int  N 
)

This function performs componentwise addition of a vector with a complex scalar.

Parameters:
x Vector input (Q1.15) in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
alpha Scalar input (Q1.15) in the format |Re0 Im0|
y Output (Q1.15) in the format |Re0 Im0 Re0 Im0|,......,|Re(N-1) Im(N-1) Re(N-1) Im(N-1)|
N Length of x WARNING: N>=4
The function implemented is : $\mathbf{y} = \alpha + \mathbf{x}$

int add_cpx_vector32 ( short *  x,
short *  y,
short *  z,
unsigned int  N 
)

int add_real_vector64 ( short *  x,
short *  y,
short *  z,
unsigned int  N 
)

int sub_real_vector64 ( short *  x,
short *  y,
short *  z,
unsigned int  N 
)

int add_real_vector64_scalar ( short *  x,
long long int  a,
short *  y,
unsigned int  N 
)

int add_vector16 ( short *  x,
short *  alpha,
short *  y,
unsigned int  N 
)

This function performs componentwise addition of two vectors with Q1.15 components.

Parameters:
x Vector input (Q1.15)
y Scalar input (Q1.15)
y Output (Q1.15)
N Length of x WARNING: N must be a multiple of 32
The function implemented is : $\mathbf{y} = \mathbf{x} + \mathbf{y}$

int complex_conjugate ( short *  x1,
short *  y,
unsigned int  N 
)

void bit8_txmux ( int  length,
int  offset 
)

void bit8_rxdemux ( int  length,
int  offset 
)

char dB_fixed ( unsigned  int  ) 

int write_output ( const char *  fname,
const char *  vname,
void *  data,
int  length,
int  dec,
char  format 
)

Write output file from signal data.

Parameters:
fname output file name
vname output vector name (for MATLAB/OCTAVE)
data point to data
length length of data vector to output
dec decimation level
format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit)

void Zero_Buffer ( void *  ,
unsigned  int 
)

void Zero_Buffer_nommx ( void *  buf,
unsigned int  length 
)

void mmxcopy ( void *  dest,
void *  src,
int  size 
)

int signal_energy ( int *  ,
unsigned  int 
)

Computes the signal energy per subcarrier.

int iSqrt ( int  value  ) 

unsigned char log2_approx ( unsigned  int  ) 

unsigned char log2_approx64 ( unsigned long long int  x  ) 

short invSqrt ( short  x  ) 

int phy_phase_compensation_top ( unsigned int  pilot_type,
unsigned int  initial_pilot,
unsigned int  last_pilot,
int  ignore_prefix 
)

Compensate the phase rotation of the RF. WARNING: This function is currently unused. It has not been tested!

Parameters:
pilot_type indicates whether it is a CHBCH (=0) or a SCH (=1) pilot
initial_pilot index of the first pilot (which serves as reference)
last_pilot index of the last pilot in the range of pilots to correct the phase
ignore_prefix set to 1 if cyclic prefix has not been removed (by the hardware)

void phy_phase_compensation ( short *  ref_sch,
short *  tgt_sch,
short *  out_sym,
int  ignore_prefix,
int  aa,
struct complex16 perror_out 
)

This function is used by the EMOS to compensate the phase rotation of the RF. It has been designed for symbols of type CHSCH or SCH, but cannot be used for the data channels.

Parameters:
ref_sch reference symbol
tgt_sch target symbol
out_sym output of the operation
ignore_prefix set to 1 if cyclic prefix has not been removed (by the hardware)
aa antenna index
perror_out phase error (output parameter)


Generated on Thu May 14 10:34:29 2009 for OPENAIR by  doxygen 1.4.7