diff options
author | Karel Kočí <cynerd@email.cz> | 2017-11-25 15:08:07 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2017-11-25 15:08:07 +0100 |
commit | fcb67b16d13de62092e3720d08adb0ef5e35de3d (patch) | |
tree | ca9daaf9d80e14bddff224f2f7e81123acdd7dd8 /qtmips_machine/core.cpp | |
parent | f5d4468b2a8afa28ddad0bad425f762725eb69a7 (diff) | |
download | qtmips-fcb67b16d13de62092e3720d08adb0ef5e35de3d.tar.gz qtmips-fcb67b16d13de62092e3720d08adb0ef5e35de3d.tar.bz2 qtmips-fcb67b16d13de62092e3720d08adb0ef5e35de3d.zip |
Test pipelined core
Diffstat (limited to 'qtmips_machine/core.cpp')
-rw-r--r-- | qtmips_machine/core.cpp | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/qtmips_machine/core.cpp b/qtmips_machine/core.cpp index d86a6f4..75690a3 100644 --- a/qtmips_machine/core.cpp +++ b/qtmips_machine/core.cpp @@ -163,14 +163,35 @@ void CoreSingle::step() { CorePipelined::CorePipelined(Registers *regs, MemoryAccess *mem) : \ Core(regs, mem) { - // Nothing to do + // Initialize to NOPE // + // dtFetch + dt_f.inst = Instruction(0x00); + // dtDecode + dt_d.inst = dt_f.inst; + dt_d.mem2reg = false; + dt_d.memwrite = false; + dt_d.alusrc = false; + dt_d.regd = false; + dt_d.regwrite = false; + dt_d.branch = false; + dt_d.aluop = ALU_OP_SLL; + dt_d.val_rs = 0; + dt_d.val_rt = 0; + // dtExecute + dt_e.regwrite = dt_d.regwrite; + dt_e.rwrite = dt_d.regwrite; + dt_e.alu_val = 0; + // dtMemory + dt_m.regwrite = dt_e.regwrite; + dt_m.rwrite = dt_e.rwrite; + dt_m.alu_val = dt_e.alu_val; } void CorePipelined::step() { // TODO implement pipelined - struct dtFetch f = fetch(); - struct dtDecode d = decode(f); - struct dtExecute e = execute(d); - struct dtMemory m =memory(e); - writeback(m); + writeback(dt_m); + dt_m =memory(dt_e); + dt_e = execute(dt_d); + dt_d = decode(dt_f); + dt_f = fetch(); } |