Question
Should be written in Python: A disassembler takes a machine code file (binary) and converts it back into assembly code. Disassemblers are a key tool
Should be written in Python:
A disassembler takes a machine code file (binary) and converts it back into assembly code. Disassemblers are a key tool in the software reverse engineering process because it allows you to go from the raw binary all the way back to the original source code, if desired. For this assignment you will be given 8 32-bit binary strings and the type of the instruction (I-type, R-type, or J-type). Youll write a basic disassembler in Python that splits the 32-bit string into its corresponding fields, converts them from binary into their string representation, then reorders the fields, resulting in the original assembly code instruction. Heres an example:
Here are the 8 machine code instructions to disassemble (its fine to hard-code them into your program):
1. instr1 = 00000001101011100101100000100100 (R-type)
2. instr2 = 10001101010010010000000000001000 (I-type)
3. instr3 = 00001000000000010010001101000101 (J-type)
4. instr4 = 00000010101010010101100000100010 (R-type)
5. instr5 = 00000011111000000000000000001000 (R-type)
6. instr6 = 00110101111100001011111011101111 (I-type)
7. instr7 = 10101110100011010000000000100000 (I-type)
8. instr8 = 00000010110011010101000000100000 (R-type)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started