svt_fsm Class Reference

Inheritance diagram for class svt_fsm:

List of all members.


Detailed Description

Base class for describing protocol state machines



Public Member Functions

function void  abort ( )
virtual function void  build ( )
function bit  callback_client_exists ( )
function svt_fsm  create_fsm ( svt_type_factory_override_base typ, string name )
function void  exception ( svt_fsm_exception except )
virtual function string  get_name ( )
virtual function string  get_uid ( )
virtual function string  get_xml_name ( )
function void  goto_cb_exec ( svt_fsm_state_base from_state, svt_fsm_state_base to_state )
function svt_fsm_state_base  m_create_state ( svt_type_factory_override_base typ )
function void  m_init ( )
function void  new ( string name = "", uvm_report_object reporter = null )
function void  override_fsm ( svt_type_factory_override_base orig, svt_type_factory_override_base over )
function void  override_state ( svt_type_factory_override_base orig, svt_type_factory_override_base over )
virtual function void  print ( )
task   run ( )
function void  save_current_state_to_xml ( )
function void  set_name ( string name )
virtual function void  set_xml_writer ( svt_xml_writer xml_writer )
task   wait_for_state_transition ( output svt_fsm_state_base to_state )

Public Attributes

int  callback_client_exists_cache = -1; 
uvm_report_object  reporter 

Protected Member Functions

virtual function bit  is_viable_next_fsm_state ( svt_fsm_state_base test_next )
function void  set_done_state ( svt_fsm_state_base state )
function void  set_reset_state ( svt_fsm_state_base state )
function void  set_start_state ( svt_fsm_state_base state )
virtual task   wait_for_reset ( )


Member Function Documentation

  function void
 svt_fsm::abort

 (   ) 


Terminate the FSM. This will cause the run method to return.

 virtual function void
 svt_fsm::build

 (   ) 


The FSM states are created in extensions of this method, using the `svt_fsm_create_state macro.

  function bit
 svt_fsm::callback_client_exists

 (   ) 

  function svt_fsm
 svt_fsm::create_fsm

 (  svt_type_factory_override_base typ , string name  ) 


Create a sub-FSM instance of the specified type using the local factory. Should not be called directly. Rather, the `svt_fsm_create_fsm macro should be used instead.

  function void
 svt_fsm::exception

 (  svt_fsm_exception except  ) 


Should be called whenever an error is detected by the FSM implementation Calls all registered instances of the svt_fsm_callback :: exception method.

 virtual function string
 svt_fsm::get_name

 (   ) 


 Superseded functions 
 uvm_object :: get_name 

 virtual function string
 svt_fsm::get_uid

 (   ) 


This method can be used to obtain a unique identifier for a data object.

Return values - Unique identifier for the object.

 virtual function string
 svt_fsm::get_xml_name

 (   ) 


This method provides a name which can be used to establish a channel associated with this FSM in the XML output. If there are multiple FSMs this is needed to differentiate this FSM from the other FSMs in the XML file. As such it needs to be unique across the set of FSMs that will be included in the XML file.

If there is just one state machine, then it is unnecessary to provide a channel for the FSM in the XML. In this case get_xml_name can return an empty string. This will result in the channel field not being included in the XML output.

The default implementation uses get_name to obtain a representative name that can be used for the channel. This therefore supports there being multiple FSMs in the XML.

Return values - Name to be used to define a channel for the FSM in the XML output.

  function void
 svt_fsm::goto_cb_exec

 (  svt_fsm_state_base from_state , svt_fsm_state_base to_state  ) 


Function encapsulating actions that occur at the transition from current to next state, including calling the 'goto' callback.

 protected virtual function bit
 svt_fsm::is_viable_next_fsm_state

 (  svt_fsm_state_base test_next  ) 


Method which checks whether the provided fsm state can be reached directly from the current fsm state.

test_next - The state to be checked as a possible next state.

Return values - Indicates that this state is (1) or is not (0) a viable next state.

  function svt_fsm_state_base
 svt_fsm::m_create_state

 (  svt_type_factory_override_base typ  ) 


Create a state of the specified type using the factory. Should not be called directly. Rather, the `svt_fsm_create_state macro should be used instead.

  function void
 svt_fsm::m_init

 (   ) 


Initialize the FSM and it's states. Called automatically when run is called.

  function void
 svt_fsm::new

 (  string name = "", uvm_report_object reporter = null  ) 

  function void
 svt_fsm::override_fsm

 (  svt_type_factory_override_base orig , svt_type_factory_override_base over  ) 


Override the type of a sub-FSM for this FSM instance only. Must be called before the state that creates the sub-FSM is started.

  function void
 svt_fsm::override_state

 (  svt_type_factory_override_base orig , svt_type_factory_override_base over  ) 


Override a state type with another state type for this FSM instance only. Must be called before build is called.

 virtual function void
 svt_fsm::print

 (   ) 


Print a description of the FSM and its current state.

  task
 svt_fsm::run

 (   ) 


Start and run the FSM until it is aborted.

  function void
 svt_fsm::save_current_state_to_xml

 (   ) 


Function that can force the current state to get an end time and be forced out to XML.

 protected function void
 svt_fsm::set_done_state

 (  svt_fsm_state_base state  ) 


Define the final state of the FSM (optional). Should be called in an extension of build or run. The final state should be a dead-end state.

  function void
 svt_fsm::set_name

 (  string name  ) 


Set the name of the FSM instance

 Superseded functions 
 uvm_object :: set_name 

 protected function void
 svt_fsm::set_reset_state

 (  svt_fsm_state_base state  ) 


Define the reset state of the FSM (required if the start state is a dead-end state). Requires that wait_for_reset be implemented. Should be called in an extension of build or run.

 protected function void
 svt_fsm::set_start_state

 (  svt_fsm_state_base state  ) 


Define the start state of the FSM (required). Should be called in an extension of build or run. The start state is one of the state that can be a dead-end state.

 virtual function void
 svt_fsm::set_xml_writer

 (  svt_xml_writer xml_writer  ) 


Set the XML Writer, used to generate XML output at state transitions.

 protected virtual task
 svt_fsm::wait_for_reset

 (   ) 


Must be implemented if a reset state is defined. Automatically invoked by the run task, it must return only once the reset condition has been detected. The implementation must not call super.wait_for_reset.

  task
 svt_fsm::wait_for_state_transition

 (  output svt_fsm_state_base to_state  ) 


Wait for the FSM to transition state and return the state it just transitioned to. Returns NULL if the FSM was aborted.

Member Attribute Documentation

 int  attribute
 svt_fsm::callback_client_exists_cache = -1


Cached callback_client_exists return value used to accelerate callback processing.

 uvm_report_object  attribute
 svt_fsm::reporter