Presentation is loading. Please wait.

Presentation is loading. Please wait.

Assembler, Compiler, MIPS simulator

Similar presentations


Presentation on theme: "Assembler, Compiler, MIPS simulator"— Presentation transcript:

1 Assembler, Compiler, MIPS simulator
Assembly, Assembler, Linker Assembling, Linking. When to use assembly. Drawbacks of assembly SPIM simulator. Writing a program. Running it. Syntax of MIPS assembly

2 Assembly & Machine Instructions
What is Assembly ? Symbolic representation of a computer’s binary encoding - machine language Programming view of the architecture of a particular processor. machine instruction assembly language statement   add $t0,$t1,$t2

3 Assembly vs. Machine Instructions
machine instruction assembly language statement   add $t0,$t1,$t2 Machine instructions: Are beneficial to use in computers. It is hard for humans to keep track of machine instructions ones and zeros. Assembly: By using symbols programmers gain flexibility in describing the computation. Assembly language is a compact notation. Symbolic names for operations and locations Programming facilities – macros, pseudoinstructions.

4 Assembling, linking A tool called an assembler translates assembly language into binary instructions - object module. Another tool, called a linker combines a collection of object and library files into an executable file, which a computer can run. header

5 Compiling, linking In a high level programming language like C or Java a programmer is mostly unaware of computer architecture. The same source program can run (after compiling) on any processor family. That is done by sophisticated compilers which know exactly how to translate the high level program to the particular machine language.

6 Interpreters There are two ways to run programs written in a high-level language. The most common is to compile the program; the other method is to pass the program through an interpreter. Interpreter is a program that executes instructions written in a high-level language.

7 Interpreters vs. compilers
Interpreting code is slower than running the compiled code because the interpreter must analyze each statement in the program each time it is executed and then perform the desired action whereas the compiled code just performs the action within a fixed context determined by the compilation This run-time analysis is known as "interpretive overhead". Access to variables is also slower in an interpreter because the mapping of identifiers to storage locations must be done repeatedly at run-time rather than at compile time.

8 Where we need the Assembly
The primary reason to program in assembly language, as opposed to an available high-level language, is that the speed or size of a program is critically important. A hybrid approach, in which most of a program is written in a high-level language and time-critical sections are written in assembly language, builds on the strengths of both languages Cases when no high-level language or compiler is available on a particular computer Ability to exploit specialized instructions, for example, string copy or pattern-matching instructions.

9 Assembly language disadvantages versus High level languages
Assembly programs are machine-specific and must be totally rewritten to run on another computer architecture. Assembly language programs are longer than the equivalent programs written in a high-level language. programmers write roughly the same number of lines of code per day in assembly and in high-level languages longer programs are more difficult to read and understand and they contain more bugs


Download ppt "Assembler, Compiler, MIPS simulator"

Similar presentations


Ads by Google