Reverse Assembly Typical problem:

Slides:



Advertisements
Similar presentations
MIPS Assembly Tutorial
Advertisements

Lecture 5: MIPS Instruction Set
Machine Instructions Operations
Princess Sumaya Univ. Computer Engineering Dept. Chapter 2: IT Students.
Chapter 2 Instructions: Language of the Computer
Chapter 2.
ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson slides3.ppt Modification date: March 16, Addressing Modes The methods used in machine instructions.
CEG 320/520: Computer Organization and Assembly Language Programming1 Assembly Language Programming Machine Code Hand Assembly.
Chapter 2 Instructions: Language of the Computer Part III.
COE Computer Organization & Assembly Language
Chapter 3 Assembly Language: Part 1. Machine language program (in hex notation) from Chapter 2.
CS 300 – Lecture 6 Intro to Computer Architecture / Assembly Language Instructions.
ECE 265 – LECTURE 9 PROGRAM DESIGN 8/12/ ECE265.
Assembly & Machine Languages
Instruction Set Architecture
ITEC 352 Lecture 20 JVM Intro. Functions + Assembly Review Questions? Project due today Activation record –How is it used?
Lecture Objectives: 1)Define the terms least significant bit and most significant bit. 2)Explain how unsigned integer numbers are represented in memory.
ICS312 Set 9 Logic & Shift Instructions. Logic & Shift Instructions Logic and Shift Instructions can be used to change the bit values in an operand. The.
Computer Organization and Architecture Instructions: Language of the Machine Hennessy Patterson 2/E chapter 3. Notes are available with photocopier 24.
Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C Chapter 8 – Machine Instructions These are lecture notes to accompany the book.
EET 4250 Instruction Representation & Formats Acknowledgements: Some slides and lecture notes for this course adapted from Prof. Mary Jane Penn.
Chapter 2 — Instructions: Language of the Computer — 1 Memory Operands Main memory used for composite data – Arrays, structures, dynamic data To apply.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 9 Binary Representation and Logical Operations.
First Foray into Programming (the hard way). A reminder from last lesson: A machine code instruction has two parts:  Op-code  Operand An instruction.
SRC: instruction formats Op-coderarb rc c Type D Op-code Type Aunused Op-codera Type Bc1 21 Op-coderarb.
Instructor: Dr. Mike Turi Department of Computer Science and Computer Engineering Pacific Lutheran University Lecture slides adapted from Part 4, EE 334.
MIPS Assembly Language Programming
Chapter 8 – Machine Instructions
Compsci 210 Tutorial Five.
Instruction format Instruction is a command to microprocessor to perform a given task on specified data. Each instruction has two parts: One is the task.
A Uni-bus Data Path Implementation for the SRC
COMPUTER ARCHITECTURE & OPERATIONS I
Assembly Language Assembly Language
Morgan Kaufmann Publishers
Lecture 4: MIPS Instruction Set
Computer Science 210 Computer Organization
The University of Adelaide, School of Computer Science
Insert Presentation Title Here Insert Presentation Summary Here
CS/COE0447 Computer Organization & Assembly Language
Chapter 4.
Computer Architecture & Operations I
Teaching Computing to GCSE
Computer Architecture
Computer Organization and ASSEMBLY LANGUAGE
CSCI206 - Computer Organization & Programming
Computer Architecture & Operations I
The University of Adelaide, School of Computer Science
Data Transfers To be able to implement
ECEG-3202 Computer Architecture and Organization
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Programmer’s View of the EAGLE
Computer Science 210 Computer Organization
Unit 12 CPU Design & Programming
Part II Instruction-Set Architecture
Data manipulation instructions
Computer Architecture
COMS 361 Computer Organization
UCSD ECE 111 Prof. Farinaz Koushanfar Fall 2018
COMS 361 Computer Organization
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Assemblers CSCI/CMPE 3334 David Egle.
ECE 352 Digital System Fundamentals
Instructions in Machine Language
Addressing mode summary
Lecture 11 Z80 Instruction Hong DGU.
Execution time Execution Time (processor-related) = IC x CPI x T
Insert Presentation Title Here Insert Presentation Summary Here
Example 1: (expression evaluation)
CS501 Advanced Computer Architecture
Reverse Assembly Typical problem:
Presentation transcript:

Reverse Assembly Typical problem: Given a machine language instruction for the SRC, it may be required to find the equivalent SRC assembly language instruction

Example: Reverse assemble the following SRC machine language instructions: 68C2003A h E1C60004 h 61885000 h 724E8000 h 1A4000D4 h 084000D0 h Solution: 1. Write the given hexadecimal instruction in binary form 68C2003A h  0110 1000 1100 0010 0000 0000 0011 1010 b 2. Examine the first five bits of the instruction, and pick the corresponding mnemonic from the SRC instruction set listing arranged according to ascending order of op-codes 01101 b  13 d  addi  add immediate

4. Therefore, the assembly language instruction is addi R3, R1, 58 3. Now we know that this instruction uses the type C format, the two 5-bit fields after the op-code field represent the destination and the source registers respectively, and that the remaining 17-bits in the instruction represent a constant 0110 1000 1100 0010 0000 0000 0011 1010 b 4. Therefore, the assembly language instruction is addi R3, R1, 58 op-code ra field rb field 17-bit c1 field addi R3 R1 3A h = 58 d

Summary 68C2003A h addi R3, R1, 58 E1C60004 h 61885000 h 724E8000 h Given machine language instruction Equivalent assembly language instruction 68C2003A h addi R3, R1, 58 E1C60004 h 61885000 h 724E8000 h 1A4000D4 h 084000D0 h

We can do it a bit faster now ! Here is step 1 for all instructions Given instruction in hexadeximal Equivalent instruction in binary E1C60004 h 1110 0001 1100 0110 0000 0000 0000 0100 b 61885000 h 0110 0001 1000 1000 0101 0000 0000 0000 b 724E8000 h 0111 0010 0100 1110 1000 0000 0000 0000 b 1A4000D4 h 0001 1010 0100 0000 0000 0000 1101 0100 b 084000D0 h 0000 1000 0100 0000 0000 0000 1101 0000 b

Step 2: Pick up the op code for each instruction Given instruction in hexadeximal Op-code field mnemonic E1C60004 h 1110 0 b shl 61885000 h 0110 0 b add 724E8000 h 0111 0 b sub 1A4000D4 h 0001 1 b st 084000D0 h 0000 1 b ld

Step 3: Determine the instruction type for each instruction Given instruction in hexadeximal mnemonic Instruction type E1C60004 h shl 61885000 h add 724E8000 h sub 1A4000D4 h st 084000D0 h ld

Step 3: Determine the instruction type for each instruction The meaning of the remaining fields will depend on the instruction type (i.e., the instruction format) Given instruction in hexadeximal mnemonic Instruction type E1C60004 h shl 61885000 h add 724E8000 h sub 1A4000D4 h st 084000D0 h ld

Step 3: Determine the instruction type for each instruction Given instruction in hexadeximal mnemonic Instruction type E1C60004 h shl 61885000 h add 724E8000 h sub 1A4000D4 h st 084000D0 h ld

Summary 68C2003A h addi R3, R1, 58 E1C60004 h 61885000 h 724E8000 h Given machine language instruction Equivalent assembly language instruction 68C2003A h addi R3, R1, 58 E1C60004 h 61885000 h 724E8000 h 1A4000D4 h 084000D0 h

Note for graphics designer Please insert the attached images one per slide according to the numbering