1 MIPS VHDL Overview Reference: VHDL Tutorial on CDROM, or Accolade Reference Guide Notes: / 3055-05 / pdf / MIPS_vhdl_notes.pdf.

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.
EECE476 Lecture 7: Single-Cycle CPU Instruction Processing & Control Chapter 5, Sections 5.3, 5.4 The University of British ColumbiaEECE 476© 2005 Guy.
1 VLSI DESIGN USING VHDL Part II A workshop by Dr. Junaid Ahmed Zubairi.
Processor II CPSC 321 Andreas Klappenecker. Midterm 1 Tuesday, October 5 Thursday, October 7 Advantage: less material Disadvantage: less preparation time.
©UCB CS 162 Computer Architecture Lecture 3: Pipelining Contd. Instructor: L.N. Bhuyan
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.
The Datapath Andreas Klappenecker CPSC321 Computer Architecture.
©UCB CS 161Computer Architecture Chapter 5 Instructor: L.N. Bhuyan LECTURE 10.
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.
Single Cycle Datapath Lecture notes from MKP, H. H. Lee and S. Yalamanchili.
1 Datapath and Control CDA 3101 Discussion Section10.
Processor: Datapath and Control
VHDL for Combinational Circuits. VHDL We Know Simple assignment statements –f
Gary MarsdenSlide 1University of Cape Town Chapter 5 - The Processor  Machine Performance factors –Instruction Count, Clock cycle time, Clock cycles per.
Topic 3: VHDL José Nelson Amaral Paul Berube Paras Mehta
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.
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
Single Cycle Datapath Lecture notes from MKP, H. H. Lee and S. Yalamanchili.
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.
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.
July 2, 2001Systems Architecture I1 Systems Architecture II (CS 282) Lab 3: State Elements, Registers, and Memory * Jeremy R. Johnson Monday July 2, 2001.
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.
1 Chapter 5: Datapath and Control (Part 2) CS 447 Jason Bakos.
Lecture 5. MIPS Processor Design
Computer Architecture Lecture 6.  Our implementation of the MIPS is simplified memory-reference instructions: lw, sw arithmetic-logical instructions:
Access the Instruction from Memory
Single Cycle CPU - Control
Combinational logic circuit
Single Cycle Datapath Lecture notes from MKP, H. H. Lee and S. Yalamanchili.
Computer Architecture
Multi-Cycle CPU.
Discussion Session Week 10
MIPS processor continued
Review: MIPS Pipeline Data and Control Paths
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
CS/COE0447 Computer Organization & Assembly Language
CSCI206 - Computer Organization & Programming
CS/COE0447 Computer Organization & Assembly Language
CS/COE0447 Computer Organization & Assembly Language
Systems Architecture II
Levels in Processor Design
CSE378 Midterm Review Moore’s Law -- What are the two versions?
Composing the Elements
Composing the Elements
Lecture 9. MIPS Processor Design – Decoding and Execution
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Single Cycle Datapath Lecture notes from MKP, H. H. Lee and S. Yalamanchili.
MIPS processor continued
CS/COE0447 Computer Organization & Assembly Language
Control Unit (single cycle implementation)
The Processor: Datapath & Control.
Processor: Datapath and Control
CS/COE0447 Computer Organization & Assembly Language
Presentation transcript:

1 MIPS VHDL Overview Reference: VHDL Tutorial on CDROM, or Accolade Reference Guide Notes: / / pdf / MIPS_vhdl_notes.pdf

2 Single-Cycle MIPS Model (Patterson & Hennessy fig. 5.39)

3 MIPS (after chnges to make it pipelining)

4 MIPS modules for Lab-3 IFE EXE CTL IDE MEM

5 Top Level - MIPS.vhl - includes "control" Ports and Connections to other modules (1 of 2) ARCHITECTURE structure OF MIPS IS COMPONENT control PORT( Opcode : IN STD_LOGIC_VECTOR( 5 DOWNTO 0 ); RegDst : OUT STD_LOGIC; ALUSrc : OUT STD_LOGIC; MemtoReg : OUT STD_LOGIC; RegWrite : OUT STD_LOGIC; MemRead : OUT STD_LOGIC; MemWrite : OUT STD_LOGIC; Branch : OUT STD_LOGIC; ALUop : OUT STD_LOGIC_VECTOR( 1 DOWNTO 0 ); clock, reset: IN STD_LOGIC ); END COMPONENT;

