svt_8b10b_data Class Reference

Inheritance diagram for class svt_8b10b_data:

List of all members.


Detailed Description

A utility class that encapsulates an individual unit of transfer in an 8b/10b encoding protocol. The object can be initialized with either eight bit data or ten bit data. Methods are present on the object 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:



Public Member Functions

virtual function vmm_data  allocate ( )
virtual function unsigned int  byte_pack ( ref logic [7:0] bytes[], input int unsigned offset, input int kind )
function unsigned int  byte_size ( int kind = -1 )
virtual function unsigned int  byte_unpack ( const ref logic [7:0] bytes[], input int unsigned offset, input int len, input int kind )
virtual function bit  compare ( vmm_data to, output string diff, input int kind )
virtual function vmm_data  copy ( vmm_data to = null )
function bit  decode_data ( bit [9:0] value, ref bit RD )
function bit  decode_prop_val ( string prop_name, bit [1023:0] prop_val, ref string prop_val_string, input svt_pattern_data :: type_enum typ )
function void  do_all ( vmm_data :: do_what_e do_what, ref logic [7:0] pack[], const ref logic [7:0] unpack[] )
function svt_pattern  do_allocate_pattern ( )
function unsigned int  do_byte_pack ( ref logic [7:0] bytes[], input int unsigned offset, input int kind = -1 )
function unsigned int  do_byte_unpack ( const ref logic [7:0] bytes[], input int unsigned offset, input int len, input int kind )
function bit  do_compare ( vmm_data to, output string diff, input int kind )
function bit  do_is_valid ( bit silent = 1, int kind = -1 )
function bit  encode_data ( bit [7:0] value, ref bit RD )
function bit  encode_kcode ( bit [7:0] value, ref bit RD )
function bit  encode_prop_val ( string prop_name, string prop_val_string, ref bit [1023:0] prop_val, input svt_pattern_data :: type_enum typ )
function string  get_code_group ( )
function string  get_mcd_class_name ( )
function bit  get_prop_val ( string prop_name, ref bit [1023:0] prop_val, input int array_ix, ref svt_data data_obj )
virtual function bit  is_valid ( bit silent = 1, int kind = -1 )
function bit  is_valid_10b ( bit [9:0] value, logic disp_in = 1'bx )
function bit  is_valid_K8b ( bit [7:0] value, logic disp_in = 1'bx )
function bit [8:0]   lookup_8b ( bit [9:0] value, bit disp_in )
function bit [9:0]   lookup_D10b ( bit [7:0] value, bit disp_in )
function bit [9:0]   lookup_K10b ( bit [7:0] value, bit disp_in )
virtual function string  psdisplay ( string prefix = "" )
function string  psdisplay_meta_info ( string prefix = "" )
function string  psdisplay_short ( string prefix = "", bit hdr_only = 0 )
function int  reasonable_constraint_mode ( bit on_off )
function bit  set_prop_val ( string prop_name, bit [1023:0] prop_val, int array_ix )
function void  new ( vmm_log log = null, string suite_name = "" )

Public Attributes

rand bit [9:0]   data_10bit 
rand bit [7:0]   data_8bit 
rand bit  data_k 
svt_transaction :: status_enum  status 

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] 
static protected svt_8b10b_data  __vmm_rhs 

Constraints

constraint  reasonable_data_10bit  ( )
constraint  reasonable_data_8bit  ( )


Member Function Documentation

 virtual function vmm_data
 svt_8b10b_data::allocate

 (   ) 


 Superseded functions 
 vmm_data :: allocate 
 svt_data :: allocate 
 svt_transaction :: allocate 

 virtual function unsigned int
 svt_8b10b_data::byte_pack

 (  ref logic [7:0] bytes [], input int unsigned offset , input int kind  ) 


 Superseded functions 
 vmm_data :: byte_pack 
 svt_data :: byte_pack 
 svt_transaction :: byte_pack 

  function unsigned int
 svt_8b10b_data::byte_size

 (  int kind = -1  ) 


Returns the size (in bytes) required by the byte_pack operation. If protocol defines physical representation for transaction then -1 kind does RELEVANT byte_size calculation. If not, -1 kind results in an error. svt_data :: COMPLETE always results in COMPLETE byte_size calculation.

 Superseded functions 
 vmm_data :: byte_size 
 svt_data :: byte_size 
 svt_transaction :: byte_size 

 virtual function unsigned int
 svt_8b10b_data::byte_unpack

 (  const ref logic [7:0] bytes [], input int unsigned offset , input int len , input int kind  ) 


 Superseded functions 
 vmm_data :: byte_unpack 
 svt_data :: byte_unpack 
 svt_transaction :: byte_unpack 

 virtual function bit
 svt_8b10b_data::compare

 (  vmm_data to , output string diff , input int kind  ) 


 Superseded functions 
 vmm_data :: compare 
 svt_data :: compare 
 svt_transaction :: compare 

 virtual function vmm_data
 svt_8b10b_data::copy

 (  vmm_data to = null  ) 


 Superseded functions 
 vmm_data :: copy 
 svt_data :: copy 
 svt_transaction :: copy 

  function bit
 svt_8b10b_data::decode_data

 (  bit [9:0] value , ref bit RD  ) 


Decodes a ten bit data value into its eight bit representation. The data_8bit, data_k, and data_10bit values are updated as a result of calling this function. The function returns 0 and no properties are updated if Xs or Zs are passed in via the arguments, or if the value that is passed in is not in the 10b/8b lookup table.

value - Ten bit value to be decoded

RD - 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.

  function bit
 svt_8b10b_data::decode_prop_val

 (  string prop_name , bit [1023:0] prop_val , ref string prop_val_string , input svt_pattern_data :: type_enum typ  ) 


Simple utility used to convert 'bit [1023:0]' property value representation into its equivalent string property value representation. If provided the type is used by the default implementation to choose an appropriate conversion method. If the type is specified as UNDEF then the the field is assumed to be an int field and the string is assumed to be an ascii int representation. Derived classes can extend this method to support other field representations such as strings, enums, bitvecs, etc.

prop_name - The name of the property being decoded.

prop_val - The bit vector decoding of prop_val_string.

prop_val_string - The resulting decoded value.

typ - Optional field type used to help in the decode effort.

Return values - Status indicating the success/failure of the decode.


 Superseded functions 
 svt_data :: decode_prop_val 
 svt_transaction :: decode_prop_val 

  function void
 svt_8b10b_data::do_all

 (  vmm_data :: do_what_e do_what , ref logic [7:0] pack [], const ref logic [7:0] unpack []  ) 


 Superseded functions 
 vmm_data :: do_all 
 svt_data :: do_all 
 svt_transaction :: do_all 

  function svt_pattern
 svt_8b10b_data::do_allocate_pattern

 (   ) 


HDL Support: This method allocates a pattern containing svt_pattern_data instances for all of the primitive data fields in the object. The svt_pattern_data :: name is set to the corresponding field name, the svt_pattern_data :: value is set to 0.

Return values - An svt_pattern instance containing entries for all of the data fields.


 Superseded functions 
 svt_data :: do_allocate_pattern 
 svt_transaction :: do_allocate_pattern 

  function unsigned int
 svt_8b10b_data::do_byte_pack

 (  ref logic [7:0] bytes [], input int unsigned offset , input int kind = -1  ) 


Packs the object into the bytes buffer, beginning at offset. If protocol defines physical representation for transaction then -1 kind does RELEVANT byte_pack. If not, -1 kind results in an error. svt_data :: COMPLETE always results in COMPLETE byte_pack.

 Superseded functions 
 vmm_data :: do_byte_pack 
 svt_data :: do_byte_pack 
 svt_transaction :: do_byte_pack 

  function unsigned int
 svt_8b10b_data::do_byte_unpack

 (  const ref logic [7:0] bytes [], input int unsigned offset , input int len , input int kind  ) 


Unpacks the object from the bytes buffer, beginning at offset. If protocol defines physical representation for transaction then -1 kind does RELEVANT byte_unpack. If not, -1 kind results in an error. svt_data :: COMPLETE always results in COMPLETE byte_unpack.

 Superseded functions 
 vmm_data :: do_byte_unpack 
 svt_data :: do_byte_unpack 
 svt_transaction :: do_byte_unpack 

  function bit
 svt_8b10b_data::do_compare

 (  vmm_data to , output string diff , input int kind  ) 


Compares the object with to. Differences are placed in diff. Only supported kind values are -1 and svt_data :: COMPLETE. If protocol defines physical representation for transaction then -1 does RELEVANT compare. If not, -1 does COMPLETE (i.e., all fields checked) compare. svt_data :: COMPLETE always results in COMPLETE compare.

 Superseded functions 
 vmm_data :: do_compare 
 svt_data :: do_compare 
 svt_transaction :: do_compare 

  function bit
 svt_8b10b_data::do_is_valid

 (  bit silent = 1, int kind = -1  ) 


Checks to see that the data field values are valid, focusing mainly on checking/enforcing valid_ranges constraint. Only supported kind values are -1 and svt_data :: COMPLETE. If protocol defines physical representation for transaction then -1 does RELEVANT is_valid. If not, -1 does COMPLETE (i.e., all fields checked) is_valid. svt_data :: COMPLETE always results in COMPLETE is_valid.

 Superseded functions 
 vmm_data :: do_is_valid 
 svt_data :: do_is_valid 
 svt_transaction :: do_is_valid 

  function bit
 svt_8b10b_data::encode_data

 (  bit [7:0] value , ref bit RD  ) 


Encodes an eight bit data value into its ten bit representation. The data_8bit, data_k, and data_10bit values are updated as a result of calling this function. The function returns 0 and no properties are updated if Xs or Zs are passed in via the arguments.

value - Eight bit value to be encoded

RD - 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. value

  function bit
 svt_8b10b_data::encode_kcode

 (  bit [7:0] value , ref bit RD  ) 


Encodes an eight bit control value into its ten bit representation. The data_8bit, data_k, and data_10bit values are updated as a result of calling this function. The function returns 0 and no properties are updated if Xs or Zs are passed in via the arguments, or if the value passed in is not in the 8b/10b lookup table.

value - Eight bit value to be encoded

RD - 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.

  function bit
 svt_8b10b_data::encode_prop_val

 (  string prop_name , string prop_val_string , ref bit [1023:0] prop_val , input svt_pattern_data :: type_enum typ  ) 


Simple utility used to convert string property value representation into its equivalent 'bit [1023:0]' property value representation. If provided the type is used by the default implementation to choose an appropriate conversion method. If the type is specified as UNDEF then the the field is assumed to be an int field and the string is assumed to be an ascii int representation. Derived classes can extend this method to support other field representations such as strings, enums, bitvecs, etc.

prop_name - The name of the property being encoded.

prop_val_string - The string describing the value to be encoded.

prop_val - The bit vector encoding of prop_val_string.

typ - Optional field type used to help in the encode effort.

Return values - Status indicating the success/failure of the encode.


 Superseded functions 
 svt_data :: encode_prop_val 
 svt_transaction :: encode_prop_val 

  function string
 svt_8b10b_data::get_code_group

 (   ) 


Returns the code group of the data value as a string

  function string
 svt_8b10b_data::get_mcd_class_name

 (   ) 


Returns the class name for the object.

 Superseded functions 
 svt_data :: get_mcd_class_name 

  function bit
 svt_8b10b_data::get_prop_val

 (  string prop_name , ref bit [1023:0] prop_val , input int array_ix , ref svt_data data_obj  ) 


HDL Support: For read access to public data members of this class.

 Superseded functions 
 svt_data :: get_prop_val 
 svt_transaction :: get_prop_val 

 virtual function bit
 svt_8b10b_data::is_valid

 (  bit silent = 1, int kind = -1  ) 


 Superseded functions 
 vmm_data :: is_valid 
 svt_data :: is_valid 
 svt_transaction :: is_valid 

  function bit
 svt_8b10b_data::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_8b10b_data::is_valid_K8b

 (  bit [7:0] 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 bit [8:0]
 svt_8b10b_data::lookup_8b

 (  bit [9:0] value , bit disp_in  ) 


Access to the 10b lookup tables without disparity calculations. These are added to make expressing constraints possible when VCS supports this feature.

value - Value to be applied to the lookup table

disp_in - Disparity column that the 8 bit value will be returned from

  function bit [9:0]
 svt_8b10b_data::lookup_D10b

 (  bit [7:0] value , bit disp_in  ) 


Access to the D8b lookup tables without disparity calculations. These are added to make expressing constraints possible when VCS supports this feature.

value - Value to be applied to the lookup table

disp_in - Disparity column that the 10 bit value will be returned from

  function bit [9:0]
 svt_8b10b_data::lookup_K10b

 (  bit [7:0] value , bit disp_in  ) 


Access to the K8b lookup tables without disparity calculations. These are added to make expressing constraints possible when VCS supports this feature.

value - Value to be applied to the lookup table

disp_in - Disparity column that the 10 bit value will be returned from

 virtual function string
 svt_8b10b_data::psdisplay

 (  string prefix = ""  ) 


 Superseded functions 
 vmm_data :: psdisplay 
 svt_data :: psdisplay 
 svt_transaction :: psdisplay 

  function string
 svt_8b10b_data::psdisplay_meta_info

 (  string prefix = ""  ) 


Displays the meta information to a string. Each line of the generated output is preceded by prefix. Extends class flexibility in choosing what meta information should be displayed.

 Superseded functions 
 svt_transaction :: psdisplay_meta_info 

  function string
 svt_8b10b_data::psdisplay_short

 (  string prefix = "", bit hdr_only = 0  ) 


Returns a string (with no line feeds) that reports the essential contents of the transaction generally necessary to uniquely identify that transaction.

prefix - (Optional: default = "") The string given in this argument becomes the first item listed in the value returned. It is intended to be used to identify the transactor (or other source) that requested this string. This argument should be limited to 8 characters or less (to accommodate the fixed column widths in the returned string). If more than 8 characters are supplied, only the first 8 characters are used.

hdr_only - (Optional: default = 0) If this argument is supplied, and is '1', the function returns a 3-line table header string, which indicates which transaction data appears in the subsequent columns. If this argument is '1', the prefix argument becomes the column label for the first header column (still subject to the 8 character limit).


 Superseded functions 
 svt_transaction :: psdisplay_short 

  function int
 svt_8b10b_data::reasonable_constraint_mode

 (  bit on_off  ) 


Method to turn reasonable constraints on/off as a block.

 Superseded functions 
 svt_data :: reasonable_constraint_mode 

  function bit
 svt_8b10b_data::set_prop_val

 (  string prop_name , bit [1023:0] prop_val , int array_ix  ) 


HDL Support: For write access to public data members of this class.

 Superseded functions 
 svt_data :: set_prop_val 
 svt_transaction :: set_prop_val 

  function void
 svt_8b10b_data::new

 (  vmm_log log = null, string suite_name = ""  ) 


CONSTRUCTOR: Create a new transaction instance, passing the appropriate argument values to the vmm_data parent class.

log - Sets the log file that is used for status output.

suite_name - A String that identifies the product suite to which the transaction object belongs.


 Superseded functions 
 svt_data :: new 
 svt_transaction :: new 


Member Attribute Documentation

 rand bit [9:0]   attribute
 svt_8b10b_data::data_10bit


Ten bit representation of the data

This property is declared rand, but the rand_mode is disabled in the constructor.

 rand bit [7:0]   attribute
 svt_8b10b_data::data_8bit


Eight bit representation of the data

This property is declared rand, but the rand_mode is disabled in the constructor.

 rand bit  attribute
 svt_8b10b_data::data_k


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

This property is declared rand, but the rand_mode is disabled in the constructor.

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


Ten bit value to eight bit lookup table

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


Eight bit data value to ten bit lookup table

 static protected integer  attribute
 svt_8b10b_data::lookup_table_disparity[int]


Disparity lookup table (indexed by ten bit values)

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


Eight bit control value to ten bit lookup table

 svt_transaction :: status_enum  attribute
 svt_8b10b_data::status = INITIAL


Status information about the current processing state

 static protected svt_8b10b_data  attribute
 svt_8b10b_data::__vmm_rhs


Member Constraint Documentation

  constraint
 svt_8b10b_data::reasonable_data_10bit


Ensures that the 10 bit representation matches the 8 bit representation with either positive or negative disparity

Note: Functions in constraints won't be supported until VCS 2008.03, so this constraint is commented out for now.


constraint reasonable_data_10bit {
    /*
    if (data_k == 1'b0) {
      data_10bit inside { lookup_D10b(data_8bit, 1'b0), lookup_D10b(data_8bit, 1'b1) };
    }
    else {
      data_10bit inside { lookup_K10b(data_8bit, 1'b0), lookup_K10b(data_8bit, 1'b1) };
    }
    */
  }

  constraint
 svt_8b10b_data::reasonable_data_8bit


Ensures that the 8 bit representation matches the 10 bit representation and if the data represents a control character, then the constraint ensures that a valid control character is selected

Note: Functions in constraints won't be supported until VCS 2008.03, so this constraint is commented out for now.


constraint reasonable_data_8bit {
    /*
    {data_k, data_8bit} inside { lookup_8b(data_10bit, 1'b0), lookup_8b(data_10bit, 1'b1) };
     if (data_k == 1'b1) {
      lookup_table_K10b.exists(data_8bit);
    }
    */
  }