svt_data_converter Class Reference

Inheritance diagram for class svt_data_converter:

List of all members.


Detailed Description

A utility class that encapsulates different conversions and calculations used across various protocols. Such as:

a) 8B10B ENCODING Methods are used to encode eight bit data into its ten bit representation, or decode ten bit data into its eight bit representation. The current running disparity must be provided to encode or decode the data properly, and the updated running disparity value is returned from these functions via a ref argument.

The 8b/10b and 10b/8b conversion methods utilize lookup tables instead of calculations for performance reasons. The data values represent the full 8-bit state space, but the K-code values only utilize a subset of the 8-bit state space. Therefore, the following K-code values are incorporated into the lookup tables:

b) CRC CALCULATIONS



Public Member Functions

function void  apply_byte_to_crc ( bit [7:0] value, bit init = 0 )
function bit  decode_8b10b_data ( input bit [9:0] data_in, ref bit running_disparity, output bit data_k, output bit [7:0] data_out )
function bit  encode_8b10b_data ( input bit [7:0] data_in, input bit data_k, ref bit running_disparity, output bit [9:0] data_out )
function bit  get_code_group ( input bit [9:0] value, output bit data_k, output string byte_name )
function bit [31:0]   get_crc ( )
function bit [31:0]   get_crc_initial_value ( )
function bit [31:0]   get_crc_polynomial ( )
function void  initialize_8b10b ( bit force_load = 0 )
function void  initialize_crc ( bit [31:0] poly, int width, bit [31:0] init, bit force_load = 0 )
function bit  is_valid_10b ( bit [9:0] value, logic disp_in = 1'bx )
function bit  is_valid_K8b ( byte unsigned value, logic disp_in = 1'bx )
function void  new ( vmm_log log )
function string  psdisplay_meta_info ( string prefix )
function void  scramble ( input byte unsigned array_in[], ref bit [15:0] lfsr, output byte unsigned array_out[] )
function void  set_crc_initial_value ( bit [31:0] init )
function void  set_crc_polynomial ( bit [31:0] poly )
function void  unscramble ( input byte unsigned array_in[], ref bit [15:0] lfsr, output byte unsigned array_out[] )

Public Attributes

vmm_log  log 

Protected Attributes

static protected bit [8:0]   lookup_table_8b [int] 
static protected bit [9:0]   lookup_table_D10b [512] 
static protected integer  lookup_table_disparity [int] 
static protected bit [9:0]   lookup_table_K10b [int] 


Member Function Documentation

  function void
 svt_data_converter::apply_byte_to_crc

 (  bit [7:0] value , bit init = 0  ) 


This methods applies a byte to the CRC algorithm.

value - Value to be applied to the CRC algorithm

init - Optional argument that signifies that the CRC value should be initialized before the value is applied.

  function bit
 svt_data_converter::decode_8b10b_data

 (  input bit [9:0] data_in , ref bit running_disparity , output bit data_k , output bit [7:0] data_out  ) 


Decodes a ten bit data value into its eight bit representation. The function returns 0 and the output is unpredictable.

data_in - Ten bit value to be decoded

running_disparity - The value provided to this argument determines whether the ten bit value is selected from the positive or negative disparity column. The value is updated with the disparity of the new ten bit value that is selected. If the encode operation fails then the value remains unchanged.

data_k - Flag that determines when the Ten bit data represents a control character.

data_out - Eight bit decoded data.

  function bit
 svt_data_converter::encode_8b10b_data

 (  input bit [7:0] data_in , input bit data_k , ref bit running_disparity , output bit [9:0] data_out  ) 


Encodes an eight bit data value into its ten bit representation. The function returns 0 and the output is unpredictable if Xs and Zs are passed in via the argument.

data_in - Eight bit value to be encoded.

data_k - Flag that determines when the eight bit data represents a control character.

running_disparity - The value provided to this argument determines whether the ten bit value is selected from the positive or negative disparity column. The value is updated with the disparity of the new ten bit value that is selected. If the encode operation fails then the value remains unchanged.

data_out - Ten bit encoded data.

  function bit
 svt_data_converter::get_code_group

 (  input bit [9:0] value , output bit data_k , output string byte_name  ) 


Returns the code group of the data value as a string and a data_k bit indicating if the 10 bit value is of type D-CODE or K-CODE. The function returns 0 if the value is not to be located in the tables.

value - Value to be looked up in the 10B table.

data_k - Bit indicating if the input value belongs to the D or K CODE.

byte_name - String code group name, sunch as D0.0 or K28.1.

  function bit [31:0]
 svt_data_converter::get_crc

 (   ) 


This method returns the calculated CRC value.

  function bit [31:0]
 svt_data_converter::get_crc_initial_value

 (   ) 


Utility method for getting the CRC initial value.

Return values - The CRC initial value.

  function bit [31:0]
 svt_data_converter::get_crc_polynomial

 (   ) 


Utility method for getting the crc polynomial value.

Return values - The CRC polynomial value.

  function void
 svt_data_converter::initialize_8b10b

 (  bit force_load = 0  ) 


This method initializes the 8b10b lookup tables.

force_load - Forces the 8b10b tables to be re-initialized.

  function void
 svt_data_converter::initialize_crc

 (  bit [31:0] poly , int width , bit [31:0] init , bit force_load = 0  ) 


This method initializes the CRC lookup table, saves the CRC width, and the initial CRC value.

poly - Polynomial used to initialize the CRC lookup table

width - Width of the CRC lookup table that is generated

init - The CRC value is initialized to this value

force_load - Forces the CRC algorithm to be re-initialized

  function bit
 svt_data_converter::is_valid_10b

 (  bit [9:0] value , logic disp_in = 1'bx  ) 


Returns true if the provided value is in the 10 bit lookup table. Otherwise returns false.

value - Value to be tested

disp_in - Optional disparity to test against. If this value is not provided, then the function returns true whether the value was found in the positive or negative disparity column.

  function bit
 svt_data_converter::is_valid_K8b

 (  byte unsigned value , logic disp_in = 1'bx  ) 


Returns true if the provided value is in the 8 bit control character lookup table. Otherwise returns false.

value - Value to be tested

disp_in - Optional disparity to test against. If this value is not provided, then the function returns true whether the value was found in the positive or negative disparity column.

  function void
 svt_data_converter::new

 (  vmm_log log  ) 


CONSTRUCTOR: Constructor for the svt_data_converter. This does not initialize any of the conversion packages. Individual converters (e.g., 8b10b, crc, etc.) must be initialized individually by the extended classes.

log - Required vmm_log used for message output.

  function string
 svt_data_converter::psdisplay_meta_info

 (  string prefix  ) 


Displays the meta information to a string. Each line of the generated output is preceded by prefix.

  function void
 svt_data_converter::scramble

 (  input byte unsigned array_in [], ref bit [15:0] lfsr , output byte unsigned array_out []  ) 


Function is used for scrambling a byte of data. Following rules are followed while implementing this function: 1) The LFSR implements the polynomial: G(X)=X^16+X^5+X^4+X^3+1 2) All D-codes and K-codes are scrambled. 3) There is no resetting of the LFSR under any condition.

array_in - An array that contains data to be scrambled.

lfsr - Sixteen bit value with which the function encodes the data. It is up to the entity calling this function to keep track of the lfsr value and to provide the correct lfsr value on the subsequent calls.

array_out - An array constaing the scrambled data.

  function void
 svt_data_converter::set_crc_initial_value

 (  bit [31:0] init  ) 


Utility method for setting the CRC initial value.

init - The new CRC initial value.

  function void
 svt_data_converter::set_crc_polynomial

 (  bit [31:0] poly  ) 


Utility method for setting the CRC polynomial value.

poly - The new CRC polynomial value.

  function void
 svt_data_converter::unscramble

 (  input byte unsigned array_in [], ref bit [15:0] lfsr , output byte unsigned array_out []  ) 


Function is used for unscrambling a byte of data. The function returns 0 and the output is unpredictable if Xs and Zs are passed in via the argument. Following rules are followed while implementing this function: 1) The LFSR implements the polynomial: G(X)=X^16+X^5+X^4+X^3+1 2) There is no resetting of the LFSR under any condition.

array_in - An array whose elements need to be unscrambled.

lfsr - Is the Sixteen bit value with which the function decodes the data. It is up to the entity calling this function to keep track of the lfsr value and to provide the correct lfsr value on the subsequent calls.

array_out - An array containing unscrambled data.


Member Attribute Documentation

 vmm_log  attribute
 svt_data_converter::log


Log instance that will be passed in from a derived class (through the constructor).

 static protected bit [8:0]   attribute
 svt_data_converter::lookup_table_8b[int]


Ten bit value to eight bit lookup table

 static protected bit [9:0]   attribute
 svt_data_converter::lookup_table_D10b[512]


Eight bit data value to ten bit lookup table

 static protected integer  attribute
 svt_data_converter::lookup_table_disparity[int]


Disparity lookup table (indexed by ten bit values)

 static protected bit [9:0]   attribute
 svt_data_converter::lookup_table_K10b[int]


Eight bit control value to ten bit lookup table