Of course, the hardware doesn t really execute MIPS assembly language code.

Similar documents
Introduction. Datapath Basics

Chapter 4. The Processor

The Processor: Datapath and Control. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Chapter 4. The Processor

Chapter 4. The Processor Designing the datapath

Processor (I) - datapath & control. Hwansoo Han

Chapter 4. The Processor. Instruction count Determined by ISA and compiler. We will examine two MIPS implementations

The MIPS Processor Datapath

The Processor (1) Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Chapter 2. Instruction Set Architecture (ISA)

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

Chapter 4. Instruction Execution. Introduction. CPU Overview. Multiplexers. Chapter 4 The Processor 1. The Processor.

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

ECE232: Hardware Organization and Design

Unsigned Binary Integers

Unsigned Binary Integers

COMPUTER ORGANIZATION AND DESIGN. The Hardware/Software Interface. Chapter 4. The Processor: A Based on P&H

Chapter 3. Instructions:

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

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

Chapter 4. The Processor. Computer Architecture and IC Design Lab

Chapter 3 MIPS Assembly Language. Ó1998 Morgan Kaufmann Publishers 1

Topic Notes: MIPS Instruction Set Architecture

CPE 335 Computer Organization. Basic MIPS Architecture Part I

Chapter 2. lw $s1,100($s2) $s1 = Memory[$s2+100] sw $s1,100($s2) Memory[$s2+100] = $s1

ECE 486/586. Computer Architecture. Lecture # 7

LECTURE 5. Single-Cycle Datapath and Control

Systems Architecture

Chapter 2: Instructions:

Instructions: MIPS arithmetic. MIPS arithmetic. Chapter 3 : MIPS Downloaded from:

Computer Science and Engineering 331. Midterm Examination #1. Fall Name: Solutions S.S.#:

Chapter 4. The Processor

Lecture Topics. Announcements. Today: Single-Cycle Processors (P&H ) Next: continued. Milestone #3 (due 2/9) Milestone #4 (due 2/23)

Data paths for MIPS instructions

ECE369. Chapter 2 ECE369

Inf2C - Computer Systems Lecture Processor Design Single Cycle

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

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

COMPSCI 313 S Computer Organization. 7 MIPS Instruction Set

Chapter 4. The Processor

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

The Processor. Z. Jerry Shi Department of Computer Science and Engineering University of Connecticut. CSE3666: Introduction to Computer Architecture

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

Computer Architecture. Lecture 2 : Instructions

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

Mark Redekopp and Gandhi Puvvada, All rights reserved. EE 357 Unit 15. Single-Cycle CPU Datapath and Control

CS61C Machine Structures. Lecture 13 - MIPS Instruction Representation I. 9/26/2007 John Wawrzynek. www-inst.eecs.berkeley.

CSE140: Components and Design Techniques for Digital Systems

ECE260: Fundamentals of Computer Engineering

Computer Organization and Components

CSEE 3827: Fundamentals of Computer Systems

Review: Abstract Implementation View

CS Computer Architecture Spring Week 10: Chapter

Lecture 10: Simple Data Path

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

Computer Organization and Components

Computer Hardware Engineering

COMP MIPS instructions 2 Feb. 8, f = g + h i;

COMPUTER ORGANIZATION AND DESIGN

TDT4255 Computer Design. Lecture 4. Magnus Jahre. TDT4255 Computer Design

ECE260: Fundamentals of Computer Engineering

All instructions have 3 operands Operand order is fixed (destination first)

CC 311- Computer Architecture. The Processor - Control

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

EECS150 - Digital Design Lecture 10- CPU Microarchitecture. Processor Microarchitecture Introduction

Single Cycle Datapath

Announcements HW1 is due on this Friday (Sept 12th) Appendix A is very helpful to HW1. Check out system calls

ECE260: Fundamentals of Computer Engineering

361 datapath.1. Computer Architecture EECS 361 Lecture 8: Designing a Single Cycle Datapath

LECTURE 6. Multi-Cycle Datapath and Control

Outline. EEL-4713 Computer Architecture Designing a Single Cycle Datapath

Chapter 1. Computer Abstractions and Technology. Lesson 3: Understanding Performance

Instruction Set Architecture

Lecture 9: Disassembly

For More Practice FMP

CS222: Processor Design

Single Cycle Datapath

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

Instructions: Language of the Computer

BASIC COMPUTER ORGANIZATION. Operating System Concepts 8 th Edition

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

Chapter 4 The Processor 1. Chapter 4A. The Processor

CENG 3420 Computer Organization and Design. Lecture 06: MIPS Processor - I. Bei Yu

361 div.1. Computer Architecture EECS 361 Lecture 7: ALU Design : Division

COMP303 - Computer Architecture Lecture 8. Designing a Single Cycle Datapath

Lecture 4: MIPS Instruction Set

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

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Instructions: Language of the Computer

Operations, Operands, and Instructions

ECE 15B Computer Organization Spring 2011

Programmable Machines

CENG 3420 Lecture 06: Datapath

Programmable Machines

Computer Science 61C Spring Friedland and Weaver. The MIPS Datapath

EECS150 - Digital Design Lecture 9- CPU Microarchitecture. Watson: Jeopardy-playing Computer

CS61C : Machine Structures

MIPS Coding Continued

ELEC 5200/6200 Computer Architecture and Design Spring 2017 Lecture 4: Datapath and Control

CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath

Transcription:

Machine Language MIPS ML 1 Of coue, the hardware doesn t really execute MIPS assembly language code. The hardware can only store bits, and so the instructions it executes must be expressed in a suitable binary format. We call the language made up of those instructions the machine language. Different families of processo typically suppo different machine languages. In the beginning, all programming was done in machine language very ugly Assembly languages were created to make the programming process more human-centric. Assembly language code is translated into machine language by an assembler. Alas, there is no univeal assembly language. In practice, assembly languages are tightly coupled with the underlying machine language and hardware.

