summaryrefslogtreecommitdiffstats
path: root/de1/fpga-flash-nor/hexled.v
diff options
context:
space:
mode:
Diffstat (limited to 'de1/fpga-flash-nor/hexled.v')
-rw-r--r--de1/fpga-flash-nor/hexled.v72
1 files changed, 72 insertions, 0 deletions
diff --git a/de1/fpga-flash-nor/hexled.v b/de1/fpga-flash-nor/hexled.v
new file mode 100644
index 0000000..1c25a59
--- /dev/null
+++ b/de1/fpga-flash-nor/hexled.v
@@ -0,0 +1,72 @@
+module hexled (
+ value,
+ s7
+ );
+
+ input [3:0] value;
+ output [6:0] s7;
+ reg [6:0] s7;
+
+ always @( value )
+ begin
+ case ( value )
+ 4'h0: s7 = ~7'b0111111;
+ 4'h1: s7 = ~7'b0000110;
+ 4'h2: s7 = ~7'b1011011;
+ 4'h3: s7 = ~7'b1001111;
+ 4'h4: s7 = ~7'b1100110;
+ 4'h5: s7 = ~7'b1101101;
+ 4'h6: s7 = ~7'b1111101;
+ 4'h7: s7 = ~7'b0000111;
+ 4'h8: s7 = ~7'b1111111;
+ 4'h9: s7 = ~7'b1101111;
+ 4'hA: s7 = ~7'b1110111;
+ 4'hB: s7 = ~7'b1111100;
+ 4'hC: s7 = ~7'b0111001;
+ 4'hD: s7 = ~7'b1011110;
+ 4'hE: s7 = ~7'b1111001;
+ 4'hF: s7 = ~7'b1110001;
+ endcase
+ end
+endmodule // hexled
+
+module hexledx (
+ value,
+ blank,
+ minus,
+ s7
+ );
+
+ input [3:0] value;
+ input blank;
+ input minus;
+ output [6:0] s7;
+ reg [6:0] s7;
+
+ always @( value or blank or minus )
+ begin
+ if ( blank )
+ s7 = ~7'b0000000;
+ else if ( minus )
+ s7 = ~7'b1000000;
+ else case ( value )
+ 4'h0: s7 = ~7'b0111111;
+ 4'h1: s7 = ~7'b0000110;
+ 4'h2: s7 = ~7'b1011011;
+ 4'h3: s7 = ~7'b1001111;
+ 4'h4: s7 = ~7'b1100110;
+ 4'h5: s7 = ~7'b1101101;
+ 4'h6: s7 = ~7'b1111101;
+ 4'h7: s7 = ~7'b0000111;
+ 4'h8: s7 = ~7'b1111111;
+ 4'h9: s7 = ~7'b1101111;
+ 4'hA: s7 = ~7'b1110111;
+ 4'hB: s7 = ~7'b1111100;
+ 4'hC: s7 = ~7'b0111001;
+ 4'hD: s7 = ~7'b1011110;
+ 4'hE: s7 = ~7'b1111001;
+ 4'hF: s7 = ~7'b1110001;
+ endcase
+ end
+endmodule // hexledx
+