6 Top Level - MIPS.vhl - includes "control" (2 of 2) SIGNAL ALUSrc : STD_LOGIC; SIGNAL Branch : STD_LOGIC; SIGNAL RegDst : STD_LOGIC; SIGNAL Regwrite : STD_LOGIC; SIGNAL MemWrite : STD_LOGIC; SIGNAL MemtoReg : STD_LOGIC; SIGNAL MemRead : STD_LOGIC; SIGNAL ALUop : STD_LOGIC_VECTOR( 1 DOWNTO 0 ); SIGNAL Instruction: STD_LOGIC_VECTOR( 31 DOWNTO 0 ); COMPONENT control PORT MAP ( Opcode => Instruction( 31 DOWNTO 26 ), RegDst => RegDst, ALUSrc => ALUSrc, MemtoReg => MemtoReg, RegWrite => RegWrite, MemRead => MemRead, MemWrite => MemWrite, Branch => Branch, ALUop => ALUop, clock => clock, reset => reset ); END control ; BLUE - Output Port of "control," RED - Input Port of "control," GREEN - Internal Note: Input Ports and Output Ports are mapped to Internal Signals.

7 -- control module (implements MIPS control unit) LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_SIGNED.ALL; ENTITY control IS PORT( SIGNAL Opcode : IN STD_LOGIC_VECTOR( 5 DOWNTO 0 ); SIGNAL RegDst : OUT STD_LOGIC; SIGNAL ALUSrc : OUT STD_LOGIC; SIGNAL MemtoReg : OUT STD_LOGIC; SIGNAL RegWrite : OUT STD_LOGIC; SIGNAL MemRead : OUT STD_LOGIC; SIGNAL MemWrite : OUT STD_LOGIC; SIGNAL Branch : OUT STD_LOGIC; SIGNAL ALUop : OUT STD_LOGIC_VECTOR( 1 DOWNTO 0 ); SIGNAL clock, reset: IN STD_LOGIC ); END control ; - - These parameters must match the list in MIPS.vhd in order and type. Matching names as well avoids confusion. "control" module - defined in control.vhd (1 of 2)

8 MIPS "control" module - (2 of 2) ARCHITECTURE behavior OF control IS SIGNAL R_format, Lw, Sw, Beq : STD_LOGIC; -- Internal "Wires" BEGIN -- Code to generate (internal) control signals using opcode bits R_format <= '1' WHEN Opcode = "000000" ELSE '0'; Lw <= '1' WHEN Opcode = "100011" ELSE '0'; Sw <= '1' WHEN Opcode = "101011" ELSE '0'; Beq <= '1' WHEN Opcode = "000100" ELSE '0'; RegDst <= R_format; - - define Output Port values ALUSrc <= Lw OR Sw; - - note use of logic "OR" MemtoReg <= Lw; RegWrite <= R_format OR Lw; MemRead <= Lw; MemWrite <= Sw; Branch <= Beq; ALUOp( 1 ) <= R_format; ALUOp( 0 ) <= Beq; END behavior; BLUE - Output Port of "control," RED - Input Port of "control," GREEN - Internal

9 "idecode" module - external Ports (1 of 4) - - Idecode module (implements the register file for LIBRARY IEEE; - - the MIPS computer) USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY Idecode IS - - define external port names PORT(read_data_1: OUT STD_LOGIC_VECTOR( 31 DOWNTO 0 ); read_data_2: OUT STD_LOGIC_VECTOR( 31 DOWNTO 0 ); Instruction : IN STD_LOGIC_VECTOR( 31 DOWNTO 0 ) read_data : IN STD_LOGIC_VECTOR( 31 DOWNTO 0 ); ALU_result: IN STD_LOGIC_VECTOR( 31 DOWNTO 0 ); RegWrite : IN STD_LOGIC; MemtoReg : IN STD_LOGIC; RegDst : IN STD_LOGIC; Sign_extend : OUT STD_LOGIC_VECTOR( 31 DOWNTO 0 ); clock,reset: IN STD_LOGIC ); END Idecode;

