From 1e0bc1333028a9556faf3d6734c140c6fd76d113 Mon Sep 17 00:00:00 2001 From: Dan Ravensloft Date: Mon, 7 Dec 2020 14:25:44 +0000 Subject: Transpose Table 4-43 to fix decoding of srlz.i --- src/lib.rs | 20 ++++---------------- tests/test.rs | 5 +++++ 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c2a8960..8c7496b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3953,23 +3953,11 @@ fn get_m_opcode_and_encoding(tag: u8, word: &BitSlice) -> (Opcode, Ope if x3 == 0 { // `Table 4-43 System/Memory Management 4-bit+2-bit Ext` const TABLE4_43: [(Opcode, OperandEncodingM); 64] = [ - (Break_m, M37), (Invala, M24), (Fwb, M24), (Srlz_d, M24), // `1-bit Ext (Table 4-46)` is handled independently - (Purple, None), (Purple, None), (Purple, None), (Srlz_i, M24), - (Purple, None), (Invala_e_int, M26), (Mf, M24), (Purple, None), - (Purple, None), (Invala_e_fp, M27), (Mf_a, M24), (Sync_i, M24), - (Sum, M44), (Sum, M44), (Sum, M44), (Sum, M44), - (Rum, M44), (Rum, M44), (Rum, M44), (Rum, M44), - (Ssm, M44), (Ssm, M44), (Ssm, M44), (Ssm, M44), - (Rsm, M44), (Rsm, M44), (Rsm, M44), (Rsm, M44), - (Purple, None), (Purple, None), (Mov_m, M30), (Purple, None), - (Purple, None), (Purple, None), (Purple, None), (Purple, None), - (Loadrs, M25), (Purple, None), (Purple, None), (Purple, None), - (Purple, None), (Purple, None), (Purple, None), (Purple, None), - (Flushrs, M25), (Purple, None), (Purple, None), (Purple, None), - (Purple, None), (Purple, None), (Purple, None), (Purple, None), - (Purple, None), (Purple, None), (Purple, None), (Purple, None), - (Purple, None), (Purple, None), (Purple, None), (Purple, None), + (Break_m, M37), (Purple, None), (Purple, None), (Purple, None), (Sum, M44), (Rum, M44), (Ssm, M44), (Rsm, M44), (Purple, None), (Purple, None), (Loadrs, M25), (Purple, None), (Flushrs, M25), (Purple, None), (Purple, None), (Purple, None), + (Invala, M24), (Purple, None), (Invala_e_int, M26), (Invala_e_fp, M27), (Sum, M44), (Rum, M44), (Ssm, M44), (Rsm, M44), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), + (Fwb, M24), (Purple, None), (Mf, M24), (Mf_a, M24), (Sum, M44), (Rum, M44), (Ssm, M44), (Rsm, M44), (Mov_m, M30), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), + (Srlz_d, M24), (Srlz_i, M24), (Purple, None), (Sync_i, M24), (Sum, M44), (Rum, M44), (Ssm, M44), (Rsm, M44), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), ]; let index = word[27..33].load::(); if index == 0b00001 { diff --git a/tests/test.rs b/tests/test.rs index 01df3fb..a21cfcc 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -46,6 +46,11 @@ fn test_ad_hoc() { let data = [0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00, 0x60, 0x00, 0x40, 0x00, 0x14, 0x00, 0x90]; let inst = decoder.decode(data[..].iter().cloned()).unwrap(); assert_eq!(format!("{}", inst), expected); + + let expected = "[MMI] srlz.i;; mov r9=0x1; nop.i 0x0;;"; + let data = [0x0b, 0x00, 0x00, 0x00, 0x31, 0x00, 0x90, 0x08, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x04, 0x00]; + let inst = decoder.decode(data[..].iter().cloned()).unwrap(); + assert_eq!(format!("{}", inst), expected); } #[test] fn test_shr_shl_dep_ext() { -- cgit v1.1