Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in this part you are asked to recognize what a given segment of machine code does, by translating it into assembly code, and annotating it

image text in transcribed

in this part you are asked to recognize what a given segment of machine code does, by translating it into assembly code, and annotating it with expressions in a high level language like C. This process from binary code back to source code, is called disassembling. Disassemble the following machine code into operations and arguments, e.g., ADD R1, R2, R3. Explain what the whole program does, either in plain English (e.g., it calculates the product of R1 and R2) or in C type of pseudo code (e.g, R3 = R1 * R2.) Note: you need to make up unique labels for your assembly code

The following instruction set is supported by a simple processor, which is similar to what we discussed in the class, with a few new instructions added. The format of most instructions is defined as follows. bits 15:14 13:10 98:65:32:0 f ficld unused opcode w src1 where the fields are defined as follows opcode: operation to be performed by the processor write back ALU output to register file (1 = yes, 0 = no) W. src address of the first ALU operand in the register file address of the second ALU operand in the register file address in the register file where the output is written SrC dst: For opcodes BEQ, BLEZ and JUMP, the 6 least significant bits (5:0) give an address in the instruction memory, which is byte-addressed. The opcode HALT has all operand bits (9:0) being 0. When an instruction has only two operands, the field for the unused operand is filled with 0-bits. For example, bits (5:3) for SLL are all zero because src2 is not used. The opcode and meaning of these instructions are listed in the following table. Operation opcodeBinary encoding ADD SUB SLL SRL 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xA [srcl]- src2] Rldst] INV ~RIsrc11 Rldst XOR OR AND NCR BRZ BLEZ src IIIR[src2] Rldst] src 11 + 1 Rldst If R[src1] = 0, branch to BAddr If R[src1] S0, branch to BAddr 0xE OxF JUMP Jump to JAddr Stop execution HALT In this part you are asked to recognize what a given segment of machine code does, by translating it into assembly code, and annotating it with expressions in a high level language like C. This process, 1. from binary code back to source code, is called "disassembling." Disassemble the following machine code into operations and arguments, e.g., ADD Rl. R2, R3. Explain what the whole program does, either in plain English (e.g.. it calculates the product of Rl and R2) or in C type of pseudo code (e.g. R3-RI *R2.) Note: you need to make up unique labels for your assembly code. Addr:Code 0x00 07 FE 0x02: 06 08 0x04: 28 08 0x06 38 02 0x08: 02 47 OxOA: 3C 00 The following instruction set is supported by a simple processor, which is similar to what we discussed in the class, with a few new instructions added. The format of most instructions is defined as follows. bits 15:14 13:10 98:65:32:0 f ficld unused opcode w src1 where the fields are defined as follows opcode: operation to be performed by the processor write back ALU output to register file (1 = yes, 0 = no) W. src address of the first ALU operand in the register file address of the second ALU operand in the register file address in the register file where the output is written SrC dst: For opcodes BEQ, BLEZ and JUMP, the 6 least significant bits (5:0) give an address in the instruction memory, which is byte-addressed. The opcode HALT has all operand bits (9:0) being 0. When an instruction has only two operands, the field for the unused operand is filled with 0-bits. For example, bits (5:3) for SLL are all zero because src2 is not used. The opcode and meaning of these instructions are listed in the following table. Operation opcodeBinary encoding ADD SUB SLL SRL 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xA [srcl]- src2] Rldst] INV ~RIsrc11 Rldst XOR OR AND NCR BRZ BLEZ src IIIR[src2] Rldst] src 11 + 1 Rldst If R[src1] = 0, branch to BAddr If R[src1] S0, branch to BAddr 0xE OxF JUMP Jump to JAddr Stop execution HALT In this part you are asked to recognize what a given segment of machine code does, by translating it into assembly code, and annotating it with expressions in a high level language like C. This process, 1. from binary code back to source code, is called "disassembling." Disassemble the following machine code into operations and arguments, e.g., ADD Rl. R2, R3. Explain what the whole program does, either in plain English (e.g.. it calculates the product of Rl and R2) or in C type of pseudo code (e.g. R3-RI *R2.) Note: you need to make up unique labels for your assembly code. Addr:Code 0x00 07 FE 0x02: 06 08 0x04: 28 08 0x06 38 02 0x08: 02 47 OxOA: 3C 00

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

Students also viewed these Databases questions