• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

sst/elements/bus/bus.h

00001 // Copyright 2009-2010 Sandia Corporation. Under the terms
00002 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
00003 // Government retains certain rights in this software.
00004 // 
00005 // Copyright (c) 2009-2010, Sandia Corporation
00006 // All rights reserved.
00007 // 
00008 // This file is part of the SST software package. For license
00009 // information, see the LICENSE file in the top level directory of the
00010 // distribution.
00011 
00012 
00013 #ifndef _BUS_H
00014 #define _BUS_H
00015 
00016 #include <sst/core/component.h>
00017 #include <sst/core/log.h>
00018 #include <sst/elements/include/memoryChannel.h>
00019 #include <sst/elements/include/memMap.h>
00020 
00021 #ifndef BUS_DBG
00022 #define BUS_DBG 0
00023 #endif
00024 
00025 using namespace SST;
00026 
00027 class Bus : public Component
00028 {
00029     private: // types
00030         class Device;
00031         typedef MemoryChannel< uint64_t, Device* >     devChan_t;
00032         typedef devChan_t::event_t      event_t;
00033         typedef devChan_t::addr_t       addr_t;
00034         typedef devChan_t::cookie_t     cookie_t;
00035         typedef uint64_t                length_t;
00036         typedef MemMap< addr_t, length_t, Device* >  memMap_t; 
00037 
00038         class Device {
00039 
00040             public:
00041                 Device( Component& comp, std::string name, Params_t ); 
00042                 void clock( Cycle_t );
00043                 bool send( event_t*, cookie_t );
00044                 Cycle_t timeStamp();
00045                 event_t* getReq();
00046                 Bus::event_t::reqType_t doResp();
00047 
00048             private:
00049                 typedef std::pair< event_t*, cookie_t >  respE_t;
00050                 typedef std::pair< event_t*, Cycle_t >   reqE_t;
00051 
00052                 reqE_t                  m_req;
00053                 devChan_t*              m_devChan;
00054                 Log< BUS_DBG >&         m_dbg;
00055                 std::string             m_name;
00056         }; 
00057 
00058         struct AtBat {
00059             bool        valid;
00060             event_t*    event;
00061             Device*     srcDev;
00062             Device*     dstDev;
00063         }; 
00064 
00065     public: // functions
00066 
00067         Bus( ComponentId_t id, Params_t& params );
00068         void initDevices( Params_t& params );
00069         void initDevice( std::string name, Params_t& params );
00070 
00071     private: // functions
00072 
00073             Bus();
00074         Bus( const Bus& c );
00075 
00076         bool clock( Cycle_t );
00077         bool doRead( event_t*, Device* src, Device* dst );
00078         bool doWrite( event_t*, Device* src, Device* dst );
00079         
00080     private: // data
00081 
00082         bool                    m_readBusy;
00083         bool                    m_writeBusy;
00084         memMap_t                m_memMap;
00085         AtBat                   m_atBat;
00086         Log< BUS_DBG >&         m_dbg;
00087         Log<>&                  m_log;
00088 };
00089 
00090 #endif

Generated on Fri Oct 22 2010 11:02:21 for SST by  doxygen 1.7.1