Show dust.h syntax highlighted
/**
* You should not include this file. Use one of the following:
*
* dust_model.h - structure reflection
* dust_model_and_transactions - structure reflection and transaction monitoring
* dust_model_and_introspection - structure reflection, transaction monitoring, and full data introspection
*
*/
/*
Copyright (c) 2006 : Technical University of Braunschweig, Germany
All rights reserved.
Authors: Wolfgang Klingauf, TU Braunschweig, E.I.S.
<klingauf@eis.cs.tu-bs.de>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer. Redistributions
in binary form must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution. Neither the name of
the Technical University of Braunschweig, Germany nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __dust_h__
#define __dust_h__
#if defined(__GENERIC_H__) || defined(PAYLOAD_EVENT_QUEUE_H) || defined(__ATTRIBUTES_H__) || defined(__BASICPORTS_H__) || defined(__CLASS_WRAPPER_H__) || defined(_GS_DUST_PORT_H_) || defined(__shipAPI_h__) || defined(__TLM_PORT_H__)
#error The dust inlcude HAS TO be included prior to all other inlcudes, because many includes depend on the definitions made inside the dust include!
#endif
#define DUST_ENABLE
#include <string>
//---------------------------------------------------------------------------------
// DUST Makro definitions for design interpretation
//---------------------------------------------------------------------------------
// include dust headers for users convenience
# include "xml_log/static_model/model_builder.h"
# include "xml_log/tr_model/tr_listener.h"
# define DUST_RECORD_STRUCTURE model_builder mb(true);
typedef struct extended_attr {
std::string kind;
std::string protocol;
std::string direction;
};
# define DUST_ATTRIBUTE(a,b,c,d) extended_attr attrib; \
attrib.kind = b; \
attrib.protocol = c; \
attrib.direction = d; \
sc_attribute<extended_attr> *attr; \
attr = new sc_attribute<extended_attr>(a, attrib); \
sc_module::add_attribute(*attr);
# define DUST_MASTER_PORT(a,b) DUST_ATTRIBUTE(a, "DUST_PORT", b, "Master");
# define DUST_SLAVE_PORT(a,b) DUST_ATTRIBUTE(a, "DUST_PORT", b, "Slave");
# define DUST_BUS(a) DUST_ATTRIBUTE(a, "DUST_BUS", "", "");
# define DUST_MASTER_MODULE(a,b) DUST_ATTRIBUTE(a, "DUST_MODULE", b, "Master");
# define DUST_SLAVE_MODULE(a,b) DUST_ATTRIBUTE(a, "DUST_MODULE", b, "Slave");
# define DUST_PROTOCOL(a) DUST_ATTRIBUTE(a, "DUST_PROTOCOL", "", "");
# define DUST_SCHEDULER(a) DUST_ATTRIBUTE(a, "DUST_SCHEDULER", "", "");
# define DUST_PORT(a,b) DUST_ATTRIBUTE(a, "DUST_PORT", b, "");
# define DUST_BRIDGE(a) DUST_ATTRIBUTE(a, "DUST_BRIDGE", "", "");
//---------------------------------------------------------------------------------
// Further includes (don't change position in the code!)
//---------------------------------------------------------------------------------
//this one will include scv.h
#include "protocol/generic.h"
#include "gstlm/attributes.h"
//---------------------------------------------------------------------------------
// SCV extensions for the TransactionContainer
//---------------------------------------------------------------------------------
using namespace tlm;
SCV_ENUM_EXTENSIONS(GenericSRespType){
public:
SCV_ENUM_CTOR(GenericSRespType){
SCV_ENUM(Generic_SRESP_NULL);
SCV_ENUM(Generic_SRESP_DVA);
SCV_ENUM(Generic_SRESP_FAIL);
SCV_ENUM(Generic_SRESP_ERR);
}
};
SCV_ENUM_EXTENSIONS(GenericMCmdType){
public:
SCV_ENUM_CTOR(GenericMCmdType){
SCV_ENUM(Generic_MCMD_IDLE);
SCV_ENUM(Generic_MCMD_WR);
SCV_ENUM(Generic_MCMD_RD);
SCV_ENUM(Generic_MCMD_RDEX);
SCV_ENUM(Generic_MCMD_RDL);
SCV_ENUM(Generic_MCMD_WRNP);
SCV_ENUM(Generic_MCMD_WRC);
SCV_ENUM(Generic_MCMD_BCST);
}
};
SCV_ENUM_EXTENSIONS(GenericMBurstSeqType){
public:
SCV_ENUM_CTOR(GenericMBurstSeqType){
SCV_ENUM(Generic_MBURSTSEQ_INCR);
SCV_ENUM(Generic_MBURSTSEQ_DFLT1);
SCV_ENUM(Generic_MBURSTSEQ_WRAP);
SCV_ENUM(Generic_MBURSTSEQ_DFLT2);
SCV_ENUM(Generic_MBURSTSEQ_XOR);
SCV_ENUM(Generic_MBURSTSEQ_STRM);
SCV_ENUM(Generic_MBURSTSEQ_UNKN);
SCV_ENUM(Generic_MBURSTSEQ_RESERVED);
}
};
SCV_EXTENSIONS(MasterDataType){
public:
scv_extensions<unsigned char *> data;
scv_extensions<unsigned int> size;
SCV_EXTENSIONS_CTOR(MasterDataType){
SCV_FIELD(data);
SCV_FIELD(size);
}
};
#define DUST_CLASS_WRAPPER_EXTENSION(type) \
SCV_EXTENSIONS(class_wrapper<type>){ \
public: \
scv_extensions<type> value; \
SCV_EXTENSIONS_CTOR(class_wrapper<type>){ \
SCV_FIELD(value); \
} \
}; \
DUST_CLASS_WRAPPER_EXTENSION(GenericMCmdType);
DUST_CLASS_WRAPPER_EXTENSION(GenericSRespType);
DUST_CLASS_WRAPPER_EXTENSION(GenericMBurstSeqType);
DUST_CLASS_WRAPPER_EXTENSION(unsigned int);
DUST_CLASS_WRAPPER_EXTENSION(unsigned long long);
SCV_EXTENSIONS(GenericTransaction){
public:
scv_extensions<class_wrapper<GenericMCmdType> > mCmd;
scv_extensions<class_wrapper<GenericSRespType> > sResp;
scv_extensions<class_wrapper<unsigned int> > mBurstLength;
scv_extensions<class_wrapper<unsigned long long> > mAddr;
scv_extensions<class_wrapper<unsigned int> > mID;
scv_extensions<MasterDataType> msData;
SCV_EXTENSIONS_CTOR(GenericTransaction){
SCV_FIELD(mCmd);
SCV_FIELD(sResp);
SCV_FIELD(mBurstLength);
SCV_FIELD(mAddr);
SCV_FIELD(mID);
SCV_FIELD(msData); // must always be the last field (used in peq)
}
};
SCV_EXTENSIONS(GenericPhase) {
public:
scv_extensions<int> state;
scv_extensions<unsigned int> BurstNumber;
SCV_EXTENSIONS_CTOR(GenericPhase) {
SCV_FIELD(state);
SCV_FIELD(BurstNumber);
}
};
#endif /* __dust_h__ */
See more files for this project here