Assembly Language vs. Machine Language MIPS ML 2 Assembly provides convenient symbolic representation - much easier than writing down numbe - e.g., destination fit Machine language is the underlying reality - e.g., destination is no longer fit Assembly can provide 'pseudoinstructions' - e.g., move $t0, $t1 exists only as an extension to assembly - would be translated to add $t0,$t1,$zero by the assembler When considering performance you should count real instructions

Classifying the Assembly Instructions MIPS ML 3 Examining the (basic) MIPS assembly instructions, we can easily identify three fundamentally different categories, according to the paramete they take: - instructions that take 3 registe add $s0, $s1, $s2 or $t1, $t0, $t1 - instructions that take 2 registe and an immediate (offset, number, address, etc.) addi $t7, $s5, 42 lw $s3, 12($t4) beq $t1, $t3, Label01 - instructions that take an immediate j Label01

Overview of MIPS Machine Language MIPS ML 4 Simple instructions, all 32 bits wide Very structured, no unnecessary baggage Only three instruction formats: R rd shamt funct I 16-bit immediate J 26-bit immediate R-format: I-format J-format: basic arithmetical-logical instructions load/store/conditional branch instructions jump/unconditional branch instructions

Overview of MIPS Machine Language MIPS ML 5 In MIPS32 Release 2, there are over 200 basic MIPS machine instructions. In order to specify that many different instructions, we could use a field of 7 or more bits in every machine instruction. But MIPS machine language uses a 6-bit code field and a variety of special cases. For R-format instructions, the code field is set to 000000, and the last 6 bits specify exactly which arithmetic/logical instruction is to be performed. R rd shamt funct I 16-bit immediate J 26-bit immediate

Arithmetic/Logical Instructions MIPS ML 6 Instructions, like registe and words of data, are also 32 bits long Example: add $t1, $s1, $s2 registe have numbe, $t1 = 9, $s1 = 17, $s2 =18 Machine language basic arithmetic/logic instruction format: 000000 10001 10010 01001 00000 100000 rd shamt funct Can you guess what the field names stand for? rd shamt funct eration code (code) 1 st source register 2 nd source register destination register shift amount code variant selector

Mapping Assembly to Machine Language MIPS ML 7 Note how the assembly instruction maps into the machine representation: add $t1, $s1, $s2 000000 10001 10010 01001 00000 100000 rd shamt funct The three register fields are each 5 bits wide. Why? For arithmetic-logical instructions, both the field and the funct field are used to specify the paicular eration that is to be performed. If you view memory contents, this would appear as 0x02324820.

Load Instructions MIPS ML 8 Consider the load-word and store-word instructions: - what would the regularity principle have us do? - new principle: Good design demands a compromise We need a different type of machine language instruction format for these: - I-type for data transfer instructions - other format was R-type for register Example: lw $t0, 32($s2) 100011 10010 01001 0000 0000 0010 0000 16-bit number Where's the compromise?

Jump Instructions MIPS ML 9 Consider the jump instruction: j Label01 We need a different type of machine language instruction format for this as well. Example: j exit # assume exit is a statement label 000010 26-bit offset depending on value of exit

Anticipating Execution MIPS ML 10 What will be involved in executing a machine language instruction? Consider an I-type instruction, say a lw instruction: I 16-bit immediate The code bits must be analyzed to determine that the instruction is lw. The contents of $ must be fetched to the ALU and added to the immediate field to compute the apprriate address. The contents at that address must be fetched from memory and written to register $.

Decoding the Opcode MIPS ML 11 We will need some so of control logic that takes the 6-bit code and determines what specific machine instruction it corresponds to, and then trigge the necessary erations of other hardware units. The control logic will be purely combinational. Each hardware component, like the ALU will take ceain control inputs; it will be the job of the decoder unit to set those control lines. Note: for R-type instructions, this will be a little more involved.

Fetching Register Operands MIPS ML 12 The registe must be organized in some way that makes it possible to conduct a transaction of the form "give me the contents of register number K". Such a device is called a register file. A register file has an input po that accepts a register number (a 5-bit po in our case) from which data will be read. The register file processes that input and channels the contents of the corresponding register to an output po (a 32-bit po in our case).

Computing the Address MIPS ML 13 The value fetched from the register must be combined with the 16-bit immediate value from the instruction. This will require an adder circuit, but we will embed that in a more complex arithmeticlogic unit (ALU). The ALU will accept two 32-bit values (erands) and accept control input bits that specify which eration is to be applied to those erands. The ALU will supply the computed result to a 32-bit output po. Note: the ALU will be designed to take 32-bit erands. That means that the 16-bit value taken from the instruction must be widened to 32-bits, and that must be done in such a way that the sign of the immediate value is preserved.

Fetching the Data MIPS ML 14 There must be a memory unit that has an input po that will accept a 32-bit address. The memory unit must have a control input that specifies a value is to be read from that address (as posed to being written to it). The memory unit must have a 32-bit output po to which the memory unit can channel the requested data value.

Loading the Data to a Register MIPS ML 15 The register file must have an input po that accepts a register number to which data will be written. It will also need a control input to trigger the write eration.

Connections MIPS ML 16 A careful examination of the previous few slides will also reveal the need for a number of connections to channel data from one hardware component to another. For example, there must be a way to move data from the register file's output po to the ALU's input pos. In order to design a datapath for executing MIPS machine language instructions, we must identify all the hardware components we will need, and the necessary connections, and the necessary control logic and control lines