Better register dump

This commit is contained in:
mariusmonton 2018-09-20 15:29:22 +02:00
parent 66b27f7613
commit 981b84a5eb
2 changed files with 36 additions and 31 deletions

View File

@ -8,6 +8,7 @@
#define REGISTERS_H #define REGISTERS_H
#define SC_INCLUDE_DYNAMIC_PROCESSES #define SC_INCLUDE_DYNAMIC_PROCESSES
#include <iomanip>
#include "systemc" #include "systemc"
#include "tlm.h" #include "tlm.h"

View File

@ -10,45 +10,49 @@ Registers::Registers() {
} }
void Registers::dump(void) { void Registers::dump(void) {
cout << "************************************" << endl; cout << "************************************" << endl;
cout << "Registers dump" << dec << endl; cout << "Registers dump" << dec << endl;
#if 0 cout << "x0 (zero): " << left << setw(8) << register_bank[0];
cout << "x0 (zero): " << register_bank[0] << "\t"; cout << "x1 (ra): " << left << setw(8) << register_bank[1];
cout << "x1 (ra): " << register_bank[1] << "\t"; cout << "x2 (sp): " << left << setw(8) << register_bank[2];
cout << "x2 (sp): " << register_bank[2] << "\t"; cout << "x3 (gp): " << left << setw(8) << register_bank[3] << endl;
cout << "x3 (gp): " << register_bank[3] << "\t" << endl;
cout << "x4 (tp): " << register_bank[4] << "\t"; cout << "x4 (tp): " << left << setw(8) << register_bank[4];
cout << "x5 (t0): " << register_bank[5] << "\t"; cout << "x5 (t0): " << left << setw(8) << register_bank[5];
cout << "x6 (t1): " << register_bank[6] << "\t"; cout << "x6 (t1): " << left << setw(8) << register_bank[6];
cout << "x7 (t2): " << register_bank[7] << "\t" << endl; cout << "x7 (t2): " << left << setw(8) << register_bank[7] << endl;
cout << "x8 (s0/fp): " << register_bank[8] << "\t"; cout << "x8 (s0/fp): " << left << setw(8) << register_bank[8];
cout << "x9 (s1): " << register_bank[9] << "\t"; cout << "x9 (s1): " << left << setw(8) << register_bank[9];
cout << "x10 (a0): " << register_bank[10] << "\t"; cout << "x10 (a0): " << left << setw(8) << register_bank[10];
cout << "x11 (a1): " << register_bank[11] << "\t" << endl; cout << "x11 (a1): " << left << setw(8) << register_bank[11] << endl;
cout << "x12 (a2): " << register_bank[12] << "\t"; cout << "x12 (a2): " << left << setw(8) << register_bank[12];
cout << "x13 (a3): " << register_bank[13] << "\t"; cout << "x13 (a3): " << left << setw(8) << register_bank[13];
cout << "x14 (a4): " << register_bank[14] << "\t"; cout << "x14 (a4): " << left << setw(8) << register_bank[14];
cout << "x15 (a5): " << register_bank[15] << "\t" << endl; cout << "x15 (a5): " << left << setw(8) << register_bank[15] << endl;
cout << "x16 (a6): " << register_bank[16] << "\t"; cout << "x16 (a6): " << left << setw(8) << register_bank[16];
cout << "x17 (a7): " << register_bank[17] << "\t"; cout << "x17 (a7): " << left << setw(8) << register_bank[17];
cout << "x18 (s2): " << register_bank[18] << "\t"; cout << "x18 (s2): " << left << setw(8) << register_bank[18];
cout << "x19 (s3): " << register_bank[19] << "\t" << endl; cout << "x19 (s3): " << left << setw(8) << register_bank[19] << endl;
#else cout << "x20 (s4): " << left << setw(8) << register_bank[16];
for(int i=0;i<32;i++) { cout << "x21 (s5): " << left << setw(8) << register_bank[17];
cout << "R" << dec << i << ": " << register_bank[i] << "\t"; cout << "x22 (s6): " << left << setw(8) << register_bank[18];
if (i % 4 == 3) { cout << "x23 (s7): " << left << setw(8) << register_bank[19] << endl;
cout << endl;
}
}
#endif
cout << "PC: 0x" << hex << register_PC << endl; cout << "x24 (s8): " << left << setw(8) << register_bank[16];
cout << "x25 (s9): " << left << setw(8) << register_bank[17];
cout << "x26 (s10): " << left << setw(8) << register_bank[18];
cout << "x27 (s11): " << left << setw(8) << register_bank[19] << endl;
cout << "x28 (t3): " << left << setw(8) << register_bank[16];
cout << "x29 (t4): " << left << setw(8) << register_bank[17];
cout << "x30 (t5): " << left << setw(8) << register_bank[18];
cout << "x31 (t6): " << left << setw(8) << register_bank[19] << endl;
cout << "PC: 0x" << hex << left << setw(8) << register_PC << endl;
cout << "************************************" << endl; cout << "************************************" << endl;
} }