Display cycle count in memory access view
MODIFY
src/mainmemory.h
src/mainmemory.h
@@ -9,6 +9,7 @@ typedef struct {
uint32_t pc; // GUI converts pc value to an instruction
RW rw;
uint32_t addr;
+ uint32_t cycle;
} RVAccess;
template <typename key_T, typename value_T>

MODIFY
src/pipeline.cpp
src/pipeline.cpp
@@ -570,7 +570,7 @@ void Pipeline::propagateCombinational() {
mux_alures_PC4_MEM.update();
if (r_MemRead_EXMEM) {
// Store read access for use in GUI
- RVAccess acc{(uint32_t)r_PC_EXMEM, RW::Read, (uint32_t)r_alures_EXMEM};
+ RVAccess acc{(uint32_t)r_PC_EXMEM, RW::Read, (uint32_t)r_alures_EXMEM, m_pcsCycles.size()};
m_RVAccesses.insert(m_RVAccesses.begin(), acc);
switch ((uint32_t)r_MemRead_EXMEM) {
case LB: {
@@ -714,7 +714,7 @@ int Pipeline::step() {
m_reg.clock();
if (r_MemWrite_EXMEM) {
// Store write access for use in GUI
- RVAccess acc{(uint32_t)r_PC_EXMEM, RW::Write, (uint32_t)r_alures_EXMEM};
+ RVAccess acc{(uint32_t)r_PC_EXMEM, RW::Write, (uint32_t)r_alures_EXMEM, m_pcsCycles.size()};
m_RVAccesses.insert(m_RVAccesses.begin(), acc);
switch ((uint32_t)r_MemWrite_EXMEM) {
case SB: {

MODIFY
src/rwjumpmodel.cpp
src/rwjumpmodel.cpp
@@ -12,13 +12,15 @@ QVariant RWJumpModel::headerData(int section, Qt::Orientation orientation, int r
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
switch (section) {
case 0:
- return "PC";
+ return "Cycle";
case 1:
- return "Access type";
+ return "PC";
case 2:
- return "Instruction";
+ return "Access type";
case 3:
- return "Target address";
+ return "Instruction";
+ case 4:
+ return "Access address";
default:
return QVariant();
}
@@ -41,7 +43,7 @@ void RWJumpModel::update() {
int RWJumpModel::columnCount(const QModelIndex& parent) const {
Q_UNUSED(parent)
- return 4; // PC, Write type and instrution
+ return 5; // PC, Write type and instrution
}
QVariant RWJumpModel::data(const QModelIndex& index, int role) const {
@@ -54,16 +56,18 @@ QVariant RWJumpModel::data(const QModelIndex& index, int role) const {
return QVariant();
switch (index.column()) {
case 0:
+ return access.cycle - 1;
+ case 1:
return access.pc;
- case 1: {
+ case 2: {
if (access.rw == RW::Read)
return "Read";
return "Write";
}
- case 2: {
+ case 3: {
return m_parserPtr->getInstructionString(access.pc);
}
- case 3: {
+ case 4: {
return QString("0x%1").arg(QString::number(access.addr, 16));
}
}

MODIFY
src/rwjumpwidget.cpp
src/rwjumpwidget.cpp
@@ -14,6 +14,7 @@ void RWJumpWidget::init() {
ui->view->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
ui->view->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);
ui->view->horizontalHeader()->setSectionResizeMode(3, QHeaderView::Stretch);
+ ui->view->horizontalHeader()->setSectionResizeMode(4, QHeaderView::Stretch);
ui->view->setSelectionBehavior(QAbstractItemView::SelectRows);
}

MODIFY
src/rwjumpwidget.ui
src/rwjumpwidget.ui
<item>
<widget class="QPushButton" name="jump">
<property name="text">
- <string>Go to selected address</string>
+ <string>Go to selected access address</string>
</property>
</widget>
</item>

Display cycle count in memory access view