Quantcast
Channel: SystemC Language Forum RSS Feed
Viewing all articles
Browse latest Browse all 595

Newbie sc_signal<class T> creation problem

$
0
0

Hi,

I'm a newbie with systemc and using it for design.

I want to implement a class representing a generic register file which requires a mandatory parameter NUM_REGS in its constructor.

I want to then contain this register file inside sc_signal<> to allow event handling.

The reg_files header looks something like this (simplified version):

#include<systemc.h>

class reg_file
{
   private:
   sc_uint<8> *reg_set;

   public:
   unsigned REG_NUMS;

   reg_file(const unsigned numberOfRegs)
   {
      REG_NUMS = numberOfRegs;
      reg_set = new sc_uint<8> [REG_NUMS];
   }

   ~reg_file()
   {
      delete reg_set;
   }
}; 

I want to contain the objects of this class in sc_signal by passing numberOfRegs as as a parameter during a creation of the the signal like this:

sc_signal<reg_file> tmr_regs;     // Where to pass numberOfRegs?

Viewing all articles
Browse latest Browse all 595

Trending Articles