EITF35: Introduction to Structured VLSI Design

Similar documents
EITF35: Introduction to Structured VLSI Design

Nanosistemų programavimo kalbos 5 paskaita. Sekvencinių schemų projektavimas

Sequential Circuit Design: Principle

Sequential Circuit Design: Principle

VHDL And Synthesis Review

In our case Dr. Johnson is setting the best practices

Lecture 4: Modeling in VHDL (Continued ) EE 3610 Digital Systems

Sequential Logic - Module 5

Sequential Statement

VHDL. VHDL History. Why VHDL? Introduction to Structured VLSI Design. Very High Speed Integrated Circuit (VHSIC) Hardware Description Language

VHDL for Synthesis. Course Description. Course Duration. Goals

COE 405, Term 062. Design & Modeling of Digital Systems. HW# 1 Solution. Due date: Wednesday, March. 14

Part 4: VHDL for sequential circuits. Introduction to Modeling and Verification of Digital Systems. Memory elements. Sequential circuits

Two HDLs used today VHDL. Why VHDL? Introduction to Structured VLSI Design

VHDL in 1h. Martin Schöberl

SEQUENTIAL CIRCUIT DESIGN: PRINCIPLE

Lecture 12 VHDL Synthesis

FSM Components. FSM Description. HDL Coding Methods. Chapter 7: HDL Coding Techniques

CSE 260 Introduction to Digital Logic and Computer Design. Exam 1. Your name 2/13/2014

Schedule. ECE U530 Digital Hardware Synthesis. Rest of Semester. Midterm Question 1a

Timing in synchronous systems

DESCRIPTION OF DIGITAL CIRCUITS USING VHDL

Case Study AM2901. Hierarchy in Large Designs

Assignment. Last time. Last time. ECE 4514 Digital Design II. Back to the big picture. Back to the big picture

VHDL Examples Mohamed Zaky

EITF35: Introduction to Structured VLSI Design

Verilog for High Performance

COVER SHEET: Total: Regrade Info: 5 (14 points) 7 (15 points) Midterm 1 Spring 2012 VERSION 1 UFID:

VHDL: Code Structure. 1

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 3

VHDL for FPGA Design. by : Mohamed Samy

ECE 545 Lecture 7. Modeling of Circuits with a Regular Structure. Aliases, Attributes, Packages. Mixing Design Styles. George Mason University

Inferring Storage Elements

Lecture 9. VHDL, part IV. Hierarchical and parameterized design. Section 1 HIERARCHICAL DESIGN

VHDL for Logic Synthesis

Computer-Aided Digital System Design VHDL

Lecture 7. Standard ICs FPGA (Field Programmable Gate Array) VHDL (Very-high-speed integrated circuits. Hardware Description Language)

The CPU Bus : Structure 0

[VARIABLE declaration] BEGIN. sequential statements

1 ST SUMMER SCHOOL: VHDL BOOTCAMP PISA, JULY 2013

VHDL: RTL Synthesis Basics. 1 of 59

Field Programmable Gate Array

קורס VHDL for High Performance. VHDL

Midterm Exam Thursday, October 24, :00--2:15PM (75 minutes)

Summary of FPGA & VHDL

Modeling Synchronous Logic Circuits. Debdeep Mukhopadhyay IIT Madras

SEQUENTIAL STATEMENTS

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 3

ECE 448 Lecture 4. Sequential-Circuit Building Blocks. Mixing Description Styles

ECE 545 Lecture 9. Modeling of Circuits with a Regular Structure. Aliases, Attributes, Packages. George Mason University

Lecture 5: State Machines, Arrays, Loops. EE 3610 Digital Systems

Hardware Description Languages. Modeling Complex Systems

CS211 Digital Systems/Lab. Introduction to VHDL. Hyotaek Shim, Computer Architecture Laboratory

OUTLINE SYSTEM-ON-CHIP DESIGN. GETTING STARTED WITH VHDL September 3, 2018 GAJSKI S Y-CHART (1983) TOP-DOWN DESIGN (1)

Tutorial 4 HDL. Outline VHDL PROCESS. Modeling Combinational Logic. Structural Description Instantiation and Interconnection Hierarchy

