Prev Problem
Next Problem

72. 7-Segment Display Decoder

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

How do you plan to solve it?

 

Code

/*Write your code here*/
module sevenseg_hex(input [3:0]hex,output [6:0]seg);
reg [6:0]s;
always@(*)begin
    case(hex)
    4'h0 : s =7'b1111110 ;
    4'h1 : s =7'b0110000 ;
    4'h2 : s = 7'b1101101;
    4'h3 : s =7'b1111001 ;
    4'h4 : s =7'b0110011 ;
    4'h5 : s =7'b1011011;
    4'h6 : s =7'b1011111;
    4'h7 : s =7'b1110000 ;
    4'h8 : s =7'b1111111 ;
    4'h9 : s =7'b1111011 ;
    4'ha : s =7'b1110111 ;  
    4'hb : s =7'b0011111;
    4'hc : s =7'b1001110 ; 
    4'hd : s =7'b0111101 ;
    4'he : s =7'b1001111 ;
    4'hf : s =7'b1000111 ;
    default : s =7'b1111110;
    endcase
end
assign seg = s;
endmodule

 

Was this helpful?
Upvote
Downvote