Digital Integrated Circuits

Similar documents
Digital Integrated Circuits

Digital Integrated Circuits

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

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

Digital Design with FPGAs. By Neeraj Kulkarni

EPC6055 Digital Integrated Circuits EXAM 1 Fall Semester 2013

Modeling Sequential Circuits in Verilog

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

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

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

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

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

Topics. Midterm Finish Chapter 7

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

Last Lecture. Talked about combinational logic always statements. e.g., module ex2(input logic a, b, c, output logic f); logic t; // internal signal

Topics. Midterm Finish Chapter 7

Nikhil Gupta. FPGA Challenge Takneek 2012

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

Verilog Lecture Gandhi Puvvada, USC always statements, Coding a Flip-Flop. blocking and non-blocking assignments. Copyright 2008 Gandhi Puvvada 1

L5: Simple Sequential Circuits and Verilog

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

Synthesis of Combinational and Sequential Circuits with Verilog

Synthesis of Language Constructs. 5/10/04 & 5/13/04 Hardware Description Languages and Synthesis

Register Transfer Level

ECE 551: Digital System *

Blocking(=) vs Nonblocking (<=) Assignment. Lecture 3: Modeling Sequential Logic in Verilog HDL. Procedural assignments

Digital Design with SystemVerilog

L5: Simple Sequential Circuits and Verilog

Writing Circuit Descriptions 8

Verilog for High Performance

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

CSE140L: Components and Design Techniques for Digital Systems Lab

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

CAD for VLSI Design - I. Lecture 21 V. Kamakoti and Shankar Balachandran

Verilog Tutorial. Introduction. T. A.: Hsueh-Yi Lin. 2008/3/12 VLSI Digital Signal Processing 2

Homework deadline extended to next friday

EE178 Lecture Verilog FSM Examples. Eric Crabill SJSU / Xilinx Fall 2007

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Sciences

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

CS/EE Homework 7 Solutions

CSE140L: Components and Design

Verilog for Synthesis Ing. Pullini Antonio

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

Verilog Execution Semantics

Control in Digital Systems

Chapter 9: Sequential Logic Modules

EEL 4783: HDL in Digital System Design

ECEN 468 Advanced Logic Design

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

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

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

Lecture 12 VHDL Synthesis

FPGA: FIELD PROGRAMMABLE GATE ARRAY Verilog: a hardware description language. Reference: [1]

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

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

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

CSE 140L Final Exam. Prof. Tajana Simunic Rosing. Spring 2008

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

Course Topics - Outline

VERILOG: FLIP-FLOPS AND REGISTERS

Department of Computer Science and Electrical Engineering. Intro to Verilog II

Lecture 32: SystemVerilog

L5: Simple Sequential Circuits and Verilog

RTL Design (Using ASM/SM Chart)

In this lecture, we will focus on two very important digital building blocks: counters which can either count events or keep time information, and

Behavioral Modeling and Timing Constraints

EN164: Design of Computing Systems Lecture 06: Lab Foundations / Verilog 2

FSM and Efficient Synthesizable FSM Design using Verilog

EECS150 - Digital Design Lecture 10 Logic Synthesis

Sequential Logic Design

Modeling Synchronous Logic Circuits. Debdeep Mukhopadhyay IIT Madras

Verilog Coding Guideline

Microcomputers. Outline. Number Systems and Digital Logic Review

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

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

MCMASTER UNIVERSITY EMBEDDED SYSTEMS

ELCT 501: Digital System Design

ECE Digital Engineering Laboratory. Designing for Synthesis

Nonblocking Assignments in Verilog Synthesis; Coding Styles That Kill!

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

Verilog introduction. Embedded and Ambient Systems Lab

Synthesizable Verilog

In the previous lecture, we examined how to analyse a FSM using state table, state diagram and waveforms. In this lecture we will learn how to design

In the previous lecture, we examined how to analyse a FSM using state table, state diagram and waveforms. In this lecture we will learn how to design

Graduate Institute of Electronics Engineering, NTU Design of Datapath Controllers

CS6710 Tool Suite. Verilog is the Key Tool

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

EECS150 - Digital Design Lecture 20 - Finite State Machines Revisited

Laboratory Exercise 3 Davide Rossi DEI University of Bologna AA

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

ECE 551 Digital System Design and Synthesis. Instructor: Kewal K. Saluja. Midterm Exam

L5: Simple Sequential Circuits and Verilog

EECS150 - Digital Design Lecture 7 - Computer Aided Design (CAD) - Part II (Logic Simulation) Finite State Machine Review

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

Laboratory Exercise 7

DIGITAL SYSTEM DESIGN

problem maximum score 1 10pts 2 8pts 3 10pts 4 12pts 5 7pts 6 7pts 7 7pts 8 17pts 9 22pts total 100pts

R10. II B. Tech I Semester, Supplementary Examinations, May

