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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [processor/] [VHDL/] [ext_modules/] [ext_Dis7Seg/] [pkg_Dis7Seg.vhd] - Blame information for rev 7

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

Line No. Rev Author Line
1 3 jlechner
-----------------------------------------------------------------------
2
-- This file is part of SCARTS.
3
-- 
4
-- SCARTS is free software: you can redistribute it and/or modify
5
-- it under the terms of the GNU General Public License as published by
6
-- the Free Software Foundation, either version 3 of the License, or
7
-- (at your option) any later version.
8
-- 
9
-- SCARTS is distributed in the hope that it will be useful,
10
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
-- GNU General Public License for more details.
13
-- 
14
-- You should have received a copy of the GNU General Public License
15
-- along with SCARTS.  If not, see <http://www.gnu.org/licenses/>.
16
-----------------------------------------------------------------------
17
 
18
 
19
-------------------------------------------------------------------------------
20
-- Title      : Package Extension-Module
21
-- Project    : SCARTS - Scalable Processor for Embedded Applications in
22
--              Realtime Environment
23
-------------------------------------------------------------------------------
24
-- File       : pkg_display.vhd
25
-- Author     : Dipl. Ing. Martin Delvai
26
-- Company    : TU Wien - Institut fr Technische Informatik
27
-- Created    : 2002-02-11
28
-- Last update: 2011-03-20
29
-- Platform   : SUN Solaris
30
-------------------------------------------------------------------------------
31
-- Description:
32
-- Deklarationen und Konstanten r die 7 Segment Anzeige
33
-------------------------------------------------------------------------------
34
-- Copyright (c) 2002 
35
-------------------------------------------------------------------------------
36
-- Revisions  :
37
-- Date        Version  Author  Description
38
-- 2002-02-11  1.0      delvai  Created
39
-------------------------------------------------------------------------------
40
-------------------------------------------------------------------------------
41
-- LIBRARIES
42
-------------------------------------------------------------------------------
43
 
44
LIBRARY IEEE;
45
use IEEE.std_logic_1164.all;
46
 
47
use work.scarts_pkg.all;
48
 
49
 
50
-------------------------------------------------------------------------------
51
-- PACKAGE
52
-------------------------------------------------------------------------------
53
 
54
package pkg_dis7seg is
55
 
56
  type digit_t is record
57
    SegA   :  std_logic;
58
    SegB   :  std_logic;
59
    SegC   :  std_logic;
60
    SegD   :  std_logic;
61
    SegE   :  std_logic;
62
    SegF   :  std_logic;
63
    SegG   :  std_logic;
64
  end record;
65
 
66
  type digit_vector_t is array (natural range <>) of digit_t;
67
 
68
  component ext_Dis7Seg
69
    generic (
70
      DIGIT_COUNT : integer range 1 to 8;
71
      MULTIPLEXED : integer range 0 to 1);
72
    port (
73
      clk        : IN  std_logic;
74
      extsel     : in   std_ulogic;
75
      exti       : in  module_in_type;
76
      exto       : out module_out_type;
77
      digits     : out digit_vector_t((DIGIT_COUNT-1) * (1-MULTIPLEXED) downto 0);
78
      DisEna     : OUT std_logic;
79
      PIN_select : OUT std_logic_vector(DIGIT_COUNT-1 downto 0));
80
  end component;
81
 
82
 
83
  function bin2digit (
84
    constant number : std_logic_vector(3 downto 0))
85
    return digit_t;
86
 
87
 
88
end pkg_dis7seg;
89
 
90
 
91
 
92
package body pkg_dis7seg is
93
 
94
  function bin2digit (
95
    constant number : std_logic_vector(3 downto 0))
96
    return digit_t is
97
    variable v : digit_t;
98
  begin
99
 
100
    case number is
101
      when "0000" =>
102
        v.SegA   := '0';
103
        v.SegB   := '0';
104
        v.SegC   := '0';
105
        v.SegD   := '0';
106
        v.SegE   := '0';
107
        v.SegF   := '0';
108
        v.SegG   := '1';
109
      when "0001" =>
110
        v.SegA   := '1';
111
        v.SegB   := '0';
112
        v.SegC   := '0';
113
        v.SegD   := '1';
114
        v.SegE   := '1';
115
        v.SegF   := '1';
116
        v.SegG   := '1';
117
      when "0010" =>
118
        v.SegA   := '0';
