A Simplified MIPS Processor in Verilog. Data Memory module DM(MemRead, MemWrite, ABUS, DIN, DATABUS); – MemWrite: Nothing happens if 0. If 1, the memory.

Slides:



Advertisements
Similar presentations
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Lecture 13 - A Verilog.
Advertisements

Pipeline Example: cycle 1 lw R10,9(R1) sub R11,R2, R3 and R12,R4, R5 or R13,R6, R7.
COMP541 Datapath & Single-Cycle MIPS
The Processor: Datapath & Control
331 W9.1Spring :332:331 Computer Architecture and Assembly Language Spring 2006 Week 9 Building a Single-Cycle Datapath [Adapted from Dave Patterson’s.
Levels in Processor Design
CMPUT Computer Organization and Architecture II1 CMPUT229 - Fall 2003 TopicE: Building a Data Path and a Control Path for a Microprocessor José Nelson.
331 Lec 14.1Fall 2002 Review: Abstract Implementation View  Split memory (Harvard) model - single cycle operation  Simplified to contain only the instructions:
Computer Structure - Datapath and Control Goal: Design a Datapath  We will design the datapath of a processor that includes a subset of the MIPS instruction.
CMPUT Computer Organization and Architecture II1 CMPUT329 - Fall 2003 TopicH: Building a Data Path and a Control Path for a Microprocessor José Nelson.
Copyright 1998 Morgan Kaufmann Publishers, Inc. All rights reserved. Digital Architectures1 Machine instructions execution steps (1) FETCH = Read the instruction.
The Processor: Datapath & Control. Implementing Instructions Simplified instruction set memory-reference instructions: lw, sw arithmetic-logical instructions:
Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
Supplementary notes for pipelining LW ____,____ SUB ____,____,____ BEQ ____,____,____ ; assume that, condition for branch is not satisfied OR ____,____,____.
COSC 3430 L08 Basic MIPS Architecture.1 COSC 3430 Computer Architecture Lecture 08 Processors Single cycle Datapath PH 3: Sections
A full die photograph of the MIPS R2000 RISC Microprocessor is shown above. The 1986 MIPS R2000 with five pipeline stages and 450,000 transistors was the.
Processor: Datapath and Control
COMP541 Datapaths II & Single-Cycle MIPS
Computer Architecture and Design – ECEN 350 Part 6 [Some slides adapted from A. Sprintson, M. Irwin, D. Paterson and others]
1 A single-cycle MIPS processor  An instruction set architecture is an interface that defines the hardware operations which are available to software.
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.
MIPS processor continued. In Class Exercise Question Show the datapath of a processor that supports only R-type and jr reg instructions.
December 26, 2015©2003 Craig Zilles (derived from slides by Howard Huang) 1 A single-cycle MIPS processor  As previously discussed, an instruction set.
A Simplified MIPS Processor in Verilog
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Single-Cycle Datapath and Control.
PC Instruction Memory Address Instr. [31-0] 4 Fig 4.6 p 309 Instruction Fetch.
February 22, 2016©2003 Craig Zilles (derived from slides by Howard Huang) 1 A single-cycle MIPS processor  As previously discussed, an instruction set.
MIPS processor continued
Datapath and Control AddressInstruction Memory Write Data Reg Addr Register File ALU Data Memory Address Write Data Read Data PC Read Data Read Data.
COM181 Computer Hardware Lecture 6: The MIPs CPU.
Single Cycle Processor Design using Verilog
1 Chapter 5: Datapath and Control (Part 2) CS 447 Jason Bakos.
MIPS Processor.
Lecture 9. MIPS Processor Design – Single-Cycle Processor Design Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System.
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
Lecture 5. MIPS Processor Design
Computer Architecture Lecture 6.  Our implementation of the MIPS is simplified memory-reference instructions: lw, sw arithmetic-logical instructions:
Single-cycle CPU Control
Access the Instruction from Memory
EE204 Computer Architecture
Single Cycle CPU - Control
Single-Cycle Datapath and Control
Computer Architecture
Single Cycle Processor
D.4 Finite State Diagram for the Multi-cycle processor
MIPS Processor.
MIPS processor continued
A Simplified MIPS Processor in Verilog
CSCI206 - Computer Organization & Programming
Single-Cycle CPU DataPath.
CS/COE0447 Computer Organization & Assembly Language
CSCI206 - Computer Organization & Programming
MIPS Processor.
Verilog.
Levels in Processor Design
The Processor Lecture 3.3: Single-cycle Implementation
The Processor Lecture 3.2: Building a Datapath with Control
Lecture 9. MIPS Processor Design – Decoding and Execution
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Control Unit (single cycle implementation)
Foundations for Datapath Design
MIPS processor continued
CS/COE0447 Computer Organization & Assembly Language
Control Unit (single cycle implementation)
The Processor: Datapath & Control.
COMS 361 Computer Organization
MIPS Processor.
Processor: Datapath and Control
Presentation transcript:

A Simplified MIPS Processor in Verilog

Data Memory module DM(MemRead, MemWrite, ABUS, DIN, DATABUS); – MemWrite: Nothing happens if 0. If 1, the memory at location ABUS will be written with DIN. – ABUS: At any moment, the data at location ABUS will appear at DATABUS. – MemRead: Not used.

Data Memory Address bus: 8 bits. Data bus: 32 bits. Each memory location holds 32 bits.

Data Memory Init the contents in data memory with any value you like: initial begin for (i=0; i <= DM_ADDR_MAX_m1; i = i + 1) ram[i] = i*10 + 1; end

Instruction Memory module IM(CSB,WRB,ABUS,DATABUS); – CSB: chip select. If 0, selected. If 1, not selected. – WRB: Not used. – ABUS: Address bus. At any moment, if chip is selected, the data at location ABUS will appear at DATABUS.

Instruction Memory Address bus: 8 bits. Data bus: 32 bits. Each memory location holds 32 bits.

Instruction Memory The most straightforward way of loading a program: ram[0] = 32'b ; // addi $0, $0, 0 ram[1] = 32'b ; // addi $1, $1, 1 ram[2] = 32'b ; // addi $2, $2, 2 ram[3] = 32'b ; // addi $3, $3, 3 ram[4] = 32'b ; // nop ram[5] = 32'b ; // nop ram[6] = 32'b ; // nop ram[7] = 32'b ; // nop ram[8] = 32'b ; // nop ram[9] = 32'b ; // nop

Get The Next PC module getNextPC (PCSrc, currPC, offset, out); parameter MIPS_PC_WIDTH_m1 = 7; input PCSrc; input [MIPS_PC_WIDTH_m1:0] offset; input [MIPS_PC_WIDTH_m1:0] currPC; output reg [MIPS_PC_WIDTH_m1:0] out; currPC, offset) if (PCSrc == 0) out <= currPC + 1; else out <= currPC offset; endmodule

