Building a Computer. Quiz #2 on 10/31, open book and notes. (This is the last lecture covered) I wonder where this goes? L16- Building a Computer 1

Similar documents
Computer Engineering Department. CC 311- Computer Architecture. Chapter 4. The Processor: Datapath and Control. Single Cycle

Processor Design & ALU Design

EC 413 Computer Organization

Computer Architecture. ECE 361 Lecture 5: The Design Process & ALU Design. 361 design.1

Project Two RISC Processor Implementation ECE 485

3. (2) What is the difference between fixed and hybrid instructions?

4. (3) What do we mean when we say something is an N-operand machine?

Lecture 13: Sequential Circuits, FSM

Pipelining. Traditional Execution. CS 365 Lecture 12 Prof. Yih Huang. add ld beq CS CS 365 2

[2] Predicting the direction of a branch is not enough. What else is necessary?

[2] Predicting the direction of a branch is not enough. What else is necessary?

Lecture 13: Sequential Circuits, FSM

Arithmetic and Logic Unit First Part

CPU DESIGN The Single-Cycle Implementation

Designing Single-Cycle MIPS Processor

Lecture 3, Performance

Lecture 3, Performance

1. (2 )Clock rates have grown by a factor of 1000 while power consumed has only grown by a factor of 30. How was this accomplished?

Implementing the Controller. Harvard-Style Datapath for DLX

Computer Architecture

Computer Architecture ELEC2401 & ELEC3441

Review. Combined Datapath

TEST 1 REVIEW. Lectures 1-5

Control. Control. the ALU. ALU control signals 11/4/14. Next: control. We built the instrument. Now we read music and play it...

CSE Computer Architecture I


A Second Datapath Example YH16

Simple Instruction-Pipelining. Pipelined Harvard Datapath

61C In the News. Processor Design: 5 steps

L07-L09 recap: Fundamental lesson(s)!

CPS 104 Computer Organization and Programming Lecture 11: Gates, Buses, Latches. Robert Wagner

CPSC 3300 Spring 2017 Exam 2

Computer Architecture

UNIVERSITY OF WISCONSIN MADISON

CA Compiler Construction

Enrico Nardelli Logic Circuits and Computer Architecture

Simple Instruction-Pipelining (cont.) Pipelining Jumps

CS61C : Machine Structures

CS61C : Machine Structures

Simple Instruction-Pipelining. Pipelined Harvard Datapath

CSCI-564 Advanced Computer Architecture

EECS150 - Digital Design Lecture 11 - Shifters & Counters. Register Summary

Design of Sequential Circuits

ECE 3401 Lecture 23. Pipeline Design. State Table for 2-Cycle Instructions. Control Unit. ISA: Instruction Specifications (for reference)

COVER SHEET: Problem#: Points

Review: Single-Cycle Processor. Limits on cycle time

Computer Architecture. ESE 345 Computer Architecture. Design Process. CA: Design process

ECEN 651: Microprogrammed Control of Digital Systems Department of Electrical and Computer Engineering Texas A&M University

Design. Dr. A. Sahu. Indian Institute of Technology Guwahati

System Data Bus (8-bit) Data Buffer. Internal Data Bus (8-bit) 8-bit register (R) 3-bit address 16-bit register pair (P) 2-bit address

Outcomes. Spiral 1 / Unit 2. Boolean Algebra BOOLEAN ALGEBRA INTRO. Basic Boolean Algebra Logic Functions Decoders Multiplexers

ECE290 Fall 2012 Lecture 22. Dr. Zbigniew Kalbarczyk

Introduction EE 224: INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN. Lecture 6: Sequential Logic 3 Registers & Counters 5/9/2010

Logic and Computer Design Fundamentals. Chapter 8 Sequencing and Control

CprE 281: Digital Logic

