mod02 - CS 230 Introduction to Computers and Computer...

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

View Full Document Right Arrow Icon
CS 230 - Winter 2011 2-1 CS 230 – Introduction to Computers and Computer Systems Module 2 – Assembly Language Martin Karsten mkarsten@cs.uwaterloo.ca
Background image of page 1

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

View Full DocumentRight Arrow Icon
CS 230 - Winter 2011 2-2 Overview assembly language: MIPS arithmetic operations data movement conditional execution subroutines
Background image of page 2
CS 230 - Winter 2011 2-3 Machine Code binary code – comprised of 0s and 1s “direct” execution by processor program (bits) grouped into instructions fixed vs. variable length operation code (opcode) + operands instructions control processor opcode designates operation operands designate data
Background image of page 3

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

View Full DocumentRight Arrow Icon
CS 230 - Winter 2011 2-4 Assembly Language human-readable “programming language” very simple compared to, e.g., Scheme, Python almost direct mapping to machine code, except: labels data declaration pseudo instructions compilation by assembler program into machine code
Background image of page 4
CS 230 - Winter 2011 2-5 Instruction Set repertoire of instructions different processors have different sets many commonalities depending on use cases scalar processor – one data item at a time typical workstation/laptop/etc. CPU vector processor – array of data (vector) e.g., graphics processor (GPU) hybrids. ..
Background image of page 5

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

View Full DocumentRight Arrow Icon
CS 230 - Winter 2011 2-6 Turing Completeness well-defined theoretical concept fundamental capabilities of instruction set minimum requirements typical programming languages / instruction sets are Turing complete ... vs. data description languages, e.g. XML
Background image of page 6
CS 230 - Winter 2011 2-7 MIPS Architecture MIPS: M icroprocessor without I nterlocked P ipeline S tages interlocking? pipeline? details later (Module 3) multiple revisions, systems, and compilers => not just a single standard
Background image of page 7

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

View Full DocumentRight Arrow Icon
CS 230 - Winter 2011 2-8 MIPS Assembly Language each instruction takes 32 bit = 4 bytes = word arithmetic instructions operate on registers separate memory load and store 32 registers available, 32 bit wide instructions have up to 3 operands: 1 st operand is destination 2 nd and 3 rd are sources same register can be source and destination
Background image of page 8
CS 230 - Winter 2011 2-9 MIPS Machine Code see reference sheet, additions: Add Immediate addi $t, $s, i 0010 00ss ssst tttt iiii iiii iiii iiii $t = $s + i Jump and Link jal x 0000 11xx xxxx xxxx xxxx xxxx xxxx xxxx $31 = pc + 4; pc = x
Background image of page 9

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

View Full DocumentRight Arrow Icon
CS 230 - Winter 2011 2-10 Special Registers PC – program counter current location in machine code incremented by 4 for each instruction $0 – constant 0 conventions (more later) $28 – global pointer ($gp) $29 – stack pointer ($sp) $30 – frame pointer ($fp) $31 – return address ($ra)
Background image of page 10
2-11 MIPS Assembly Language two addressing modes register: operands in registers immediate: one operand is a 16-bit constant memory: 32-bit address space
Background image of page 11

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

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

This note was uploaded on 09/28/2011 for the course CS 230 taught by Professor Bb during the Spring '11 term at Waterloo.

Page1 / 82

mod02 - CS 230 Introduction to Computers and Computer...

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

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