Lab 8 (Sections 300, 301 and 302) Prelab: ALU and ALU Control

Similar documents
Lab 7 (All Sections) Prelab: Verilog Review and ALU Datapath and Control

Lab 8 (All Sections) Prelab: ALU and ALU Control

Lab 4 : MIPS Function Calls

ECE232: Hardware Organization and Design

Chapter 4. The Processor

Single Cycle CPU Design. Mehran Rezaei

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

Chapter 4. The Processor

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

Lab 3 (All Sections) Prelab: MIPS-Control Instructions

Chapter 2. Instructions:

Lab 4 Prelab: MIPS Function Calls

Lab 3 (Sections 300, 301 and 302) Prelab: MIPS-Control Instructions

Lab 9 : ALU Control and Data Path

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

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

Chapter 4. The Processor Designing the datapath

Processor (I) - datapath & control. Hwansoo Han

CPU Organization (Design)

CS3350B Computer Architecture Quiz 3 March 15, 2018

ECE 2035 Programming HW/SW Systems Spring problems, 6 pages Exam One 4 February Your Name (please print clearly)

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

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

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam One 22 September Your Name (please print clearly) Signed.

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

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

CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath

4. What is the average CPI of a 1.4 GHz machine that executes 12.5 million instructions in 12 seconds?

Review of instruction set architectures

Lecture 4: MIPS Instruction Set

Unsigned Binary Integers

Unsigned Binary Integers

Review: Abstract Implementation View

The Processor: Datapath & Control

ECE468 Computer Organization and Architecture. Designing a Single Cycle Datapath

MIPS%Assembly% E155%

Full Datapath. CSCI 402: Computer Architectures. The Processor (2) 3/21/19. Fengguang Song Department of Computer & Information Science IUPUI

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

Introduction. Datapath Basics

CS 61C: Great Ideas in Computer Architecture Datapath. Instructors: John Wawrzynek & Vladimir Stojanovic

Mips Code Examples Peter Rounce

361 control.1. EECS 361 Computer Architecture Lecture 9: Designing Single Cycle Control

Solution printed. Do not start the test until instructed to do so! CS 2504 Intro Computer Organization Test 2 Spring 2006.

CS 2506 Computer Organization II

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

Graduate Institute of Electronics Engineering, NTU MIPS CPU Lab 3 memory,register file & control unit

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

MIPS-Lite Single-Cycle Control

Control Unit. Simulation. Result

ECE 30 Introduction to Computer Engineering

CS 2504 Intro Computer Organization Test 1

RISC-V Assembly and Binary Notation

COMPSCI 313 S Computer Organization. 7 MIPS Instruction Set

Laboratory Single-Cycle MIPS CPU Design (4): 16-bits version One clock cycle per instruction

CC 311- Computer Architecture. The Processor - Control

Inf2C - Computer Systems Lecture Processor Design Single Cycle

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

LECTURE 5. Single-Cycle Datapath and Control

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

University of Jordan Computer Engineering Department CPE439: Computer Design Lab

MIPS Coding Continued

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

ECE260: Fundamentals of Computer Engineering

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

CSCI 402: Computer Architectures. Fengguang Song Department of Computer & Information Science IUPUI. Today s Content

COMP303 Computer Architecture Lecture 9. Single Cycle Control

Project Description EEC 483 Computer Organization, Spring 2019

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

CS 351 Exam 2 Mon. 11/2/2015

CSE 378 Midterm 2/12/10 Sample Solution

CS 2506 Computer Organization II Test 1. Do not start the test until instructed to do so! printed

CS222: MIPS Instruction Set

ECE260: Fundamentals of Computer Engineering

Lecture 6 Decision + Shift + I/O

The MIPS Processor Datapath

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

UC Berkeley CS61C : Machine Structures

Systems Architecture

Sheet For the following C code: a = b + c; b = a + c; d = a b; Write an equivalent assembly MIPS program. Solution:

CENG 3420 Lecture 06: Datapath

Lecture 5: Procedure Calls

ECE 2035 Programming HW/SW Systems Spring problems, 6 pages Exam Two 11 March Your Name (please print) total

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

Winter 2002 FINAL EXAMINATION

ECE/CS 552: Introduction to Computer Architecture ASSIGNMENT #1 Due Date: At the beginning of lecture, September 22 nd, 2010

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

CS 2506 Computer Organization II

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

Computer Architecture Experiment

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

Digital Design and Computer Architecture Harris and Harris

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

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

Laboratory Exercise 6 Pipelined Processors 0.0

/ : Computer Architecture and Design Fall Midterm Exam October 16, Name: ID #:

Chapter 3. Instructions:


Major CPU Design Steps

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

Transcription:

Lab 8 (Sections 300, 301 and 302) Prelab: ALU and ALU Control Name: Sign the following statement: On my honor, as an Aggie, I have neither given nor received unauthorized aid on this academic work 1 Objective In this lab you will be implementing the ALU module and its control block. For this lab you are expected to be familiar with the ALU design (see Chapter C.5 of the textbook). In addition, you should have a thorough understanding of the MIPS instruction set. 2 Introduction In this lab, you will design the 32-bit Arithmetic Logic Unit (ALU) as described in Chapter C.5 of the textbook. Your ALU will become an important part of the MIPS microprocessor that you will build in later labs, so it is advised to do this lab carefully. 3 ALU and ALU CONTROL Blocks As you know, the ALU is the most crucial element in any processor data-path. Almost every instruction uses ALU for some processing. For example, ADD and ADDI use the ALU for addition, SUB for subtraction, and I for logical, etc. 1

