mod04-2up

mod04-2up - 12-03-05 1 CS 230 - Winter 2012 4-1 CS 230...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 12-03-05 1 CS 230 - Winter 2012 4-1 CS 230 Introduction to Computers and Computer Systems Module 4 Build and Execute (Slides based on materials prepared by Martin Karsten) CS 230 - Winter 2012 4-2 Overview execution approaches scanning regular expressions parsing context-free grammars linking and loading 12-03-05 2 CS 230 - Winter 2012 4-3 Classical Tool Chain Compilertranslates high level language into assembly program. Assemblertranslates assembly program into machine code in object file. Linkercombines multiple object files of machine code into program file. Loaderloads program file into main memory. Libraryis special object file that can be added to program file during linking or loading. CS 230 - Winter 2012 4-4 Other Execution Approaches Interpretation execute source code directly execute binary code by software Byte Code compile to intermediate binary representation Just-In-Time Compilation compile during runtime 12-03-05 3 CS 230 - Winter 2012 4-5 Compiler program translation from sourcelanguage to targetlanguage usually: high-level to low-level (assembly) complex to simple typically followed by assembler to generate machine code CS 230 - Winter 2012 4-6 Assembler line by line translation from oneassembly instruction to onemachine code instruction translate pseudo-instructions insert data for .worddirective and possibly other directives... ignore comments and blank lines compute address of each label 12-03-05 4 CS 230 - Winter 2012 4-7 Instruction Format Jump oooo ooii iiii iiii iiii iiii iiii iiii o opcode i jump target instructions with large constant operand jump target = high4(PC) + (i << 2) combine highest 4 bits of current PC with immediate operand multiplied by 4 CS 230 - Winter 2012 4-8 Machine Code Jump jal35528 0000 1100 0000 00000010 0010 1011 0010 12-03-05 5 CS 230 - Winter 2012 4-9 Instruction Format Immediate oooo ooss ssst tttt iiii iiii iiii iiii o opcode s,t - registers i immediate operand instructions with register and constant operand CS 230 - Winter 2012 4-10 Machine Code Immediate lw$1, 23($2) 1000 1100 0100 00010000 0000 0001 0111 12-03-05 6 CS 230 - Winter 2012 4-11 Instruction Format Register 0000 00ss ssst tttt dddd d000 00ff ffff opcode 000000 s,t,d registers f function instructions with all operands in registers CS 230 - Winter 2012 4-12 Machine Code Register add$1, $2, $3 0000 0000 0100 00110000 1000 0010 0000 mult$2, $3 0000 0000 0100 00110000 0000 0001 1000 12-03-05 7 CS 230 - Winter 2012 4-13 Stack Frame stack pointer: bottom of stack, first free field stack pointer might vary during routine set up stack for subroutine call at routine entry, frame pointer is set e.g. to stack pointer at that time frame pointerproviders a constant base to access local variables and arguments use offset in...
View Full Document

This note was uploaded on 04/01/2012 for the course CS 230 taught by Professor Bb during the Spring '11 term at Waterloo.

Page1 / 34

mod04-2up - 12-03-05 1 CS 230 - Winter 2012 4-1 CS 230...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online