aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-03-26 23:40:21 +0100
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-03-26 23:40:21 +0100
commitc72e3ad5824eb9385b62a51633cff817b825f06d (patch)
tree7329be83ff8fc8bd0133206ec52e3b4d23e58dad /qtmips_gui
parent816b01b99eb770958589aadab25cd5e103917003 (diff)
downloadqtmips-c72e3ad5824eb9385b62a51633cff817b825f06d.tar.gz
qtmips-c72e3ad5824eb9385b62a51633cff817b825f06d.tar.bz2
qtmips-c72e3ad5824eb9385b62a51633cff817b825f06d.zip
Change single cycle core with delay slot to use separate fetch stage.
When instructions are visualized then it is even more misleading to keep old instruction in decode phase delay buffer. The single cycle core with delay slot is upgraded to the variant with fetch and execute phases. This way the structure is logical and delay slot has purpose. Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui')
-rw-r--r--qtmips_gui/coreview.cpp43
-rw-r--r--qtmips_gui/coreview.h4
2 files changed, 23 insertions, 24 deletions
diff --git a/qtmips_gui/coreview.cpp b/qtmips_gui/coreview.cpp
index 36e9a8d..242c416 100644
--- a/qtmips_gui/coreview.cpp
+++ b/qtmips_gui/coreview.cpp
@@ -268,17 +268,28 @@ QGraphicsSimpleTextItem *CoreViewScene::new_label(const QString &str, qreal x, q
}
CoreViewSceneSimple::CoreViewSceneSimple(machine::QtMipsMachine *machine) : CoreViewScene(machine) {
- NEW_I(instr_prim, 230, 60, instruction_fetched);
+ NEW_I(inst_prim, 230, 60, instruction_executed, QColor(255, 173, 230));
if (machine->config().delay_slot()) {
- NEW(Latch, delay_slot_latch, 55, 470, machine, 25);
- NEW_I(instr_delay, 60, 500, instruction_program_counter);
+ NEW(Latch, latch_if_id, 158, 250, machine, 220);
+ NEW_I(inst_fetch, 79, 60, instruction_fetched, QColor(255, 173, 173));
}
coreview::Connection *con;
// Fetch stage
- new_bus(mem_program->connector_instruction(), dc.instr_bus->new_connector(mem_program->connector_instruction()->point()));
- con = new_bus(ft.junc_pc_4->new_connector(coreview::Connector::AX_Y), dc.add->connector_in_b());
- con->setAxes({CON_AXIS_Y(270)});
+ if (machine->config().delay_slot()) {
+ struct coreview::Latch::ConnectorPair lp_ft_inst = latch_if_id->new_connector(mem_program->connector_instruction()->y() - latch_if_id->y());
+ new_bus(mem_program->connector_instruction(), lp_ft_inst.in);
+ struct coreview::Latch::ConnectorPair lp_ft_pc = latch_if_id->new_connector(210);
+ new_bus(ft.junc_pc_4->new_connector(coreview::Connector::AX_Y), lp_ft_pc.in);
+ // Decode stage
+ new_bus(lp_ft_inst.out, dc.instr_bus->new_connector(lp_ft_inst.out->point()));
+ con = new_bus(lp_ft_pc.out, dc.add->connector_in_b());
+ con->setAxes({CON_AXIS_Y(270)});
+ } else {
+ new_bus(mem_program->connector_instruction(), dc.instr_bus->new_connector(mem_program->connector_instruction()->point()));
+ con = new_bus(ft.junc_pc_4->new_connector(coreview::Connector::AX_Y), dc.add->connector_in_b());
+ con->setAxes({CON_AXIS_Y(270)});
+ }
// Decode stage
coreview::Bus *regs_bus1 = new_bus(regs->connector_read1(), alu->connector_in_a());
const coreview::Connector *regs_bus_con = dc.cmp->new_connector(-0.5, 1);
@@ -301,22 +312,10 @@ CoreViewSceneSimple::CoreViewSceneSimple(machine::QtMipsMachine *machine) : Core
con->setAxes({CON_AXIS_Y(678)});
// WriteBack
// From decode stage to fetch stage
- if (machine->config().delay_slot()) {
- struct coreview::Latch::ConnectorPair lp_addr = delay_slot_latch->new_connector(10);
- struct coreview::Latch::ConnectorPair lp_branch = delay_slot_latch->new_connector(20);
- con = new_signal(dc.and_branch->connector_out(), lp_branch.out);
- con->setAxes({CON_AXIS_Y(370)});
- new_signal(lp_branch.in, ft.multiplex->connector_ctl());
- con = new_bus(dc.add->connector_out(), lp_addr.out);
- con->setAxes({CON_AXIS_Y(360)});
- con = new_bus(lp_addr.in, ft.multiplex->connector_in(1));
- con->setAxes({CON_AXIS_Y(10)});
- } else {
- con = new_signal(dc.and_branch->connector_out(), ft.multiplex->connector_ctl());
- con->setAxes({CON_AXIS_Y(370), CON_AXIS_X(490)});
- con = new_bus(dc.add->connector_out(), ft.multiplex->connector_in(1));
- con->setAxes({CON_AXIS_Y(360), CON_AXIS_X(480), CON_AXIS_Y(10)});
- }
+ con = new_signal(dc.and_branch->connector_out(), ft.multiplex->connector_ctl());
+ con->setAxes({CON_AXIS_Y(370), CON_AXIS_X(490)});
+ con = new_bus(dc.add->connector_out(), ft.multiplex->connector_in(1));
+ con->setAxes({CON_AXIS_Y(360), CON_AXIS_X(480), CON_AXIS_Y(10)});
// From decode to execute stage
new_signal(dc.ctl_block->new_connector(1, 0.6), ex.mux_imm->connector_ctl());
new_signal(dc.ctl_block->new_connector(1, 0.2), alu->connector_ctl());
diff --git a/qtmips_gui/coreview.h b/qtmips_gui/coreview.h
index 0abc870..93c0032 100644
--- a/qtmips_gui/coreview.h
+++ b/qtmips_gui/coreview.h
@@ -130,8 +130,8 @@ public:
CoreViewSceneSimple(machine::QtMipsMachine *machine);
private:
- coreview::InstructionView *instr_prim, *instr_delay;
- coreview::Latch *delay_slot_latch;
+ coreview::InstructionView *inst_prim, *inst_fetch;
+ coreview::Latch *latch_if_id;
};
class CoreViewScenePipelined : public CoreViewScene {