Xilinx two 4 bit adder + 7 seg display

Discussion in 'Homework Help' started by rawrinc, Apr 5, 2014.

  1. rawrinc

    Thread Starter New Member

    Apr 5, 2014
    Here is the assignment "For this project, you will be taking in two 4 bit inputs (A and B), adding them
    together, and then decoding the result into a format that a 7 Segment display
    supports. You must also indicate any overflow with an “o” on the display. "

    Everyone is struggling very hard with this because of our lack of knowledge and bad professor. I have this code:
    Code ( (Unknown Language)):
    1. module Proj2Module(
    2.     input [3:0] a,
    3.     input [3:0] b,
    4.     output [3:0] sum,
    5.     output carry
    6.     );
    7.         wire cin;
    9.         assign cin = 1'b0;
    10.         SingleStage s0( .a( a[0] ), .b( b[0]), .cin( cin ), .s( sum[0]), .cout( ripple0 ) );
    11.         SingleStage s1( .a( a[1] ), .b( b[1]), .cin( ripple0 ), .s( sum[1]), .cout( ripple1 ) );
    12.         SingleStage s2( .a( a[2] ), .b( b[2]), .cin( ripple1 ), .s( sum[2]), .cout( ripple2 ) );
    13.         SingleStage s3( .a( a[3] ), .b( b[3]), .cin( ripple2 ), .s( sum[3]), .cout( carry ) );
    15. endmodule
    I read in a wiki that this SHOULD take in two 4bit inputs and add them together, but how do I decode this into something a 7 segment display could use? Very confused. Thanks for any help!

    EDIT: There is a pretty good chance I'm completely wrong, if so, how do I even go about doing this?
    Last edited: Apr 5, 2014