Logo
NGFC_AWGN_Demo

Demo program for AWGN IP Core.

The Usage() function shows how to execute the test program, options available and default values set for different configuration variables. The Variables section specifies variables used in the test program, what they specify, the values it holds and can take. The main() function specifies sequence of api calls executed and tested.

Functions

void AWGNUsage ()
 
int main (int argc, char *argv[])
 

Variables

uint enable =1
 enable mode bit for the AWGN IP Core. Toggling the enable signal will cause the registers to revert to default power-on states. It takes values 0 or 1 and defaults to 1
 
uint activate =0
 output enable for the AWGN IP Core. Enable this after configuring the registers associated with api calls starting with C. It takes values 0 or 1 and defaults to 0
 
fpgawb_ipcore_t ip_core
 fpgawb_ipcore_t struct which stores useful information about the IP Core after executing get IP Info api call. Check fpgawb_lib.h or api call documentation for more information
 
int channel =-1
 Channel number for the AWGN IP Core Channel. It takes values 0 to (number of IP Core channels-1) and defaults to -1 (test program executed for all channels)
 
fpgawb_ipcore_awgn_seed_config_t seed_config
 fpgawb_ipcore_awgn_seed_config_t struct passed as argument for configure wheel api call. Check fpgawb_lib.h or api call documentation for more information
 
fpgawb_ipcore_awgn_noise_variance_scalar_config_t var_config
 fpgawb_ipcore_awgn_noise_variance_scalar_config_t struct passed as argument for configure wheel api call. Check fpgawb_lib.h or api call documentation for more information
 
uint config_mode =0
 Configuration mode for the test program. Indicates to run the program in configure mode or dynamic mode. It takes values 0-AWGN setup,Seed Values/1-Dynamic parameters(Direct Values or SNR dB). It defaults to 0.
 
uint change_seed_0 =0
 change_seed_0 allows the starting seed for output 0 to be changed and takes values of 0 or 1. It defaults to 0
 
uint change_seed_1 =0
 change_seed_1 allows the starting seed for output 1 to be changed and takes values of 0 or 1. It defaults to 0
 
uint seed0 =1
 seed0 is the starting seed for output 0 and takes values from 1 to 0xFFFFFFFF.
 
uint seed1 =1
 seed1 is the starting seed for output 1 and takes values from 1 to 0xFFFFFFFF.
 
uint change_scalar_0 =0
 change_scalar_0 allows the variance scalar for output 0 to be changed and takes values of 0 or 1. It defaults to 0
 
uint change_scalar_1 =0
 change_scalar_1 allows the variance scalar for output 0 to be changed and takes values of 0 or 1. It defaults to 0
 
double snr_db_0 =0
 snr_db_0 is the signal to noise ratio (dB) for output 0 and takes positive values. It defaults to 0
 
double snr_db_1 =0
 snr_db_1 is the signal to noise ratio (dB) for output 1 and takes positive values. It defaults to 0
 
double noise_var_scalar_0 =0
 noise_var_scalar_0 is the value to be used as the noise variance scalar for output 0 and takes values from 0 to 2-2^(-15). It defaults to 0
 
double noise_var_scalar_1 =0
 noise_var_scalar_1 is the value to be used as the noise variance scalar for output 1 and takes values from 0 to 2-2^(-15). It defaults to 0
 
uint config_mode =0
 Configuration mode for the test program. Indicates to run the program in configure mode (with reset) or dynamic mode (without reset). It takes values 0-Reset PID Controller and 1-No reset. It defaults to 0.
 

Function Documentation

void AWGNUsage ( )

Usage:
./fpgawb_ipcore_awgn [-A Activate] [-b Board] [-c ChannelNumber] [-C ConfigMode] [-e Enable] [-d0 direct_input_0] [-d1 direct_input_1] [-r0 snr_db_0] [-r1 snr_db_1] [-s0 seed_0] [-s1 seed_1]

Options Default value
-A Activate (0/1) 0
-b Board Number 0
-c Channel Number (0-(Numchans-1) -1 (all channels)
-C Config (0/1) 0
-d0 Direct Scalar 0 (0:2-2^(-15)) 0
-d1 Direct Scalar 0 (0:2-2^(-15)) 0
-e Enable (0/1) 0
-r0 SNR dB 0 (dB) 0
-r1 SNR dB 1 (dB) 0
-s0 Seed 0 (~0:0xFFFFFFFF) FW Default
-s1 Seed 1 (~0:0xFFFFFFFF) FW Default

NOTE: Omission of a seed parameter will leave the seed value as the firmware default or previous value.
NOTE: Using both SNRdB and Direct Noise Variance Scalar for one output is prohibited. Using neither will leave that output's scalar unchanged.

Examples:
SETUP: ./fpgawb_ipcore_awgn -C 0 -b 0 -s0 0x3FFFFFFF -s1 0x13451345
RUNTIME:./fpgawb_ipcore_awgn -C 1 -b 0 -r0 1.2 -r1 0.5
===
SETUP: ./fpgawb_ipcore_awgn -C 0 -b 0 -s1 87AFFE34
RUNTIME: ./fpgawb_ipcore_awgn -C 1 -b 0 -r0 0.3 -d1 1.37

int main ( int  argc,
char *  argv[] 
)

Step 1: OPEN DEVICE
ccrtNGFC_Open(&handle,board_no,oflags)
Before using any API calls, the user needs to open the device and get a handle. This handle is then used as the first argument in most of the following APIs.

Step 2: GET DRIVER INFO
ccrtNGFC_Get_Driver_Info(handle, &binfo)
This call returns useful driver information and saves in the ccrtngfc_driver_info_t structure for later use.

Step 3: GET LIBRARY INFO
ccrtNGFC_Get_Library_Info(handle, &linfo)
This call returns useful library information and saves in the ccrtngfc_library_info_t structure for later use.

Step 4: GET IP INFO
fpgawb_AWGN_Get_Ip_Info(handle, &ip_core)
This call returns useful IP Core information and saves in the fpgawb_ipcore_t structure for later use.

Step 5: ACTIVATE AWGN CHANNEL
fpgawb_AWGN_Activate_Ch(handle,chan,enable,activate)
This call activates the AWGN IP Core Channel. Note to set activate to 0 because we will be using the Configuration api calls which requires activate be 0. The default for activate is 0 in this test program. It is set to 1 at the end.

Step 6: CONFIGURE SEED PARAMETERS
C_fpgawb_AWGN_Set_Ch_Seeds(handle,chan,&seed_config)
This call

Step 11: ACTIVATE AWGN
fpgawb_AWGN_Activate(handle,chan,enable,activate)
This call activates the AWGN IP Core channel. Note to set the activate to 1 to start running the AWGN IP Core.

Step 16: CLOSE DEVICE
ccrtNGFC_Close(handle)
Closes the device with the handle