1 //
2 // Copyright (c) 2010-2021 Antmicro
3 // Copyright (c) 2011-2015 Realtime Embedded
4 //
5 // This file is licensed under the MIT License.
6 // Full license text is available in 'licenses/MIT.txt'.
7 //
8 using System;
9 
10 namespace Antmicro.Renode.Peripherals.CPU.Disassembler
11 {
12     public interface IDisassembler
13     {
TryDisassembleInstruction(ulong pc, byte[] memory, uint flags, out DisassemblyResult result, int memoryOffset = 0)14         bool TryDisassembleInstruction(ulong pc, byte[] memory, uint flags, out DisassemblyResult result, int memoryOffset = 0);
TryDecodeInstruction(ulong pc, byte[] memory, uint flags, out byte[] opcode, int memoryOffset = 0)15         bool TryDecodeInstruction(ulong pc, byte[] memory, uint flags, out byte[] opcode, int memoryOffset = 0);
16     }
17 
18     public struct DisassemblyResult
19     {
20         public ulong PC { get; set; }
21         public int OpcodeSize { get; set; }
22         public string OpcodeString { get; set; }
23         public string DisassemblyString { get; set; }
24 
ToStringAntmicro.Renode.Peripherals.CPU.Disassembler.DisassemblyResult25         public override string ToString()
26         {
27             return $"0x{PC:x8}:   {OpcodeString} {DisassemblyString}";
28         }
29     }
30 }
31 
32