Implementing a MIPS processor using SME
Carl-Johannes Johnsen
Department of Computer Science University of Copenhagen
August 22, 2017
Carl-Johannes Johnsen Implementing a MIPS processor using SME
Implementing a MIPS processor using SME Carl-Johannes Johnsen - - PowerPoint PPT Presentation
Implementing a MIPS processor using SME Carl-Johannes Johnsen Department of Computer Science University of Copenhagen August 22, 2017 Carl-Johannes Johnsen Implementing a MIPS processor using SME Background The Machine Architecture class at
Carl-Johannes Johnsen Implementing a MIPS processor using SME
Carl-Johannes Johnsen Implementing a MIPS processor using SME
Carl-Johannes Johnsen Implementing a MIPS processor using SME
Carl-Johannes Johnsen Implementing a MIPS processor using SME
1 public interface InputA : IBus { 2 bool bit { get; set; } 3 } 4 ... 5 public class AndGate : SimpleProcess { 6 [InputBus] InputB input1; 7 [InputBus] InputC input2; 8 [OutputBus] Internal3 output; 9 10 protected override void OnTick() { 11
12 } 13 } 14 15 public class OrGate : SimpleProcess { 16 ... 17 protected override void OnTick() { 18
19 } 20 } 21 22 public class XorGate : SimpleProcess { 23 ... 24 protected override void OnTick() { 25
26 } 27 }
OR AND AND XOR XOR InputA InputB InputC Sum Carry
Carl-Johannes Johnsen Implementing a MIPS processor using SME
1 public interface ReadA : IBus { 2 short addr { get; set; } 3 } 4 ... 5 6 public interface WriteBus : IBus { 7 bool enabled { get; set; } 8 short addr { get; set; } 9 uint data { get; set; } 10 } 11 12 public interface OutputA : IBus { 13 uint data { get; set; } 14 } 15 ... 1 public class Register : SimpleProcess { 2 [InputBus] ReadA readA; 3 [InputBus] ReadB readB; 4 [InputBus] WriteBus write; 5 6 [OutputBus] OutputA outputA; 7 [OutputBus] OutputB outputB; 8 9 uint[] data = new uint[32]; 10 11 protected override void OnTick() { 12 if (write.enabled && write.addr > 0) 13 data[write.addr] = write.data; 14
15
16 } 17 } Carl-Johannes Johnsen Implementing a MIPS processor using SME
Register file Control unit Jump unit Splitter Instruction Memory Sign extend ALU ALU control Memory | | | PC Write buffer Clock
Carl-Johannes Johnsen Implementing a MIPS processor using SME
Register file Control unit Jump unit Splitter Instruction Memory Sign extend ALU ALU control Memory JAL | | | | PC Write buffer Clock
Carl-Johannes Johnsen Implementing a MIPS processor using SME
ALU Register File Memory Jump Instruction Memory PC Control | Forwarding Unit | | | Hazard Detectection IF ID EX MEM WB
Carl-Johannes Johnsen Implementing a MIPS processor using SME
MARS SME # CT time (ms) CR (hz) # CT time (ms) CR (hz) Towers of Hanoi n = 5 719 585 ∼1229 720 - 1058 516 - 1190 ∼1395 - ∼889 Quicksort n = 8 483 582 ∼829 484 - 763 375 - 895 ∼1290 - ∼852 Fib no optimization n = 10 220 584 ∼376 221 - 251 191 - 356 ∼1157 - ∼753 Fib forward n = 10 98 586 ∼167 100 - 130 119 - 209 ∼840 - ∼ 622 Fib hazard n = 10 84 588 ∼142 86 - 126 113 - 212 ∼761 - ∼594
Carl-Johannes Johnsen Implementing a MIPS processor using SME
Carl-Johannes Johnsen Implementing a MIPS processor using SME
Carl-Johannes Johnsen Implementing a MIPS processor using SME
Carl-Johannes Johnsen Implementing a MIPS processor using SME
1 #include "xparameters.h" 2 #include "LogicGates_AXI.h" 3 #include "xil_io.h" 4 5 int base = XPAR_LOGICGATES_AXI_0_S00_AXI_BASEADDR; 6 int bit1 = LOGICGATES_AXI_S00_AXI_SLV_REG0_OFFSET; 7 int bit2 = LOGICGATES_AXI_S00_AXI_SLV_REG1_OFFSET; 8 int and = LOGICGATES_AXI_S00_AXI_SLV_REG2_OFFSET; 9 int or = LOGICGATES_AXI_S00_AXI_SLV_REG3_OFFSET; 10 int not = LOGICGATES_AXI_S00_AXI_SLV_REG4_OFFSET; 11 int xor = LOGICGATES_AXI_S00_AXI_SLV_REG5_OFFSET; 12 13 void print_regs() { 14 xil_printf("%d %d | %d %d %d %d\n", 15 LOGICGATES_AXI_mReadReg(base, bit1), 16 LOGICGATES_AXI_mReadReg(base, bit2), 17 LOGICGATES_AXI_mReadReg(base, and), 18 LOGICGATES_AXI_mReadReg(base, or), 19 LOGICGATES_AXI_mReadReg(base, not), 20 LOGICGATES_AXI_mReadReg(base, xor)); 21 } 22 23 void write_regs(int bit1_data, int bit2_data) { 24 LOGICGATES_AXI_mWriteReg(base, bit1, bit1_data); 25 LOGICGATES_AXI_mWriteReg(base, bit2, bit2_data); 26 } 1 int main() { 2 init_platform(); 3 4 write_regs(0,0); 5 print_regs(); 6 7 write_regs(0,1); 8 print_regs(); 9 10 write_regs(1,0); 11 print_regs(); 12 13 write_regs(1,1); 14 print_regs(); 15 16 cleanup_platform(); 17 return 0; 18 } 1 0 0 | 0 0 1 0 2 0 1 | 0 1 1 1 3 1 0 | 0 1 0 1 4 1 1 | 1 1 0 0 Carl-Johannes Johnsen Implementing a MIPS processor using SME
Carl-Johannes Johnsen Implementing a MIPS processor using SME
Carl-Johannes Johnsen Implementing a MIPS processor using SME
Carl-Johannes Johnsen Implementing a MIPS processor using SME
Carl-Johannes Johnsen Implementing a MIPS processor using SME