Services and Modeling for Embedded Software Development
Embecosm divider strip
Prev  Next

11.2.1.  JtagExtensionSC Extension Class Definition

The extension class is a subclass of the abstract SystemC template class tlm::tlm_extension

class JtagExtensionSC: public tlm::tlm_extension<JtagExtensionSC>
	  

The extension holds data on the JTAG access type required (reset, shift through the instruction register, shift through the data register) and the exact number of bits to be shifted. For long term compatibility a data field to request debug is added, although it is not used in this application note.

An enumeration type is specified to define the access type. This is public, since targets and initiators must be able to reference it.

  enum AccessType {
    RESET,
    SHIFT_IR,
    SHIFT_DR
  };
	  

The constructor initializes the data fields to appropriate default values (type RESET, bit size zero, debug disabled).

JtagExtensionSC ();
	  

It might be thought appropriate to have variants that could simultaneously initialize the arguments, allowing for easy dynamic allocation and destruction of extensions as needed. However allocation of the extension class is expensive in SystemC, and dynamic allocation is discouraged. Instead a single instance is typically allocated and reused.

Two virtual methods from the parent class must be implemented to allow instances to cloned and copied.

virtual tlm::tlm_extension_base* clone() const;
virtual void copy_from (tlm::tlm_extension_base const &ext);
	  

The public interface to the extension is through its accessors, a pair for each data field.

AccessType  getType () const;
void        setType (AccessType _type);

int         getBitSize () const;
void        setBitSize (int  _bitSize);

bool        getDebugEnabled () const;
void        setDebugEnabled (bool  _debugEnabled);
	  

The data itself is held privately within the class.

AccessType  type;
int         bitSize;
bool        debugEnabled;
	  

The definition of the SystemC generic payload extension class for JTAG, JtagExtensionSC, may be found in sys-models/jtag-soc/JtagExtensionSC.h in the distribution.

Embecosm divider strip