/* * mytrace.h - variables needed for dinero+ to SBC trace conversion */ #ifndef MYTRACE_H #define MYTRACE_H #include #include #include #define MAX_TABLE 50000 #define MAX_STREAM 10000 #define MAX_FIFO 20000 #define INSTR_TYPE 2 /* types */ typedef unsigned int long long address_t; typedef unsigned int instr_t; typedef int long long offset_t; typedef char unsigned byte1_t; typedef short unsigned byte2_t; typedef short unsigned stream_t; /* stuct for mem ref info kept along with stream table, just last addr because of address offset field in data address trace*/ typedef struct node_ref { address_t last_addr; struct node_ref *next; } node_ref; /* struct for fifo entry with data address info*/ typedef struct buffer_entry_type { stream_t stream_index; byte2_t mem_ref; byte1_t ready_flag; offset_t addr_offset; offset_t data_stride; int long long rep_count; } buffer_entry_type; /* struct for temp data info, to be kept until the end of a stream */ typedef struct temp_data { byte2_t mem_ref; address_t data_address; struct temp_data* next; } temp_data; /* dinero+ trace file, SBC instruction trace, SBC data trace, SBC stream table file*/ FILE *fdin, *fsbci, *fsbcd, *ftable; char *traceName; /* trace name */ int fileNum1, fileNum2; /* partial trace first, last number */ int ISLen[MAX_TABLE]; /* instruction stream length */ address_t ISAddress[MAX_TABLE]; /* instruction stream start address*/ instr_t currentStream[MAX_STREAM]; /* instructions in current stream */ address_t currentStreamStart; /* start address of the current stream */ int currentLen; /* current stream length */ int tableSize; /* size of the stream table */ char currentTypeB[MAX_STREAM]; /* type of instructions in the stream */ byte2_t MemRef; /* current number of mem references in the stream */ stream_t StreamIndex; /* index of the current stream */ address_t CurrentAddr; /* current data address */ offset_t TestStride; /* variable for testing the current stride */ node_ref* RefList[MAX_TABLE]; /* array of pointers to lists of mem ref info nodes */ /* pointers to mem ref info nodes */ node_ref* CurrentRef; node_ref* PrevRef; /* pointers to temp data info nodes */ temp_data* CurrentTemp; temp_data* PrevTemp; temp_data* HeadTemp; buffer_entry_type FIFOBuffer[MAX_FIFO]; /* FIFO buffer */ int FIFOSize, FIFOTop, FIFOStart; /* FIFO buffer size, top, and start */ address_t myAddr; /* current address */ instr_t myIWord; /* current instruction word */ byte1_t myType; /* current reference type */ /* functions */ void WriteFIFO(int index); char OffsetSize(offset_t Offset); void SearchUpdateFIFO(void); void EmptyFIFO(void); void NewFIFO(void); void SearchUpdateStream(void); void fatal(const char *msg); void compressTrace(void); void doInstr(void); void doData(void); #endif