Skip to content

Commit

Permalink
Update descriptions on 64 bit instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
TheThirdOne committed Jul 10, 2020
1 parent 21bf74e commit ca1fb58
Show file tree
Hide file tree
Showing 20 changed files with 17 additions and 43 deletions.
3 changes: 1 addition & 2 deletions src/rars/riscv/instructions/ADDIW.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package rars.riscv.instructions;

// TODO: update description
public class ADDIW extends ImmediateInstruction {
public ADDIW() {
super("addiw t1,t2,-100", "Addition immediate: set t1 to (t2 plus signed 12-bit immediate)", "000",true);
super("addiw t1,t2,-100", "Addition immediate: set t1 to (t2 plus signed 12-bit immediate) using only the lower 32 bits", "000",true);
}

public long compute(long value, long immediate) {
Expand Down
3 changes: 1 addition & 2 deletions src/rars/riscv/instructions/ADDW.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package rars.riscv.instructions;

// TODO: update description
public class ADDW extends ArithmeticW {
public ADDW() {
super("addw t1,t2,t3", "Addition: set t1 to (t2 plus t3)",
super("addw t1,t2,t3", "Addition: set t1 to (t2 plus t3) using only the lower 32 bits",
"0000000", "000",new ADD());
}
}
1 change: 0 additions & 1 deletion src/rars/riscv/instructions/AUIPC.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public AUIPC() {

public void simulate(ProgramStatement statement) {
int[] operands = statement.getOperands();
// TODO: make sure this is fine
RegisterFile.updateRegister(operands[0], RegisterFile.getProgramCounter() - INSTRUCTION_LENGTH + (operands[1] << 12));
}
}
3 changes: 1 addition & 2 deletions src/rars/riscv/instructions/DIVUW.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package rars.riscv.instructions;

// TODO: update description
public class DIVUW extends ArithmeticW {
public DIVUW() {
super("divuw t1,t2,t3", "Multiplication: set t1 to the lower 32 bits of t2*t3",
super("divuw t1,t2,t3", "Division: set t1 to the result of t2/t3 using unsigned division limited to 32 bits",
"0000001", "101",new DIVU());
}

Expand Down
3 changes: 1 addition & 2 deletions src/rars/riscv/instructions/DIVW.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package rars.riscv.instructions;

// TODO: update description
public class DIVW extends ArithmeticW {
public DIVW() {
super("divw t1,t2,t3", "Multiplication: set t1 to the lower 32 bits of t2*t3",
super("divw t1,t2,t3", "Division: set t1 to the result of t2/t3 using only the lower 32 bits",
"0000001", "100",new DIV());
}
}
3 changes: 1 addition & 2 deletions src/rars/riscv/instructions/LD.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import rars.Globals;
import rars.riscv.hardware.AddressErrorException;

// todo: update description
public class LD extends Load {
public LD() {
super("ld t1, -100(t2)", "Set t1 to contents of effective memory word address", "011",true);
super("ld t1, -100(t2)", "Set t1 to contents of effective memory double word address", "011",true);
}

public long load(int address) throws AddressErrorException {
Expand Down
3 changes: 1 addition & 2 deletions src/rars/riscv/instructions/LWU.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import rars.Globals;
import rars.riscv.hardware.AddressErrorException;

// todo: update description
public class LWU extends Load {
public LWU() {
super("lwu t1, -100(t2)", "Set t1 to contents of effective memory word address", "110",true);
super("lwu t1, -100(t2)", "Set t1 to contents of effective memory word address without sign-extension", "110",true);
}

public long load(int address) throws AddressErrorException {
Expand Down
3 changes: 1 addition & 2 deletions src/rars/riscv/instructions/MULW.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package rars.riscv.instructions;

// TODO: update description
public class MULW extends ArithmeticW {
public MULW() {
super("mulw t1,t2,t3", "Multiplication: set t1 to the lower 32 bits of t2*t3",
super("mulw t1,t2,t3", "Multiplication: set t1 to the lower 32 bits of t2*t3 using only the lower 32 bits of the input",
"0000001", "000",new MUL());
}
}
3 changes: 1 addition & 2 deletions src/rars/riscv/instructions/REMUW.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package rars.riscv.instructions;

// TODO: update description
public class REMUW extends ArithmeticW {
public REMUW() {
super("remuw t1,t2,t3", "Multiplication: set t1 to the lower 32 bits of t2*t3",
super("remuw t1,t2,t3", "Remainder: set t1 to the remainder of t2/t3 using unsigned division limited to 32 bits",
"0000001", "111",new REMU());
}
}
3 changes: 1 addition & 2 deletions src/rars/riscv/instructions/REMW.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package rars.riscv.instructions;

// TODO: update description
public class REMW extends ArithmeticW {
public REMW() {
super("remw t1,t2,t3", "Multiplication: set t1 to the lower 32 bits of t2*t3",
super("remw t1,t2,t3", "Remainder: set t1 to the remainder of t2/t3 using only the lower 32 bits",
"0000001", "110",new REM());
}
}
3 changes: 1 addition & 2 deletions src/rars/riscv/instructions/SD.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import rars.Globals;
import rars.riscv.hardware.AddressErrorException;

// todo: update description
public class SD extends Store {
public SD() {
super("sd t1, -100(t2)", "Store word : Store contents of t1 into effective memory word address", "011",true);
super("sd t1, -100(t2)", "Store double word : Store contents of t1 into effective memory double word address", "011",true);
}

public void store(int address, long data) throws AddressErrorException {
Expand Down
3 changes: 1 addition & 2 deletions src/rars/riscv/instructions/SLLIW.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
import rars.riscv.BasicInstruction;
import rars.riscv.BasicInstructionFormat;

// TODO: description
public class SLLIW extends BasicInstruction {
public SLLIW() {
super("slliw t1,t2,10", "Shift left logical : Set t1 to result of shifting t2 left by number of bits specified by immediate",
super("slliw t1,t2,10", "Shift left logical (32 bit): Set t1 to result of shifting t2 left by number of bits specified by immediate",
BasicInstructionFormat.R_FORMAT, "0000000 ttttt sssss 001 fffff 0011011",true);
}

Expand Down
3 changes: 1 addition & 2 deletions src/rars/riscv/instructions/SLLW.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package rars.riscv.instructions;

// TODO: update description
public class SLLW extends ArithmeticW {
public SLLW() {
super("sllw t1,t2,t3", "Shift left logical: Set t1 to result of shifting t2 left by number of bits specified by value in low-order 5 bits of t3",
super("sllw t1,t2,t3", "Shift left logical (32 bit): Set t1 to result of shifting t2 left by number of bits specified by value in low-order 5 bits of t3",
"0000000", "001",new SLL());
}
}
4 changes: 0 additions & 4 deletions src/rars/riscv/instructions/SLTIU.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,4 @@ public SLTIU() {
public long compute(long value, long immediate) {
return (Long.compareUnsigned(value, immediate) < 0) ? 1 : 0;
}
/* TODO make sure this is correct
public int compute(int value, int immediate) {
return (Integer.compareUnsigned(value, immediate) < 0) ? 1 : 0;
}*/
}
5 changes: 0 additions & 5 deletions src/rars/riscv/instructions/SLTU.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,4 @@ public SLTU() {
public long compute(long value, long value2) {
return (Long.compareUnsigned(value, value2) < 0) ? 1 : 0;
}
/* TODO make sure this is correct
public int computeW(int value, int value2) {
return (Integer.compareUnsigned(value, value2) < 0) ? 1 : 0;
}
*/
}
3 changes: 1 addition & 2 deletions src/rars/riscv/instructions/SRAIW.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
import rars.riscv.BasicInstruction;
import rars.riscv.BasicInstructionFormat;

// TODO: description
public class SRAIW extends BasicInstruction {
public SRAIW() {
super("sraiw t1,t2,10", "Shift right arithmetic : Set t1 to result of sign-extended shifting t2 right by number of bits specified by immediate",
super("sraiw t1,t2,10", "Shift right arithmetic (32 bit): Set t1 to result of sign-extended shifting t2 right by number of bits specified by immediate",
BasicInstructionFormat.R_FORMAT, "0100000 ttttt sssss 101 fffff 0011011",true);
}

Expand Down
3 changes: 1 addition & 2 deletions src/rars/riscv/instructions/SRAW.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package rars.riscv.instructions;

// TODO: update description
public class SRAW extends ArithmeticW {
public SRAW() {
super("sraw t1,t2,t3", "Shift left logical: Set t1 to result of shifting t2 left by number of bits specified by value in low-order 5 bits of t3",
super("sraw t1,t2,t3", "Shift left logical (32 bit): Set t1 to result of shifting t2 left by number of bits specified by value in low-order 5 bits of t3",
"0100000", "101",new SRA());
}
}
2 changes: 1 addition & 1 deletion src/rars/riscv/instructions/SRLIW.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class SRLIW extends BasicInstruction {
public SRLIW() {
super("srliw t1,t2,10", "Shift right logical : Set t1 to result of shifting t2 right by number of bits specified by immediate",
super("srliw t1,t2,10", "Shift right logical (32 bit): Set t1 to result of shifting t2 right by number of bits specified by immediate",
BasicInstructionFormat.R_FORMAT, "0000000 ttttt sssss 101 fffff 0011011",true);
}

Expand Down
3 changes: 1 addition & 2 deletions src/rars/riscv/instructions/SRLW.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package rars.riscv.instructions;

// TODO: update description
public class SRLW extends ArithmeticW {
public SRLW() {
super("srlw t1,t2,t3", "Shift left logical: Set t1 to result of shifting t2 left by number of bits specified by value in low-order 5 bits of t3",
super("srlw t1,t2,t3", "Shift left logical (32 bit): Set t1 to result of shifting t2 left by number of bits specified by value in low-order 5 bits of t3",
"0000000", "101",new SRL());
}
}
3 changes: 1 addition & 2 deletions src/rars/riscv/instructions/SUBW.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package rars.riscv.instructions;

// TODO: update description
public class SUBW extends ArithmeticW {
public SUBW() {
super("subw t1,t2,t3", "Addition: set t1 to (t2 plus t3)",
super("subw t1,t2,t3", "Subtraction: set t1 to (t2 minus t3) using only the lower 32 bits",
"0100000", "000",new SUB());
}
}

0 comments on commit ca1fb58

Please sign in to comment.