digital design using hdl

Upload: shanibahria

Post on 04-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 Digital design using hdl

    1/33

  • 7/29/2019 Digital design using hdl

    2/33

    2

    A Digital Circuit, in general, can be subdivided into two parts:

    Combinational part A circuit whose output is a function of its

    current inputs only

    Sequential part A circuit whose output is a function of its current

    inputs plus the past inputs [requires memory elements such as latches

    or flip-flops]

    Digital Circuits

  • 7/29/2019 Digital design using hdl

    3/33

    3

    FSM is a mathematical abstraction of a Sequential Circuit

    A System - comprising of inputs, outputs, and states while modeling

    time as discrete instants at which inputs or outputs can change

    Synchronous FSM when states and output transitions are

    synchronized with a clock (positive or negative edge)

    Asynchronous FSM - when states and output transitions can occur

    at any time in response to input changes

    Finite State Machine (FSM)

  • 7/29/2019 Digital design using hdl

    4/33

    Finite State Machine Elements For an edge-triggered, synchronous FSM

    implemented in digital logic, consider:

    A set of input events (input signals, including clock)

    A set of output events (output signals)

    A set of states (state variables are flip flops)

    A function that maps states and input to output

    (this is the output logic) A function that maps states and inputs to states

    (this is the next-state logic)

    A description of the initial state (initial flip flop value)

    4

  • 7/29/2019 Digital design using hdl

    5/33

    FSM

  • 7/29/2019 Digital design using hdl

    6/33

    Example

  • 7/29/2019 Digital design using hdl

    7/33

    Code

  • 7/29/2019 Digital design using hdl

    8/33

    8

    Step-1: Understanding the SpecificationsA Simple Vending Machine Design Example: [a] Accepts 1 or 2

    Rupees Coins [b] Delivers a bottle of drink costing Rupees 3 [c]

    Provides change where applicable

    A Vending Machine Model

    CLOCK

    COINS

    Rs. 1

    Coin

    Rs. 2Coin

    Input Conditioning FSM OutputDrivers

    Vend

    Change

    Drink / Change

    FSM Design Steps- Example

  • 7/29/2019 Digital design using hdl

    9/33

    9

    Step-2: State Diagram

    RepresentationEach State is represented as a circle

    with output arrows Next to the arrow, input and outputs

    are given

    For Vending Machine, FSM remains in

    state S0 until there is some coin, either

    of Rs. 1 or Rs. 2 inserted.

    Upon such an event, depending upon

    the coin type, it switches to another state

    FSM should not activate the Vend /

    Change driver unless the credit equals orexceed the Rs. 3

    A state transition diagram can be

    drawn as shown in figure

    Notation used in State Diagram Representation

    State Name

    Description

    00/00Inputs: Rs. 1: Rs. 2 Outputs: Vend: Change

    S0

    Idle

    01/0010/00

    FSM Design Steps- Example

  • 7/29/2019 Digital design using hdl

    10/33

    10

    State Diagram Representation of Vending Machine

    Step-2: State Diagram Representation

    S0

    S1 S2

    S3 S4 S5 S6

    S7 S8

    Inputs/Outputs = Rs.2:Rs.1/Vend:Change

    FSM Design Steps- Example

  • 7/29/2019 Digital design using hdl

    11/33

    Every good deed is charity whether you come to your brother's assistance or just greet him with a smile.

    Prophet Muhammad (SAW)

  • 7/29/2019 Digital design using hdl

    12/33

    Example

  • 7/29/2019 Digital design using hdl

    13/33

    Specifications

  • 7/29/2019 Digital design using hdl

    14/33

    Possible Combinations

  • 7/29/2019 Digital design using hdl

    15/33

    State Space Model

  • 7/29/2019 Digital design using hdl

    16/33

    Code

  • 7/29/2019 Digital design using hdl

    17/33

    Code

  • 7/29/2019 Digital design using hdl

    18/33

    Code

  • 7/29/2019 Digital design using hdl

    19/33

    Test Bench

  • 7/29/2019 Digital design using hdl

    20/33

    Design Traffic signal controller with

    different Specifications

  • 7/29/2019 Digital design using hdl

    21/33

    Timers

  • 7/29/2019 Digital design using hdl

    22/33

    CODE

  • 7/29/2019 Digital design using hdl

    23/33

    Top Level

  • 7/29/2019 Digital design using hdl

    24/33

    Wise men speak because they have something to say; Fools because they haveto say something.

    ~ Plato

    http://clicks.aweber.com/y/ct/?l=IJmew&m=3mBQq1CPr29_5Nh&b=3BbLt5EUS.V62v540E_hfAhttp://clicks.aweber.com/y/ct/?l=IJmew&m=3mBQq1CPr29_5Nh&b=3BbLt5EUS.V62v540E_hfA
  • 7/29/2019 Digital design using hdl

    25/33

    1.Inputs/Outputs

  • 7/29/2019 Digital design using hdl

    26/33

    2.State Diagram

  • 7/29/2019 Digital design using hdl

    27/33

    3.State Assignments

  • 7/29/2019 Digital design using hdl

    28/33

    4.Set Clear and State registers

  • 7/29/2019 Digital design using hdl

    29/33

    Describing the Behavior

  • 7/29/2019 Digital design using hdl

    30/33

  • 7/29/2019 Digital design using hdl

    31/33

    Test Bench

  • 7/29/2019 Digital design using hdl

    32/33

    Test Bench

  • 7/29/2019 Digital design using hdl

    33/33