68
Introduction to ASIC flow and Verilog HDL

Introduction to ASIC flow and VerilogHDL. What is Verilog ? IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Embed Size (px)

Citation preview

Page 1: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Introduction to ASIC flow and Verilog HDL

Page 2: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

What is Verilog ?

IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital system

Used in both hardware simulation and synthesis

HDL : A text programing language used for model a piece of hardware

Page 3: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

More Terminology:

Register Transfer Level : A type of behavioral modeling, for the purpose of synthesis.

Synthesis : Translating HDL to a circuit and then optimizing the represented circuit.

RTL Synthesis : Translating the RTL model of hardware into an optimized technology specific gate level implementation.

Page 4: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

What is Synthesis?

Page 5: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Synthesis Implementation (Basic)

Page 6: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Basic VLSI Design Flow:

Page 7: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Synthesis vs Simulation

Page 8: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Synthesis Flow

Page 9: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Basics of Combinational Digital Design

Using a NAND gate, how many ways can you come up with an Inverter?

Page 10: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Implementing an Inverter using 2:1 MUX

Equation of the Mux :

Output = S * A + S (bar) * B

If we replace A with zero and B with 1 we get the functionality of an Inverter

Output = S * 0 + S (bar) * 1

Output = S (bar)

You can verify using truth tables, the following circuit describes an inverter using 2:1 MUX

Page 11: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

And Gate using 2:1 MUX Equation of the Mux :

Output = S * A + S (bar) * B

Tie Input B to zero we get

Output = S*A (AND gate)

Page 12: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

2:1 MUX using only NAND Gates

Page 13: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Verilog : The module

Page 14: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Behavioral Description (Continuous /Dataflow Assignment)

Continuous assignment use the assign keyword.

A simple natural way to express the circuit.

Specify the logic expression instead of describing the gate level.

HDL more useful if used as a higher level of abstraction.

The RHS is continuously evaluated as a function of arbitrarily changing

inputs

The target / output is a net driven by combinational logic

Page 15: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Implementation of a Dataflow Assignment

Page 16: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Behavioral Description (Procedural Assignment) An alternative, often higher level of abstraction in behavioral class

Two structured procedural statements : always and initial.

Rather than specifying a circuit by Boolean expression, we use if – else (case, while, for statements)

Supports richer control structures and provides greater flexibility.

Page 17: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Mux Implementation of Procedural statement with always

Page 18: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Gate Level : Structural Description

Provides gate level details of the design.

Net represents connections between hardware elements. Nets are declared with the keyword wire

This coding style is error prone, it’s used only when we are sure about the exact circuit implementation

Verilog supports basic logic gates as primitives

: and, or, nor, NAND, XOR, XNOR, NOT, buf

Page 19: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Structural Implementation of MUX

Page 20: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Verilog Registers In digital design registers represents memory elements.

Digital registers need a clock to operate and update their state at a particular edge.

Registers in Verilog are different from digital design, please don’t confuse

In Verilog (reg) simple means a variable that can hold value, which can be changed anytime by assigning a new one

Page 21: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Combining Procedural and Continuous

Page 22: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

The case statement: Case and if can be used interchangeably to implement conditional

execution within always blocks.

Case statements can be more easily read

Page 23: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

N - bit signals in verilog

2:1 MUX with 8 – bit operands.

Page 24: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Multi bit arithmetic the easy way:

Page 25: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Port Connection Implementation

Page 26: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Connecting module instantiation Ports

module Full_Adder(Cin, x, y, Cout, s);

input Cin;

input x, y;

output Cout;

output s;

wire c1, c2, s1;

Half_Add HA1(x, y, c1, s1);

Half_Add HA2(s1, Cin, c2, s);

assign Cout = c1 | c2;

endmodule

Page 27: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Basic Verilog Construct

Page 28: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Verilog Combinational Logic

Page 29: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Alternative coding style for CL

Page 30: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Combined Verilog code for Flip Flop

Page 31: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Incorrect specification in Verilog:

Use always block sensitivity list to wait for clock to change

Page 32: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Sequential vs Combinational in always block

Page 33: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Synchronous vs Asynchronous clear

Page 34: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Implementing Asynchronous/Synchronous Reset

Page 35: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Verilog Implementation for Asynch/Synch Reset

Page 36: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Synchronous vs Asynchronous -III

Page 37: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Synchronous vs Asynchronous Reset

Page 38: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Getting the best of both worlds: Synchronize the asynchronous external reset signal.

Use this synchronous signal as input to all asynchronous flip flops.

Asynch reset FF takes less logic to implement, consumes less power.

Page 39: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

The Asynchronous Metastable Problem

Page 40: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Blocking vs Non-Blocking

Page 41: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Swap function using blocking/non blocking

Page 42: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Assignment style for Sequential design

Page 43: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Use Non-Blocking for Sequential Logic

Page 44: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Use Blocking for Combinational Logic

Page 45: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Structural Representation (Revisited)

Page 46: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Structural Representation of a 4-bit Adder

Page 47: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital
Page 48: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital
Page 49: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Modeling Finite State Machines

Page 50: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Moore Machine example

Page 51: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Code for Traffic light controller

Page 52: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Traffic light controller code(contd.)

sushant singh
Default is red, suppose sccidently the state becomes 11, which is undfined, the controller will turn that to red.
sushant singh
Default is red, suppose sccidently the state becomes 11, which is undfined, the controller will turn that to red.
Page 53: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Further thoughts:

Page 54: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Non-latched Traffic light controller code:

sushant singh
Unlike the previous latched code where we used both state and light triggering at positive edge clock, here we just trigger the state.
sushant singh
We use non blocking asignment, hence only 2 flip flops are synthesized for storing the state
sushant singh
Output will be specified in a seperate always block.
Page 55: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Non-latched code (continued):

Page 56: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Moore Machine : Example 2

Page 57: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Code for parity detector:

sushant singh
Since the state can be even or odd (2 states) we can store it in one reg i.e. even_odd.
Page 58: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Parity Detector code (continued):

Page 59: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Reasoning it’s a Moore

Page 60: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Mealy Machine : Example

Page 61: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Sequence Detector : Code

sushant singh
At any clock pulse, next state will be the present state.
sushant singh
Only the state is coded as flip flops, remaining logic is combinational
Page 62: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Sequence Detector code :(continued)

sushant singh
Primary Outputs and next state is purely combinational driven.
Page 63: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital
Page 64: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Example with Multiple Modules

sushant singh
(add_sub) is the control signal with which the operation (+/-)is selected, from which the parity is determined.
sushant singh
We have partitioned the design into 3 parts.
sushant singh
The Adder will take A as one input and either B or B's compliment as the other, depending on the signal
sushant singh
If add_sub is 0 then Compliemntor will pass the value of B, if 1 will pass B's compliment +1, performing subtraction
Page 65: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

The Compliment module

Page 66: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

The Adder Module

sushant singh
Here at the output we get a concatinated result of carry out and sum and hence denote by { }
Page 67: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

The parity checker module

Page 68: Introduction to ASIC flow and VerilogHDL. What is Verilog ?  IEEE industry standard Hardware Descriptive Language (HDL) – used to describe a digital

Top Level Module: Interconnecting the lower level modules