logic-circuit-design / practice / 03_Roulette / rtl / SEG7_LUT.v
SEG7_LUT.v
Raw
// 7 segment LED decoder
module SEG7_LUT	( 
    oSEG, 
    iDIG
);
    input  [2:0]        iDIG;
    output [6:0]        oSEG;


    assign  oSEG = SEG(iDIG);

//  7SEG-LED pin assignment
//     ----t----
//     |       |    Common Anode
//     lt     rt     => Negative logic
//     |       |
//     ----m----
//     |       |
//     lb     rb
//     |       |
//     ----b----

    function [6:0] SEG;
        input [2:0] iDIG;
        case(iDIG)
            3'd0: SEG = 7'b1101111; // b
            3'd1: SEG = 7'b1011111; // lb
            3'd2: SEG = 7'b1111110; // lt
            3'd3: SEG = 7'b1111101; // t
            3'd4: SEG = 7'b1111011; // rt
            3'd5: SEG = 7'b1110111; // rb
         default: SEG = 7'b1111111; // Blank
        endcase
    endfunction

endmodule