OpenCores
URL https://opencores.org/ocsvn/s1_core/s1_core/trunk

Subversion Repositories s1_core

[/] [s1_core/] [trunk/] [tools/] [src/] [tracan.cpp] - Blame information for rev 113

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 113 albert.wat
 
2
#include "tracan.h"
3
 
4
// Useful functions
5
void reverse_string(char *s) {
6
  char t, *e = s + strlen(s);
7
  while (--e > s) { t = *s;*s++=*e;*e=t; }
8
}
9
unsigned long long bitsToInt(char *bit_vector, int bit_pos_max, int bit_pos_min) {
10
  unsigned long long value = 0;
11
  unsigned int len = strlen(bit_vector);
12
  if (bit_pos_min < 0 || bit_pos_min > bit_pos_max || bit_pos_max >= len) {
13
    printf("*** ERROR *** Invalid substring boundaries MIN=%d MAX=%d LEN=%d", bit_pos_min, bit_pos_max, len);
14
    exit(1);
15
  }
16
  for(unsigned long long i = 0; i <= bit_pos_max-bit_pos_min; i++) {
17
    if (bit_vector[bit_pos_min+i]=='1')
18
      value += (1ULL<<i);
19
  }
20
  return value;
21
}
22
 
23
// Print functions
24
void print_pcx_req(char *buf) {
25
  if    (!strcmp(buf, "10000")) printf("PCX_REQ RAM_DDR_0 ");
26
  else if (!strcmp(buf, "01000")) printf("PCX_REQ RAM_DDR_1 ");
27
  else if (!strcmp(buf, "00100")) printf("PCX_REQ RAM_DDR_2 ");
28
  else if (!strcmp(buf, "00010")) printf("PCX_REQ RAM_DDR_3 ");
29
  else if (!strcmp(buf, "00001")) printf("PCX_REQ ROM_IOBridge ");
30
  else printf("PCX_REQ Unknown_%s ", buf);
31
}
32
void print_pcx_atom(char *buf) {
33
  if (!strcmp(buf, "1"))
34
    printf("ATOMIC_");
35
}
36
void print_pcx_data(char *buf) {
37
  char str_type[20], str_size[20];
38
  if (!bitsToInt(buf, PCX_VLD,PCX_VLD)) return;
39
  switch(bitsToInt(buf, PCX_RQ_HI,PCX_RQ_LO)) {
40
    case LOAD_RQ:    strcpy(str_type, "LOAD_RQ");    break;
41
    case IMISS_RQ:   strcpy(str_type, "IMISS_RQ");   break;
42
    case STORE_RQ:   strcpy(str_type, "STORE_RQ");   break;
43
    case CAS1_RQ:    strcpy(str_type, "CAS1_RQ");    break;
44
    case CAS2_RQ:    strcpy(str_type, "CAS2_RQ");    break;
45
    case SWAP_RQ:    strcpy(str_type, "SWAP_RQ");    break;
46
    case STRLOAD_RQ: strcpy(str_type, "STRLOAD_RQ"); break;
47
    case STRST_RQ:   strcpy(str_type, "STRST_RQ");   break;
48
    case STQ_RQ:     strcpy(str_type, "STQ_RQ");     break;
49
    case INT_RQ:     strcpy(str_type, "INT_RQ");     break;
50
    case FWD_RQ:     strcpy(str_type, "FWD_RQ");     break;
51
    case FWD_RPY:    strcpy(str_type, "FWD_RPY");    break;
52
    case RSVD_RQ:    strcpy(str_type, "RSVD_RQ");    break;
53
    case ATOM_REQ_A: strcpy(str_type, "ATOM_REQ_A"); break;  // Added by Simply RISC
54
    case ATOM_REQ_B: strcpy(str_type, "ATOM_REQ_B"); break;  // Added by Simply RISC
55
    default:         sprintf(str_type, "Unknown_0x%02llX", bitsToInt(buf, PCX_RQ_HI,PCX_RQ_LO));
56
  }
57
  switch(bitsToInt(buf, PCX_SZ_HI,PCX_SZ_LO)) {
58
    case PCX_SZ_1B:  strcpy(str_size, "1B");  break;
59
    case PCX_SZ_2B:  strcpy(str_size, "2B");  break;
60
    case PCX_SZ_4B:  strcpy(str_size, "4B");  break;
61
    case PCX_SZ_8B:  strcpy(str_size, "8B");  break;
62
    case PCX_SZ_16B: strcpy(str_size, "16B"); break;
63
    default:         sprintf(str_size, "Unknown_0x%02llX", bitsToInt(buf, PCX_SZ_HI,PCX_SZ_LO));
64
  }
65
  printf("PCX_DATA Valid=%llu Type=%s NonCache_RnW=%llu PE=%llu.%llu Buffer=%llu L1Way_Packet=%llu Size=%s Address=0x%010llX Store_Data=0x%016llX\n",
66
         bitsToInt(buf, PCX_VLD,PCX_VLD), str_type, bitsToInt(buf, PCX_R,PCX_R), bitsToInt(buf, PCX_CP_HI,PCX_CP_LO), bitsToInt(buf, PCX_TH_HI,PCX_TH_LO),
67
         bitsToInt(buf, PCX_BF_HI,PCX_BF_LO), bitsToInt(buf, PCX_WY_HI,PCX_WY_LO), str_size,
68
         bitsToInt(buf, PCX_AD_HI,PCX_AD_LO), bitsToInt(buf, PCX_DA_HI,PCX_DA_LO));
69
}
70
void print_pcx_grant(char *buf) {
71
  if    (!strcmp(buf, "10000")) printf("PCX_GRANT RAM_DDR_0\n");
72
  else if (!strcmp(buf, "01000")) printf("PCX_GRANT RAM_DDR_1\n");
73
  else if (!strcmp(buf, "00100")) printf("PCX_GRANT RAM_DDR_2\n");
74
  else if (!strcmp(buf, "00010")) printf("PCX_GRANT RAM_DDR_3\n");
75
  else if (!strcmp(buf, "00001")) printf("PCX_GRANT ROM_IOBridge\n");
76
  else printf("PCX_GRANT Unknown_%s\n", buf);
77
}
78
void print_cpx_ready(char *buf) {
79
  printf("CPX_READY %s\n", buf);
80
}
81
void print_cpx_data(char *buf) {
82
  char str_type[20];
83
  if (!bitsToInt(buf, CPX_VLD,CPX_VLD)) return;
84
  switch(bitsToInt(buf, CPX_RQ_HI,CPX_RQ_LO)) {
85
    case LOAD_RET:    strcpy(str_type, "LOAD_RET");    break;
86
    case INV_RET:     strcpy(str_type, "INV_RET__AT_ACK__EVICT_REQ"); break;
87
    case ST_ACK:      strcpy(str_type, "ST_ACK");      break;
88
    case INT_RET:     strcpy(str_type, "INT_RET");     break;
89
    case TEST_RET:    strcpy(str_type, "TEST_RET");    break;
90
    case FP_RET:      strcpy(str_type, "FP_RET");      break;
91
    case IFILL_RET:   strcpy(str_type, "IFILL_RET");   break;
92
    case ERR_RET:     strcpy(str_type, "ERR_RET");     break;
93
    case STRLOAD_RET: strcpy(str_type, "STRLOAD_RET"); break;
94
    case STRST_ACK:   strcpy(str_type, "STRST_ACK");   break;
95
    case FWD_RQ_RET:  strcpy(str_type, "FWD_RQ_RET");  break;
96
    case FWD_RPY_RET: strcpy(str_type, "FWD_RPY_RET"); break;
97
    case RSVD_RET:    strcpy(str_type, "RSVD_RET");    break;
98
    default:          sprintf(str_type, "Unknown_0x%02llX", bitsToInt(buf, CPX_RQ_HI,CPX_RQ_LO));
99
  }
100
  printf("CPX_DATA Valid=%llu Type=%s Error=%llu NonCache_RnW=%llu Thread=%llu IntSrc_etc=0x%04llX Load_Data=0x%016llX%016llX\n",
101
         bitsToInt(buf, CPX_VLD,CPX_VLD), str_type, bitsToInt(buf, CPX_ERR_HI-1,CPX_ERR_LO), bitsToInt(buf, CPX_R,CPX_R), bitsToInt(buf, CPX_TH_HI,CPX_TH_LO),
102
         bitsToInt(buf, CPX_IN_HI,CPX_IN_LO), bitsToInt(buf, CPX_DA_HI,CPX_DA_LO+64), bitsToInt(buf, CPX_DA_LO+63,CPX_DA_LO));
103
}
104
 
105
// Main function
106
int main() {
107
  char bit_vector[200];
108
  char signal_type;
109
  while(!feof(stdin)) {
110
    fscanf(stdin, "%s %c\n", bit_vector, &signal_type);
111
    reverse_string(bit_vector);
112
    switch (signal_type) {
113
    case VCD_ID_PCX_REQ:   print_pcx_req(bit_vector);    break;
114
    case VCD_ID_PCX_ATOM:  print_pcx_atom(bit_vector);   break;
115
    case VCD_ID_PCX_DATA:  print_pcx_data(bit_vector);   break;
116
    case VCD_ID_PCX_GRANT: print_pcx_grant(bit_vector);  break;
117
    case VCD_ID_CPX_READY: print_cpx_ready(bit_vector);  break;
118
    case VCD_ID_CPX_DATA:  print_cpx_data(bit_vector);   break;
119
    }
120
  }
121
}
122
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.