Computer Architecture and Design, PreLab 8 2 4 ALUCtrl BusA ALU Zero BusW BusB Fig. 1: ALU Block As shown in Figure 1, an ALU module takes two 32-bit inputs (BusA and BusB), performs an operation as specified by the 4-bit ALUCtrl field, and outputs the result on the 32 bit output bus BusW. When the value on BusW is 0, the Zero signal is set to 1, otherwise it is set to 0. The basic operations performed by an ALU are: 1. Addition 2. Subtraction 3. 4. AND 5. Set on less than (compare and set) In this lab, we will be extending the ALU to implement 2 additional operations: 1. Shift left 2. Shift right The shift left operation takes two values, A and B, each of which is 32-bits. B is shifted left A bits (B << A), and written to W. Shift right works in an similar manner but shifts to the right instead of the left. Make sure that you consider the fact that for shifts BusA holds the Amount of shift and BusB is the value that ALU is going to shift.

Computer Architecture and Design, PreLab 8 3 4 Questions Assuming your ALU can perform basic operations, as well as the 2 additional operations you will add. 1. What is the operation that your ALU performs with the following instructions? Instruction LW (Load Word) SW (Store Word) BEQ (Branch of Equal) SLT (Set on Less Than) SLL SRL 2. ALU Control The ALU control block takes 2 inputs ALU Action The function field from an R-TYPE instruction (bits [5:0] of the instruction). ALUOP(2 bits) from the main control unit The output of the ALU control unit is a 4-bit signal, which directly controls the ALU. Give the ALU Ctrl values for the following operations: Note: For Shift operations (shift left and shift right), you may used any unassigned value. For the purposes of this lab, use 0011 for shift right, and 0100 for shift left. Operation Addition AND Subtract Set on Less Than N SRL SLL ALU Control lines

Computer Architecture and Design, PreLab 8 4 3. How would you extend the datapath in Figure 2 to implement the SLL and SRL instructions. Note: The ALU needs the first port to contain the value to shift and the second to contain the amount to shift by. Pay special attention to the data path for these values. Fig. 2: ALU Datapath

Computer Architecture and Design, PreLab 8 5 4. The ALUOP takes 3 values: 00 Implicit Add (Used by load and store and addi). 01 Implicit Subtract (used by beq). 10 Use Function Field (used by R-Type instructions). 11 Implicit (Used by ori) Complete the following table for mapping the ALUOP and FUNCT fields to ALUCTRL signals. Instruction ALUOP Funct Field ALU operation ALU Control (2 bits) Instruct[5:0] (4 bits) LW 00 XXXXXX 0010 SW XXXXXX 0010 BEQ XXXXXX ADD 10 100000 addition 0010 SUB subtraction AND AND I SLT SLL 10 0011 SRL 0100 Note: You will use the above mapping to implement the ALU control block during inlab.

Computer Architecture and Design, PreLab 8 6 Test # Test ALUCtrl A B W Zero (4 bits) (32 bits) (32 bits) (32 bits) 1 ADD 0, 0 2 0x00000000 0x00000000 0x00000000 1 2 ADD 0, 1 2 0x00000000 0xFFFFFFFF 0xFFFFFFFF 0 3 ADD 1, 1 2 0xFFFFFFFF 0x00000001 0x00000000 1 4 ADD F F, 1 2 0x000000FF 5 SUB 0, 0 6 0x00000000 0x00000000 0x00000000 1 6 SUB 1, 1 7 SUB 1, 1 8 SLT 0, 0 7 0x00000000 0x00000000 0x00000000 1 9 SLT 0, 1 0x00000001 0 10 SLT 0, 1 0x00000000 1 11 SLT 1, 0 12 SLT 1, 0 0xFFFFFFFF 13 AND 0xFFFFFFFF, 0xFFFFFFFF 0xFFFFFFFF 14 AND 0xFFFFFFFF, 0xFFFFFFFF 0xCAFEBABE 0xCAFEBABE 0xCAFEBABE 15 AND 0x00000000, 0xFFFFFFFF 16 AND 0x12345678, 0x12345678 0x87654321 17 0xF0F0F0F0, 0xF0F0F0F0 0x0000FFFF 0 0x0000FFFF 18 0x12345678, 0x87654321 19 SLL 0x12345678,0x2 0x12345678 0x00000002 20 SLL 0x80000000,0x3 0x80000000 21 SRL 0x00000001,0x3 0x00000001 0x00000003 22 SRL 0x00001234,0x6 0x00001234 0x00000006 Tab. 1: ALU Test Vectors 5. During the in-lab, you will be implementing the ALU block. As part of the design process, you need to develop an appropriate set of test vectors to verify basic functionality. Complete Table 1 (submit hardcopy or via email) to verify that all 7 ALU operations work as designed. Note that all values are expressed in hexadecimal. You will use this table to test the ALU Verilog code that you will implement during the in-lab (make sure to keep a copy of your submitted answers).