Presentation is loading. Please wait.

Presentation is loading. Please wait.

EEC4133 Computer Organization & Architecture Chapter 6: Languages and the Machine by Muhazam Mustapha, May 2014.

Similar presentations


Presentation on theme: "EEC4133 Computer Organization & Architecture Chapter 6: Languages and the Machine by Muhazam Mustapha, May 2014."— Presentation transcript:

1 EEC4133 Computer Organization & Architecture Chapter 6: Languages and the Machine by Muhazam Mustapha, May 2014

2 Learning Outcome By the end of this chapter, students are expected to have some theoretical concept of how high performance assembly coding is done Most of the material in this slide set is adopted from Murdocca & Heuring 2007

3 Chapter Content Process of Generating Machine Code –Compile, Assemble, Link, Load –Macro High Performance Computing –Pipelining –Overlapping Register –Low Power Coding

4 Generating Machine Code

5 Compilation [Definition] Compilation is a process of converting high level language code into assembly language code The high level languages include: C, C++, C#, Java, Pascal, BASIC, etc These high level languages are machine (microprocessor) independent

6 Compilation Example (a C language code): –a = b+c; –This code may convert to: MOV A, [b]; ADD A, [c]; MOV [a], A;

7 Assembly [Definition] Assembly is a process of converting assembly language instructions into machine language opcode that consist of 1-s and 0-s Assembly language instruction and its corresponding machine language opcode is highly dependent to the microprocessor being used

8 Assembly Example: –MOV A, B; –This assembly code may convert to machine code: 11000000000000000000000000000001 Op Addressing Type TargetSource

9 Macro [Definition] Macro is a piece of assembly code that is invoked like a subroutine but actually is expanded inline into the program during preprocessing before assembly Having macros in assembly language program while avoid overhead of subroutine calls (faster runtime), but the resulting machine code will be larger

10 Macro

11 Linking [Definition] Linking is a process after assembly to resolve (finalize) the resources pointer or location that have been defined in separate modules either in libraries or user defined After linking, all off module or clashing parameters will be resolved to the correct references

12 Loading A finished executable code will references within itself or external locations External references most likely is fixed Internal references will need to be adjusted as the code won’t have prior knowledge about the exact location where it is put in during execution

13 Loading [Definition] Loading is a process to load an executable into main memory and re- calculate the references to reflect the actual resources location at runtime

14 High Performance Computing

15 Pipelining In the fetch-execute cycle, one would realize that there is no need to wait for one instruction to complete the entire cycle before beginning the next one

16 Pipelining [Definition] Pipelining is an enhancement to the fetch-execute cycle, whereby a subsequent instruction can begin a stage in the cycle when the previous instruction is at the next stage, without waiting for that previous instruction to finish the entire cycle

17 Pipelining

18 Obviously pipelining can be smoothly done if the sequence of instructions are properly synchronized and do not depend on the result of the earlier ones before they complete the cycle The logic to automatically re-arrange the instructions so that pipelining is at its optimum level is done by the compiler –Sometimes forced delay might be needed

19 Pipelining

20 Overlapping Register Use With pipelining, a further improvement can be made if the microprocessor has a large no. registers that can be set to input registers and output registers [Definition] Overlapping register use is the use input registers by a second procedure call, while the first procedure call has NOT yet returned, but already finished using those input registers

21 Overlapping Register Use

22 Low Power Coding Consider the following code: ld [2096], %r16 ld [2100], %r17 ld [2104], %r18 ld [2108], %r19 The corresponding machine code is: 2

23 Low Power Coding The no. transitions in the previous code is 8, and can be reduced to 6 if they are re- arranged:

24 Low Power Coding With less transitions in the machine code there will be less power used This can be achieved by Gray code sequencing of instruction code This is just one way to power optimized our machine code


Download ppt "EEC4133 Computer Organization & Architecture Chapter 6: Languages and the Machine by Muhazam Mustapha, May 2014."

Similar presentations


Ads by Google