Week 6 The darkness, the loop of negative thoughts on repeat, clamours and interferes with the music I hear in my head. Lady Gaga.

Slides:



Advertisements
Similar presentations
CENG 311 Decisions in C/Assembly Language
Advertisements

Goal: Write Programs in Assembly
4.
MIPS assembly. Review  Lat lecture, we learnt  addi,  and, andi, or, ori, xor, xori, nor,  beq, j, bne  An array is stored sequentially in the memory.
Branches Two branch instructions:
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /15/2013 Lecture 11: MIPS-Conditional Instructions Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER.
Comp Sci Control structures 1 Ch. 5 Control Structures.
ECE 15B Computer Organization Spring 2010 Dmitri Strukov Lecture 5: Data Transfer Instructions / Control Flow Instructions Partially adapted from Computer.
1 Lecture 3a: Supplemental Notes for Chapter 3 CS 447 Jason Bakos.
CSCE 212 Quiz 8 – 3/23/11 1.What type of element is the ALU (combinational or state) and what does it mean for an element to be that type? 2.What is the.
Lecture 5 Sept 14 Goals: Chapter 2 continued MIPS assembly language instruction formats translating c into MIPS - examples.
Fall 2003SYCS-401 Operating Systems Instruction Set Architecture An overview of MIPS R3000 assembly language.
ECE 232 L5 Assembl.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 5 MIPS Assembly.
More decisions and logic (1) Fall 2010 Lecture 4: Loads, Logic, Loops.
CEG 320/520: Computer Organization and Assembly Language ProgrammingFlow Control 1 Flow Control.
Lecture 8. MIPS Instructions #3 – Branch Instructions #1 Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System Education.
Lecture 15: 10/24/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
11/02/2009CA&O Lecture 03 by Engr. Umbreen Sabir Computer Architecture & Organization Instructions: Language of Computer Engr. Umbreen Sabir Computer Engineering.
Chapter 10 The Assembly Process. What Assemblers Do Translates assembly language into machine code. Assigns addresses to all symbolic labels (variables.
IFT 201: Unit 1 Lecture 1.3: Processor Architecture-3
17 - Jumps & Branches. The PC PC marks next location in Fetch, Decode, Execute cycle.
MIPS coding. Review Shifting – Shift Left Logical (sll) – Shift Right Logical (srl) – Moves all of the bits to the left/right and fills in gap with 0’s.
Chapter 2 Decision-Making Instructions (Instructions: Language of the Computer Part V)
Computer Architecture CSE 3322 Lecture 3 Assignment: 2.4.1, 2.4.4, 2.6.1, , Due 2/3/09 Read 2.8.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Computer Organization CS224 Fall 2012 Lessons 7 and 8.
Chapter 2 — Instructions: Language of the Computer — 1 Conditional Operations Branch to a labeled instruction if a condition is true – Otherwise, continue.
MIPS Instruction Set Architecture Prof. Sirer CS 316 Cornell University.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 11 Conditional Operations.
CS 312 Computer Architecture & Organization
Computer Architecture & Operations I
CS 230: Computer Organization and Assembly Language
CS2100 Computer Organisation
MIPS Coding Continued.
Computer Architecture & Operations I
Decision Making.
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
Conditional Branches What distinguishes a computer from a simple calculator is its ability to make decisions Decisions are made using the if statement,
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Instructions for Making Decisions
Designing MIPS Processor (Single-Cycle) Presentation G
CS170 Computer Organization and Architecture I
The University of Adelaide, School of Computer Science
Pick up the handout on your way in!!
Control Flow and Arrays
ARM Control Structures
Design of the Control Unit for One-cycle Instruction Execution
MIPS Processor.
ECE232: Hardware Organization and Design
The Processor Lecture 3.6: Control Hazards
Instruction encoding The ISA defines Format = Encoding
The University of Adelaide, School of Computer Science
Part II Instruction-Set Architecture
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Flow of Control -- Conditional branch instructions
A 1-Bit Arithmetic Logic Unit
ARM Control Structures
MIPS Instruction Set Architecture
MIPS Assembly.
Flow of Control -- Conditional branch instructions
MIPS assembly.
The Processor: Datapath & Control.
7/6/
CS 286 Computer Architecture & Organization
MIPS Processor.
9/13/
MIPS instructions.
Conditional Branching (beq)
Control Flow and Arrays
Presentation transcript:

Week 6 The darkness, the loop of negative thoughts on repeat, clamours and interferes with the music I hear in my head. Lady Gaga

Branching Statements Simplest is unconditional branch b address Address is a label and points somewhere in the code section of the memory. Allows the PC to jump to a new location in memory to read the next opcode.

If Statement

If else

Condition Codes Register where the bits represent specific states of the processor Each Processor will have a unique set of condition codes, but the general function remains the same. Below is the ARM processor

Explicit Compare and Branch This type of branching uses 2 ALUs 1st for address modification PC = PC + offset 2nd for the comparison. E.g. blt R1, 10, target #if R1 < 10 then goto target

Implicit Condition Codes. General concept Set the condition codes by performing an ALU Operation. Virtually all ALU operations will set the condition codes. Branch according to the state of a particular code. E.g. Sub R1, R1, 1 #subtract 1 from register 1 Bez End #if condition code Z = 1 then branch It is assumed that subtracting 1 from R1 could result in R1 becoming Zero When R1 becomes 0, the Z flag is set in the condition code. Bez (branch if zero) will branch if Z is set, otherwise it will fall through to the next instruction.

Condition Registers, Separate Branch inst. Special instructions which will test for a specific property and only set that condition code E.g. Branch if $t2 < 10 blt $t2, 10, skip Is be expanded to: slti $1, $t2, 10 #set $1 = 1 if t2 < 10 bne $1, $0, 2 #2 is the offset for the PC in our example

Code example

MIPS Uses a combination of Implicit and Condition registers 86% of branches are equality or inequality, beq and bne Compare 2 registers and branch These comparisons are implemented directly in hardware. OR Comparison to zero - bgtz, bgez, bltz, blez Hardware implemented. 14% of branches are Compare to an immediate Thus we have 2 instructions, slt, sltu, slti, etc. and the branch Makes sense that the first branch option is very efficient.

Print String Char by Char while loop

Print Char by Char do_while loop

Print Char by Char for loop

Letter Grade case statement

End