119
        v.SegB   := '0';
120
        v.SegC   := '1';
121
        v.SegD   := '0';
122
        v.SegE   := '0';
123
        v.SegF   := '1';
124
        v.SegG   := '0';
125
      when "0011" =>
126
        v.SegA   := '0';
127
        v.SegB   := '0';
128
        v.SegC   := '0';
129
        v.SegD   := '0';
130
        v.SegE   := '1';
131
        v.SegF   := '1';
132
        v.SegG   := '0';
133
      when "0100" =>
134
        v.SegA   := '1';
135
        v.SegB   := '0';
136
        v.SegC   := '0';
137
        v.SegD   := '1';
138
        v.SegE   := '1';
139
        v.SegF   := '0';
140
        v.SegG   := '0';
141
      when "0101" =>
142
        v.SegA   := '0';
143
        v.SegB   := '1';
144
        v.SegC   := '0';
145
        v.SegD   := '0';
146
        v.SegE   := '1';
147
        v.SegF   := '0';
148
        v.SegG   := '0';
149
      when "0110" =>
150
        v.SegA   := '0';
151
        v.SegB   := '1';
152
        v.SegC   := '0';
153
        v.SegD   := '0';
154
        v.SegE   := '0';
155
        v.SegF   := '0';
156
        v.SegG   := '0';
157
      when "0111" =>
158
        v.SegA   := '0';
159
        v.SegB   := '0';
160
        v.SegC   := '0';
161
        v.SegD   := '1';
162
        v.SegE   := '1';
163
        v.SegF   := '1';
164
        v.SegG   := '1';
165
      when "1000" =>
166
        v.SegA   := '0';
167
        v.SegB   := '0';
168
        v.SegC   := '0';
169
        v.SegD   := '0';
170
        v.SegE   := '0';
171
        v.SegF   := '0';
172
        v.SegG   := '0';
173
      when "1001" =>
174
        v.SegA   := '0';
175
        v.SegB   := '0';
176
        v.SegC   := '0';
177
        v.SegD   := '0';
178
        v.SegE   := '1';
179
        v.SegF   := '0';
180
        v.SegG   := '0';
181
      when "1010" =>
182
        v.SegA   := '0';
183
        v.SegB   := '0';
184
        v.SegC   := '0';
185
        v.SegD   := '1';
186
        v.SegE   := '0';
187
        v.SegF   := '0';
188
        v.SegG   := '0';
189
      when "1011" =>
190
        v.SegA   := '1';
191
        v.SegB   := '1';
192
        v.SegC   := '0';
193
        v.SegD   := '0';
194
        v.SegE   := '0';
195
        v.SegF   := '0';
196
        v.SegG   := '0';
197
      when "1100" =>
198
        v.SegA   := '0';
199
        v.SegB   := '1';
200
        v.SegC   := '1';
201
        v.SegD   := '0';
202
        v.SegE   := '0';
203
        v.SegF   := '0';
204
        v.SegG   := '1';
205
      when "1101" =>
206
        v.SegA   := '1';
207
        v.SegB   := '0';
208
        v.SegC   := '0';
209
        v.SegD   := '0';
210
        v.SegE   := '0';
211
        v.SegF   := '1';
212
        v.SegG   := '0';
213
      when "1110" =>
214
        v.SegA   := '0';
215
        v.SegB   := '1';
216
        v.SegC   := '1';
217
        v.SegD   := '0';
218
        v.SegE   := '0';
219
        v.SegF   := '0';
220
        v.SegG   := '0';
221
      when "1111" =>
222
        v.SegA   := '0';
223
        v.SegB   := '1';
224
        v.SegC   := '1';
225
        v.SegD   := '1';
226
        v.SegE   := '0';
227
        v.SegF   := '0';
228
        v.SegG   := '0';
229
      when others =>
230
        v.SegA   := '1';
231
        v.SegB   := '1';
232
        v.SegC   := '1';
233
        v.SegD   := '1';
234
        v.SegE   := '1';
235
        v.SegF   := '1';
236
        v.SegG   := '0';
237
    end case;
238
    return v;
239
  end bin2digit;
240
 
241
end pkg_dis7seg;
242
 
243
 
244
 
245
 
246
-------------------------------------------------------------------------------
247
--                             END PACKAGE
248
------------------------------------------------------------------------------- 

powered by: WebSVN 2.1.0

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