diff options
author | iximeow <me@iximeow.net> | 2020-10-10 14:27:56 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2020-10-10 14:27:56 -0700 |
commit | bd7cae741ca961ef6d5959bbf060205d9c514af0 (patch) | |
tree | 709bdd04ba392c30386ef5069f2911d07079d693 /tests | |
parent | 0a67a0cffdb503967885422c2b966a0e70ec6969 (diff) |
start getting display impls together, distinguish read/write operands
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test.rs | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/tests/test.rs b/tests/test.rs index cac89d0..a035c37 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -7,10 +7,35 @@ fn test_a_bundle() { // [MMI] addl r15=0,r1;; // ld8.acq r16=[r15],8 // mov r14=r1;; - let data = [0x0b, 0x78, 0x00, 0x02, 0x00, 0x24, 0x00, 0x41, 0x3c, 0x70, 0x27, 0xc0, 0x01, 0x08, 0x00, 0x84]; +// let data = [0x0b, 0x78, 0x00, 0x02, 0x00, 0x24, 0x00, 0x41, 0x3c, 0x70, 0x27, 0xc0, 0x01, 0x08, 0x00, 0x84]; + let data = [0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0]; + let data = [0x04, 0x10, 0x1c, 0x00, 0x80, 0x45, 0x02, 0x4c, 0x80, 0x09, 0x00, 0x60, 0xf0, 0x13, 0x1a, 0x60]; + let data = [0x05, 0x10, 0x41, 0x18, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x60, 0x20, 0x00, 0x23, 0xc8, 0x6f]; let decoder = InstDecoder::default(); - decoder.decode(data[..].iter().cloned()).unwrap(); + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + println!("{:?}", inst); + println!("{}", inst); +} + +#[test] +fn test_br_cosmetics() { + let decoder = InstDecoder::default(); + + let data = [0x11, 0x08, 0x00, 0x1e, 0x18, 0x10, 0x60, 0x80, 0x04, 0x80, 0x03, 0x00, 0x60, 0x00, 0x80, 0x00]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + let stringy = format!("{}", inst); +// assert_eq!(stringy, "[MIB] ld8 r1=[r15]; mov b6=r16; br.few b6;;"); + + let data = [0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + let stringy = format!("{}", inst); +// assert_eq!(stringy, "[MLX] nop.m 0; brl.sptk.few tgt;;"); + + let data = [0x19, 0x50, 0x40, 0x19, 0x3f, 0x23, 0x80, 0x00, 0x00, 0x00, 0x48, 0x80, 0x00, 0x00, 0x84, 0x02]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + let stringy = format!("{}", inst); + assert_eq!(stringy, "[MMB] adds r10=-48,r12; mov r8=0; br.ret.dptk.few b0"); } // from elf64-ia64-vms.c |