COMP 303 MIPS Processor Design Project 3: Simple Execution Loop

Similar documents
Processor design - MIPS

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

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

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

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

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


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

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

Computer Architecture. The Language of the Machine

Programming the processor

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

Midterm. Sticker winners: if you got >= 50 / 67

ECE 2035 Programming HW/SW Systems Fall problems, 7 pages Exam Two 23 October 2013

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

Chapter 4. The Processor

ICS 233 COMPUTER ARCHITECTURE. MIPS Processor Design Multicycle Implementation

Topic Notes: MIPS Instruction Set Architecture

RTL Model of a Two-Stage MIPS Processor

A General-Purpose Computer The von Neumann Model. Concocting an Instruction Set. Meaning of an Instruction. Anatomy of an Instruction

Concocting an Instruction Set

Instruction Set Architecture of. MIPS Processor. MIPS Processor. MIPS Registers (continued) MIPS Registers

COMPSCI 313 S Computer Organization. 7 MIPS Instruction Set

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

Concocting an Instruction Set

EE108B Lecture 3. MIPS Assembly Language II

Concocting an Instruction Set

Chapter 2. Instructions:

The MIPS Instruction Set Architecture

MIPS Instruction Set

ECE 30 Introduction to Computer Engineering

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

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

Final Project: MIPS-like Microprocessor

Winter 2002 FINAL EXAMINATION

Instruction Set Architecture part 1 (Introduction) Mehran Rezaei

Assembly Programming

MIPS%Assembly% E155%

Chapter 4. The Processor

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

MIPS Instruction Reference

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

MIPS PROJECT INSTRUCTION SET and FORMAT

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

Concocting an Instruction Set

CS 351 Exam 2 Mon. 11/2/2015

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

ECE 473 Computer Architecture and Organization Project: Design of a Five Stage Pipelined MIPS-like Processor Project Team TWO Objectives

Reduced Instruction Set Computer (RISC)

Q1: /30 Q2: /25 Q3: /45. Total: /100

Computer Architecture

CS222: MIPS Instruction Set

Introduction. Datapath Basics

Instructions: Language of the Computer

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

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

INSTRUCTION SET COMPARISONS

Week 10: Assembly Programming

Reduced Instruction Set Computer (RISC)

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

Project Part A: Single Cycle Processor

ECE Exam I February 19 th, :00 pm 4:25pm

CSE 378 Final Exam 3/14/11 Sample Solution

Unsigned Binary Integers

Unsigned Binary Integers

CSE 141L Computer Architecture Lab Fall Lecture 3

These actions may use different parts of the CPU. Pipelining is when the parts run simultaneously on different instructions.

Chapter 4. The Processor Designing the datapath

Review of instruction set architectures

ENCM 369 Winter 2013: Reference Material for Midterm #2 page 1 of 5

Mips Code Examples Peter Rounce

Data paths for MIPS instructions

2) Using the same instruction set for the TinyProc2, convert the following hex values to assembly language: x0f

I-Format Instructions (3/4) Define fields of the following number of bits each: = 32 bits

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

University of California at Santa Barbara. ECE 154A Introduction to Computer Architecture. Quiz #1. October 30 th, Name (Last, First)

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

MIPS Instruction Format

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

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

ASIC = Application specific integrated circuit

CS 61C: Great Ideas in Computer Architecture. MIPS CPU Datapath, Control Introduction

M2 Instruction Set Architecture

Chapter 3. Instructions:

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

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam Two 23 October Your Name (please print clearly) Signed.

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

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

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.

Instruction Set Architecture. "Speaking with the computer"

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

Instruction Set Principles. (Appendix B)

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

CS 4200/5200 Computer Architecture I

Computer Architecture I Midterm I

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

ECE260: Fundamentals of Computer Engineering

University of California College of Engineering Computer Science Division -EECS. CS 152 Midterm I

CENG 3420 Lecture 06: Datapath