Arithme(c logic units and memory

2

Designing MIPS Processor

CMP 334: Seventh Class

A crash course in Digital Logic

CHAPTER log 2 64 = 6 lines/mux or decoder 9-2.* C = C 8 V = C 8 C * 9-4.* (Errata: Delete 1 after problem number) 9-5.

Basic Computer Organization and Design Part 3/3

Chapter 5. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 5 <1>

Combinatorial Logic Design Multiplexers and ALUs CS 64: Computer Organization and Design Logic Lecture #13

Adders allow computers to add numbers 2-bit ripple-carry adder

CSE370 HW6 Solutions (Winter 2010)

Instruction register. Data. Registers. Register # Memory data register

ALU A functional unit

Sequential Circuits. Circuits with state. Silvina Hanono Wachman Computer Science & Artificial Intelligence Lab M.I.T. L06-1

Digital Electronics II Mike Brookes Please pick up: Notes from the front desk

Spiral 2-1. Datapath Components: Counters Adders Design Example: Crosswalk Controller

Mark Redekopp, All rights reserved. Lecture 1 Slides. Intro Number Systems Logic Functions

UNIT 8A Computer Circuitry: Layers of Abstraction. Boolean Logic & Truth Tables

EECS150 - Digital Design Lecture 24 - Arithmetic Blocks, Part 2 + Shifters

Arithmetic Circuits Didn t I learn how to do addition in the second grade? UNC courses aren t what they used to be...

CSc 256 Midterm 2 Fall 2010

ECE/CS 250 Computer Architecture

Department of Electrical and Computer Engineering The University of Texas at Austin

Verilog HDL:Digital Design and Modeling. Chapter 11. Additional Design Examples. Additional Figures

EECS150 - Digital Design Lecture 25 Shifters and Counters. Recap

Practice Homework Solution for Module 4

Logic design? Transistor as a switch. Layered design approach. CS/COE1541: Introduction to Computer Architecture. Logic Design Review.

Digital Integrated Circuits A Design Perspective. Arithmetic Circuits. Jan M. Rabaey Anantha Chandrakasan Borivoje Nikolic.

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

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 9 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

Preparation of Examination Questions and Exercises: Solutions

Logic Design. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

Computer Science. 19. Combinational Circuits. Computer Science COMPUTER SCIENCE. Section 6.1.

ECE 250 / CPS 250 Computer Architecture. Basics of Logic Design Boolean Algebra, Logic Gates

Microprocessor Power Analysis by Labeled Simulation

Latches. October 13, 2003 Latches 1

CSE 200 Lecture Notes Turing machine vs. RAM machine vs. circuits

CS/COE1541: Introduction to Computer Architecture. Logic Design Review. Sangyeun Cho. Computer Science Department University of Pittsburgh

Implementing Absolute Addressing in a Motorola Processor (DRAFT)

Intro To Digital Logic

Chapter 7: Digital Components. Oregon State University School of Electrical Engineering and Computer Science. Review basic digital design concepts:

CMP N 301 Computer Architecture. Appendix C

Chapter 7. Sequential Circuits Registers, Counters, RAM

Integrated Circuits & Systems

Measurement & Performance

Transcription:

Building a Computer I wonder where this goes? B LU MIPS Kit Quiz # on /3, open book and notes (This is the last lecture covered) Comp 4 Fall 7 /4/7 L6- Building a Computer

THIS IS IT! Motivating Force or Inciting Incident This is the point in the course where the PLOT actually begins. We are now ready to build a computer. The ingredients are all in place, now it is time to build a legitimate computer. One that executes instructions, much the way any other desktop, P, or other computer does. Comp 4 Fall 7 /4/7 L6- Building a Computer

The MIPS IS OP 6 5 5 5 5 6 6 6 r s r t r d shamt func R-type: LU with Reguster operands Reg[rd] Reg[rs] op Reg[rt] r s r t immediate I-type: LU with constant operand Reg[rt] Reg[rs] op (immediate) r s r t immediate I-type: Load and Store Reg[rt] Mem[Reg[rs] + (immediate)] Mem[Reg[rs] + (immediate)] Reg[rt] r s r t immediate I-type: Branch s if (Reg[rs] == Reg[rt]) + 4 + 4*(immediate) if (Reg[rs]!= Reg[rt]) + 4 + 4*(immediate) 6-bit constant J-type: jump ( & xf) 4*(immediate) Comp 4 Fall 7 /4/7 The MIPS instruction set as seen from a Hardware Perspective classes classes distinguished distinguished by by types: types: ) ) 3-operand 3-operand LU LU ) ) LU LU w/immediate w/immediate 3) 3) Loads/Stores Loads/Stores 4) 4) Branches Branches 5) 5) Jumps Jumps L6- Building a Computer 3

esign pproach Incremental Featurism Each instruction class can be implemented using a simple component repertoire. We ll try implementing data paths for each class individually, and merge them (using MUes, etc). Steps:. 3-Operand LU instructions. LU w/immediate instructions. Load & Store s 3. Jump & Branch instructions 4. Exceptions 5. Merge data paths Our Bag of Components: s Muxes B LU LU & adders + R R W W (3-port) R R Memories W R R/W ata Comp 4 Fall 7 /4/7 L6- Building a Computer 4

