Jump to content
Sign in to follow this  

Recommended Posts

Dear all, 

I am new to payload extensions and I would appreciate a feedback on whether I am doing things right.. 

I need to declare a simple payload extension, including two additional fields: 

  • a reset value 
  • a 16 bit bit vector representing the value of a register

In the header, I simply declare the clone/copy from functions, plus my additional fields:

class reg_extension : public tlm::tlm_extension<reg_extension>{

  tlm::tlm_extension_base* clone() const ; 
  void copy_from(tlm::tlm_extension_base const &); 
  bool reset; 
  sc_bv<16> value; 

And then I implemented the functions, by taking care of the additional reset and value fields: 

  reset = false; 
  value = sc_bv<16>(0); 

tlm::tlm_extension_base * reg_extension::clone() const{
  cout<<"Executing clone!"<<endl;
  reg_extension * ext = new reg_extension();
  ext->reset = this->reset; 
  ext->value = this->value; 
  return ext;

void reg_extension::copy_from(tlm::tlm_extension_base const & ext){
  reset = static_cast<reg_extension const &>(ext).reset;  
  value = static_cast<reg_extension const &>(ext).value;  

Is this enough for the extension to work?
Best regards,


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this