Transcription:

COMP 303 MIPS Processor Design Project 3: Simple Execution Loop Due date: November 20, 23:59 Overview: In the first three projects for COMP 303, you will design and implement a subset of the MIPS32 architecture in Logisim, a software logic simulator. The goal of these projects is to move you from designing small special-purpose circuits, such as those you designed as homework exercises, to building complex, general-purpose CPUs. We will be implementing a basic 32-bit MIPS processor. We will ignore more advanced features such as the MIPS coprocessor instructions and traps/exceptions. Read this document entirely, paying special attention to the section Deviation from the MIPS standard. We will be using Logisim, a free hardware design and circuit simulation tool. We have implemented a library of components to help you, and Logisim comes with libraries containing basic gates, memory chips, multiplexors and decoders, and other simple components. You may use any of these basic components in your designs, but you may not use the Logisim arithmetic library anywhere in your design. If you wish to download additional libraries from the web to use in your design, please check with the course staff for approval. YOU HAVE TO USE THE ALU YOU HAVE IMPLEMENTED FOR PROJECT2. EACH GROUP SHOULD USE THEIR OWN ALU IN ORDER TO GET POINTS FROM THIS PROJECT. OTHERWISE THE COPY REGULATIONS WILL BE APPLIED.

Project 3: Simple Execution Loop Here we will implement the basic execution loop for the processor, but only implementing two flow control instructions (unconditional jumps), and a few arithmetic and logic instructions. Your design should consist of a program counter, a MIPS Program ROM to store the compiled assembly code of the program, a 32x32 register file, your 32-bit ALU, and other components, along with the instruction decode logic and control circuits needed to connect them together. The design will be non-pipelined, so that in each clock cycle the processor fetches and executes a complete instruction. For the arithmetic instructions, this includes: fetching the instruction to execute from the program ROM, decoding the instruction, selecting arguments from the register file, computing a result, storing the result in the register file, and incrementing the program counter by 4. For jump instructions, no value is written to the register file, and the program counter is set to a value selected from the register file or from the immediate field of the instruction. Begin by connecting a register file, your ALU, and enough circuitry to implement a few arithmetic instructions. Once this is working, you can add logic to handle the jump instructions. For this project, your processor must implement the following MIPS instructions: J, JR, ADDU, SUBU, AND, OR, XOR, NOR, ANDI, LUI. There is a strange quirk of the MIPS architecture. The PC-relative branch targets for control flow instructions do not refer to the address of the current instruction; instead they refer to the address of the instruction immediately following the current one. [You will see later on that this is because a high-performance implementation of the MIPS is pipelined, and the pipeline structure means that the PC has already been updated to point to the next instruction by the time the branch target is computed. You may ignore this comment for now and do not need to understand pipelining, as long as you accept that, by convention, the branch target address is computed from the address of the instruction following the current one. Also, the real MIPS has a branch delay slot, which you should ignore for this project. Your processor will not have a branch delay slot] We have provided some very simple test programs, but they do not thoroughly test the processor. Write a test program that more fully tests all of the features you have implemented in this project. This is a critical step, and you should spend a fair amount of time developing a comprehensive set of test programs that exercise all of the different parts of your processor. Components you will need: The cs316 library contains a triple-ported (dual read / single write) 32-bit wide by 32-registers deep register file, and a Program memory chip capable of loading a MIPS assembly language file directly into its memory. Logisim's memory library contains registers you can use for your program counter. Hint: The instruction decode logic in this project should be extremely simple do not waste time implementing an efficient decoder, because you will have to build a new decoder in project 3 anyway.

