1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Apr 6, 2010.

Slides:



Advertisements
Similar presentations
Goal: Write Programs in Assembly
Advertisements

Integer Arithmetic: Multiply, Divide, and Bitwise Operations
Adding the Jump Instruction
1 COMP541 Datapaths II Montek Singh Mar 22, 2007.
Computer Architecture CPSC 321 E. J. Kim. Overview Logical Instructions Shifts.
1 COMP541 Sequencing – III (Sequencing a Computer) Montek Singh April 9, 2007.
Logical & shift ops (1) Fall 2007 Lecture 05: Logical Operations.
Computer ArchitectureFall 2007 © October 3rd, 2007 Majd F. Sakr CS-447– Computer Architecture.
The Processor 2 Andreas Klappenecker CPSC321 Computer Architecture.
Lecture 16: Basic CPU Design
Shift Instructions (1/4)
CPEN Digital System Design Chapter 9 – Computer Design
1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Oct 29, 2014.
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.
1 COMP541 Completing the MIPS Datapath Montek Singh Mar 27, 2007.
The Processor Data Path & Control Chapter 5 Part 1 - Introduction and Single Clock Cycle Design N. Guydosh 2/29/04.
Counters and Registers
1 CS/COE0447 Computer Organization & Assembly Language Chapter 3.
Fall EE 333 Lillevik 333f06-l7 University of Portland School of Engineering Computer Organization Lecture 7 ALU design MIPS data path.
1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Apr 11, 2012.
CSCI 136 Lab 1: 135 Review.
1 COMP541 Multicycle MIPS Montek Singh Apr 4, 2012.
COMP541 Multicycle MIPS Montek Singh Apr 8, 2015.
CDA 3101 Fall 2013 Introduction to Computer Organization The Arithmetic Logic Unit (ALU) and MIPS ALU Support 20 September 2013.
CDA 3101 Fall 2013 Introduction to Computer Organization
Datapath and Control Unit Design
1. Building A CPU  We’ve built a small ALU l Add, Subtract, SLT, And, Or l Could figure out Multiply and Divide  What about the rest l How do.
COMP541 Multicycle MIPS Montek Singh Mar 25, 2010.
Computer Organization CS224 Fall 2012 Lessons 7 and 8.
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
Datapath and Control AddressInstruction Memory Write Data Reg Addr Register File ALU Data Memory Address Write Data Read Data PC Read Data Read Data.
1 COMP541 Datapaths I Montek Singh Mar 8, Topics  Over next 2/3 classes: datapaths  Basic register operations Book sections 7-2 to 7-6 and 7-8.
COM181 Computer Hardware Lecture 6: The MIPs CPU.
CS161 – Design and Architecture of Computer Systems
CS161 – Design and Architecture of Computer Systems
Variable Word Width Computation for Low Power
COMPUTER ARCHITECTURE & OPERATIONS I
COMP541 Datapaths I Montek Singh Mar 28, 2012.
Chap 7. Register Transfers and Datapaths
Performance of Single-cycle Design
Morgan Kaufmann Publishers
Digital Logic Last Time … This Time … Control Path, Arithmetic Ops a
Processor (I).
CS/COE0447 Computer Organization & Assembly Language
CS/COE0447 Computer Organization & Assembly Language
Single-Cycle CPU DataPath.
CSCI206 - Computer Organization & Programming
Computer Architecture & Operations I
CSE 370 – Winter 2002 – Comb. Logic building blocks - 1
ECE232: Hardware Organization and Design
Rocky K. C. Chang 6 November 2017
Instruction encoding The ISA defines Format = Encoding
The Processor Lecture 3.4: Pipelining Datapath and Control
CS/COE0447 Computer Organization & Assembly Language
The Processor Lecture 3.1: Introduction & Logic Design Conventions
Guest Lecturer TA: Shreyas Chand
CS/COE0447 Computer Organization & Assembly Language
COMS 361 Computer Organization
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Processor: Multi-Cycle Datapath & Control
Instruction encoding The ISA defines Format = Encoding
COMP541 Datapaths I Montek Singh Mar 18, 2010.
Instruction encoding The ISA defines Format = Encoding
Control units In the last lecture, we introduced the basic structure of a control unit, and translated our assembly instructions into a binary representation.
ECE 352 Digital System Fundamentals
MIPS Assembly.
Instruction encoding The ISA defines Format = Encoding
COMS 361 Computer Organization
Processor: Datapath and Control
CS/COE0447 Computer Organization & Assembly Language
Presentation transcript:

1 COMP541 Final Missing Pieces of MIPS: Adding Memory & I/O Montek Singh Apr 6, 2010

2 Summary of Remaining Labs  April 9: Complete the CPU Show: Show:  show a complete and working Lab 7 Do: Do:  add shift instruction  add keyboard/joystick  integrate with your VGA code  April 16: Demo development Show: Show:  show a complete and working Lab 8 Do: Do:  develop your game/demo app  April 23: Wrap up demo show demo! show demo!

