CSSE232 Computer Architecture. Logic and Decision Opera:ons

Similar documents
CS3350B Computer Architecture MIPS Instruction Representation

COMPSCI 313 S Computer Organization. 7 MIPS Instruction Set

Instructions: MIPS ISA. Chapter 2 Instructions: Language of the Computer 1

Chapter 2. Computer Abstractions and Technology. Lesson 4: MIPS (cont )

Unsigned Binary Integers

Unsigned Binary Integers

Lecture 4: MIPS Instruction Set

Computer Architecture

ECE232: Hardware Organization and Design

MIPS Instruc,ons CS 64: Computer Organiza,on and Design Logic Lecture #8

Introduction to the MIPS. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University

MIPS Coding Continued

Today s topics. MIPS operations and operands. MIPS arithmetic. CS/COE1541: Introduction to Computer Architecture. A Review of MIPS ISA.

Lecture 5: Procedure Calls

MIPS%Assembly% E155%

Chapter 2A Instructions: Language of the Computer

CSCI 402: Computer Architectures

CS222: MIPS Instruction Set

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture

ENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design

101 Assembly. ENGR 3410 Computer Architecture Mark L. Chang Fall 2009

Chapter 2. Instructions: Language of the Computer. Adapted by Paulo Lopes

Topic Notes: MIPS Instruction Set Architecture

ECE232: Hardware Organization and Design. Computer Organization - Previously covered

ECE 154A Introduction to. Fall 2012

MIPS R-format Instructions. Representing Instructions. Hexadecimal. R-format Example. MIPS I-format Example. MIPS I-format Instructions

EEM 486: Computer Architecture. Lecture 2. MIPS Instruction Set Architecture

Lectures 3-4: MIPS instructions

Chapter 2. Instructions:

Computer Organization and Components

Branch Addressing. Jump Addressing. Target Addressing Example. The University of Adelaide, School of Computer Science 28 September 2015

CSCI 402: Computer Architectures. Instructions: Language of the Computer (3) Fengguang Song Department of Computer & Information Science IUPUI.

Chapter 2: Instructions:

CS 4200/5200 Computer Architecture I

ELEC / Computer Architecture and Design Fall 2013 Instruction Set Architecture (Chapter 2)

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization

comp 180 Lecture 10 Outline of Lecture Procedure calls Saving and restoring registers Summary of MIPS instructions

Computer Architecture. MIPS Instruction Set Architecture

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

CS61C - Machine Structures. Lecture 6 - Instruction Representation. September 15, 2000 David Patterson.

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

Lecture 2. Instructions: Language of the Computer (Chapter 2 of the textbook)

Instructions: Language of the Computer

COMPUTER ORGANIZATION AND DESIGN

Instructions: Language of the Computer

Computer Architecture Instruction Set Architecture part 2. Mehran Rezaei

Chapter 2. Instruction Set Architecture (ISA)

CS 61C: Great Ideas in Computer Architecture. MIPS Instruc,on Representa,on II. Dan Garcia

Lecture 6 Decision + Shift + I/O

Reduced Instruction Set Computer (RISC)

Chapter 2. Instructions: Language of the Computer. HW#1: 1.3 all, 1.4 all, 1.6.1, , , , , and Due date: one week.

CS 61c: Great Ideas in Computer Architecture

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture

MIPS Assembly: More about Memory and Instructions CS 64: Computer Organization and Design Logic Lecture #7

ECE260: Fundamentals of Computer Engineering

Computer Architecture

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

Reduced Instruction Set Computer (RISC)

CSSE 232 Computer Architecture I. I/O and Addressing

A Processor. Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University. See: P&H Chapter , 4.1-3

MIPS Instruction Set Architecture (2)

ECE260: Fundamentals of Computer Engineering

Grading: 3 pts each part. If answer is correct but uses more instructions, 1 pt off. Wrong answer 3pts off.

Mips Code Examples Peter Rounce

Chapter 2. Instructions: Language of the Computer

The MIPS Instruction Set Architecture

Computer Architecture. Lecture 2 : Instructions

Review. Lecture #9 MIPS Logical & Shift Ops, and Instruction Representation I Logical Operators (1/3) Bitwise Operations

Stored Program Concept. Instructions: Characteristics of Instruction Set. Architecture Specification. Example of multiple operands

Instructor: Randy H. Katz hap://inst.eecs.berkeley.edu/~cs61c/fa13. Fall Lecture #7. Warehouse Scale Computer

MIPS ISA. 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support

EEC 581 Computer Architecture Lecture 1 Review MIPS

Instruction Set Architecture part 1 (Introduction) Mehran Rezaei

Thomas Polzer Institut für Technische Informatik

MACHINE LANGUAGE. To work with the machine, we need a translator.

A Processor! Hakim Weatherspoon CS 3410, Spring 2010 Computer Science Cornell University. See: P&H Chapter , 4.1-3

Lecture 9: Disassembly

Anne Bracy CS 3410 Computer Science Cornell University. See P&H Chapter: , , Appendix B

Character Is a byte quantity (00~FF or 0~255) ASCII (American Standard Code for Information Interchange) Page 91, Fig. 2.21

MIPS Memory Access Instructions

CS31001 COMPUTER ORGANIZATION AND ARCHITECTURE. Debdeep Mukhopadhyay, CSE, IIT Kharagpur. Instructions and Addressing

ECE 331 Hardware Organization and Design. Professor Jay Taneja UMass ECE - Discussion 3 2/8/2018

Computer Architecture Experiment

CS 61C: Great Ideas in Computer Architecture. MIPS Instruction Formats

EN164: Design of Computing Systems Topic 03: Instruction Set Architecture Design

Course Administration

Chapter 3. Instructions:

