1
0
forked from Rativel/BurritOS

add addi print test

This commit is contained in:
Quentin Legot
2022-11-09 15:54:01 +01:00
parent 756410e5b4
commit 3b17ffcaa6
2 changed files with 17 additions and 7 deletions

View File

@@ -260,16 +260,16 @@ pub fn print(ins: Instruction, pc: i32) -> String { //TODO pc should be u64
#[cfg(test)]
mod Test {
mod test {
use crate::{print, decode};
#[test]
fn test1() {
let sub = decode::decode(0b01000001000010001000111000110011);
let add = decode::decode(0b00000001000010001000111000110011);
let xor = decode::decode(0b00000001000010001100111000110011);
let slr = decode::decode(0b00000001000010001101111000110011);
let sra = decode::decode(0b01000001000010001101111000110011);
fn test_op() {
let sub = decode::decode(0b0100000_10000_10001_000_11100_0110011);
let add = decode::decode(0b0000000_10000_10001_000_11100_0110011);
let xor = decode::decode(0b0000000_10000_10001_100_11100_0110011);
let slr = decode::decode(0b0000000_10000_10001_101_11100_0110011);
let sra = decode::decode(0b0100000_10000_10001_101_11100_0110011);
assert_eq!("sub r28, r17, r16", print::print(sub, 0));
assert_eq!("xor r28, r17, r16", print::print(xor, 0));
@@ -278,4 +278,11 @@ mod Test {
assert_eq!("add r28, r17, r16", print::print(add, 0));
}
#[test]
fn test_opi() {
let addi = decode::decode(0b0000000000_10001_000_11100_0010011);
assert_eq!("addi x28, x17, 0", print::print(addi, 0));
}
}