A few tips on finishing up your MIPS  Sign extension: simple assume all of your I-type instructions are signed assume all of your I-type instructions are signed  e.g., lw, sw, addi, beq thus, simply sign-extend every immediate operand thus, simply sign-extend every immediate operand  just extend value of bit 15 to upper 16 bits  Single-cycle vs. multi-cycle I think single-cycle is easier I think single-cycle is easier  Memory I think making your own is easier than using Block RAMs I think making your own is easier than using Block RAMs  Do everything step-by-step! 3

This is your single-cycle MIPS 4

5Memory  Word width 16 or 32 bits? 16 or 32 bits?  Addressing Byte address or word address? Byte address or word address?

6 Expanding Memory Block  First let’s look in detail at data memory block  See how to add block memories  Add I/O? 7-segment 7-segment Char. terminal Char. terminal

Memory Block Signals 7 Address – 32 bits Write Data – 32 bits Read Data – 32 bits Mem Write – 1 bit Mem Read – 1 bit

8 Using 2 Smaller RAMs  If you are using Block RAMs may have to combine multiple to provide adequate size may have to combine multiple to provide adequate size (that’s why I recommend making your own RAM!) (that’s why I recommend making your own RAM!) example: example:

9 Block RAM Specs  Try two 1024x16 2 parity bits unused 2 parity bits unused Gives 1K words (32-bit) Gives 1K words (32-bit)  Could add 2 more RAMs to increase mem to 2K words

10 Memory Map  Refers to how physical memory is populated  In our example, memory from 0 to 1023 (or 2047) It’s in multiple blocks, but that’s invisible to programmer It’s in multiple blocks, but that’s invisible to programmer

11 Another Portion of Memory  Let’s see how to add a block of x8 character memory for the VGA

12 Memory Map Instruction and Data Memory Empty… Character Memory Do you test all bits in your memory decoder? Up to you.  Keep in mind: your character memory may have different word widths your character memory may have different word widths e.g., x1, or x8, etc. e.g., x1, or x8, etc. you may need to do some address and data conversion you may need to do some address and data conversion

13 Adding I/O  Look at memory-mapped I/O  Conceptually like this

14 In Reality  Isolated from CPU  On standard buses PCI PCI  Ours will typically be simpler Just memory addresses Just memory addresses

15Later  You’ll add joystick or keyboard (or both) into memory locations that you can read e.g., at two locations right above character memory e.g., at two locations right above character memory

16 How Does Processor Begin?  One way is to initialize PC to 0 or some other predefined address or some other predefined address  Make sure to have instructions there Modern computers have flash memory to boot CPU or go to configuration utility Modern computers have flash memory to boot CPU or go to configuration utility On (very) old computers had to enter boot program on front panel On (very) old computers had to enter boot program on front panel

Shift Instructions  You may want to add simple shift instructions To multiply by factors of 2 To multiply by factors of 2  e.g., shift-logical-left, shift-logical-right and shift-arithmetic-right  you could simply implement shifts by “1” –i.e., perhaps ignore greater shift amounts  So let’s talk about shifters (and shift registers) 17

Shift Types  Logical shift: shifts value to left or right and fills empty spaces with 0’s Ex: >> 2 = Ex: >> 2 = Ex: << 2 = Ex: << 2 =  Arithmetic shift: same as logical shifter, but on right shift, fills empty spaces with the old most significant bit (msb). Ex: >>> 2 = Ex: >>> 2 = Ex: <<< 2 = Ex: <<< 2 =  Rotate: rotates bits in a circle, such that bits shifted off one end are shifted into the other end Ex: ROR 2 = Ex: ROR 2 = Ex: ROL 2 = Ex: ROL 2 = 00111

Shift Register Symbol: Implementation: Shift a new value in on each clock edge Shift a value out on each clock edge Serial-to-parallel converter: converts serial input (S in ) to parallel output (Q 0:N-1 )

Shift Register with Parallel Load When Load = 1, acts as a normal N-bit register When Load = 0, acts as a shift register Now can act as a serial-to-parallel converter (S in to Q 0:N- 1 ) or a parallel-to-serial converter (D 0:N-1 to S out )

Adding Shift Instruction: First Thought  Make a parallel-load, bidirectional shift register Anything wrong with that? Anything wrong with that? 21

22 Takes Multiple Clocks  First clock loads shift reg  Second makes the shift  Third loads to destination reg And that’s for a one-bit shift  Any alternatives?

Simple Shifter Design Left shiftR shift Arithmetic R shift

24 Is This Better?  Three short clocks may be faster than one limited by gate delays But complex control But complex control  We could implement 1 or n bit shift instruction MIPS has up to 31 bits MIPS has up to 31 bits

25 Lots of Muxes  When n gets larger, this becomes large  Can use levels of muxes Similar to carry-lookahead adder Similar to carry-lookahead adder

My recommendation  Implement sll, srl, sra… … with constant shift amount of “1” … with constant shift amount of “1” you can always do bigger shifts by repeating in software you can always do bigger shifts by repeating in software 26