AN 729: Implementing JESD204B IP Core System Reference Design with Nios II Processor

ID 683844
Date 5/04/2015
Public
Document Table of Contents

1.11.2. Functions in rules.c Source File

The rules enforced by the dynamic reconfiguration function to check validity of the reconfiguration values for each JESD204B parameter are coded as discrete functions in rules.c. In the table below, the transport layer rules are indicated by “TL:”. The function prototypes of the functions listed in the table below can be found in the rules.h header file located in the software file directory

Table 14.  rules.c
Function Prototype Parameters Rule/Function Description
int Min (int val1 , int val2) Returns the minimum of val1 and val2.
int L_Range (int val) L The value for L must be an integer within the range of 1-8.

Returns 0 if valid, 1 if invalid.

int L_Max (int val, int init) L The value for L must not exceed the initially configured value.

Returns 0 if valid, 1 if invalid.

int L_Even (int L_val, int F_val) L, F The value for L must be an even number if F = 1.

Returns 0 if valid, 1 if invalid.

int M_Range (int val) M The value for M must be an integer within the range of 1-32.

Returns 0 if valid, 1 if invalid.

int F_Range (int val) F The value for F must be an integer within the range of 1,2, 4-256 (any integer value between 1-256 except 3)

TL: The value for F must be an integer of the values 1, 2, 4, 8.

Returns 0 if valid, 1 if invalid.

int F_Max (int val, int init) F, M ,S, N', L The value for F must not exceed the initially configured value. By extension, since F is defined by the formula F = (M * S * N')/(8*L), the values for M, S, N' and L must be such that the new value for F not exceed the initial configured value.

Returns 0 if valid, 1 if invalid.

int F_Equal (int M_val, int S_val, int NP_val, int L_val, int F_val) F, M, S, N', L The values for M, S, N' and L must be such that the current value of F conforms to the formula F(current) = (M * S * N')/(8*L). If a new value of F is indicated, then F(current) = F(new). If not, then F(current) = F(initially configured).

Returns 0 if valid, 1 if invalid.

int S_Range (int val) S The value for S must be an integer within the range of 1-32.

Returns 0 if valid, 1 if invalid.

int N_Range (int val) N The value for N must be an integer within the range of 1-32.

TL: The value for N must be an integer within the range of 12-16.

Returns 0 if valid, 1 if invalid.

int N_Max (int val, int max) N The value for N must adhere to the range of N ≤ N'.

Returns 0 if valid, 1 if invalid.

int NP_Range (int val) N' The value for N' must be an integer within the range of 4-32.

Returns 0 if valid, 1 if invalid.

int CS_Range (int val) CS The value for CS must be an integer within the range of 0-3.

Returns 0 if valid, 1 if invalid.

int K_Range (int K_val, int F_val) K The value for K must be an integer within the range 17/F ≤ K ≤ min(32, floor(1024/F)).

Returns 0 if valid, 1 if invalid.

int FxK_Div_4 (int FxK_val) F, K The value of F * K must be divisible by 4.

Returns 0 if valid, 1 if invalid.

int Calc_FxK (int F_val, int K_val) Calculates F * K value and checks the FxK_Div_4 rule. If F * K is divisible by 4, return F * K value, else return 0.
Note: Error return value differs from the usual value.
int HD_Range (int val) High Density (HD) The value for HD must be either 0 or 1.

Returns 0 if valid, 1 if invalid.

int HD_Transport (int HD_val, int N_val) HD, N TL: The value for HD can be 1 if and only if N=16.

Returns 0 if valid, 1 if invalid.

int SCR_Range (int val) Scrambler Enable The value for SCR must be either 0 or 1.

Returns 0 if valid, 1 if invalid.

int SUB_Range (int val) Subclass The value for subclass must be 0, 1 or 2.

Returns 0 if valid, 1 if invalid.

int DR_Range (int val) Serial Data Rate The value for DR must be 1, 2, 4. DR value is integer divisor of initially configured serial data rate. For example, DR=2 means the initially configured data rate divided by 2.

Returns 0 if valid, 1 if invalid.

int DR_Min (int dr_init, int val) Serial Data Rate The value for DR must not fall below the minimum allowable range of the target device family. Minimum serial data rate spec:
  • Arria V GZ, Arria 10, Stratix V: 2 Gbps
  • Arria V: 1 Gbps
Refer to the JESD204B IP Core User Guide for the latest information on the minimum serial data rate spec. The minimum data rate value is defined by the DATA_RATE_MIN parameter in the main.h header file. You are responsible to ensure that the minimum data rate value for the target device is correctly set.

Returns 0 if valid, 1 if invalid.

int FC_Range (int val) Frame clock, serial data rate, M, S, N', L The values of serial data rate, M, S, N' and L must be such that the new frame clock value, FC(new) does not exceed the initially configured frame clock value, FC(initially configured). Furthermore, the ratio of FC(initially configured) to FC(new) must be 1, 2, 4 only.

Returns 0 if valid, 1 if invalid.

int Calc_FC (int M_val, int S_val, int NP_val, int L_val, int DR_div_val, int DR_init_val, int FC_init_val) Calculates the new frame clock value, FC(new) according to the following formula: FC(new) = (Serial data rate * L * 8) / (M * S * N' * 10) Calculates the ratio of initially configured frame clock value, FC(initially configured) to FC(new) and checks FC_Range rule (i.e 1, 2, 4). If ratio is within range, return ratio, else return 0.
Note: Error return value differs from the usual value.