Skip to content

Instantly share code, notes, and snippets.

@cocomoff
Created April 12, 2018 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cocomoff/a4bd3f88fda65462364ebf460fa94960 to your computer and use it in GitHub Desktop.
Save cocomoff/a4bd3f88fda65462364ebf460fa94960 to your computer and use it in GitHub Desktop.
7seg decode
module seg7dec (
input [3:0] DIN,
output reg [6:0] HEX
);
always @* begin
case ( DIN )
4'h0: HEX = 7'b1000000;
4'h1: HEX = 7'b1111001;
4'h2: HEX = 7'b0100100;
4'h3: HEX = 7'b0110000;
4'h4: HEX = 7'b0011001;
4'h5: HEX = 7'b0010010;
4'h6: HEX = 7'b0000010;
4'h7: HEX = 7'b1011000;
4'h8: HEX = 7'b0000000;
4'h9: HEX = 7'b0010000;
default:HEX = 7'bxxxxxxx;
endcase
end
endmodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment