Code Search for Developers
 
 
  

router_fabric.h from GreenSocs at Krugle


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

GreenSocs

To develop SystemC infrustructure, basic IP, patches and add on library code for eventual standerdization.\r\nThe GreenSocs project is made up of a number of contributions (sub projects). Please visit www.greensocs.com for more information.

Project homepage: http://sourceforge.net/projects/greensocs
Programming language(s): C,C++,Java,Perl,XML
License: other

  class_wrapper.h
  description.h
  dust.h
  dust_model.h
  dust_model_and_introspection.h
  dust_model_and_transactions.h
  gs_config.h
  gs_config_parser.h
  gs_configurable.h
  gs_datatypes.h
  gs_dust_port.h
  gs_param.h
  gs_param_root.h
  gs_trace.h
  memoryutils.h
  payload_event_queue-new_buggy.h
  payload_event_queue.h
  phase_trace.h
  ref_count.h
  router_fabric.h