Thursday, 17 September 2015 Upcoming talk: Harnessing - - PowerPoint PPT Presentation

thursday 17 september 2015
SMART_READER_LITE
LIVE PREVIEW

Thursday, 17 September 2015 Upcoming talk: Harnessing - - PowerPoint PPT Presentation

Thursday, 17 September 2015 Upcoming talk: Harnessing Bioinformatics to Improve the Rice Root System September 24 at 4:30 p.m. in Steffee B10 Allegheny will be offering Introduction to Bioinformatics this spring--CMPSC/BIO 200.


slide-1
SLIDE 1

Thursday, 17 September 2015

Upcoming talk: Harnessing Bioinformatics to Improve the Rice Root System September 24 at 4:30 p.m. in Steffee B10 Allegheny will be offering “Introduction to Bioinformatics” this spring--CMPSC/BIO 200. Prerequisite: CMPSC 111

slide-2
SLIDE 2

Today:

  • Return lab 1 -- remarks
  • Quiz! (Yay!)
  • More on binary and twos complement
  • Back to MIPS
slide-3
SLIDE 3

Binary (unsigned)

Base 2 -- each position from right to left is a power of 2, starting with 20 = 1: 1001011 1x26 + 1x23 + 1x21 + 1x20 = 64 + 8 + 2 + 1 = 75

slide-4
SLIDE 4

Useful to Know:

In k bits (unsigned), we can store all the values from 0 through 2k-1. Example: 4 bits: 0 = 0000, 1 = 0001, 2 = 0010, …, 15 = 1111 (15 = 24-1) Binary numbers ending in 0 represent even numbers; binary numbers ending in 00 represent multiples of 4; binary numbers ending in 000 represent multiples of 8; etc.

slide-5
SLIDE 5

Converting Between Bases

Converting from binary to decimal: add up powers of 2. (C example: “bintodec.c” in code repository). Converting from decimal to binary: repeatedly divide by 2 and look at remainders. Example: convert 13 to base 2 13 / 2 = 6, remainder 1 6 / 2 = 3, remainder 0 3 / 2 = 1, remainder 1 1 / 2 = 0, remainder 1

1101

slide-6
SLIDE 6

Converting from Decimal to Binary

Doing this in C is a bit tricky -- bits are computed from right to left, but we can’t print from right to left! Solution: use an array! See “dectobin.c” in repository.

slide-7
SLIDE 7

Signed Integers

Use the “twos complement” representation. Most significant (leftmost) bit is used to represent a NEGATIVE power of 2: Example (7-bit twos complement):

1001011

  • 1x26 + 1x23 + 1x21 + 1x20 =
  • 64 + 8 + 2 + 1 = -53
slide-8
SLIDE 8

Signed Integers

In twos complement, a string of all 1s represents -1: Example (5-bit twos complement): 11111 = -32 + 16 + 8 + 4 + 2 + 1 = -1 It is actually easy to compute the twos complement representation of a negative number. First, find the binary representation of the absolute value, then flip all the bits and add 1...

slide-9
SLIDE 9

Signed Integers

What is -75 in 8-bit twos complement? +75 = 01001011 (Note: you have to fill in all 8 bits!) Flip: 10110100 Add 1: +1 10110101 = -75 The reverse process takes us back to +75: Flip: 01001010 Add 1: 1 01001011 = +75

slide-10
SLIDE 10

Supplement to 17 September slides

Binary Addition (unsigned):

213 11010101 + 159 + 10011111 372 101110100 1 1 0 1 0 1 0 1 1 0 0 1 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 0

“Carries”

slide-11
SLIDE 11

Supplement to 17 September slides

Binary Addition (signed): (8-bit 2s complement)

  • 79 10110001

+ 97 + 01100001 18 00010010 1 0 1 1 0 0 0 1 0 1 1 0 0 0 0 1 1 0 1 1 1 0 1 0

“Carries”

1 1

slide-12
SLIDE 12

Chapter 2 — Instructions: Language of the Computer — 12

Representing Instructions

■ Instructions are encoded in binary ■ Called machine code ■ MIPS instructions ■ Encoded as 32-bit instruction words ■ Small number of formats encoding operation code (opcode), register numbers, … ■ Regularity! ■ Register numbers ■ $t0 – $t7 are reg’s 8 – 15 ■ $t8 – $t9 are reg’s 24 – 25 ■ $s0 – $s7 are reg’s 16 – 23 §2.5 Representing Instructions in the Computer

slide-13
SLIDE 13

Chapter 2 — Instructions: Language of the Computer — 13

MIPS R-format Instructions

■ Instruction fields ■ op: operation code (opcode) ■ rs: first source register number ■ rt: second source register number ■ rd: destination register number ■ shamt: shift amount (00000 for now) ■ funct: function code (extends opcode)

  • p

rs rt rd shamt funct

6 bits 6 bits 5 bits 5 bits 5 bits 5 bits