fix ADD_ADD
This commit is contained in:
parent
4fa691a568
commit
27cd7d35c7
@ -102,7 +102,6 @@ impl Machine {
|
||||
|
||||
let inst : Instruction = decode(machine.instructions[machine.pc as usize]);
|
||||
|
||||
machine.pc += 4;
|
||||
|
||||
match inst.opcode {
|
||||
RISCV_LUI => {
|
||||
@ -194,6 +193,8 @@ impl Machine {
|
||||
}
|
||||
},
|
||||
|
||||
//TODO store instructions
|
||||
|
||||
//******************************************************************************************
|
||||
// Treatment for: OPI INSTRUCTIONS
|
||||
RISCV_OPI => {
|
||||
@ -265,11 +266,11 @@ impl Machine {
|
||||
} else {
|
||||
match inst.funct3 {
|
||||
RISCV_OP_ADD => {
|
||||
// RISCV_OP_ADD_ADD inaccessible
|
||||
/*if (inst.funct7 == RISCV_OP_ADD_ADD) {
|
||||
machine.int_reg[inst.rd as usize] = machine.int_reg[inst.rs1 as usize] + machine.int_reg[inst.rs2 as usize];*/
|
||||
if (inst.funct7 == RISCV_OP_ADD_ADD) {
|
||||
machine.int_reg[inst.rd as usize] = machine.int_reg[inst.rs1 as usize] + machine.int_reg[inst.rs2 as usize];
|
||||
} else {
|
||||
machine.int_reg[inst.rd as usize] = machine.int_reg[inst.rs1 as usize] - machine.int_reg[inst.rs2 as usize];
|
||||
//}
|
||||
}
|
||||
},
|
||||
RISCV_OP_SLL => {
|
||||
machine.int_reg[inst.rd as usize] = machine.int_reg[inst.rs1 as usize] << (machine.int_reg[inst.rs2 as usize] & 0x3f);
|
||||
@ -371,6 +372,7 @@ impl Machine {
|
||||
_ => { println!("{} opcode non géré", inst.opcode)},
|
||||
}
|
||||
|
||||
machine.pc += 4;
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user