ParaNut SystemC Model
A SystemC Model of the ParaNut architecture
Classes | Macros
base.h File Reference

Helpers, Makros and performance measuring Classes used in most ParaNut files. More...

#include <systemc.h>
#include <sstream>
Include dependency graph for base.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CEventDef
 Event definition class. More...
 
class  CPerfMon
 Performance monitor class. More...
 
class  CPerfMonCPU
 CPU performance monitor class. More...
 

Macros

#define PN_CLOCK_TRIGGERED(method_name)   SC_METHOD(method_name) sensitive << clk.pos();
 
Static Configuration...
#define PN_BIG_ENDIAN   0
 System endianess configuration. More...
 

Enumerations

Performance measuring...
enum  EEventsCPU {
  EV_ALU = 0 , EV_LOAD , EV_STORE , EV_JUMP ,
  EV_OTHER , EV_IFETCH
}
 CPU performance monitor events enum. More...
 

Variables

Dynamic Configuration....
int pn_cfg_vcd_level
 VCD trace level. More...
 
int pn_cfg_insn_trace
 Internal simulation instruction trace level. More...
 
bool pn_cfg_disable_cache
 Cache enable override. More...
 
bool pn_cfg_debug_mode
 Interactive debug mode enable. More...
 

Basic types and constants...

#define KB   1024
 Number of Bytes in a Kilobyte. More...
 
#define MB   (1024 * 1024)
 Number of Bytes in a Megabyte. More...
 
#define GB   (1024 * 1024 * 1024)
 Number of Bytes in a Gigabyte. More...
 
#define MIN(A, B)   ((A) < (B) ? (A) : (B))
 Minimum of A and B. More...
 
#define MAX(A, B)   ((A) > (B) ? (A) : (B))
 Maximum of A and B. More...
 
#define NUM_BITS(A)   ((int)(ceil(log2 (A))))
 Number of bits necessary to encode A. More...
 
#define C(MEMBER)   (MEMBER == t.MEMBER)
 Convenient macro to compare a member variable with the member of input t. More...
 
#define C_ARR(MEMBER, NUM)   ({ bool ret = 1; for (int n = 0; n < NUM; ++n) if (!C(MEMBER[n])) ret = 0; ret; })
 Same as C(MEMBER), but for arrays. More...
 
#define XLEN   32
 Number of instruction/register Bits. More...
 
typedef unsigned char TByte
 Byte type (8 Bit). More...
 
typedef unsigned short THalfWord
 Half word type (16 Bit). More...
 
typedef unsigned TWord
 Word type (32 Bit). More...
 
typedef unsigned long long TDWord
 Double word type (64 Bit). More...
 

SystemC tracing...

#define PN_TRACE(TF, OBJ)
 Add sc_object OBJ to the trace file TF. More...
 
#define PN_TRACE_BUS(TF, OBJ, N_MAX)
 Add each sc_object of OBJ array/bus to the trace file TF. More...
 
#define PN_TRACE_BUS_BUS(TF, OBJ, N_MAX, K_MAX)
 Add each sc_object of 2D OBJ array/bus to the trace file TF. More...
 
#define PN_TRACE_R(TF, OBJ, MEMBER, STR)
 Helper macro for recursively calling sc_trace in own types/structs. More...
 
#define PN_TRACE_R_BUS(TF, OBJ, MEMBER, STR, N_MAX)
 Helper macro for recursively calling sc_trace in own types/structs. More...
 
#define PN_TRACE_R_BUS_BUS(TF, OBJ, MEMBER, STR, N_MAX, K_MAX)
 Helper macro for recursively calling sc_trace in own types/structs. More...
 
bool pn_trace_verbose
 Output verbose tracing information. More...
 
std::string pn_GetTraceName (sc_object *obj, const char *name, int dim, int arg1, int arg2)
 Generates and returns a trace file compatible string. More...
 

Testbench helpers...

#define PN_ASSERT(COND)   pn_TbAssert (COND, NULL, __FILE__, __LINE__)
 Testbench assert without message. More...
 
#define PN_ASSERTF(COND, FMT)   pn_TbAssert (COND, pn_TbPrintf FMT, __FILE__, __LINE__)
 Testbench assert with formatted message. More...
 
#define PN_ASSERTM(COND, MSG)   pn_TbAssert (COND, MSG, __FILE__, __LINE__)
 Testbench assert with message. More...
 
#define PN_INFO(MSG)   pn_TbInfo (MSG, __FILE__, __LINE__)
 Testbench info with message. More...
 
#define PN_INFOF(FMT)   pn_TbInfo (pn_TbPrintf FMT, __FILE__, __LINE__)
 Testbench info with formatted message. More...
 
#define PN_WARNING(MSG)   pn_TbWarning (MSG, __FILE__, __LINE__)
 Testbench warning with message. More...
 
#define PN_WARNINGF(FMT)   pn_TbWarning (pn_TbPrintf FMT, __FILE__, __LINE__)
 Testbench warning with formatted message. More...
 
#define PN_ERROR(MSG)   pn_TbError (MSG, __FILE__, __LINE__)
 Testbench error with message. More...
 
#define PN_ERRORF(FMT)   pn_TbError (pn_TbPrintf FMT, __FILE__, __LINE__)
 Testbench error with formatted message. More...
 
sc_trace_file * pn_trace_file
 ParaNut trace file pointer. More...
 
char * pn_TbPrintf (const char *format,...)
 Testbench printf helper. More...
 
void pn_TbAssert (bool cond, const char *msg, const char *filename, const int line)
 Testbench assert helper. More...
 
void pn_TbInfo (const char *msg, const char *filename, const int line)
 Testbench information helper. More...
 
void pn_TbWarning (const char *msg, const char *filename, const int line)
 Testbench warning helper. More...
 
void pn_TbError (const char *msg, const char *filename, const int line)
 Testbench error helper. More...
 
template<typename T >
sc_core::sc_signal_in_if< T > const & vh_const (T const &v)
 vvh_const type/struct (vhdl constant value equivalent) More...
 
char * pn_DisAss (TWord insn)
 Dissassemble RISC-V instructions to C string. More...
 

Detailed Description

Helpers, Makros and performance measuring Classes used in most ParaNut files.