Chapter 9: Sequential Logic Modules

EECS150 - Digital Design Lecture 10 Logic Synthesis

Transcription:

Digital Integrated Circuits Lecture 4 Jaeyong Chung System-on-Chips (SoC) Laboratory Incheon National University

BCD TO EXCESS-3 CODE CONVERTER 0100 0101 +0011 +0011 0111 1000 LSB received first Chung EPC6055 2

STATE ASSIGNMENT One-Hot State Encoding One Flip-Flop per State Simple Combinational Logic Minimal State Encoding Use log 2 (#states) Flip-Flops Assignment of State Codes Impacts Amount of Combinational Logic Chung EPC6055 3

STATE ASSIGNMENT GUIDELINES Assign Adjacent State Codes States with same NS for given input States that are NS of same state States having same output for given input Chung EPC6055 4

ASSIGNMENT MAP AND TRANSITION TABLE State Assignment Guidelines (1,2), (3,4), (5,6), (0,1,4,6), (2,3,5) Chung EPC6055 5

K-MAPS FOR BCD TO EXCESS-3 CONVERTER Chung EPC6055 6

REALIZATION OF CODE CONVERTER Chung EPC6055 7

VERILOG MODEL FOR MUX module mux_assign (I0, I1, A, F); input I0, I1, A; output F; wire F; assign F = (A)? I1 : I0; module Chung EPC6055 8

ALWAYS BLOCK FOR COMB. LOGIC I 1 I 2 Combinational Logic O 1 O 2 I N O N reg O1; reg O2;... reg ON; 1. Declare each output as reg (but no seq. gates will be inferred) 2. Put all inputs into the sensitivity list always @(I1 or I2 or I3 or... or IN) begin O1 = 0; O2 = 0;... ON = 0;... O1 =... ;... O2 =... ;... ON =... ; 3. Initialize each output (Optional). 4. Check each output is assigned at least once regardless of inputs Chung EPC6055 9

VERILOG MODEL FOR MUX module mux_if (I0, I1, A, F); input I0, I1, A; output F; reg F; always @ (I0 or I1 or A) begin if(a == 1 b0) begin F = I0; else begin F = I1; module Chung EPC6055 10

Verilog MODEL FOR MUX module mux_case (I0, I1, A, F); input I0, I1, A; output F; reg F; always @ (I0 or I1 or A) begin case (A) begin 1 b0 : F = I0; 1 b1 : F = I1; default : case module Chung EPC6055 11

CASCADED 2-TO-1 MUXES Chung EPC6055 12

4-TO-1 MUX 00 01 10 11 Chung EPC6055 13

REG. WITH SYNCHRONOUS CLEAR AND LOAD Chung EPC6055 14

LEFT SHIFT REG. WITH SYNC. CLEAR & LOAD always @(posedge CLK) begin if (CLR == 1 b1) begin Q <= 4 b0000; else if (Ld == 1 b1) begin Q <= D; else if (Ls == 1 b1) begin Q <= {D[2:0], Rin} Concatenation // Bit Chung EPC6055 15

SIMPLE SYNCHRONOUS COUNTER always @(posedge CLK) begin if (ClrN == 1 b0) begin Q <= 4 b0000; else if (En == 1 b1) begin Q <= Q + 1 b1; else begin Q <= Q Chung EPC6055 16

74163 COUNTER Standard Part Available in TTL and CMOS 4 Bit Counter Chung EPC6055 17

74163 COUNTER Control Signals Next State ClrN LdN P T Q 3+ Q + 2 Q 1+ Q + 0 0 X X 0 0 0 0 (clear) 1 0 X D 3 D 2 D 1 D 0 (parallel load) 1 1 0 Q 3 Q 2 Q 1 Q 0 (no change) 1 1 1 present state + 1 (increment count) Chung EPC6055 18

74163 COUNTER module c74163 (D, Clk, ClrN, LdN, P, T, Carry, Q); input [3:0] D; input ClrN, LdN, P, T; output [3:0] Q; output Carry; reg [3:0] Q; reg Carry; always @(posedge Clk) begin if (ClrN == 1'b0) begin //ClrN = 0 Q <= 4'b0; Carry <= 1'b0; else begin //ClrN = 0, LdN = 0 if (LdN == 1'b0) begin Q <= D; else begin if( (P && T) == 1'b0) begin //ClrN = 0, LdN = 1, PT = 0 Q <= Q; else begin //ClrN = 0, LdN = 1, PT = 1 {Carry, Q} <= Q + 1; module Chung EPC6055 19

8-BIT COUNTERS FROM 74163 Chung EPC6055 20

BLOCK DIAGRAM A, B, C as Inputs and F = ab + bc as Output Chung EPC6055 21

TWO STRUCTURAL IMPLEMENTATIONS F = ab + bc Describes Functionality These 2 Structures Describe How Realized Chung EPC6055 22

MULTIPLE LEVELS OF ABSTRACTION Verilog Allows Describing Hardware at Different Levels of Abstraction Behavior No hardware implied Structural Interconnection of components Synthesis Tools convert from high-level to lower level State-of-the-art Design Automation Tools Generate Efficient Hardware for Logic and Arithmetic Circuits Memory Structures Often Need Manual Optimizations Chung EPC6055 23

CODE Using Structural Code Similar to In-Lining Assembly Code in Software Allows Designer to Fully Control Final Design Can Hand Optimize Using Behavior Code Often Used Less Design Time Important for Time-to-Market Synthesis Tools Quite Good Chung EPC6055 24

Simulation/Test Bench Test Bench Design Done Need to Test to See whether Meet Design Spec How to Test? Set Initial Conditions Drive Inputs (Possibly All Combinations) Compare Outputs Chung EPC6055 25

Simulation/Test Bench BCD to Excess-3 Code Converter Designed in Chapter 2 Chung EPC6055 26

Simulation/Test Bench BCD to Excess-3 Code Converter Designed in Chapter 2 Chung EPC6055 27

Simulation/Test Bench BCD to Excess-3 Code Converter 4 Different Ways of Implementation Behavioral with Separate Combinational and Sequential Processes Behavioral with Single Process Data Flow with Equations Structural Chung EPC6055 28

Simulation/Test Bench BCD to Excess-3 Code Converter Sample Code (Parallel) module bcd_to_excess3 (x, clk, z); input [3:0] x; output [3:0] z; reg [3:0] z; always @ (posedge clk) begin z = x + 4'd3; module Need to Write Test Bench Set Initial Condition: Reset Registers Drive Input : Drive X Chung EPC6055 29

Simulation/Test Bench BCD to Excess-3 Code Converter Set Initial Condition initial begin ~~ initial Block Executed Only Once when Simulation Starts Chung EPC6055 30

Simulation/Test Bench BCD to Excess-3 Code Converter Set Initial Condition & Drive input module bcd_to_excess3 (x, clk, z); input [3:0] x; output [3:0] z; reg [3:0] z; always @ (posedge clk) begin z = x + 4'd3; module initial begin x= 0; clk=0; repeat(9) begin #20 x = x + 1 b1; Chung EPC6055 31

Simulation/Test Bench BCD to Excess-3 Code Converter Test Bench Module module bcd_to_excess3 (x, clk, z); input [3:0] x; output [3:0] z; reg [3:0] z; always @ (posedge clk) begin z = x + 4'd3; module module tb_bcd_to_excess3; reg [3:0] x; reg clk; wire [3:0] z; initial begin x = 3 b0; clk = 0; repeat(9) begin #20 x = x + 1 b1; always begin //clock geneartion #5 clk =!clk; //no input, output ports bcd_to_excess3 m0_bcd_to_excess3 (.x(x),.clk(clk),.z(z)); module Chung EPC6055 32

Simulation/Test Bench BCD to Excess-3 Code Converter Test Bench Module module bcd_to_excess3 (x, clk, z); input [3:0] x; output [3:0] z; reg [3:0] z; always @ (posedge clk) begin z = x + 4'd3; module module tb_bcd_to_excess3; reg [0:3] x; reg clk; wire [0:3] z; initial begin x = 3 b0; clk = 0; repeat(9) begin #20 x = x + 1 b1; always begin //clock geneartion #5 clk =!clk; //no input, output ports bcd_to_excess3 m0_bcd_to_excess3 (.x(x),.clk(clk),.z(z)); initial begin $monitor( x = %b, z=%b %b %b %b, x, z[0], z[1], z[2], z[3]); module Chung EPC6055 33

Simulation/Test Bench BCD to Excess-3 Code Converter Simulation Output x = 0000 z = 0 0 1 1 x = 0001 z = 0 1 0 0 x = 0010 z = 0 1 0 1 x = 0011 z = 0 1 1 0 x = 0100 z = 0 1 1 1 x = 0101 z = 1 0 0 0 x = 0110 z = 1 0 0 1 x = 0111 z = 1 0 1 0 x = 1000 z = 1 0 1 1 x = 1001 z = 1 1 0 0 Chung EPC6055 34

Verilog Coding Tip Guildelines Guideline #1: When modeling sequential logic, use nonblocking assignments. Guideline #2: When modeling latches, use nonblocking assignments. Guideline #3: When modeling combinational logic with an "always" block, use blocking assignments. Guideline #4: When modeling both sequential and combinational logic within the same "always" block, use nonblocking assignments. Guideline #5: Do not mix blocking and nonblocking assignments in the same "always" block. Guideline #6: Do not make assignments to the same variable from more than one "always" block. Guideline #7: Use $strobe to display values that have been assigned using nonblocking assignments. Guideline #8: Do not make assignments using #0 delays. Chung EPC6055 35