OpenCores
URL https://opencores.org/ocsvn/rtcclock/rtcclock/trunk

Subversion Repositories rtcclock

[/] [rtcclock/] [trunk/] [rtl/] [hexmap.v] - Blame information for rev 7

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dgisselq
///////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    hexmap.v
4
//              
5
// Project:     A Real--time Clock Core
6
//
7
// Purpose:     Converts a 4'bit hexadecimal value to the seven bits needed
8
//              by a seven segment display, specifying which bits are on and
9
//              which are off.
10
//
11
//              The display I am working with, however, requires a separate
12
//              controller.  This file only provides part of the input for that
13
//              controller.  That controller deals with turning on each part
14
//              of the display in a rotating fashion, since the hardware I have
15
//              cannot display more than one character at a time.  So,
16
//              buyer beware--this is not a complete seven segment display
17
//              solution.
18
//
19
//
20
//              The outputs of this routine are numbered as follows:
21
//                      o_map[7] turns on the bar at the top of the display
22
//                      o_map[6] turns on the top of the '1'
23
//                      o_map[5] turns on the bottom of a '1'
24
//                      o_map[4] turns on the bar at the bottom of the display
25
//                      o_map[3] turns on the vertical bar at the bottom left
26
//                      o_map[2] turns on the vertical bar at the top left, and
27
//                      o_map[1] turns on the bar in the middle of the display.
28
//                              The dash if you will.
29
//              Bit zero, from elsewhere, would be the decimal point.
30
//
31
// Creator:     Dan Gisselquist, Ph.D.
32
//              Gisselquist Tecnology, LLC
33
//
34
///////////////////////////////////////////////////////////////////////////
35
//
36
// Copyright (C) 2015, Gisselquist Technology, LLC
37
//
38
// This program is free software (firmware): you can redistribute it and/or
39
// modify it under the terms of  the GNU General Public License as published
40
// by the Free Software Foundation, either version 3 of the License, or (at
41
// your option) any later version.
42
//
43
// This program is distributed in the hope that it will be useful, but WITHOUT
44
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
45
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
46
// for more details.
47
//
48
// You should have received a copy of the GNU General Public License along
49
// with this program.  (It's in the $(ROOT)/doc directory.  Run make with no
50
// target there if the PDF file isn't present.)  If not, see
51
// <http://www.gnu.org/licenses/> for a copy.
52
//
53
// License:     GPL, v3, as defined and found on www.gnu.org,
54
//              http://www.gnu.org/licenses/gpl.html
55
//
56
//
57
///////////////////////////////////////////////////////////////////////////
58
module  hexmap(i_clk, i_hex, o_map);
59
        input           i_clk;
60
        input   [3:0]    i_hex;
61
        output  reg     [7:1]   o_map;
62
 
63
        always @(posedge i_clk)
64
                case(i_hex)
65
                4'h0:   o_map <= { 7'b1111110 };
66
                4'h1:   o_map <= { 7'b0110000 };
67
                4'h2:   o_map <= { 7'b1101101 };
68
                4'h3:   o_map <= { 7'b1111001 };
69
                4'h4:   o_map <= { 7'b0110011 };
70
                4'h5:   o_map <= { 7'b1011011 };
71
                4'h6:   o_map <= { 7'b1011111 };
72
                4'h7:   o_map <= { 7'b1110000 };
73
                4'h8:   o_map <= { 7'b1111111 };
74
                4'h9:   o_map <= { 7'b1111011 };
75
                4'ha:   o_map <= { 7'b1110111 };
76
                4'hb:   o_map <= { 7'b0011111 }; // b
77
                4'hc:   o_map <= { 7'b1001110 };
78
                4'hd:   o_map <= { 7'b0111101 }; // d
79
                4'he:   o_map <= { 7'b1001111 };
80
                4'hf:   o_map <= { 7'b1000111 };
81
                endcase
82
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.