PC module MIPSPC(clk, newPC, PC); Just an 8-bit D-flip-flop.

Register File module MIPSREG(clk, RegWrite, ReadAddr1, ReadAddr2, WriteAddr, ReadData1, ReadData2, WriteData); – Just as what specified in the book. – RegWrite: If 0, disabling write. If 1, register WriteAddr register WriteAddr will be overwritten with WriteData. – At any time, ReadData1 is the content of reg ReadAddr1, and ReadData2 is the content of reg ReadAddr2.

ALU module MIPSALU (ALUctl, A, B, ALUOut, Zero); input [3:0] ALUctl; input [31:0] A,B; output reg [31:0] ALUOut; output Zero; assign Zero = (ALUOut==0); //Zero is true if ALUOut is 0; goes anywhere A, B) //reevaluate if these change case (ALUctl) 0: ALUOut <= A & B; 1: ALUOut <= A | B; 2: ALUOut <= A + B; 6: ALUOut <= A - B; 7: ALUOut <= A < B ? 1:0; 12: ALUOut <= ~(A | B); // result is nor default: ALUOut <= 0; //default to 0, should not happen; endcase endmodule

Sign Extension module SignExtend (in, out); input [15:0] in; output [31:0] out; assign out[15:0] = in[15:0]; assign out[31:16] = in[15]; endmodule

Two-to-one Selector module STwoToOne32 (sel, in0, in1, out); input sel; input [31:0] in0, in1; output reg [31:0] out; in0, in1) if (sel == 0) out <= in0; else out <= in1; endmodule

Control module MIPSCtrl (instr, RegDst, ALUSrc, MemToReg, RegWrite, MemWrite, MemRead, branch, ALUCtrl); Take the 32-bit instruction, generate the control signals.

Data Path Setup According to

Supported instructions add, sub, addi, lw, sw, beq.

Stepping through the program The clock is set to be 200 time units. Run 200 every time. Check the values of the wires in the waveform Check the content of the registers and data memories in the memory windows.

The waveform after two instructions ; // addi $0, $0, ; // addi $1, $1, 1

Supporting a new instruction With the current data path, can we support a new instruction? lwr $rs, $rt, $rd What it does is to read from data memory at $rs-$rt, and write it to $rd Suppose its opcode is

Supporting a new instruction else if (instr[31:26] == 6'b000001) //lwr begin RegDst <= 1; ALUSrc <= 0; MemToReg <= 1; RegWrite <= 1; MemRead <= 1; MemWrite <= 0; branch <= 0; ALUCtrl <= 4'b0110; end