add of the test function for br instructions
This commit is contained in:
parent
3b9a23948a
commit
c7bf66f210
16
src/print.rs
16
src/print.rs
@ -350,4 +350,20 @@ mod test {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_br() {
|
||||||
|
let beq: decode::Instruction = decode::decode(0b0000000_10000_10001_000_00000_1100011);
|
||||||
|
let bne: decode::Instruction = decode::decode(0b0000000_10000_10001_001_00000_1100011);
|
||||||
|
let blt: decode::Instruction = decode::decode(0b0000000_10000_10001_100_00000_1100011);
|
||||||
|
let bge: decode::Instruction = decode::decode(0b0000000_10000_10001_101_00000_1100011);
|
||||||
|
let bltu: decode::Instruction = decode::decode(0b0000000_10000_10001_110_00000_1100011);
|
||||||
|
let bgeu: decode::Instruction = decode::decode(0b0000000_10000_10001_111_00000_1100011);
|
||||||
|
assert_eq!("blt r17 x16 0", print::print(blt, 0));
|
||||||
|
assert_eq!("bge r17 x16 0", print::print(bge, 0));
|
||||||
|
assert_eq!("bltu r17 x16 0", print::print(bltu, 0));
|
||||||
|
assert_eq!("bgeu r17 x16 0", print::print(bgeu, 0));
|
||||||
|
assert_eq!("bne r17 x16 0", print::print(bne, 0));
|
||||||
|
assert_eq!("beq r17 x16 0", print::print(beq, 0));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user