What to submit: Submit a single Logisim project file containing your processor, and a text file containing the problems in your implementations. For instance, a sample text file would be: In my implementation, xor and ori do not work but others have no problem. Help and Hints: Ask the TAs for help. We expect to see most students in office hours during the course of the project. Do a pencil and paper design for all components before implementing in Logisim. Deviation from the MIPS Standard: You can ignore any MIPS instruction or feature not mentioned in this document, and can assume that your processor will never encounter anything but legal instructions from the list above. In addition: - Assume all jumps will be word aligned and to valid ROM addresses. - Assume traps or exceptions will not occur (i.e., do not implement them). - Branch and jumps take effect immediately, rather than after a oneinstruction delay slot (although we still compute the destination PC exactly as specified in the MIPS standard). Loading the cs316 library: Select project Load library Jar Library. Select cs316.jar, and enter edu.cornell.cs316.components as the class name. This library contains the following circuits:

Register File: A 32-bit wide by 32-registers deep register file. Register $0 is hard-wired to zero at all times, and writes to $0 are ignored. Inputs ra and rb are used to select register values to output on the A and B outputs. On the rising edge of the clock, if WEis high the data value at input D is stored in register rw. Program ROM: A 32-bit wide byte-addressed ROM, with built-in MIPS assembler. Use the attributes panel to load a MIPS assembly file into the ROM. The PC input specifies the address of the current instruction, and must be a multiple of 4. The output is the 32-bit instruction at the PC address, or zero if the PC has gone past the end of the ROM. Note that zero also happens to encode a no-op in MIPS. The assembly language is in the format described below. MIPS (subset) assembly syntax: The Program ROM component understands all of the instructions you will implement. The syntax is standard MIPS syntax. Labels are case sensitive, everything else ignores case. Anything following a '#' is a comment. In this project, you will only use a few of the instructions listed below. Labels are used to mark places in the code. Jumps and branches can refer to these labels (for jumps, the address is inserted directly, for branches, a relative offset from the branch instruction is computed and inserted, accounting for the delay slot). The instruction syntax is the same as given in the MIPS standard (and different from the output of gcc and many other tools). Registers are written as $0, $1,..., $31, and the destination register goes on the left, followed by source registers and immediate values on the right. Absolute addresses (for J) are given in hex (i.e., 0x12ab), and all other integers can be in hex or signed decimal (i.e., 0x12ab or 1234 or -1234). The special constant PC can be used anywhere an integer is needed, and the assembler will replace it by the address of the instruction itself. The PC will normally fit in 15 bits or less

Some examples of instructions are: Jumps J 0x24 J my_label JR $31 Branches BEQ $5, $6, -12 BEQ $5, $6, my_loop_top BLEZ $9, 16 BLEZ $9, my_loop_done Memory Load/Store LW $12, -4($30) SW $12, 0($30) Immediate load Immediate arithmetic LUI $14, 0x123 ADDIU $12, $0, 0x1234 Register arithmetic ADDU $13, $0, $20 Shifts SLL $13, $13, 2 SLLV $15, $14, $3 Labels my_loop_top: BNE $5, $6, 16 my_loop_done: MIPS (subset) opcode summary (from the MIPS handbook): Is optimal always best? It is not enough to simply build a working circuit. We want you to build a good working circuit. But we leave it up to you to define what

good is, and we expect you to document your criteria and how you fulfill them. For example, you might aim to make the fastest processor possible, at the expense of simplicity and number of gates. Or you might aim for a minimalist design using the fewest gates possible, even if it makes your processor slower. Eventually, in Project 3, you will be asked to document your goals and justify the choices you made. All of your designs should be clear and easy to follow, and should be annotated (with text labels) for any unusual or difficult parts of the circuit. Academic Integrity. As one of the most widely studied architectures, MIPS has a wealth of information available on the web and in textbooks. You may consult any of the MIPS architecture documentation available to you in order to learn about the instruction set, what each instruction does, etc. But we expect your design to be entirely your own. If you are unsure if it is okay to borrow from some other source, just ask the TAs, and give credit in your final writeup. If you are unsure about asking the TAs, then it is probably not okay. Plagiarism in any form will not be tolerated.