Overview. Ram vs Register. Register File. Introduction to Structured VLSI Design. Recap Operator Sharing FSMD Counters.

Luleå University of Technology Kurskod SMD152 Datum Skrivtid

ECE 545 Lecture 6. Behavioral Modeling of Sequential-Circuit Building Blocks. George Mason University

SEQUENTIAL CIRCUIT DESIGN: PRACTICE

VHDL 2 Combinational Logic Circuits. Reference: Roth/John Text: Chapter 2

HDL. Hardware Description Languages extensively used for:

Sign here to give permission to return your test in class, where other students might see your score:

Counters. Counter Types. Variations. Modulo Gray Code BCD (Decimal) Decade Ring Johnson (twisted ring) LFSR

CSE 260 Introduction to Digital Logic and Computer Design. Exam 1 Solutions

CSE 260 Digital Computers: Organization and Logical Design. Exam 2 Solutions

Control and Datapath 8

VHDL Modeling Behavior from Synthesis Perspective -Part B - EL 310 Erkay Savaş Sabancı University

Finite State Machines (FSM) Description in VHDL. Review and Synthesis

VHDL Testbench. Test Bench Syntax. VHDL Testbench Tutorial 1. Contents

Quartus Counter Example. Last updated 9/6/18

Today. Comments about assignment Max 1/T (skew = 0) Max clock skew? Comments about assignment 3 ASICs and Programmable logic Others courses

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 6

Concurrent & Sequential Stmts. (Review)

Mridula Allani Fall Fall

COE 405 Design Methodology Based on VHDL

310/ ICTP-INFN Advanced Tranining Course on FPGA and VHDL for Hardware Simulation and Synthesis 27 November - 22 December 2006

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

Digital Systems Design

Luleå University of Technology Kurskod SMD098 Datum Skrivtid

Used to perform operations many times. See previous Parallel to Serial Example

APPLICATION NOTE. A CPLD VHDL Introduction. Introduction. Overview. Entity. XAPP 105 January12, 1998 (Version 1.0) 0 4* Application Note

ENGR 5865 DIGITAL SYSTEMS

DESIGN AND IMPLEMENTATION OF MOD-6 SYNCHRONOUS COUNTER USING VHDL

COE 405 Behavioral Descriptions in VHDL

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 6

TKT-1212 Digitaalijärjestelmien toteutus. Lecture 7: VHDL Testbenches Ari Kulmala, Erno Salminen 2008

ECE 2300 Digital Logic & Computer Organization. More Sequential Logic Verilog

VHDL. ELEC 418 Advanced Digital Systems Dr. Ron Hayne. Images Courtesy of Cengage Learning

Advanced Training Course on FPGA Design and VHDL for Hardware Simulation and Synthesis. 26 October - 20 November, 2009

VHDL simulation and synthesis

Contents. Chapter 9 Datapaths Page 1 of 28

Altera s Avalon Communication Fabric

FINITE STATE MACHINES (FSM) DESCRIPTION IN VHDL. Cristian Sisterna UNSJ

ELCT 501: Digital System Design

CSE140L: Components and Design Techniques for Digital Systems Lab

Synthesis from VHDL. Krzysztof Kuchcinski Department of Computer Science Lund Institute of Technology Sweden

COVER SHEET: Total: Regrade Info: 5 (5 points) 2 (8 points) 6 (10 points) 7b (13 points) 7c (13 points) 7d (13 points)

Synthesis vs. Compilation Descriptions mapped to hardware Verilog design patterns for best synthesis. Spring 2007 Lec #8 -- HW Synthesis 1

The Virtex FPGA and Introduction to design techniques

3 Designing Digital Systems with Algorithmic State Machine Charts

Transcription:

EITF35: Introduction to Structured VLSI Design Part 2.2.2: VHDL-3 Liang Liu liang.liu@eit.lth.se 1

Outline Inference of Basic Storage Element Some Design Examples DFF with enable Counter Coding Style: Segment Variables in Sequential Circuit Poor Design Examples 2

Inference of Basic Storage Elements VHDL code should be clear so that the pre-designed cells can be inferred As an architecture designer, you need to be very familiar with the available elements VHDL code of storage elements Positive edge-triggered D FF Negative edge-triggered D FF D FF with asynchronous reset D Latch (DON T USE) 3

Positive edge-triggered D FF No else branch Note the sensitivity list (only clk) rising_edge(clk) 4

Negative edge-triggered D FF falling_edge(clk) 5

D FF with Async. Reset process (clk) if rising_edge(clk) then if rst = 1' then Q <= '0' ;... 6

D FF in Xilinx FPGA 7

D Latch (Learn How to Avoid) Bad1: process(sa,sb,a,b) if sa= 1 then z<=a; elsif sb= 1 then z<=b; end if; end process Bad1; Bad2: process(sa,a,b) if sa= 1 then f<=a; end if; end process Bad2; a b sa sb L OR z Bad3: process(i3,i2,i1,i0,s) -- use case statement case S is when "00" => O <= I0; when "01" => O <= I1; when "10" => O <= I2; end case; end process Bad3; 8

Exercise c1: process(clk) if (clk event and clk = 1 )then q<= 1 ; end if; end process c1; c2: process(clk) if (clk= 1 )then q<= 1 ; end if; end process c2; c3: process(clk) if (clk= 1 )then q<= 1 ; else q<= 0 ; end if; end process c3; What is the corresponding circuits? 1 q 0 clk 9

Outline Inference of Basic Storage Element Some Design Examples DFF with enable Counter Coding Style: Segment Variables in Sequential Circuit Poor Design Examples 10

Design Examples: D FF with sync enable Sync Enable Means the enable signal is controlled by clock function circuit 11

Design Examples: D FF with sync enable architecture two_seg_arch of dff_en is signal q_reg:std_logic; signal q_next:std_logic; -- D FF process (clk, reset) if (reset= l ) then q_reg <= 0 ; elsif (clk event and c1k= l ) then q_reg <= q_next; end if ; end process; -- next-state logic q_next <= d when en = l else q_reg; -- output logic q <= q_reg; end two_seg_arch; Multi-Segment (at least two) Recommended! 12

Design Examples: Binary Counter Binary Counter Circulates through a sequence that resembles the unsigned binary number Count from 0 to 15 and repeat Set a flag when counting to 15 13

Design Examples: Binary Counter entity binary_counter4_pulse is port( clk, reset: in std_logic; max_pulse: out std_logic; q: out std_logic_vector (3 downto 0); end binary_counter4_pulse ; architecture two_seg_arch of binary_counter4_pulse is signal r_reg : unsigned (3 downto 0) ; signal r_next : unsigned (3 downto 0) ; process (clk, reset) if (reset= 1') then r_reg <= ( others=> '0') ; elsif (clk'event and clk= 1') then r_reg <= r_next; end if; end process; r_next <= r_reg + 1; -- incrementor q <= std_logic_vector(r_reg); r_reg; max_pulse <= 1' when r_reg= 1111 else 0 ; -- output end two_seg_arch; 14

Design Examples: Binary Counter How to wrap around: 1111->0000 Poor code ( Wrong code) bad:r_next <= (r_reg + 1) mod 16 In the IEEE numeric_std package, + on the unsigned data type is modeled after a hardware adder Wrap around automatically when the addition result exceeds the range. Mod operation may not be synthesized Good:r_next <= (r_reg + 1) How to wrap if we count from 0 to 9? 15

Outline Inference of Basic Storage Element Some Design Examples DFF with enable Register shifter Counter Coding Style: Segment Variables in Sequential Circuit Poor Design Examples 16

Coding Style: Segment One-segment Describe storage and combinational logic in one process May appear compact for certain simple circuit But it can be error-prone Is integration always better??? 17

Segment: D FF with sync enable architecture one_seg_arch of dff_en is process (clk,reset) if (reset= 1 ) then q < = 0 ; elsif (clk event and clk= 1 ) then if (en= 1 ) then q <= d; end if; end if ; end process; end one_seg_arch; 18

Segment: Binary Counter What will be the circuit? 19

Segment: Binary Counter A 1-bit register is inferred for the max_pulse signal. The register works as a buffer and delays the output by one clock cycle, and thus the max_pulse signal will be asserted when r_reg="0000". 20

Segment: Summary Two-segment code Separate storage segment from the rest Has a clear mapping to hardware component Is preferred and recommended One-segment code Mix memory segment and next-state logic/output logic Can sometimes be more compact No clear hardware mapping Error prone 21

Segment: Summary Keep the hardware and the corresponding coding rule in mind and then go ahead! Go ahead, two-segment works! Signals inside the clk'event and clk= 1' branch are referred as registers 22

Outline Inference of Basic Storage Element Some Design Examples DFF with enable Register shifter Counter Coding Style: Segment Variables in Sequential Circuit Poor Design Examples 23

Variables in Sequential Circuit Signals always imply an FF under clk event and clk= 1 condition When you don t want to infer an FF in a one-segment process Variable is local in a process and is not needed outside Variable may imply differently Variable is used after it is assigned: get a value every time when the process is invoked no register is inferred Variable is used before it is assigned: use the value from the previous process execution FF or register need to be inferred 24

Variables in Sequential Circuit: Example architecture arch of varaible_ff_demo is signal tmp_sigl: std_logic; process (clk) if (clk event and clk= 1 ) then tmp_sig1 <= a and b; ql <= tmp_sigl; end if ; end process; Registers are inferred q1 is one clock later than tmp_sig1 25

Variables in Sequential Circuit: Example architecture arch of varaible_ff_demo is process (clk) variable tmp_var2: std_logic; -- declare in process if (clk event and clk= 1 ) then tmp_var2 := a and b; -- notice assignment format ql <= tmp_var2; end if ; end process; Use variable tmp_sig2 is used after it is assigned Just a hard wire, no Reg. is inferred 26

Variables in Sequential Circuit: Example architecture arch of varaible_ff_demo is process (clk) variable tmp_var2: std_logic; -- declare in process if (clk event and clk= 1 ) then ql <= tmp_var2; tmp_var2 := a and b; -- change the assignment order end if ; end process; tmp_var2 No Variables! 27

Outline Inference of Basic Storage Element Some Design Examples DFF with enable Register shifter Counter Coding Style: Segment Variables in Sequential Circuit Poor Design Examples 28

Poor Design : Misuse of asynchronous reset Example: a mod-10 counter: 0,1,2,7,8,9, 0,1,2, 7,8,9,0 How to wrap from 9 to 0? 29

Poor Design : Misuse of asynchronous reset entity modl0_counter is port(clk,reset: in std_logic; q:out std_logic_vector (3 downto 0)); end modl0_counter; architecture poor_async_arch of mod10_counter is signal r_reg: unsigned (3 downto 0) ; signal r_next: unsigned (3 downto 0) ; signal async_clr: std_logic; process (clk,async_clr) if (async_clr= 1') then r_reg <= (others=> 0'); elsif(clk'event and clk= 1 ) then r_reg<=r_next; end if ; end process; r_next <= r_reg + 1; async_clr <='1' when (reset='l or r_reg="1010") else 0 ; q <= std_logic_vector(r_reg); end poor_async_arch; 30

Poor Design : Misuse of asynchronous reset Problems Glitch in counter: r_reg goes to 10 and then reset, due to the delay of comparator Glitches in aync_clr can reset the counter mistakenly Finish the output timing diagram in 2 min 31

Poor Design : Misuse of asynchronous reset Remedy architecture two_seg of mod10_counter is signal r_reg: unsigned (3 downto 0) ; signal r_next: unsigned (3 downto 0) ; process (clk,reset) if (reset = 1') then r_reg <= (others=> 0'); elsif(clk'event and clk= 1 ) then r_reg<=r_next; end if ; end process; r_next <= (others=> 0 ) when (r_reg=9) else r_reg+1; q <= std_logic_vector(r_reg); end two_seg; asynchronous reset should ONLY be used for initialization! 32

Poor Design : Misuse of derived clocks Use ONE common clock if possible 33

Reading advice RTL Hardware Design Using VHDL: P213-P254 34

Thanks 35