10 "idecode" module - internal Signals (2 of 4) ARCHITECTURE behavior OF Idecode IS TYPE register_file IS ARRAY ( 0 TO 31 ) OF STD_LOGIC_VECTOR( 31 DOWNTO 0 ); - - "register_file" is an array of 32-bit logic vectors (e.g., 32-bit words) SIGNAL register_array: register_file ; SIGNAL write_register_address : STD_LOGIC_VECTOR( 4 DOWNTO 0 ); SIGNAL write_data: STD_LOGIC_VECTOR( 31 DOWNTO 0 ); SIGNAL read_register_1_address: STD_LOGIC_VECTOR( 4 DOWNTO 0 ); SIGNAL read_register_2_address: STD_LOGIC_VECTOR( 4 DOWNTO 0 ); SIGNAL write_register_address_1: STD_LOGIC_VECTOR( 4 DOWNTO 0 ); SIGNAL write_register_address_0: STD_LOGIC_VECTOR( 4 DOWNTO 0 ); SIGNAL Instruction_immediate_value: STD_LOGIC_VECTOR( 15 DOWNTO 0 );

11 "idecode" module - operation 1 (3 of 4) BEGIN read_register_1_address <= Instruction( 25 DOWNTO 21 ); read_register_2_address <= Instruction( 20 DOWNTO 16 ); write_register_address_1<= Instruction( 15 DOWNTO 11 ); - - for Reg-Reg operations write_register_address_0 <= Instruction( 20 DOWNTO 16 ); - - for other operations (no read_2) Instruction_immediate_value <= Instruction( 15 DOWNTO 0 ); read_data_1 <= register_array( CONV_INTEGER( read_register_1_address ) ); - - Read Reg1 read_data_2 <= register_array( CONV_INTEGER( read_register_2_address ) ); - - Read Reg2 write_register_address <= write_register_address_1 - - Mux for Register Write Address WHEN RegDst = '1' ELSE write_register_address_0 ; - - weird syntax for: if(...)... else... ; - - Mux to bypass data memory for Rformat instructions write_data <= ALU_result( 31 DOWNTO 0 ) WHEN ( MemtoReg = '0' ) ELSE read_data ; Sign_extend <= X"0000" & Instruction_immediate_value - - Sign Extend 16-bits to 32-bits WHEN Instruction_immediate_value(15) = '0' - - depends on left-most bit ELSEX"FFFF" & Instruction_immediate_value; - - "&" means append, not AND library function, CONV_INTEGER("0101") = 5

12 "idecode" module - operation 2 (4 of 4) PROCESS - - this is "clocked logic", last page was BEGIN - - "combinatorial" (delays could be specified) WAIT UNTIL clock'EVENT AND clock = '1'; - - EVENT implies clock changed value IF reset = '1' THEN - - this case is for positive edge - - Initial register values on reset are register = reg# - - use loop to automatically generate reset logic - - for all registers FOR i IN 0 TO 31 LOOP register_array(i) <= CONV_STD_LOGIC_VECTOR( i, 32 ); END LOOP; - - Write back to register - don't write to register 0 ELSIF RegWrite = '1' AND write_register_address /= 0 THEN - - "/=" is not-equal register_array( CONV_INTEGER( write_register_address)) <= write_data; END IF; - - no change in register_array() unless one of two conditions satisfied END PROCESS; END behavior;

13 MIPS modules for Lab-3 and labeling delayed signals IDE RegWrite d_RegWrite ddd_RegWrite dd_RegWrite RegWrite MEM IFE EXE MemtoReg CTL ** * Change clock phase for “Data Memory” and Reg-Set “Write_Data” (write on negative edge). RegDst RegDst, no delay ALUresult_d ALU Result _dd

14 MIPS modules for Lab-4, Data Forwarding IDE RegWrite d_RegWrite ddd_RegWrite dd_RegWrite RegWrite MEM IFE EXE MemtoReg CTL ** * Change clock phase for “Data Memory” and Reg-Set “Write_Data” (write on negative edge). RegDst d_ALUresult dd_ALU Result Move RegWrite to IDE d_WriteReg WriteReg dd_ WriteReg A B A A B B X X X X X X X X ALUSrc Data Forward Control X Inputs to Data- Forward Control 0 1

15 MIPS modules for Lab-5, Branch Handling IDE MEM IFE EXE CTL * * * Change clock phase for “Data Memory” (pos.) and Register Set “Write_Data” (write on negative edge). RegDst A B A A B B X X X X X X X Data Forward Control X Inputs to Data- Forward Control = Zero Beq Branch 0 IDE MUXMUX IFE