From f3a300ce5927cad9ecf02821b3be007f9d2af22b Mon Sep 17 00:00:00 2001 From: dianshi Date: Wed, 19 Jan 2022 22:00:08 +0000 Subject: Add instruction memory --- instrmem/v0.1/test.instr | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 instrmem/v0.1/test.instr (limited to 'instrmem/v0.1/test.instr') diff --git a/instrmem/v0.1/test.instr b/instrmem/v0.1/test.instr new file mode 100644 index 0000000..785176e --- /dev/null +++ b/instrmem/v0.1/test.instr @@ -0,0 +1,15 @@ +0000_0100_0000_0000 // load R0 <- Mem(R2 + 0) +0000_0100_0100_0001 // load R1 <- Mem(R2 + 1) +0010_0000_0101_0000 // Add R2 <- R0 + R1 +0001_0010_1000_0000 // Store Mem(R1 + 0) <- R2 +0011_0000_0101_0000 // sub R2 <- R0 - R1 +0100_0000_0101_0000 // invert R2 <- !R0 +0101_0000_0101_0000 // logical shift left R2 <- R0<>R1 +0111_0000_0101_0000 // AND R2<- R0 AND R1 +1000_0000_0101_0000 // OR R2<- R0 OR R1 +1001_0000_0101_0000 // SLT R2 <- 1 if R0 < R1 +0010_0000_0000_0000 // Add R0 <- R0 + R0 +1011_0000_0100_0001 // BEQ branch to jump if R0=R1, PCnew= PC+2+offset<<1 = 28 => offset = 1 +1100_0000_0100_0000 // BNE branch to jump if R0!=R1, PCnew= PC+2+offset<<1 = 28 => offset = 0 +1101_0000_0000_0000 // J jump to the beginning address \ No newline at end of file -- cgit v1.2.3