Show router_fabric.h syntax highlighted
#ifndef __router_fabric_h__
#define __router_fabric_h__
#include "systemc.h"
/**
* \file router_fabric.h For each bus functional model in the GreenBus framework,
* this file contains a convenience create method. These methods are used
* by the configuration framework to created busses specified in the configuration file.
*
* To add a new bus, three things are important:
* 1. import all header files that are required by your bus
* 2. add a line ADDBUS(yourBusName, yourBusProtocolClass, yourBusSchedulerClass) below.
* 3. add a line busmap["yourBusName"] = create_yourBusName; in the createBusMap function below.
*
*/
// the generic router
#include "router/genericRouter.h"
//------------------------------------------------------------------------------
// Bus packages include files
//------------------------------------------------------------------------------
// SimpleBus
#include "router/protocol/SimpleBus/simpleBusProtocol.h"
#include "router/scheduler/fixedPriorityScheduler.h"
// PLB
#include "protocol/PLB.h"
#include "router/protocol/PLB/PLBBusProtocol.h"
#include "router/scheduler/dynamicPriorityScheduler.h"
//------------------------------------------------------------------------------
// Bus definitions
//------------------------------------------------------------------------------
#define ADDBUS(name, protocol, scheduler) \
void create_##name (sc_module_name &busname, sc_time &t) { \
string pname(busname); pname += "_protocol"; \
string sname(busname); sname += "_scheduler"; \
protocol *p = new protocol(pname.c_str(), t); \
scheduler *s = new scheduler(sname.c_str(), t); \
GenericRouter *r = new GenericRouter(busname); \
r->protocol_port(*p); \
p->router_port(*r); \
p->scheduler_port(*s); \
} \
ADDBUS(SimpleBus, SimpleBusProtocol, fixedPriorityScheduler)
ADDBUS(PLB, PLBBusProtocol, dynamicPriorityScheduler)
//------------------------------------------------------------------------------
// Create bus map
//------------------------------------------------------------------------------
typedef map<string, void(*)(sc_module_name&, sc_time&)> busmap;
busmap *create_busmap() {
busmap *m = new busmap();
// add bus create functions to busmap
(*m)["SimpleBus"] = create_SimpleBus;
(*m)["PLB"] = create_PLB;
return m;
}
#endif
See more files for this project here