From 4b6e0102d20d9ab060ce930e4b846c8be446bb06 Mon Sep 17 00:00:00 2001 From: Vasil Zlatanov Date: Mon, 12 Dec 2016 21:51:10 +0000 Subject: public push --- part_2/ex9/hex_to_7seg.v | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 part_2/ex9/hex_to_7seg.v (limited to 'part_2/ex9/hex_to_7seg.v') diff --git a/part_2/ex9/hex_to_7seg.v b/part_2/ex9/hex_to_7seg.v new file mode 100644 index 0000000..6b476e3 --- /dev/null +++ b/part_2/ex9/hex_to_7seg.v @@ -0,0 +1,28 @@ +module hex_to_7seg (out,in); + output [6:0] out; + input [3:0] in; + + reg [6:0] out; + + always @ (*) + case (in) + 4'h0: out = 7'b1000000; + 4'h1: out = 7'b1111001; + 4'h2: out = 7'b0100100; + 4'h3: out = 7'b0110000; + 4'h4: out = 7'b0011001; + 4'h5: out = 7'b0010010; + 4'h6: out = 7'b0000010; + 4'h7: out = 7'b1111000; + 4'h8: out = 7'b0000000; + 4'h9: out = 7'b0011000; + 4'hA: out = 7'b0001000; + 4'hB: out = 7'b0000011; + 4'hC: out = 7'b1000110; + 4'hD: out = 7'b0100001; + 4'hE: out = 7'b0000110; + 4'hF: out = 7'b0001110; + endcase +endmodule + + \ No newline at end of file -- cgit v1.2.3-54-g00ecf