+ Post New Thread
Results 1 to 3 of 3
  1. #1
    Newbie level 2
    Points: 56, Level: 1

    Join Date
    Nov 2018
    Posts
    5
    Helped
    0 / 0
    Points
    56
    Level
    1

    How to show a full adder output on a 7 segment display

    Hello,

    I am a senior at Indiana State University. My major is Information Technology but I am taking a verilog class to get an intro into it. I created a full adder but I am not sure how to get it to display on a 7 segment display. I tried to do some research but the way some of the coding is confuses me.

    This is what I have so far for my full adder that currently adds 3 inputs and produces a 4-bit output.

    Code Verilog - [expand]
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    module Fulladd(
        input a,
        input b,
        input cin,
        output s,
        output cout
        );
        
        xor(s, a, b, cin);
        and(t1, a, b);
        and(t2, a, cin);
        and(t3, b, cin);
        or(cout, t1, t2, t3);
        
    endmodule
     
    module add3(a2, a1, a0, b2, b1, b0, s2, s1, s0, cout);
    input a2, a1, a0, b2, b1, b0;
    output cout, s2, s1, s0;
     
     
    Fulladd stage0 (a0, b0, 0, s0, c1);
    Fulladd stage1 (a1, b1, c1, s1, c2);
    Fulladd stage2 (a2, b2, c2, s2, cout);

    •   AltAdvertisment

        
       

  2. #2
    Advanced Member level 5
    Points: 22,252, Level: 36
    barry's Avatar
    Join Date
    Mar 2005
    Location
    California, USA
    Posts
    4,258
    Helped
    943 / 943
    Points
    22,252
    Level
    36

    Re: How to show a full adder output on a 7 segment display

    You need a 4-bit-to-seven-segment converter. This will map the sixteen 4-bit codes to enable the appropriate segments. For example, you can define the 7-segment display in a 7-bit register (segment A=bit 0, segment B=bit 1, etc.)

    Code Enabled segments
    0000 A,B,C,D,E,F-->0111111
    0001 B,C-->0000110
    0010 A,B,D,E,G
    etc.

    Code:
    --A---
    |     |
    F     B
    |     |
    ---G---
    |     |
    E    C
    |     |
    --D---
    Note: for some reason, this website strips away whitespaces. That's supposed to be a 7-seg display above.



    •   AltAdvertisment

        
       

  3. #3
    Super Moderator
    Points: 74,987, Level: 66
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    12,281
    Helped
    4077 / 4077
    Points
    74,987
    Level
    66

    Re: How to show a full adder output on a 7 segment display

    I've edited it to surround it in code tags Barry. Looks more 'lifelike' now

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.



--[[ ]]--