LECTURE 8: VHDL PROCESSES

Slides:



Advertisements
Similar presentations
1 Datapath and Control (Multicycle datapath) CDA 3101 Discussion Section 11.
Advertisements

CWRU EECS 317 EECS 317 Computer Design LECTURE 6: State machines Instructor: Francis G. Wolff Case Western Reserve University This.
Microprocessor Design Multi-cycle Datapath Nia S. Bradley Vijay.
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.
CS 161Computer Architecture Chapter 5 Lecture 12
EECE476 Lectures 10: Multi-cycle CPU Control Chapter 5: Section 5.5 The University of British ColumbiaEECE 476© 2005 Guy Lemieux.
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 ( )
Advanced Computer Architecture 5MD00 / 5Z033 MIPS Design data path and control Henk Corporaal TUEindhoven 2007.
331 W10.1Spring :332:331 Computer Architecture and Assembly Language Spring 2005 Week 10 Building a Multi-Cycle Datapath [Adapted from Dave Patterson’s.
Datapath and Control Andreas Klappenecker CPSC321 Computer Architecture.
The Multicycle Processor CPSC 321 Andreas Klappenecker.
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.
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.
CSET 4650 Field Programmable Logic Devices Dan Solarek VHDL Additional Details & Examples.
CWRU EECS 318 EECS 318 CAD Computer Aided Design LECTURE 5: AOIs, WITH-SELECT-WHEN, WHEN-ELSE Instructor: Francis G. Wolff Case Western.
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
Topic 3: VHDL José Nelson Amaral Paul Berube Paras Mehta
C HAPTER 5 T HE PROCESSOR : D ATAPATH AND C ONTROL M ULTICYCLE D ESIGN.
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.
1 Processor: Datapath and Control Single cycle processor –Datapath and Control Multicycle processor –Datapath and Control Microprogramming –Vertical and.
CEC 220 Digital Circuit Design VHDL in Sequential Logic Wednesday, March 25 CEC 220 Digital Circuit Design Slide 1 of 13.
Multicycle Implementation
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.
COM181 Computer Hardware Lecture 6: The MIPs CPU.
CWRU EECS 318 EECS 318 CAD Computer Aided Design LECTURE Simulator 2: Textio, Wait, Clocks, and Test Benches Instructor: Francis G. Wolff
CWRU EECS 318 EECS 318 CAD Computer Aided Design LECTURE 7: Multicycle CPU Instructor: Francis G. Wolff Case Western Reserve University.
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
CWRU EECS 318 EECS 318 CAD Computer Aided Design LECTURE 6: State machines Instructor: Francis G. Wolff Case Western Reserve University.
EECS 322 Test 3 SolutionsWednesday March 22, 2000 Problem 1 (50%): A group of EECS students have decided to compete with Intel Corporation in the microcontroller.
Computer Architecture Lecture 6.  Our implementation of the MIPS is simplified memory-reference instructions: lw, sw arithmetic-logical instructions:
Design a MIPS Processor (II)
Multi-Cycle Datapath and Control
Chapter 5: A Multi-Cycle CPU.
Computer Architecture
IT 251 Computer Organization and Architecture
/ Computer Architecture and Design
ECE/CS 552: Multicycle Data Path
Systems Architecture I
Multi-Cycle CPU.
D.4 Finite State Diagram for the Multi-cycle processor
Multi-Cycle CPU.
Basic MIPS Architecture
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.
Chapter Five The Processor: Datapath and Control
The Multicycle Implementation
Computer Organization Ellen Walker Hiram College
Chapter Five The Processor: Datapath and Control
The Multicycle Implementation
Systems Architecture I
Vishwani D. Agrawal James J. Danaher Professor
Behavioral Modeling of Sequential-Circuit Building Blocks
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Processor: Multi-Cycle Datapath & Control
Figure 8.1. The general form of a sequential circuit.
Single Cycle Datapath Lecture notes from MKP, H. H. Lee and S. Yalamanchili.
Multi-Cycle Datapath Lecture notes from MKP, H. H. Lee and S. Yalamanchili.
Finite State Machine for Control
5.5 A Multicycle Implementation
Processor Design Datapath and Design.
ECE 448 Lecture 6 Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL code ECE 448 – FPGA and ASIC Design.
Systems Architecture I
Sequntial-Circuit Building Blocks
Processor: Datapath and Control
(Sequential-Circuit Building Blocks)
Presentation transcript:

LECTURE 8: VHDL PROCESSES EECS 318 CAD Computer Aided Design LECTURE 8: VHDL PROCESSES Instructor: Francis G. Wolff wolff@eecs.cwru.edu Case Western Reserve University This presentation uses powerpoint animation: please viewshow CWRU EECS 318

2-to-1 Multiplexor: and Datapath multiplexor 1 a b S Y n 1 a b S Y behavioral Datapath is n bits wide WITH s SELECT Y <= a WHEN ‘0’, b WHEN OTHERS; WITH s SELECT Y <= a WHEN ‘0’, b WHEN OTHERS; Where is the difference? CWRU EECS 318

Generic 2-to-1 Datapath Multiplexor Entity 1 a b S Y n LIBRARY IEEE; USE IEEE.std_logic_1164.all; USE IEEE.std_logic_arith.all; ENTITY Generic_Mux IS GENERIC (n: INTEGER); PORT (Y: OUT std_logic_vector(n-1 downto 0); a: IN std_logic_vector(n-1 downto 0); b: IN std_logic_vector(n-1 downto 0); S: IN std_logic_vector(0 downto 0) ); END ENTITY; CWRU EECS 318

Generic 2-to-1 Datapath Multiplexor Architecture ARCHITECTURE Generic_Mux_arch OF Generic_Mux IS BEGIN WITH S SELECT Y <= a WHEN "1", b WHEN OTHERS; END ARCHITECTURE; CONFIGURATION Generic_Mux_cfg OF Generic_Mux IS FOR Generic_Mux_arch END FOR; END CONFIGURATION; Configurations are require for simulation CWRU EECS 318

Structural SR Flip-Flop (Latch) NAND R S Qn+1 0 0 U 0 1 1 1 0 0 1 1 Qn R S Q ENTITY Latch IS PORT(R, S: IN std_logic; Q, NQ: OUT std_logic); END ENTITY; ARCHITECTURE latch_arch OF Latch IS BEGIN Q <= R NAND NQ; NQ <= S NAND Q; END ARCHITECTURE; CWRU EECS 318

Inferring Behavioral Latches: Asynchronous Sensitivity list of signals: Every time a change of state or event occurs on these signals this process will be called NAND R S Qn+1 0 0 U 0 1 1 1 0 0 1 1 Qn R S Q ARCHITECTURE Latch2_arch OF Latch IS BEGIN PROCESS (R, S) BEGIN IF R= ‘0’ THEN Q <= ‘1’; NQ<=‘0’; ELSIF S=‘0’ THEN Q <= ‘0’; NQ<=‘1’; END IF; END PROCESS; END ARCHITECTURE; Sequential Statements CWRU EECS 318

Gated-Clock SR Flip-Flop (Latch Enable) Q LE ARCHITECTURE Latch_arch OF GC_Latch IS BEGIN PROCESS (R, S, LE) BEGIN IF LE=‘1’ THEN IF R= ‘0’ THEN Q <= ‘1’; NQ<=‘0’; ELSIF S=‘0’ THEN Q <= ‘0’; NQ<=‘1’; END IF; END IF; END PROCESS; END ARCHITECTURE; CWRU EECS 318

Inferring D-Flip Flops: Synchronous Notice the Process does not contain D: PROCESS(Clock, D) ARCHITECTURE Dff_arch OF Dff IS BEGIN PROCESS (Clock) BEGIN IF Clock’EVENT AND Clock=‘1’ THEN Q <= D; END IF; END PROCESS; END ARCHITECTURE; Sensitivity lists contain signals used in conditionals (i.e. IF) Clock’EVENT is what distinguishes a D-FlipFlip from a Latch CWRU EECS 318

Inferring D-Flip Flops: rising_edge ARCHITECTURE Dff_arch OF Dff IS BEGIN PROCESS (Clock) BEGIN IF Clock’EVENT AND Clock=‘1’ THEN Q <= D; END IF; END PROCESS; END ARCHITECTURE; Alternate and more readable way is to use the rising_edge function ARCHITECTURE dff_arch OF dff IS BEGIN PROCESS (Clock) BEGIN IF rising_edge(Clock) THEN Q <= D; END IF; END PROCESS; END ARCHITECTURE; CWRU EECS 318

Inferring D-Flip Flops: Asynchronous Reset ARCHITECTURE dff_reset_arch OF dff_reset IS BEGIN PROCESS (Clock, Reset) BEGIN IF Reset= ‘1’ THEN -- Asynchronous Reset Q <= ‘0’ ELSIF rising_edge(Clock) THEN --Synchronous Q <= D; END IF; END PROCESS; END ARCHITECTURE; CWRU EECS 318

Inferring D-Flip Flops: Synchronous Reset PROCESS (Clock, Reset) BEGIN IF rising_edge(Clock) THEN IF Reset=‘1’ THEN Q <= ‘0’ ELSE Q <= D; END IF; END IF; END PROCESS; Synchronous Reset Synchronous FF PROCESS (Clock, Reset) BEGIN IF Reset=‘1’ THEN Q <= ‘0’ ELSIF rising_edge(Clock) THEN Q <= D; END IF; END PROCESS; Asynchronous Reset Synchronous FF CWRU EECS 318

D-Flip Flops: Asynchronous Reset & Preset PROCESS (Clock, Reset, Preset) BEGIN IF Reset=‘1’ THEN --highest priority Q <= ‘0’; ELSIF Preset=‘1’ THEN Q <= ‘0’; ELSIF rising_edge(Clock) THEN Q <= D; END IF; END PROCESS; CWRU EECS 318

RTL Multi-cycle Datapath: with controller Register Transfer Level (RTL) View CWRU EECS 318

CPU controller: Finite State Machine ALUzero PCWriteCond PCSourceMux PCWriteEnable PCWrite ALUOp MemRead ALUSrcAMux MemWrite ALUSrcBMux IorDMux FSM RegWrite IRWrite RegDstMux MemtoReg Clock Reset IRopcode CWRU EECS 318

CPU Controller: Entity ENTITY cpu_controller is PORT( CLK, RST :IN std_logic; IRopcode :IN std_logic_vector(5 downto 0); ALUzero :IN std_logic; PCWriteEnable :OUT std_logic; PCSourceMux :OUT std_logic_vector(1 downto 0); MemRead, MemWrite :OUT std_logic; IorDMux :OUT std_logic; IRWrite :OUT std_logic; RegWrite :OUT std_logic; RegDstMux :OUT std_logic; MemtoRegMux :OUT std_logic; ALUOp :OUT std_logic_vector(2 downto 0) ALUSrcAMux :OUT std_logic; ALUSrcBMux :OUT std_logic_vector(1 downto 0); ); END ENTITY; CWRU EECS 318

CPU controller: R-Format State Machine Cycle 1 Cycle 2 Cycle 3 Cycle 4 Ifetch Reg/Dec Exec Wr R-Format Decode Clock=1 Clock=1 Fetch Exec Rtype Clock=1 Clock=1 Write Rtype CWRU EECS 318

CPU Controller: Current State Process ARCHITECTURE cpu_controller_arch OF cpu_controller IS TYPE CPUStates IS (Fetch, Decode, ExecRtype, WriteRtype); SIGNAL State, NextState :CPUStates; BEGIN PROCESS (State) BEGIN CASE State IS WHEN Fetch => NextState <= Decode; WHEN Decode => NextState <= ExecRtype; WHEN ExecRtype => NextState <= WriteRtype; WHEN WriteRtype => NextState <= Fetch; WHEN OTHERS => NextState <= Fetch; END CASE; END PROCESS; • • • CWRU EECS 318

CPU controller: NextState Clock Process PROCESS (CLK, RST) BEGIN IF RST='1' THEN -- Asynchronous Reset State <= Fetch; ELSIF rising_edge(CLK) THEN State <= NextState; END IF; END PROCESS; END ARCHITECTURE; CWRU EECS 318

T1 Fetch: State machine Decode Exec Write Reg Start Cycle 1 Cycle 2 Cycle 3 Cycle 4 Ifetch Reg/Dec Exec Wr R-Format Start Decode MemRead=1, MemWrite=0 IorD=1 (MemAddrPC) IRWrite=1 (IRMem[PC]) ALUOP=ADD (PC4+PC) ALUSrcA=0 (=PC) ALUSrcB=1 (=4) PCWrite=1, PCSource=1 (=ALU) RegWrite=0, RegDst=X, MemtoReg=X Exec Write Reg Instruction Fetch CWRU EECS 318

T1 Fetch: VHDL with Moore Output States PROCESS (State) BEGIN CASE State IS WHEN Fetch => NextState <= Decode; MemRead <= '1'; MemWrite <= '0'; IorD <= '1' IRWrite <= '1'; ALUOp <= "010”; --add ALUSrcAMux <= '1'; --PC ALUSrcBMux <= "01"; --4 PCWriteEnable<= '1'; PCSourceMux <= "00"; --ALU (not ALUOut) RegWrite <= '0'; RegDstMux <= 'D'; MemtoReg <= 'D'; MemRead=1, MemWrite=0 IorD=1 (MemAddrPC) IRWrite=1 (IRMem[PC]) ALUOP=ADD (PC4+PC) ALUSrcA=0 (=PC) ALUSrcB=1 (=4) PCWrite=1, PCSource=1 (=ALU) RegWrite=0, RegDst=X, MemtoReg=X Instruction Fetch 'D' for Don’t Care CWRU EECS 318

VHDL inferred Latches: WARNING In VHDL case statement The same signal must be defined for each case Otherwise that signal will be inferred as a latch and not as combinatorial logic! For example, Even though RegDstMux <= 'D' is not used and was removed from the Decode state This will result in a RegDstMux being inferred as latch not as logic even though in the WriteRtype state it is set CWRU EECS 318

Assignment #3: CPU Architecture design (1/3) Cyber Dynamics Corporation (18144 El Camino Real, S’Vale California) needs the following embedded model 101 microprocessor designed by Thursday October 5, 2000 with the following specifications • 16 bit instruction memory using ROM • 8 bit data memory using RAM • There are eight 8-bit registers • The instruction set is as follows • All Arithmetic and logical instructions set a Zero one-bit flag (Z) based on ALU result • add, adc, sub, sbc set the Carry/Borrow one-bit Flag (C) based on ALU result CWRU EECS 318

Assignment #3: CPU Architecture design (2/3) Arithmetic and logical instructions add $rt,$rs #$rt = $rt +$rs; C=ALUcarry; Z=$rt adc $rt, $rs #$rt = $rt +$rs+C; C=ALUcarry; Z; sub $rt, $rs #$rt = $rt - $rs; C=ALUborrow; Z; sub $rt, $rs #$rt = $rt - $rs - borrow; C; Z; and $rt, $rs #$rt = $rt & $rs; C=0; Z=$rt; or $rt, $rs #$rt = $rt | $rs; C=0; Z=$rt; xor $rt, $rs #$rt = $rt ^ $rs; C=1; Z=$rt; Other Instructions continued): lbi $r, immed #$r = immediate lbr $rt,$rs #$rt = Mem[$rs] lb $r, address #$r = Mem[address] stb $r, address #Mem[address]=$r bz address #if zero then pc=pc+2+addr bc address #if carry then pc=pc+2+addr j address #pc = address jr $r #pc = $r CWRU EECS 318

Assignment #3: CPU Architecture design (2/3) (1a) Design an RTL diagram of the model 101 processor and (1b) Opcode formats and (1c) Opcode bits of a Harvard Architecture CPU (determine your own field sizes). (1d) What is the size of the Program Counter? (2) Write the assembly code for a 32 bit add Z=X+Y located in memory address for @X = 0x80 @Y = 0x84 and @Z=0x88 (3) Draw the state diagram for your FSM controller (4) Write the VHDL code for the FSM controller Note: this will be part of your final project report CWRU EECS 318