Mini-MIPS From Weste/Harris CMOS VLSI Design. CS/EE 3710 Based on MIPS  In fact, it’s based on the multi-cycle MIPS from Patterson and Hennessy Your.

Slides:



Advertisements
Similar presentations
CS/COE1541: Introduction to Computer Architecture Datapath and Control Review Sangyeun Cho Computer Science Department University of Pittsburgh.
Advertisements

Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Lecture 13 - A Verilog.
COMP541 Datapath & Single-Cycle MIPS
Microprocessor Design Multi-cycle Datapath Nia S. Bradley Vijay.
1 Chapter Five The Processor: Datapath and Control.
Chapter 5 The Processor: Datapath and Control Basic MIPS Architecture Homework 2 due October 28 th. Project Designs due October 28 th. Project Reports.
CMPUT Computer Organization and Architecture II1 CMPUT329 - Fall 2003 TopicI: Building a Multicycle Data Path and a Control Path for a Microprocessor.
Preparation for Midterm Binary Data Storage (integer, char, float pt) and Operations, Logic, Flip Flops, Switch Debouncing, Timing, Synchronous / Asynchronous.
ENEE350 Ankur Srivastava University of Maryland, College Park Based on Slides from Mary Jane Irwin ( )
331 W10.1Spring :332:331 Computer Architecture and Assembly Language Spring 2005 Week 10 Building a Multi-Cycle Datapath [Adapted from Dave Patterson’s.
CSE431 L05 Basic MIPS Architecture.1Irwin, PSU, 2005 CSE 431 Computer Architecture Fall 2005 Lecture 05: Basic MIPS Architecture Review Mary Jane Irwin.
Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
CMPE 421 Advanced Computer Architecture Supplementary material for Pipelining PART1.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Multi-Cycle Processor.
1 Computer Organization & Design Microcode for Control Sec. 5.7 (CDROM) Appendix C (CDROM) / / pdf / lec_3a_notes.pdf.
CPE232 Basic MIPS Architecture1 Computer Organization Multi-cycle Approach Dr. Iyad Jafar Adapted from Dr. Gheith Abandah slides
COMP541 Datapaths II & Single-Cycle MIPS
Let’s look at a normal lw instruction first… 1. 2 Register file addresscontent 6 (00110) (00111) OpcodeSource register Destination register.
C HAPTER 5 T HE PROCESSOR : D ATAPATH AND C ONTROL M ULTICYCLE D ESIGN.
Team DataPath Research Computer Architechture. PC and IF in the Processor.
1 COMP541 Datapaths II & Control I Montek Singh Mar 22, 2010.
Another Example: MIPS From the Harris/Weste book Based on the MIPS-like processor from the Hennessy/Patterson book.
1 Processor: Datapath and Control Single cycle processor –Datapath and Control Multicycle processor –Datapath and Control Microprogramming –Vertical and.
A Simplified MIPS Processor in Verilog
Multicycle Implementation
LECTURE 6 Multi-Cycle Datapath and Control. SINGLE-CYCLE IMPLEMENTATION As we’ve seen, single-cycle implementation, although easy to implement, could.
ECE-C355 Computer Structures Winter 2008 The MIPS Datapath Slides have been adapted from Prof. Mary Jane Irwin ( )
Datapath and Control AddressInstruction Memory Write Data Reg Addr Register File ALU Data Memory Address Write Data Read Data PC Read Data Read Data.
Fall 2015, Sep ELEC / Lecture 5 1 ELEC / Computer Architecture and Design Fall 2015 Datapath and Control (Chapter.
Datapath and Control AddressInstruction Memory Write Data Reg Addr Register File ALU Data Memory Address Write Data Read Data PC Read Data Read Data.
A Simplified MIPS Processor in Verilog. Data Memory module DM(MemRead, MemWrite, ABUS, DIN, DATABUS); – MemWrite: Nothing happens if 0. If 1, the memory.
Datapath and Control AddressInstruction Memory Write Data Reg Addr Register File ALU Data Memory Address Write Data Read Data PC Read Data Read Data.
RegDst 1: RegFile destination No. for the WR Reg. comes from rd field. 0: RegFile destination No. for the WR Reg. comes from rt field.
Adapted from Computer Organization and Design, Patterson & Hennessy, UCB ECE232: Hardware Organization and Design Part 10: Control Design
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
Design a MIPS Processor (II)
Multi-Cycle Datapath and Control
CS161 – Design and Architecture of Computer Systems
Chapter 5: A Multi-Cycle CPU.
IT 251 Computer Organization and Architecture
/ Computer Architecture and Design
ECE/CS 552: Multicycle Data Path
Systems Architecture I
Multi-Cycle CPU.
Extensions to the Multicycle CPU
Single Cycle Processor
D.4 Finite State Diagram for the Multi-cycle processor
Multi-Cycle CPU.
Basic MIPS Architecture
CS/COE0447 Computer Organization & Assembly Language
Multiple Cycle Implementation of MIPS-Lite CPU
MIPS Datapath Fig 5.28, p323 Implement all of datapath except memory.
A Simplified MIPS Processor in Verilog
CS/COE0447 Computer Organization & Assembly Language
Systems Architecture I
Vishwani D. Agrawal James J. Danaher Professor
Lecture 9. MIPS Processor Design – Decoding and Execution
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Processor: Multi-Cycle Datapath & Control
Multi-Cycle Datapath Lecture notes from MKP, H. H. Lee and S. Yalamanchili.
Chapter Four The Processor: Datapath and Control
Control Unit for Multiple Cycle Implementation
5.5 A Multicycle Implementation
Processor Design Datapath and Design.
Systems Architecture I
Control Unit for Multiple Cycle Implementation
FloorPlan for Multicycle MIPS
The Processor: Datapath & Control.
Processor: Datapath and Control
CS/COE0447 Computer Organization & Assembly Language
Presentation transcript:

Mini-MIPS From Weste/Harris CMOS VLSI Design

CS/EE 3710 Based on MIPS  In fact, it’s based on the multi-cycle MIPS from Patterson and Hennessy Your CS/EE 3810 book...  8-bit version 8-bit data and address 32-bit instruction format 8 registers numbered $0-$7 $0 is hardwired to the value 0

CS/EE 3710 Instruction Set

CS/EE 3710 Instruction Encoding

CS/EE 3710 Fibonacci C-Code

CS/EE 3710 Fibonacci C-Code Cycle 1: f1 = 1 + (-1) = 0, f2 = 0 – (-1) = 1 Cycle 2: f1 = = 1, f2 = 1 – 1 = 0 Cycle 3: f1 = = 1, f2 = 1 – 0 = 1 Cycle 4: f1 = = 2, f2 = 2 – 1 = 1 Cycle 5: f1 = = 3, f2 = 3 – 1 = 2 Cycle 6: f1 = = 5, f2 = 5 – 2 = 3

CS/EE 3710 Fibonacci Assembly Code Compute 8 th Fibonacci number (8’d13 or 8’h0D) Store that number in memory location 255

CS/EE 3710 Fibonacci Machine Code Assembly Code Machine Code

CS/EE 3710 Architecture

CS/EE 3710 Architecture

CS/EE 3710 Another View

CS/EE 3710 Control FSM

CS/EE 3710 Connection to External Memory

CS/EE 3710 External Memory from Book // external memory accessed by MIPS module exmemory #(parameter WIDTH = 8) (input clk, input memwrite, input [WIDTH-1:0] adr, writedata, output reg [WIDTH-1:0] memdata); reg [31:0] RAM [(1<<WIDTH-2)-1:0]; wire [31:0] word; // Initialize memory with program initial $readmemh("memfile.dat",RAM); // read and write bytes from 32-bit word clk) if(memwrite) case (adr[1:0]) 2'b00: RAM[adr>>2][7:0] <= writedata; 2'b01: RAM[adr>>2][15:8] <= writedata; 2'b10: RAM[adr>>2][23:16] <= writedata; 2'b11: RAM[adr>>2][31:24] <= writedata; endcase assign word = RAM[adr>>2]; case (adr[1:0]) 2'b00: memdata <= word[7:0]; 2'b01: memdata <= word[15:8]; 2'b10: memdata <= word[23:16]; 2'b11: memdata <= word[31:24]; endcase endmodule Notes: Endianess is fixed here Writes are on posedge clk Reads are asynchronous This is a 32-bit wide RAM With 64 locations But with an 8-bit interface...

CS/EE 3710 Exmem.v module exmem #(parameter WIDTH = 8, RAM_ADDR_BITS = 8) (input clk, en, input memwrite, input [RAM_ADDR_BITS-1:0] adr, input [WIDTH-1:0] writedata, output reg [WIDTH-1:0] memdata); reg [WIDTH-1:0] mips_ram [(2**RAM_ADDR_BITS)-1:0]; initial $readmemb("fib.dat", mips_ram); clk) if (en) begin if (memwrite) mips_ram[adr] <= writedata; memdata <= mips_ram[adr]; end endmodule This is synthesized to a Block RAM on the Spartan3e FPGA It’s 8-bits wide With 256 locations Both writes and reads are clocked

CS/EE 3710 Exmem.v module exmem #(parameter WIDTH = 8, RAM_ADDR_BITS = 8) (input clk, en, input memwrite, input [RAM_ADDR_BITS-1:0] adr, input [WIDTH-1:0] writedata, output reg [WIDTH-1:0] memdata); reg [WIDTH-1:0] mips_ram [(2**RAM_ADDR_BITS)-1:0]; initial $readmemb("fib.dat", mips_ram); clk) if (en) begin if (memwrite) mips_ram[adr] <= writedata; memdata <= mips_ram[adr]; end endmodule This is synthesized to a Block RAM on the Spartan3e FPGA Note clock!

CS/EE 3710 Block RAM Byte-wide Block RAM is really 9-bits – parity bit... (Actually dual ported too!)

CS/EE 3710 Our Block Ram  Read-first or Write-first? clk) if (en) begin if (memwrite) mips_ram[adr] <= writedata; memdata <= mips_ram[adr]; end

CS/EE 3710 Read_First Template

CS/EE 3710 Write_First Template

CS/EE 3710 Read_First waveforms

CS/EE 3710 Write_First Waveforms

CS/EE 3710 Block RAM Organization Each block is 18k bits... Block RAM is Single or Dual ported

CS/EE 3710 Recall – Overall System Clock Clk

CS/EE 3710 Recall – Overall System Clock Clk So, what are the implications of using a RAM that has both clocked reads and writes instead of clocked writes and async reads? (we’ll come back to this question...)

CS/EE 3710 mips Block Diagram

CS/EE 3710 mips.v // simplified MIPS processor module mips #(parameter WIDTH = 8, REGBITS = 3) (input clk, reset, input [WIDTH-1:0] memdata, output memread, memwrite, output [WIDTH-1:0] adr, writedata); wire [31:0] instr; wire zero, alusrca, memtoreg, iord, pcen, regwrite, regdst; wire [1:0] aluop,pcsource,alusrcb; wire [3:0] irwrite; wire [2:0] alucont; controller cont(clk, reset, instr[31:26], zero, memread, memwrite, alusrca, memtoreg, iord, pcen, regwrite, regdst, pcsource, alusrcb, aluop, irwrite); alucontrol ac(aluop, instr[5:0], alucont); datapath #(WIDTH, REGBITS) dp(clk, reset, memdata, alusrca, memtoreg, iord, pcen, regwrite, regdst, pcsource, alusrcb, irwrite, alucont, zero, instr, adr, writedata); endmodule

CS/EE 3710 Controller State Codes Useful constants to compare against State Register

CS/EE 3710 Control FSM

CS/EE 3710 Next State Logic

CS/EE 3710 Output Logic Continued for the other states... Very common way to deal with default values in combinational Always blocks

CS/EE 3710 Output Logic Why AND these two? Two places to update the PC pcwrite on jump pcwritecond on BEQ

CS/EE 3710 ALU Control

CS/EE 3710 ALU Invert b if subtract... add is a + b sub is a + ~b +1 subtract on slt then check if answer is negative

CS/EE 3710 zerodetect

CS/EE 3710 Register File What is this synthesized into?

CS/EE 3710 Synthesis Report

CS/EE 3710 Synthesis Report

CS/EE 3710 Synthesis Report Two register files? Why?

CS/EE 3710 Datapath Fairly complex... Not really, but it does have lots of registers instantiated directly It also instantiates muxes... Instruction Register

CS/EE 3710 Datapath continued Flops and muxes... RF and ALU

CS/EE 3710 Flops and MUXes

CS/EE 3710 Back to the Memory Question  What are the implications of using RAM that is clocked on both write and read? Book version was async read So, let’s look at the sequence of events that happen to read the instruction Four steps – read four bytes and put them in four slots in the 32-bit instruction register (IR)

CS/EE 3710 Instruction Fetch

CS/EE 3710 Instruction Fetch

CS/EE 3710 Instruction Fetch Memread, irwrite, addr, etc are set up just after clk edge Data comes back sometime after that (async) Data is captured in ir0 – ir3 on the next rising clk edge How does this change if reads are clocked?

CS/EE 3710 mips + exmem One of those rare cases where using both edges of the clock is useful! mips is expecting async readsexmem has clocked reads

CS/EE 3710 Memory Mapped I/O  Break memory space into pieces (ranges) For some of those pieces: regular memory For some of those pieces: I/O That is, reading from an address in that range results in getting data from an I/O device Writing to an address in that range results in data going to an I/O device

CS/EE 3710 Mini-MIPS Memory Map I/O Switches/LEDs Code/Data 00 3F 40 7F 80 BF C0 FF 64 bytes Top two address bits define regions 8-bit addresses 256 bytes total!

CS/EE 3710 Enabled Devices Only write to that device (i.e. enable it) if you’re in the appropriate memory range. Check top two address bits!

CS/EE 3710 MUXes for Return Data Use MUX to decide if data is coming from memory or from I/O Check address bits!

CS/EE 3710 Lab2 in a Nutshell  Understand and simulate mips/exmem Add ADDI instruction Fibonacci program – correct if 8’0d is written to memory location 255  Augment the system Add memory mapped I/O to switches/LEDs Write new Fibonacci program Simulate in ISE Demonstrate on your board

CS/EE 3710 My Initial Testbench...

CS/EE 3710 My Initial Results