We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower. Thank you!
Presentation is loading. Please wait.
Published byYazmin Cake
Modified over 2 years ago
234262 – © Yohai Devir 2007 Technion - IIT 234262 Tutorial #10 MIPS commands
234262 – © Yohai Devir 2007 Technion - IIT MIPS overview MIPS is a simple processor: All arithmetic operations are done with registers only. Memory access is done with only two instructions – LOAD \ STORE. The MIPS is a 32-bit machine. The instructions are 32-bits long. Register file (RF), with 32 registers of 32 bits each (5 bit for the number) Memory address size – 32 bits. We’ll work in resolution of words – 32bit each.
234262 – © Yohai Devir 2007 Technion - IIT Registers There are registers which are denoted by R0, R1,…R31. Register 0 is read-only and its value is 0 (R0 ≡ 0). The PC (Program Counter) is a special register. The PC points to the next instruction to be executed. In some places register K is marked as $K (i.e. R8 ≡ $8)
234262 – © Yohai Devir 2007 Technion - IIT Memory (maximal) size 2 30 words of 32 bits each. Each word has a 32-bit address, the two LSB bits of the address are 00. Memory is accessed only by LOAD\STORE commands
234262 – © Yohai Devir 2007 Technion - IIT Instructions 3 types of instructions, each kind with a fixed structure: Type R (Register) Type I (Immediate) Type J (Jump)
234262 – © Yohai Devir 2007 Technion - IIT Type R OPeration Source \ Target \ Destination Register SHift AMounT FUNCtion OPRsRtRdshamtfunc 6 bit5 bit 6 bit
234262 – © Yohai Devir 2007 Technion - IIT ADD R11,R20,R3 Semantic: R11 R20 + R3 Performs addition of the values of R20 and R3 and stores the result in R11 OPRsRtRdshamtfunc 0 6 bit5 bit 6 bit
234262 – © Yohai Devir 2007 Technion - IIT ADD R11,R20,R3 Semantic: R11 R20 + R3 OPRsRtRdshamtfunc 032 6 bit5 bit 6 bit
234262 – © Yohai Devir 2007 Technion - IIT ADD R11,R20,R3 Semantic: R11 R20 + R3 OPRsRtRdshamtfunc 01132 6 bit5 bit 6 bit
234262 – © Yohai Devir 2007 Technion - IIT ADD R11,R20,R3 Semantic: R11 R20 + R3 OPRsRtRdshamtfunc 02031132 6 bit5 bit 6 bit
234262 – © Yohai Devir 2007 Technion - IIT ADD R11,R20,R3 Semantic: R11 R20 + R3 OPRsRtRdshamtfunc 020311032 6 bit5 bit 6 bit OPRsRtRdshamtfunc 00000010100000110101100000100000 6 bit5 bit 6 bit
234262 – © Yohai Devir 2007 Technion - IIT OR R8,R7,R6 Semantic: R8 R7 OR R6 Performs bitwise logical OR between the values of R7 and R6 and stores the result in R8 OPRsRtRdshamtfunc 0768037 6 bit5 bit 6 bit
234262 – © Yohai Devir 2007 Technion - IIT SLT R10,R20,R30 Semantic: If (R20 < R30) R10 000… …00001 (32bit) else R10 000… …00000 (32bit) Name: Set Less Than OPRsRtRdshamtfunc 0203010042 6 bit5 bit 6 bit
234262 – © Yohai Devir 2007 Technion - IIT SLL R5,R7,2 Semantic: R5 R7 << 2 Name: Shift Left Logical Example: if R7= 11100… …01111 then R5 = 100… …0111100 SRL does the same but shifts right OPRsRtRdshamtfunc Not 0 70520 6 bit5 bit 6 bit
234262 – © Yohai Devir 2007 Technion - IIT Type I OPeration Source \ Target Registers IMmediate OPRsRtIM 6 bit5 bit 16 bit
234262 – © Yohai Devir 2007 Technion - IIT ADDI R2,R29,144 Semantic: R2 R29+144 Bigger constants? OPRsRtIM 8292144 6 bit5 bit 16 bit OPRsRtIM 00100011101000100000 0000 1001 0000 6 bit5 bit 16 bit
234262 – © Yohai Devir 2007 Technion - IIT LUI R3,0xB3A0 Load Upper Immediate Semantic: 1.Sets the 16 MSBs of R3 to 0xB3A0 2.Zero the 16 LSBs of R3 OPRsRtIM 15030xB3A0 6 bit5 bit 16 bit
234262 – © Yohai Devir 2007 Technion - IIT LUI Example: In order to load 0x2AC0900 to R3: R3 (before) = 0x ABCD 1234 LUI R3, 0x02AC R3 = 0x 02AC 0000 ADDI R3, 0x0900 R3 = 0x 02AC 0900
234262 – © Yohai Devir 2007 Technion - IIT BNE R31,R8,loop1 Branch on Not Equal Semantic: if R31!=R8, the next instruction to be executed is the on which is stored in the memory at label ‘loop1’ BEQ branches if EQual OPRsRtIM 4318? 6 bit5 bit 16 bit
234262 – © Yohai Devir 2007 Technion - IIT BNE R31,R8,loop1 labelAddress (decimal) instruction gremlin:00…000984ADDI R5,R0,81 00…000988SUB R7,R9,R12 00…000992… 00…000996ADDI R1,R0,5 Loop1:00…001000ADD R1,R1,R3 00…001004… … 00…001016SUBI, R1,R1,1 00…001020BNE R1,R0,loop1
234262 – © Yohai Devir 2007 Technion - IIT (BNE addr ) BNE We want to branch to address 00…001000. However, this a 32bit address while having only 16bit of IM. Most branches are to “nearby” addresses. We can put address relative to the PC. 2 LSB bits are ’00 (Why?) No need to specify the 2 LSBs. We’ll see this later: After bringing the intruction (before really reading it) the PC is incremented in 4 bytes. PC new (BNE addr +4)+IMx4
234262 – © Yohai Devir 2007 Technion - IIT BNE R31,R8,loop1 Loop1:00…001000ADD R1,R1,R3 … 00…001020BNE R1,R0,loop1 BNE instruction address is 1020, branch address is 1000. After fetching the instruction the PC will be 1024 we need to branch to an address - 24 bytes away. No need to store the 2 LSBs (-24)/4 = -6 IM should be -6 OPRsRtIM 4318-6 6 bit5 bit 16 bit
234262 – © Yohai Devir 2007 Technion - IIT LW R2,100(R3) Load Word Semantic: Read the word located in the memory address of [R3] + 100 (not 103 !!!) and write it to R2 NOTE: Rs is the Base register Rt is the register to write to. OPRsRtIM 3532100 6 bit5 bit 16 bit
234262 – © Yohai Devir 2007 Technion - IIT SW R7,200(R6) Load Word Semantic: Writes the word located in R7 to the memory address of [R6] + 200 (not 206!!!) NOTE: Rs is the Base register Rt is the read from. OPRsRtIM 4367200 6 bit5 bit 16 bit
234262 – © Yohai Devir 2007 Technion - IIT Type J OPeration eXtended Immediate Unconditional jump 2 LSBs are ’00. No need to specify them. 4 MSBs are taken from PC OPXI 6 bit26 bits
234262 – © Yohai Devir 2007 Technion - IIT J 0xEF44 4444 Jumps to a specific address Semantic: PC new PC [upper 4 MSBs] || XI || 00 OPXI 2? 6 bit26 bits
234262 – © Yohai Devir 2007 Technion - IIT J 0xEF44 4444 Example: 0xE044 4444 in binary is: Without 4 MSBs and 2 LSBs: Back to Hex: Therefore XI = 0x3D1 1111 Address (HEX)instruction 0x E123 4568:J 0xEF44 4444 EF444444 111011110100 1111010001 3D11111
234262 – © Yohai Devir 2007 Technion - IIT JAL 0xEF44 4444 Jump And Link Stores PC in Register 31 and then jumps to given address. Semantic: R31 PC PC PC [upper 4 MSBs] || XI || 00 OPXI 3? 6 bit26 bits
234262 – © Yohai Devir 2007 Technion - IIT JR R17 Jump Register – a Type R command. Semantic: PC R17 OPRsRtRdshamtfunc 0170008 6 bit5 bit 6 bit
Module : Algorithmic state machines. Machine language Machine language is built up from discrete statements or instructions. On the processing architecture,
Computer Organization & Programming Chapter 6 Single Datapath CPU Architecture.
MIPS Processor. Registers in MIPS In MIPS, there are 32 Registers. We need read up to two registers, and write to up to one register. Think registers.
7-5 Microoperation An elementary operations performed on data stored in registers or in memory. Transfer Arithmetic Logic: perform bit manipulation on.
MIPS processor continued. Review Different parts in the processor should be connected appropriately to be able to carry out the functions. Connections.
Computer Organization Rabie A. Ramadan Lecture 3.
Chapter 7 – Registers and Register Transfers Part 1 – Registers, Microoperations and Implementations Logic and Computer Design Fundamentals.
MIPS Instruction Set Advantages
Lecture 16: Basic CPU Design
COM181 Computer Hardware Lecture 6: The MIPs CPU.
Datorteknik DatapathControl bild 1 Designing a Single Cycle Datapath & Datapath Control.
The Processor 2 Andreas Klappenecker CPSC321 Computer Architecture.
Lec 4-2 Five operations of the machine cycle Fetch- fetch the next program instruction from memory. (PC+1); instruction to IR Decode- decode the instruction.
Branches Two branch instructions:
Memory and Addressing How and Where Information is Stored.
Processor I CPSC 321 Andreas Klappenecker. Midterm 1 Thursday, October 7, during the regular class time Covers all material up to that point History MIPS.
Computer Systems - Registers. Starter… Discuss in pairs the definition of the following Control Unit Arithmetic and Logic Unit Registers Internal clock.
ELEN 468 Advanced Logic Design
1 Branches and Procedure Calls Lecture 14 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
Chapter 2 Instructions: Language of the Computer
Instruction Set Architecture The portion of the machine visible to the programmer Issues: Internal storage model Addressing modes Operations Operands Encoding.
Basic Operational Concepts of a Computer
1. 2 Instructions: Words of the language understood by CPU Instruction set: CPU’s vocabulary Instruction Set Architecture (ISA): CPU’s vocabulary together.
Picoblaze Overview EENG Introduction 8-bit microcontroller for Xilinx devices Soft Core – Soft Processor 5% of the resources of spartan 3 (3S200.
KEY COMPONENTS OF A COMPUTER SYSTEM ANDREW LOLAVAR.
Chapter 10 The Assembly Process. What Assemblers Do Translates assembly language into machine code. Assigns addresses to all symbolic labels (variables.
Pirouz Bazargan SabetDecember 2003 Effective Implementation of a 32-bit RISC Processor Pirouz Bazargan Sabet University of Paris 6 - LIP6 - ASIM
Some material taken from Assembly Language for x86 Processors by Kip Irvine © Pearson Education, 2010 Slides revised 2/2/2014 by Patrick Kelley.
MIPS Architecture CPSC 321 Computer Architecture Andreas Klappenecker.
IFT 201: Unit 1 Lecture 1.3: Processor Architecture-3 Dr. Joseph M Kuitche Information Technology ASU Polytechnic School.
2.3) Example of program execution 1. instruction B25 8 Op-code B means to change the value of the program counter if the contents of the indicated register.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Electrical and Computer Engineering University of Cyprus LAB 2: MIPS.
1 A single-cycle MIPS processor An instruction set architecture is an interface that defines the hardware operations which are available to software.
The Single-Cycle Datapath and Control Unit (Lecture #10) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying.
The CPU Revision Typical machine code instructions Using op-codes and operands Symbolic addressing. Conditional and unconditional branches.
RISC Concepts, MIPS ISA and the Mini–MIPS project
Goal: Write Programs in Assembly
Chapter 2: Data Manipulation
ISA Issues; Performance Considerations. Testing / System Verilog: ECE385.
REGISTER TRANSFER & MICROOPERATIONS By Sohaib. Digital System Overview Each module is built from digital components Registers Decoders Arithmetic.
Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.
Lecture 5 Sept 14 Goals: Chapter 2 continued MIPS assembly language instruction formats translating c into MIPS - examples.
Computer Architecture CSE 3322 Lecture 2 NO CLASS MON Sept 1 Course WEB SITE crystal.uta.edu/~jpatters.
Review of the MIPS Instruction Set Architecture. RISC Instruction Set Basics All operations on data apply to data in registers and typically change the.
Computer Organization CS224 Fall 2012 Lessons 7 and 8.
CHAPTER 6 Instruction Set Architecture 12/7/
Fall EE 333 Lillevik 333f06-l7 University of Portland School of Engineering Computer Organization Lecture 7 ALU design MIPS data path.
IT253: Computer Organization Lecture 5: Assembly Language and an Introduction to MIPS Tonga Institute of Higher Education.
© 2017 SlidePlayer.com Inc. All rights reserved.