kennyruffles
Newbie level 2

My doubt is about the communication between modules using events on systemc language.
In the book SystemC: from the Ground up there is a chapter named The interrupt, a custom Primitive Channel, with the sample code below that do that:
------------------------------------------------------------------------
class eslx_interrupt_gen_if: public sc_interface {
public:
virtual void notify() = 0;
virtual void notify(sc_time t) = 0;
};
------------------------------------------------------------------------
class eslx_interrupt_evt_if: public sc_interface {
public:
virtual const sc_event& default_event() const = 0;
};
------------------------------------------------------------------------
#include "eslx_interrupt_evt_if.h"
#include "eslx_interrupt_gen_if.h"
class eslx_interrupt
: public sc_prim_channel
, public eslx_interrupt_evt_if
, public eslx_interrupt_gen_if
{
public:
// Constructors
explicit eslx_interrupt()
:sc_prim_channel(
sc_gen_unique_name("eslx_interrupt"))
{}//end constructor
explicit eslx_interrupt(sc_module_name nm)
:sc_prim_channel(nm)
{} //end constructor
// Methods
void notify() { m_interrupt.notify(); }
void notify(sc_time t) { m_interrupt.notify(t); }
const sc_event& default_event() const
{ return m_interrupt; }
private:
sc_event m_interrupt;
// Copy constructor so compiler won't create one
eslx_interrupt( const eslx_interrupt& rhs)
{} //end copy constructor
};
My question is: how can i use this code? I tried a declaration like sc_in<eslx_interrupt> port_event;
So i'll be very thankful for your help.
ps: I'm sorry for my bad english.
In the book SystemC: from the Ground up there is a chapter named The interrupt, a custom Primitive Channel, with the sample code below that do that:
------------------------------------------------------------------------
class eslx_interrupt_gen_if: public sc_interface {
public:
virtual void notify() = 0;
virtual void notify(sc_time t) = 0;
};
------------------------------------------------------------------------
class eslx_interrupt_evt_if: public sc_interface {
public:
virtual const sc_event& default_event() const = 0;
};
------------------------------------------------------------------------
#include "eslx_interrupt_evt_if.h"
#include "eslx_interrupt_gen_if.h"
class eslx_interrupt
: public sc_prim_channel
, public eslx_interrupt_evt_if
, public eslx_interrupt_gen_if
{
public:
// Constructors
explicit eslx_interrupt()
:sc_prim_channel(
sc_gen_unique_name("eslx_interrupt"))
{}//end constructor
explicit eslx_interrupt(sc_module_name nm)
:sc_prim_channel(nm)
{} //end constructor
// Methods
void notify() { m_interrupt.notify(); }
void notify(sc_time t) { m_interrupt.notify(t); }
const sc_event& default_event() const
{ return m_interrupt; }
private:
sc_event m_interrupt;
// Copy constructor so compiler won't create one
eslx_interrupt( const eslx_interrupt& rhs)
{} //end copy constructor
};
My question is: how can i use this code? I tried a declaration like sc_in<eslx_interrupt> port_event;
So i'll be very thankful for your help.
ps: I'm sorry for my bad english.
Last edited: