Logic Circuits II ECE 2411 Thursday 4:45pm-7:20pm. Lecture 3

Similar documents
Lecture 3. Behavioral Modeling Sequential Circuits. Registers Counters Finite State Machines

ECE 4514 Digital Design II. Spring Lecture 2: Hierarchical Design

ECE 574: Modeling and Synthesis of Digital Systems using Verilog and VHDL. Fall 2017 Final Exam (6.00 to 8.30pm) Verilog SOLUTIONS

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

Techniques for Digital Systems Lab. Verilog HDL. Tajana Simunic Rosing. Source: Eric Crabill, Xilinx

Modeling Sequential Circuits in Verilog

Note: Closed book no notes or other material allowed, no calculators or other electronic devices.

Sequential Logic Design

Laboratory Exercise 3

N-input EX-NOR gate. N-output inverter. N-input NOR gate

Digital Integrated Circuits

L5: Simple Sequential Circuits and Verilog

Sequential Logic Blocks

L5: Simple Sequential Circuits and Verilog

DIGITAL SYSTEM DESIGN

Lecture 32: SystemVerilog

ECE 2300 Digital Logic & Computer Organization. More Finite State Machines

Federal Urdu University of Arts, Science and Technology, Islamabad VLSI SYSTEM DESIGN. Prepared By: Engr. Yousaf Hameed.

CSCB58 - Lab 3. Prelab /3 Part I (in-lab) /2 Part II (in-lab) /2 TOTAL /8

EECS150 - Digital Design Lecture 20 - Finite State Machines Revisited

Quick Introduction to SystemVerilog: Sequental Logic

Topics. Midterm Finish Chapter 7

Graduate Institute of Electronics Engineering, NTU. Lecturer: Chihhao Chao Date:

6. Latches and Memories

L5: Simple Sequential Circuits and Verilog

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

Synthesizable Verilog

5.14 Algorithmic State Machine (ASM) Charts

Graduate Institute of Electronics Engineering, NTU Design of Datapath Controllers

The Verilog Language COMS W Prof. Stephen A. Edwards Fall 2002 Columbia University Department of Computer Science

Digital Circuit Design and Language. Datapath Design. Chang, Ik Joon Kyunghee University

ECE 4514 Digital Design II. Spring Lecture 20: Timing Analysis and Timed Simulation

Chap 6 Introduction to HDL (d)

Modeling Synchronous Logic Circuits. Debdeep Mukhopadhyay IIT Madras

CSE140L: Components and Design

L5: Simple Sequential Circuits and Verilog

ECE 551: Digital System *

Lab 7 (All Sections) Prelab: Introduction to Verilog

CSE140L: Components and Design Techniques for Digital Systems Lab

CSE 591: Advanced Hardware Design and Verification (2012 Spring) LAB #0

ECE 2300 Digital Logic & Computer Organization. More Verilog Finite State Machines

Synthesis of Combinational and Sequential Circuits with Verilog

MCMASTER UNIVERSITY EMBEDDED SYSTEMS

ENGR 3410: Lab #1 MIPS 32-bit Register File

Digital Design with FPGAs. By Neeraj Kulkarni

Verilog introduction. Embedded and Ambient Systems Lab

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 11. Introduction to Verilog II Sequential Circuits

Verilog Nonblocking Assignments with Delays - Myths & Mysteries

Digital Integrated Circuits

EEL 4783: HDL in Digital System Design

Chapter 5 Registers & Counters

Recommended Design Techniques for ECE241 Project Franjo Plavec Department of Electrical and Computer Engineering University of Toronto

FSM and Efficient Synthesizable FSM Design using Verilog

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

Verilog. What is Verilog? VHDL vs. Verilog. Hardware description language: Two major languages. Many EDA tools support HDL-based design

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

ECE 2300 Digital Logic & Computer Organization. More Verilog Finite State Machines

Post-Synthesis Simulation. VITAL Models, SDF Files, Timing Simulation

Verilog 1 - Fundamentals

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

problem maximum score 1 8pts 2 6pts 3 10pts 4 15pts 5 12pts 6 10pts 7 24pts 8 16pts 9 19pts Total 120pts

ECE 4514 Digital Design II. Spring Lecture 9: Review of Key Ideas, System Commands and Testbenches

Xilinx ASMBL Architecture

Writing Circuit Descriptions 8

C A R L E T O N U N I V E R S I T Y. FINAL EXAMINATION April Duration: 3 Hours No. of Students: 108

VHDL: RTL Synthesis Basics. 1 of 59

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Sciences

ARM 64-bit Register File

Behavioral Modeling and Timing Constraints

Verilog for High Performance

MLR Institute of Technology

Why Should I Learn This Language? VLSI HDL. Verilog-2

Course Topics - Outline

ENGN1640: Design of Computing Systems Topic 02: Design/Lab Foundations

Topics. Midterm Finish Chapter 7

ECE 4514 Digital Design II. Spring Lecture 13: Logic Synthesis

ENGR 3410: MP #1 MIPS 32-bit Register File

Synchronous Design. Synchronous design means that all registers are clocked by the same signal. Synchronous design is always desirable in

ECE 4514 Digital Design II. Spring Lecture 15: FSM-based Control

Synchronous Design. Latch Instability. RS Latch. RS Latch Timing. Signal Arrival Times. Simultaneous Switching

Sequential Logic. Reminder: Lab #2 due Thursday Fall 2016 Lecture 4

ENGN1640: Design of Computing Systems Topic 02: Design/Lab Foundations

EPC6055 Digital Integrated Circuits EXAM 1 Fall Semester 2013

EECS150 - Digital Design Lecture 10 Logic Synthesis

Computer Architecture (TT 2012)

EECS150 - Digital Design Lecture 10 Logic Synthesis

This Lecture. Some components (useful for the homework) Verilog HDL (will continue next lecture)

Verilog for Synthesis Ing. Pullini Antonio

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad ELECTRONICS AND COMMUNICATIONS ENGINEERING

Behavioral Modeling and Timing Constraints

Outline. EECS Components and Design Techniques for Digital Systems. Lec 11 Putting it all together Where are we now?

a, b sum module add32 sum vector bus sum[31:0] sum[0] sum[31]. sum[7:0] sum sum overflow module add32_carry assign

EE 231 Fall EE 231 Homework 8 Due October 20, 2010

Homework deadline extended to next friday

Laboratory Exercise 7

Introduction. Purpose. Intended Audience. Conventions. Close

Intro to Digital Logic, Lab 5 Sequential Logic. Lab Objectives. Assigned Task Mapping sequential logic to the FPGA

Amrita Vishwa Vidyapeetham. EC429 VLSI System Design Answer Key


EN164: Design of Computing Systems Lecture 07: Lab Foundations / Verilog 3

Transcription:

Logic Circuits II ECE 2411 Thursday 4:45pm-7:20pm Lecture 3

Lecture 3 Topics Covered: Chapter 4 Discuss Sequential logic Verilog Coding Introduce Sequential coding Further review of Combinational Verilog Coding

Chapter 4 Combinational Circuit Combinational circuits have no feedback paths or memory elements Asynchronous signal propagation governed only by intrinsic (gate and interconnect) delay

Sequential Circuit Chapter 5 A circuit who s state is specified by a time sequence of inputs, outputs and internal states Can be asynchronous but not widely used Synchronous signal propagation synchronized to Clock: periodic train of pulses.

Synchronous Logic Storage Elements Latch Level sensitive always @(clk) Transparent when trigger event true Output = Input Synthesis tools don t work well with latches Smaller than Flip Flops Faster than Flip Flops Used as SRAM memory cell (though not the ones covered in the book) Building blocks for Flip flops

Synchronous Logic Latch SR Latch Consists of either two cross coupled NOR or two cross coupled NAND gates Must have inversion, thus cross coupled OR/AND won t work. NOR SR Latch SET/RESET active high NAND SR Latch SET/RESET active low Sometime referred to as S R latch

SR NOR Latch `timescale 1ns/10ps NOR1 NOR2 module sr_nor(input S, R, output Q, Qb); parameter dly = 0; nor #dly NOR1(Q, R, Qb); nor #dly NOR2(Qb,S, Q); endmodule // sr_nor // Testbench for sr_nor module sr_nor_tb(); reg S = 0, R = 0; wire Q, Qb; // Instantiate sr_nor sr_nor #(.dly(1.1)) U1 (S, R, Q, Qb); // Stimulus initial begin #5 S = 1; #5 S = 0; #5 R = 1; #5 S = 1; #5 $stop; end endmodule // sr_nor_tb

SR NOR Latch

Synchronous Logic D Latch Eliminates the illegal SR state S = R = 1 with CC NORs S = R = 0 with CC NANDs

3.1.2 Transparent Latch Output changes whenever the latch is enabled D 1 0 EN 1 0 1 Q 0 D a Q EN b Qbar Chapter 3 Copyright 2012 G. Tumbush v2.3 10

Synchronous Logic D Latch `timescale 1ns/10ps // Testbench for d_latch module d_latch_tb(); reg D = 0, En = 0; wire Q, Qb; module d_latch (input D, En, output Q, Qb); parameter dly = 0; wire S, R, Db; assign #dly S =!(D & En); assign #dly R =!(Db & En); assign #dly Db =!D; assign #dly Q =!(S & Qb); assign #dly Qb =!(R & Q); endmodule // d_latch // Instantiate sr_nor d_latch U1 (.D(D),.En(En),.Q(Q),.Qb(Qb)); // Stimulus initial begin #10 D = 1; #10 D = 0; #10 En = 1; #10 D = 1; #10 D = 0; #10 D = 1; #10 En = 0; #10 D = 0; #10 $stop; end endmodule // d_latch_tb

Synchronous Logic Storage Elements Edge sensitive always @(posedge clk) Always @(negedge clk) Input is transferred to output only on control signal transition Synthesis tools can time edge triggered logic.

D Flip Flop D (Data or Delay) Flip Flop (DFF) Most widely used

3.2.1 D-Type Flip-Flop Input is stored on active edge of the D DFF D Q Q 1 D Q Q clk EN EN clk D 1 0 1 0 1 Q 1 0 Q 1 0 Chapter 3 Copyright 2012 G. Tumbush v2.3 14

D Flip Flop module d_latch (input D, En, output Q, Qb); parameter dly = 0; wire S, R, Db; assign #dly S =!(D & En); assign #dly R =!(Db & En); assign #dly Db =!D; assign #dly Q =!(S & Qb); assign #dly Qb =!(R & Q); endmodule // d_latch module d_flipflop (input D, Clk, output Q, Qb); wire Y; wire Clkb; // Invert Clk assign Clkb =!Clk; // Instantiate master d_latch master (.D(D),.En(Clk),.Q(Y),.Qb()); // Instantiate slave d_latch slave (.D(Y),.En(Clkb),.Q(Q),.Qb(Qb)); endmodule // d_flipflop `timescale 1ns/10ps // Testbench for d_latch module d_flipflop_tb(); reg D = 0, Clk = 0; wire Q, Qb; // Instantiate sr_nor d_flipflop U1 (.D(D),.Clk(Clk),.Q(Q),.Qb(Qb)); always #10 Clk =!Clk; // Stimulus initial begin @(posedge Clk); @(posedge Clk) D = 1; @(posedge Clk); @(posedge Clk) D = 0; #5 D = 1; #10 $stop; end endmodule // d_flipflop_tb

D Flip Flop

FlipFlop Exercise Using a D-type flip flop create a toggle flip flop. Hint: A toggle or T Flip-flop inverts the output if the input T is asserted, holding the value otherwise. Chapter 3 Copyright 2012 G. Tumbush v2.3 17

FlipFlop Exercise Using a D-type flip flop create a toggle flip flop. Hint: A toggle or T Flip-flop inverts the output if the input T is asserted, holding the value otherwise. Chapter 3 Copyright 2012 G. Tumbush v2.3 18

Setup and Hold Time Setup time is the time before the active edge of the that the data must remain stable clk t setup D D 0 D 1 D Q clk Hold time is the time after the active edge of the that the data must remain stable t clk hold D D 0 D 1 D Q clk Chapter 3 Copyright 2012 G. Tumbush v2.3 19

Propagation Delay Propagation delay is the delay from input to output A 1 B X t comb B A X clk t clk-q D D 1 D Q clk Q Q 0 Q 1 Chapter 3 Copyright 2012 G. Tumbush v2.3 20

Meeting Setup Time FF A D Q clk t comb Combinatorial Logic FF B D Q clk t clk-q t comb t setup clk t period Q A Q 0 Q 1 D B D 0 D 1 t period t t t clk q comb setup Chapter 3 Copyright 2012 G. Tumbush v2.3 21

Meeting Hold Time FF A D Q clk t comb Combinatorial Logic FF B D Q clk clk t clk-q t hold t comb Q A Q 0 Q 1 D B D 0 D 1 t comb t clk q Chapter 3 Copyright 2012 G. Tumbush v2.3 t hold 22

Setup/hold Exercise For the following circuit determine: 1. If it meets hold time and if so by what margin 2. The fastest frequency the circuit can be operated at 3. How would one determine if setup is the cause of a problem? D Q clk D Q clk t clk-q = 1ns t comb = 0.5ns t hold = 1.2ns t setup =1.0ns t comb t clk q t hold t period t clk q t comb t setup 1) tcomb + tclk-q = 0.5 + 1.2 = 1.7 > 1.2, so exceeds by 0.5nS 2) tclk-q + tcomb + tsetup = 1 + 0.5 + 1 = 2.5, so fmax = 1/2.5ns = 400MHz 3) Slow the Chapter 3 Copyright 2012 G. Tumbush v2.3 23

Inverter Based Memory Element Two Inverters can form the basis for a simple memory element: Odd number of inverters used for ring oscillators:

Transmission Gate base D Flip Flop Previous design are too big for industry applications Figure 5.9 Flip Flop uses: 8 NANDs (8 * 4 = 32 transistors) 3 NOTs (3 * 2 = 6 transistors) Transmission gate Flip Flop uses 4 NOTs (4 * 2 = 8 transistors) 4 Transmission Gates (4 * 2 = 8 transistors) 38 transistors 16 transistors Q Data Q