Few LU Tweaks Let s review the LU that we built a few lectures ago. (With a few minor additions) B Sub Bool Shft Math dd/sub Bidirectional Barrel Shifter Boolean 5-bit Sub Bool Shft Math OP +B -B B<< B>> B>>> & B B ^ B B Flags V,C N Flag Comp 4 Fall 7 /4/7 R Flag L6- Building a Computer 5

Fetch/ecode Use a counter to FETCH the next instruction: PROGRM COUNTER () + 3 Can be built with half-adders OP[3:6], FUNC[5:] INSTRUCTION WOR FIELS CONTROL SIGNLS use as memory address add 4 to, load new value at end of cycle fetch instruction from memory º use some instruction fields directly (register numbers, 6-bit constant) º use bits <3:6> and <5:> to generate controls Comp 4 Fall 7 /4/7 L6- Building a Computer 6

3-Operand LU ata Path r s r t r d R-type: LU with Reguster operands Reg[rd] Reg[rs] op Reg[rt] Rs: <5:> Rt: <:6> Rd: <5:> R R W W R R B LU! Comp 4 Fall 7 /4/7 L6- Building a Computer 7

Shift s r s r t r d shamt R-type: LU with Reguster operands sll: Reg[rd] Reg[rt] (shift) shamt sllv: Reg[rd] Reg[rt] (shift) Reg[rs] Rs: <5:> Rt: <:6> Rd: <5:> R R W W R R shamt:<:6> SEL SEL! B LU SEL Comp 4 Fall 7 /4/7 L6- Building a Computer 8

LU with Immediate r s r t immediate I-type: LU with constant operand Reg[rt] Reg[rs] op (immediate) Rs: <5:> Rt: <:6> Rd:<5:> Rt:<:6> R R W W W R R imm: <5:> shamt:<:6> SEL! SEL B LU... 5 4 3 3 3 3 7 6 5 4 3 3 Comp 4 Fall 7 /4/7 L6- Building a Computer 9

Load r s r t immediate I-type: Load Reg[rt] Mem[Reg[rs] + (immediate)] Rs: <5:> Rt: <:6> Rd:<5:> Rt:<:6> R R W W W R R Imm: <5:> shamt:<:6> SEL SEL B LU W R/W ata dr R Comp 4 Fall 7 /4/7 L6- Building a Computer

Store r s r t immediate I-type: Store Mem[Reg[rs] + (immediate)] Reg[rt] Rs: <5:> Rt: <:6> Rd:<5:> Rt:<:6> R R W W W R R Imm: <5:> shamt:<:6> SEL B LU W R/W ata dr R No! SEL Comp 4 Fall 7 /4/7 L6- Building a Computer

JMP s <3:9>:J<5:>: SEL 6 5 4 3 6-bit constant J-type: j: ( & xf) 4*(immediate) jal: ( & xf) 4*(immediate); Reg[3] + 4 J:<5:> Rd:<5:> Rt:<:6> 3 7 WSEL 3 Rs: <5:> R R W W W R R Rt: <:6> Imm: <5:> shamt:<:6> SEL SEL WSEL SEL B LU W R/W ata dr R Comp 4 Fall 7 /4/7 L6- Building a Computer

BEQ/BNE s <3:9>:J<5:>: BT SEL 6 5 4 3 That x4 unit is trivial. I ll just wire the input shifted over bit positions. J:<5:> r s r t immediate R-type: Branch s if (Reg[rs] == Reg[rt]) + 4 + 4*(immediate) Rd:<5:> Rt:<:6> 3 7 if (Reg[rs]!= Reg[rt]) + 4 + 4*(immediate) WSEL 3 Rs: <5:> R R W W W R R Rt: <:6> Imm: <5:> Why add, another adder? Couldn t we reuse the one in the LU? Nope, it needs to do a subtraction. SEL WSEL SEL x4 + BT B LU shamt:<:6> SEL W R/W ata dr R Comp 4 Fall 7 /4/7 L6- Building a Computer 3

Jump Indirect s <3:9>:J<5:>: JT BT SEL 6 5 4 3 r s r t r d R-type: Jump Indirect, Jump and Link Indirect jr: Reg[rs] jalr: Reg[rs], Reg[rd] + 4 J:<5:> Rd:<5:> Rt:<:6> 3 7 WSEL 3 Rs: <5:> R R W W W R R Rt: <:6> Imm: <5:> JT SEL WSEL SEL x4 + BT B LU shamt:<:6> SEL W R/W ata dr R Comp 4 Fall 7 /4/7 L6- Building a Computer 4

