2 vhdl complete outputs

Upload: gtbatman

Post on 04-Jun-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 2 VHDL Complete Outputs

    1/30

    1) Half Adder Simulation By Data Flow Modelling

  • 8/13/2019 2 VHDL Complete Outputs

    2/30

    2) Full Adder Simulation By Data Flow Modelling

  • 8/13/2019 2 VHDL Complete Outputs

    3/30

    3) (a) Half Subractor Simulation By Data Flow Modelling

  • 8/13/2019 2 VHDL Complete Outputs

    4/30

    3) (b) Full Subtractor Simulation By Data Flow Modelling

  • 8/13/2019 2 VHDL Complete Outputs

    5/30

    4) BD to Decimal Decoder Simulation By Data Flow Modelling

  • 8/13/2019 2 VHDL Complete Outputs

    6/30

    !) Binary to "ray ode on#erter Simulation By Data Flow

    Modelling

  • 8/13/2019 2 VHDL Complete Outputs

    7/30

    $) "ray to Binary ode on#erter Simulation By Data Flow

    Modelling

  • 8/13/2019 2 VHDL Complete Outputs

    8/30

    %) BD to &'ce3 ode on#erter Simulation By Data Flow

    Modelling

  • 8/13/2019 2 VHDL Complete Outputs

    9/30

    ) 4'1 Multi*le'er Simulation uing +f,ele-ae tatement

  • 8/13/2019 2 VHDL Complete Outputs

    10/30

    .) 2'4 Decoder Simulation By Data Flow Modelling

  • 8/13/2019 2 VHDL Complete Outputs

    11/30

    1/) 2 Bit Multi*lier Simulation By Data Flow Modelling

  • 8/13/2019 2 VHDL Complete Outputs

    12/30

    11) 2 Bit om*arator Simulation By Data Flow Modelling

  • 8/13/2019 2 VHDL Complete Outputs

    13/30

    12) Half Adder Simulation by Structural Modelling

  • 8/13/2019 2 VHDL Complete Outputs

    14/30

    1!) 4'1 Multi*le'er Simulation By Data Flow Modelling

  • 8/13/2019 2 VHDL Complete Outputs

    15/30

    1$) 2'4 Decoder By Be0a#ioral Modelling

  • 8/13/2019 2 VHDL Complete Outputs

    16/30

    1. VHDL Code For Half Adder By Data Flow Modelling

    library ieee

    ue ieeetdlogic11$4all

    entity 0alfadder i

    *ort(ab5 in bitc5 out bit)

    end 0alfadder

    arc0itecture 0alfadder of 0alfadder i

    begin

    67(a 'or b)

    c67(a and b)

    end 0alfadder

  • 8/13/2019 2 VHDL Complete Outputs

    17/30

  • 8/13/2019 2 VHDL Complete Outputs

    18/30

    3. (a) VHDL Code For Half Sutra!tor By Data Flow Modelling

    library ieee

    ue ieeetdlogic11$4all

    entity 0alfubtractor i

    *ort(ab5 in bit differenceborrow5 out bit)

    end 0alfubtrator

    arc0itecture 0alfubtractordfm of ubtractor i

    begin

    difference67(a 'or b)

    borrow67((not a) and b)

    end 0alfubtractordfm

  • 8/13/2019 2 VHDL Complete Outputs

    19/30

    3. () VHDL Code For Full Sutra!tor By Data Flow Modelling

    library ieee

    ue ieeetdlogic11$4all

    entity fullubtractor i

    *ort(ab*re#iouborrow5 in bit

    differencene'tborrow5 out bit)

    end fullubtractor

    arc0itecture fullubtractordfm of fullubtractor i

    begin

    difference67((a 'or b) or (b 'or *re#iouborrow) or (a 'or *re#iouborrow))

    ne'tborrow67(((not a) and (b or *re#iouborrow)) or (b and *re#iouborrow))end fullubtractordfm

  • 8/13/2019 2 VHDL Complete Outputs

    20/30

    ". VHDL Code For BCD #o De!i$al De!oder By Data Flow

    Modelling

    library ieee

    ue ieeetdlogic11$4all

    entity bcdtodecimal i

    *ort(abcd5 in bit e5 out bit#ector(/ to .))

    end bcdtodecimal

    arc0itecture bcdtodecimaldfm of bcdtodecimal i

    begin

    e(/)67((((not a) and (not b)) and (not c)) and (not d))

    e(1)67((((not a) and (not b)) and (not c)) and d)e(2)67(((not b) and c) and (not d))

    e(3)67(((not b) and c) and d)

    e(4)67((b and (not c)) and (not d))

    e(!)67((b and (not c)) and d)

    e($)67((b and c) and (not d))

    e(%)67((b and c) and d)

    e()67(a and (not d))

    e(.)67(a and d)

    end bcdtodecimaldfm

  • 8/13/2019 2 VHDL Complete Outputs

    21/30

    %. VHDL Code For Binary to &ray Code Con'erter By Data Flow

    Modelling

    library ieee

    ue ieeetdlogic11$4all

    entity binarytogray i

    *ort(b/b1b2b35 in bitg/g1g2g35 out bit)

    end binarytogray

    arc0itecture btg of binarytogray i

    begin

    g367b3

    g267b3 'or b2g167b2 'or b1

    g/67b1 'or b/

    end btg

  • 8/13/2019 2 VHDL Complete Outputs

    22/30

    . VHDL Code For &ray to Binary Code Con'erter By Data Flow

    Modelling

    library ieee

    ue ieeetdlogic11$4all

    entity graytobinary i

    *ort(g/g1g2g35 in bitb/b1b2b35 out bit)

    end graytobinary

    arc0itecture gtb of graytobinary i

    begin

    b367g3

    b267g3 'or g2b167(g3 'or (g2 'or g1))

    b/67(g3 'or (g2 'or (g1 'or g/)))

    end

  • 8/13/2019 2 VHDL Complete Outputs

    23/30

    . VHDL Code For BCD #o *+!e,,3 Code Con'erter By Data

    Flow Modelling

    library ieee

    ue ieeetdlogic11$4all

    entity bcdtoe'ce3 i

    *ort(b/b1b2b35 in bit e/e1e2e35 out bit)

    end bcdtoe'ce3

    arc0itecture bcdtoe'ce3dfm of bcdtoe'ce3 i

    begin

    e367((b3 or (b2 and b/)) or (b2 and b1))

    e267(((not b2) and b/) or ((not b/) and (b1 'or b2)))e167(b1 'nor b/)

    e/67(not b/)

    end bcdtoe'ce3dfm

  • 8/13/2019 2 VHDL Complete Outputs

    24/30

    -. (a) VHDL Code For "1 Multi/le+er 0,ing F*LS*

    State$ent,

    library ieee

    ue ieeetdlogic11$4all

    entity mu'41 i

    *ort(5 in bit#ector(/ to 1) d5 in bit#ector(/ to 3) y5 out bit)

    end mu'41

    arc0itecture mu'41be0a#iouralifele of mu'41 i

    begin

    *roce(d)

    beginif 78//8 t0en

    y67d(/)

    elif 78/18 t0en

    y67d(1)

    elif 781/8 t0en

    y67d(2)

    ele

    y67d(3)

    end ifend *roce

    end mu'41be0a#iouralifele

  • 8/13/2019 2 VHDL Complete Outputs

    25/30

    -. () VHDL Code For "1 Multi/le+er 0,ing CAS* State$ent,

    library ieee

    ue ieeetdlogic11$4all

    entity mu'41 i

    *ort(5 in bit#ector(/ to 1) d5 in bit#ector(/ to 3) y5 out bit)

    end mu'41

    arc0itecture mu'41be0a#iouralcae of mu'41 i

    begin

    *roce(d)

    begin

    cae iw0en 8//8 79 y67d(/)

    w0en 8/18 79 y67d(1)

    w0en 81/8 79 y67d(2)

    w0en ot0er 79 y67d(3)

    end cae

    end *roce

    end mu'41be0a#iouralcae

  • 8/13/2019 2 VHDL Complete Outputs

    26/30

  • 8/13/2019 2 VHDL Complete Outputs

    27/30

    14. VHDL Code For 2 Bit Multi/lier By Data Flow Modelling

    library ieee

    ue ieeetdlogic11$4all

    entity multi*lier2bit i

    *ort(a5 in bit#ector(1 downto /)b5 in bit#ector(1 downto /)

    d5 out bit#ector(3 downto /))

    end multi*lier2bit

    arc0itecture multi*lier2bitdfm of multi*lier2bit i

    ignal c5 bit

    begin

    d(/)67(a(/) and b(/))d(1)67((a(1) and b(/)) 'or (a(/) and b(1)))

    c67((a(1) and b(/)) and (a(/) and b(1)))

    d(2)67((a(1) and b(1)) 'or c)

    d(3)67((a(1) and b(1)) and c)

    end multi*lier2bitdfm

  • 8/13/2019 2 VHDL Complete Outputs

    28/30

    11. VHDL Code For 2 Bit Co$/arator By Data Flow Modelling

    library ieee

    ue ieeetdlogic11$4all

    entity com*arator2bit i

    *ort(ab5 in bit#ector(1 downto /) y5 out bit#ector(2 downto /))

    end com*arator2bit

    arc0itecture com*arator2bitdfm of com*arator2bit i

    begin

    y(/)67 (((a(1) and (not b(1))) or (a(1) and a(/) and (not b(/)))) or ((not b(1)) and a(/)

    and (not b(/))))

    y(1)67 ((((not a(1)) and b(1)) or ((not a(1)) and (not a(/)) and b(/))) or (b(1) and (nota(/)) and a(/)))

    y(2)67 ((a(1) 'nor b(1)) and (a(/) 'nor b(/)))

    end com*arator2bitdfm

  • 8/13/2019 2 VHDL Complete Outputs

    29/30

    12. VHDL Code For Half Adder y Stru!tural Modelling

    library ieee

    ue ieeetdlogic11$4all

    entity 0alfadder i

    *ort(ab5 in bit umcarry5 out bit)

    end 0alfadder

    arc0itecture 0alfaddertruct of 0alfadder i

    com*onent 'or1 i

    *ort(*:5 in bit r5 out bit)

    end com*onent

    com*onent and1 i

    *ort(u#5 in bit w5 out bit)end com*onent

    begin

    '15'or1 *ort ma*(abum)

    '25and1 *ort ma*(abcarry)

    end 0alfaddertruct

    entity 'or1 i

    *ort(*:5 in bit r5 out bit)

    end 'or1

    arc0itecture 'or1dfm of 'or1 i

    begin

    r67* 'or :

    end 'or1

    entity and1 i

    *ort(u#5 in bit w5 out bit)

    end and1

    arc0itecture and1dfm of and1 i

    begin

    w67u and #

    end and1

  • 8/13/2019 2 VHDL Complete Outputs

    30/30