Control Instructions. Computer Organization Architectures for Embedded Computing. Thursday, 26 September Summary

Control Instructions

Anne Bracy CS 3410 Computer Science Cornell University. [K. Bala, A. Bracy, E. Sirer, and H. Weatherspoon]

Assembly Language Programming. CPSC 252 Computer Organization Ellen Walker, Hiram College

Computer Organization MIPS Architecture. Department of Computer Science Missouri University of Science & Technology

Mark Redekopp, All rights reserved. EE 357 Unit 11 MIPS ISA

5/17/2012. Recap from Last Time. CSE 2021: Computer Organization. The RISC Philosophy. Levels of Programming. Stored Program Computers

Recap from Last Time. CSE 2021: Computer Organization. Levels of Programming. The RISC Philosophy 5/19/2011

CSE 141 Computer Architecture Spring Lecture 3 Instruction Set Architecute. Course Schedule. Announcements

CSSE232 Computer Architecture I. Datapath

F. Appendix 6 MIPS Instruction Reference

CENG3420 Lecture 03 Review

Processor. Han Wang CS3410, Spring 2012 Computer Science Cornell University. See P&H Chapter , 4.1 4

Transcription:

CSSE232 Computer Architecture Logic and Decision Opera:ons

Class status Reading for today: Sec:ons 2.6-2.7 Due today HW0 Lab 0 status?

Outline Logical opera:ons ShiI operators Pseudo instruc:ons Immediates Alignment Condi:onals Loops

Logical Opera:ons Operation C Java MIPS Shift left << << sll Shift right >> >>> srl, sra Bitwise AND & & and, andi Bitwise OR or, ori Bitwise NOT ~ ~ nor n Useful for extrac:ng and inser:ng groups of bits in a word

ShiI Opera:ons shamt: how many posi:ons to shii ShiI lei logical ShiI lei and fill with 0 bits sll by i bits mul:plies by 2 i ShiI right logical ShiI right and fill with 0 bits srl by i bits divides by 2 i (unsigned only) ShiI right arithme:c : shii right, fill with sign bits op rs rt rd shamt funct 6 bits 5 bits 5 bits 5 bits 5 bits 6 bits

Logical Opera:ons Logical immediate instruc:ons ori andi xori How big are immediate values?

Immediates What do you expect? addi $t0, $zero, 1 What about addi $t0, $zero, - 1 What about ori $t0, $zero, 0x8080

Immediates Zero extend or sign extend? Arithme:c instruc:ons are sign extended Logical instruc:ons are zero extended

Pseudo Instruc:ons The assembler is a program that translates add $t0, $t0, $t1 Into this 0x01094020 It will also replace 'pseudo instruc:ons' with real instruc:ons lab0, p2.asm: li $t3, 0x12340028

Big Immediates What if we need more than 16 bits?

Big Immediates What if we need more than 16 bits? li : pseudo instruc:on, composed of lui ori What is the advantage of using a pseudo instruc:on? What is the disadvantage?

Big Immediates Is lui a good compromise?

Big Immediates Is lui a good compromise?

MIPS alignment restric:ons The star:ng address has to be divisible by 4 Different from x86 load from anywhere Simple makes wiring easier Big Endian vs Lidle Endian 4 bytes in a word Which byte is on the big end vs the lidle end? MIPS Big Endian X86 Lidle Endian Problems when passing data from different machines

Extra Informa:on Page!!! Big Endian and Networking Convert between host and network format Host format is processor specific Network format is Big Endian htons htonl ntohs ntohl

Condi:onal Opera:ons Branch to labeled instruc:on if condi:on is true Otherwise, con:nue sequen:ally beq rs, rt, L1 if (rs == rt) branch to instruc:on labeled L1; bne rs, rt, L1 if (rs!= rt) branch to instruc:on labeled L1; j L1 uncondi:onal jump to instruc:on labeled L1 Labels do not have to be capitalized

Basic branching C code if(a == 0) a = a + 1; a = a + 1; MIPS assembler? (a in $t0)

Basic branching C code if(a == 0) a = a + 1; a = a + 1; MIPS assembler? (a in $t0) bne $t0, $zero, L add $t0, $t0, 1 L: add $t0, $t0, 1

C code: if (i==j) f = g+h; else f = g- h; f, g, in $s0, $s1, Compiled MIPS code: More complex if bne $s3, $s4, Else add $s0, $s1, $s2 j Exit Else: sub $s0, $s1, $s2 Exit:

Extra Informa:on Page!!! Condi:onals in ARM Every instruc:on encoding in ARM includes a 4- bit field that represents a condi:on code.

Condi:onal jumps I- type instruc:ons Immediate field holds branch target Is 16 bits enough?

Condi:onal jumps I- type instruc:ons Immediate field holds branch target Is 16 bits enough?

C code: while (n!= 0) { n--; }

Compiled MIPS code (if n in $t0): LOOP: beq $t0, $0, DONE addi $t0, $t0, -1 j LOOP DONE:

C code: Compiling Loop Statements while (save[i] == k) i += 1; i in $s3, k in $s5, address of save in $s6

Compiled MIPS code: Loop: sll $t1, $s3, 2 add $t1, $t1, $s6 lw $t0, 0($t1) bne $t0, $s5, Exit addi $s3, $s3, 1 j Loop Exit:

More Condi:onal Opera:ons Set result to 1 if a condi:on is true Otherwise, set to 0 slt rd, rs, rt if (rs < rt) rd = 1; else rd = 0; sl: rt, rs, constant if (rs < constant) rt = 1; else rt = 0; Use in combina:on with beq, bne slt $t0, $s1, $s2 # if ($s1 < $s2) bne $t0, $zero, L # branch to L

Review and Ques:ons Logical opera:ons ShiI operators Immediates Alignment Condi:onals Loops