Single Cycle Processor Design using Verilog

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.
Pipeline Example: cycle 1 lw R10,9(R1) sub R11,R2, R3 and R12,R4, R5 or R13,R6, R7.
Microprocessor Design Multi-cycle Datapath Nia S. Bradley Vijay.
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.
The Processor: Datapath & Control
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.
CMPUT Computer Organization and Architecture II1 CMPUT329 - Fall 2003 TopicH: Building a Data Path and a Control Path for a Microprocessor José Nelson.
2-to-1 Multiplexer: if Statement Discussion D7.1 Example 4.
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:
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.
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.
1 MIPS VHDL Overview Reference: VHDL Tutorial on CDROM, or Accolade Reference Guide Notes: / / pdf / MIPS_vhdl_notes.pdf.
MIPS processor continued. In Class Exercise Question Show the datapath of a processor that supports only R-type and jr reg instructions.
A Simplified MIPS Processor in Verilog
Cpu control.1 2/14 Datapath Components for Lab The Processor! ( th ed)
PC Instruction Memory Address Instr. [31-0] 4 Fig 4.6 p 309 Instruction Fetch.
A Simplified MIPS Processor in Verilog. Data Memory module DM(MemRead, MemWrite, ABUS, DIN, DATABUS); – MemWrite: Nothing happens if 0. If 1, the memory.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 5 Part 2.
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.
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.
1 Chapter 5: Datapath and Control (Part 2) CS 447 Jason Bakos.
Lecture 9. MIPS Processor Design – Single-Cycle Processor Design Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System.
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
Single Cycle CPU - Control
Single Cycle CPU.
CS 230: Computer Organization and Assembly Language
Computer Architecture
Multi-Cycle CPU.
Single Cycle Processor
D.4 Finite State Diagram for the Multi-cycle processor
Multi-Cycle CPU.
Discussion Session Week 10
MIPS processor continued
Designing MIPS Processor (Single-Cycle) Presentation G
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.
A Simplified MIPS Processor in Verilog
CS/COE0447 Computer Organization & Assembly Language
CSCI206 - Computer Organization & Programming
CSCI206 - Computer Organization & Programming
CS/COE0447 Computer Organization & Assembly Language
CS/COE0447 Computer Organization & Assembly Language
Levels in Processor Design
The Processor Lecture 3.3: Single-cycle Implementation
The Processor Lecture 3.2: Building a Datapath with Control
Vishwani D. Agrawal James J. Danaher Professor
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)
5.5 A Multicycle Implementation
MIPS processor continued
Control Unit (single cycle implementation)
The Processor: Datapath & Control.
COMS 361 Computer Organization
Processor: Datapath and Control
CS/COE0447 Computer Organization & Assembly Language
Presentation transcript:

Single Cycle Processor Design using Verilog

module processor(Clock, Reset); input Clock, Reset; wire [31:0] PC_out, PC_In; //from pc wire [31:0] Instruction; //from instruction memory wire [31:0] IncPC; //from adder incrementing pc // from control unit wire RegDst, RegWrite, ALUSrc, MemRead, MemWrite, MemToReg, Branch, Jump; wire [1:0] ALUOp; //from control wire [4:0] WriteAddr, JumpAddr; //from mux_reg wire [31:0] ReadData1, ReadData2; //from register wire [31:0] Out_signExtend; //from sign extension wire [31:0] In_B, In_shift, ShiftWire; //from alu muxs wire [3:0] In_Control; //from ALU control wire ShiftFunc, JR; wire [31:0] ALU_out; //from alu wire Zero, BranchType; //from alu wire [31:0] MemData; //from memory access wire [31:0] WriteData, JumpData; //from memory access mux wire [31:0] BranchAddress; //from branch adder wire [31:0] PC_Jump, JumpAddress, JumpAddress2; //from jump mux

PC PC_module(PC_out, PC_In, Clock, Reset); instructionMemory ins(Instruction, PC_out); adder_32bit increment_PC(IncPC, , , PC_out, 32'd4, 1'b0); controlUnit MainControl(ALUOp, RegDst, RegWrite, ALUSrc, MemRead, MemWrite, MemToReg, Branch, Jump, Instruction[31:26]); mux_2_1_5b mux_reg(JumpAddr, Instruction[20:16], Instruction[15:11], RegDst);

module PC(Out, In, Clock, Reset); output[31:0] Out; input [31:0] In; input Clock, Reset; reg [31:0] Out; initial begin Out = 32'd0; end always@(posedge Clock or posedge Reset) begin if(Reset == 1'b1) Out <= 32'd0; else Out <= In; endmodule

module instructionMemory(ReadData, Address); output[31:0] ReadData; input [31:0] Address; reg [7:0] memory[512:0]; //512 locations of byte size memory reg [31:0] ReadData; //initialize memory (program in a sense) initial begin memory[0] <= 8'b00100100; //addiu $1, $0, 10 memory[1] <= 8'b00000001; memory[2] <= 8'b00000000; memory[3] <= 8'b00001010; memory[4] <= 8'b00100100; //addiu $1, $0, 15 memory[5] <= 8'b00000010; memory[6] <= 8'b00000000; memory[7] <= 8'b00001111; memory[8] <= 8'b00000000; //subu $3, $2, $1 memory[9] <= 8'b01000001; memory[10] <= 8'b00011000; memory[11] <= 8'b00100011;

.. …. .. . ……………// all instructions need to be examined memory[500] <= 8'b00000011; //jr $31 memory[501] <= 8'b11100000; memory[502] <= 8'b11111000; memory[503] <= 8'b00001000; ReadData <= {memory[0], memory[1], memory[2], memory[3]}; end //read and write memory always @ (Address) begin ReadData = {memory[Address], memory[Address+1], memory[Address+2], memory[Address+3]}; endmodule

module adder_32bit (Sum, C_out, overflow, A, B, Mode); output [31:0] Sum; output C_out, overflow; input [31:0] A, B; input Mode; wire [31:0] Sum; wire C_out;

module controlUnit (ALUOp, RegDst, RegWrite, ALUSrc, MemRead, MemWrite, MemToReg, Branch, Jump, Instruction); input [5:0] Instruction; output [1:0] ALUOp; output RegDst, RegWrite, ALUSrc, MemRead, MemWrite, MemToReg, Branch, Jump; reg [1:0] ALUOp; reg RegDst, RegWrite, ALUSrc, MemRead, MemWrite, MemToReg, Branch, Jump; always@(Instruction) begin case(Instruction) 6'd0: begin //addu, subu, mult, div, and, or, xor, sll, sra, srl, slt, sltu, jr RegDst <= 1'b1; RegWrite <= 1'b1; ALUSrc <= 1'b0; MemRead <= 1'b0; MemWrite <= 1'b0; MemToReg <= 1'b0; Branch <= 1'b0; Jump <= 1'b0; ALUOp <= 2'b10; end

module mux_2_1_5b (Out, In0, In1, sel); output [4:0] Out; input [4:0] In0, In1; input sel; wire [4:0] Out; assign Out[0] = ~sel&In0[0] | sel&In1[0]; assign Out[1] = ~sel&In0[1] | sel&In1[1]; assign Out[2] = ~sel&In0[2] | sel&In1[2]; assign Out[3] = ~sel&In0[3] | sel&In1[3]; assign Out[4] = ~sel&In0[4] | sel&In1[4]; endmodule