CMOS DFF circuit structure Q Data Q Equivalent Q Data Q Chapter 3 Copyright 2012 G. Tumbush v2.3 26

Switch model of DFF (=0) Q Data Q Clock=0 Q Data(t-1) Data(t) Q Data(t) Chapter 3 Copyright 2012 G. Tumbush v2.3 27

Switch model of DFF (=1) closed if =1 closed if =0 Q Data closed if =0 closed if =1 Q Clock=1 Q Data(t) Data(t+1) Q Data(t) Chapter 3 Copyright 2012 G. Tumbush v2.3 28

Timing of CMOS DFF closed if =1 closed if =0 Q Data closed if =0 A closed if =1 Q Data A Q Chapter 3 Copyright 2012 G. Tumbush v2.3 29

Even Smaller T Gate Design

Characteristic Tables A characteristic table defines the logical properties that define its operation in tabular format. Q(t): present state prior to application of edge. Q(t+1): next state after edge JK next state depends on present state when J,K = 0,0 or 1,1 Q(t+1) = JQ + K Q D next state only depends on D input and is independent of present state. Q(t+1) = D

Direct Inputs Asynchronous set and/or reset inputs that force flip flop to a particular state independently of the. Used to bring storage elements to know state upon power up or put system in an initial state May reset part several times during testing FPGA flip flops initialize to zero upon programming. Asynchronously assert reset but de-assert synchronously Want all devices to come out of reset at the same time If reset released at or near active edge, flip flop output could go metastable

D Flop Flop with set/reset

Verilog Register Coding module dff_examples (input D, Clk, output Q, Qb); reg DFF_async, DFF_sync; // D Flip Flop Asychronous Reset Example always @(posedge clk or posedge reset) begin if(reset == 1) DFF_async <= 1 b0; else DFF_async <= D; end // Another D Flip Flop Asychronous Reset Example always @(posedge clk, negedge reset) begin if(!reset ) DFF_async <= 1 b0; else DFF_async <= D; end // D Flip Flop Sychronous Reset Example always @(posedge clk ) begin if(reset) DFF_async <= 1 b0; else DFF_async <= D; end

Blocking versus Non-Blocking Blocking = Executed sequentially in the order they are listed in the block of statements initial begin @(posedge clk); A = B + 1; // Executes first B = W; // Executes second C = Z W; // Executes third end Non-blocking <= Executes concurrently by evaluating the set of expressions on the right hand side and then make the left hand side assignments @(posedge clk) begin if(reset) begin A <= 8 h00; B <= 8 haa; end else begin A <= X && Y; B <= W; end end

Blocking versus Non-Blocking What about case statement? Use blocking assignments to model combinational logic within an always block always @(a or b or sel) begin : mux case (sel) 1'b0: y = a; 1'b1: y = b; default: y = 1'bx; endcase end Optional name

Decision Trees Post synthesis implementation will differ based on coding style Priority Decision Tree Parallel Decision Tree

Verilog Compiler Directives Compiler directive are preprocessing directives for macro definitions, conditional compilation of code, and file inclusion. In lecture 2, we introduce `timescale Other commonly used directives are (partial list): `define `include `ifdef `else

Verilog Compiler Directives A macro is defined using the `define directive: `define name value `define SIZE 32 reg [`SIZE-1:0] data; `define SZ(num,width) (num)*(width)-1:0 input [`SZ(32,3)] DeviceData, Differs from parameter which must be defines within module boundaries. The `include directive allows the inclusion of one file in another: `include " filename `include "Chip.vh" Note the.vh file extension. This is typically used to indicate files contains compiler directives (`defines, etc.) and not behavioral code.

Verilog Compiler Directives Conditional Compilation Code may be conditionally compiled using the `ifdef-`else- `endif preprocessor construct `ifdef DEBUG $display("in debug mode"); `else $display("in normal mode"); `endif To compile using debug mode with ModelSim: vlog +define+debug file_name.v

5.5 Analysis of Clocked Sequential Circuits A x x B A x B A A(t+1) = x(b + A) = xb + xa B(t+1) = xa y(t) = x (B + A) x

5.5 Analysis of Clocked Sequential Circuits A(t+1) = x(b + A) = xb + xa B(t+1) = xa y(t) = x (B + A) A x x B A x B A x

5.5 Analysis of Clocked Sequential Circuits

Lab 2 Write Verilog module for Figure 5.15 Write Verilog test bench for Figure 5.15 Simulate using ModelSim Show y1 and y2 waveforms for Figure 5.15 and correlate to equations in book (pg. 206) Due Sep. 29 y2 y1