Loose Ends <3:9>:J<5:>: JT BT SEL 6 5 4 3 r s r t immediate I-type: set on less than & set on less than unsigned immediate slti: if (Reg[rs] < (imm)) Reg[rt] ; else Reg[rt] sltiu: if (Reg[rs] < (imm)) Reg[rt] ; else Reg[rt] N V J:<5:> C Rd:<5:> Rt:<:6> 3 7 Imm: <5:> WSEL 3 JT Rs: <5:> R R W W W R R Rt: <:6> Reminder: To evaluate ( < B) we first compute -B and look at the flags. SEL WSEL SEL x4 + BT B LU NV shamt:<:6> C SEL W R/W ata dr R LT = N V LTU = C Comp 4 Fall 7 /4/7 L6- Building a Computer 5

More Loose Ends <3:9>:J<5:>: JT BT SEL 6 5 4 3 r s r t r d R-type: set on less than & set on less than unsigned slt: if (Reg[rs] < Reg[rt]) Reg[rd] ; else Reg[rd] sltu: if (Reg[rs] < Reg[rt]) Reg[rd] ; else Reg[rd] J:<5:> Rd:<5:> Rt:<:6> 3 7 WSEL 3 Rs: <5:> R R W W W R R Rt: <:6> Imm: <5:> JT N V C SEL WSEL SEL x4 + BT B LU N V C shamt:<:6> SEL W R/W ata dr R Comp 4 Fall 7 /4/7 L6- Building a Computer 6

LUI Ends <3:9>:J<5:>: JT BT SEL 6 5 4 3 r t immediate I-type: Load upper immediate lui: Reg[rt] Immediate << 6 J:<5:> Rd:<5:> Rt:<:6> 3 7 WSEL 3 Rs: <5:> R R W W W R R Rt: <:6> Imm: <5:> JT N V C SEL WSEL SEL x4 + BT shamt:<:6> B LU N V C 6 SEL W R/W ata dr R Comp 4 Fall 7 /4/7 L6- Building a Computer 7

Reset, Interrupts, and Exceptions FIRST, we need some way to get our machine into a known initial state. This doesn t mean that all registers will be initialized, just that we ll know where to fetch the first instruction. We ll call this control input, RESET We d also like RECOVERBLE INTERRUPTS for FULTS (eg, Illegal ) - CPU or SYSTEM generated [synchronous] TRPS & system calls (eg, read-a-character) - CPU generated [synchronous] (Implemented as an agreed upon Illegal instruction) I/O events (eg, key struck) - externally generated [asynchronous] ECEPTION GOL: Interrupt running program, invoke exception handler, return to continue execution. These are Software notions of synchrony and asynchrony. Comp 4 Fall 7 /4/7 L6- Building a Computer 8

Exceptions x8 x84 x88 <3:9>:J<5:>: JT BT SEL 6 5 4 3 Reset: x8 Bad Opcode: Reg[7] ; x84 IRQ: Reg[7] ; x88 These inputs should probably be registered a few times to avoid metastability problems RESET IRQ J:<5:> N V C SEL WSEL SEL LSEL Rd:<5:> Rt:<:6> Imm: <5:> 3 7 x4 + BT WSEL 3 JT R R W W W R R B LU N V C Rs: <5:> shamt:<:6> 6 SEL Rt: <:6> W R/W ata dr R Comp 4 Fall 7 /4/7 L6- Building a Computer 9

MIPS: Our Final Version x8 x84 x88 <3:9>:J<5:>: JT BT SEL 6 5 4 3 RESET IRQ J:<5:> N V C SEL WSEL SEL Rd:<5:> Rt:<:6> 3 7 Imm: <5:> x4 + BT WSEL 3 JT This is a complete -bit processor. lthough designed in one class lecture, it executes the majority of the MIPS R instruction set. R R W W W R R Rs: <5:> B LU N V C shamt:<:6> 6 SEL Rt: <:6> W R/W ata dr R Executes one instruction per clock ll that s left is the control logic design Comp 4 Fall 7 /4/7 L6- Building a Computer

L6- Building a Computer Comp 4 Fall 7 /4/7 MIPS Control The control unit can be built as a large ROM B S E L beq sw S E L lw andi sll add Sub Bool Shft Math 3 6 4 W E R F W R W S E L W S E L S E T P C S E L C V N I R Q R E S E T