aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-01-21 18:45:50 +0100
committerKarel Kočí <cynerd@email.cz>2018-01-21 18:45:50 +0100
commit553187e18f5a587dcf38a7d3f9a82929583ddc84 (patch)
tree5a1b96768808369360378374391a50e790e1a389
parentea044b4bb31b88507f191a764dc47e86c44858da (diff)
downloadqtmips-553187e18f5a587dcf38a7d3f9a82929583ddc84.tar.gz
qtmips-553187e18f5a587dcf38a7d3f9a82929583ddc84.tar.bz2
qtmips-553187e18f5a587dcf38a7d3f9a82929583ddc84.zip
Add delay_slot latch for no-pipeline core
-rw-r--r--qtmips_gui/coreview.cpp35
-rwxr-xr-xtests/registers/test.sh2
2 files changed, 29 insertions, 8 deletions
diff --git a/qtmips_gui/coreview.cpp b/qtmips_gui/coreview.cpp
index 0fb5e76..02e6f13 100644
--- a/qtmips_gui/coreview.cpp
+++ b/qtmips_gui/coreview.cpp
@@ -133,11 +133,6 @@ CoreViewScene::CoreViewScene(CoreView *view, machine::QtMipsMachine *machine) :
new_bus(ex.mux_imm->connector_out(), alu->connector_in_b());
// Memory stage
new_bus(mm.j_addr->new_connector(CON_AX_X), mem_data->connector_address());
- // From decode stage to fetch stage
- con = new_signal(dc.and_branch->connector_out(), ft.multiplex->connector_ctl());
- con->setAxes({CON_AXIS_Y(365), 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 write back stage to decode stage
con = new_bus(wb.mem_or_reg->connector_out(), regs->connector_write());
con->setAxes({CON_AXIS_Y(710), CON_AXIS_X(510), CON_AXIS_Y(172)});
@@ -173,7 +168,10 @@ coreview::Signal *CoreViewScene::new_signal(const coreview::Connector *a, const
}
CoreViewSceneSimple::CoreViewSceneSimple(CoreView *view, machine::QtMipsMachine *machine) : CoreViewScene(view, machine) {
- NEW(Latch, delay_slot_latch, 55, 460, machine, 50);
+ if (machine->config().delay_slot())
+ NEW(Latch, delay_slot_latch, 55, 470, machine, 25);
+ else
+ delay_slot_latch = nullptr;
coreview::Connection *con;
// Fetch stage
@@ -197,10 +195,28 @@ CoreViewSceneSimple::CoreViewSceneSimple(CoreView *view, machine::QtMipsMachine
con = new_bus(mem_data->connector_data_out(), wb.mem_or_reg->connector_in(1));
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(365)});
+ 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(365), 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)});
+ }
}
CoreViewSceneSimple::~CoreViewSceneSimple() {
- delete delay_slot_latch;
+ if (delay_slot_latch != nullptr)
+ delete delay_slot_latch;
}
CoreViewScenePipelined::CoreViewScenePipelined(CoreView *view, machine::QtMipsMachine *machine) : CoreViewScene(view, machine) {
@@ -264,6 +280,11 @@ CoreViewScenePipelined::CoreViewScenePipelined(CoreView *view, machine::QtMipsMa
con->setAxes({CON_AXIS_Y(678)});
con = new_bus(lp_mem_mem.out, wb.mem_or_reg->connector_in(1));
con->setAxes({CON_AXIS_Y(678)});
+ // From decode stage to fetch stage
+ con = new_signal(dc.and_branch->connector_out(), ft.multiplex->connector_ctl());
+ con->setAxes({CON_AXIS_Y(365), 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)});
}
CoreViewScenePipelined::~CoreViewScenePipelined() {
diff --git a/tests/registers/test.sh b/tests/registers/test.sh
index 2ace7cd..2a4fdd1 100755
--- a/tests/registers/test.sh
+++ b/tests/registers/test.sh
@@ -11,5 +11,5 @@ qtmips_make sub-qtmips_cli
mips_make_test
# Run test
-qtmips_run qtmips_cli/qtmips_cli "$TEST_DIR/registers" \
+qtmips_run qtmips_cli/qtmips_cli --trace-gp '*' "$TEST_DIR/registers" \
|| echo_fail "Test $TEST_NAME failed!"