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

Subversion Repositories artec_dongle_ii_fpga

[/] [artec_dongle_ii_fpga/] [trunk/] [src/] [led_sys/] [led_sys.vhd] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 nuubik
------------------------------------------------------------------
2
-- Universal dongle board source code
3
-- 
4
-- Copyright (C) 2006 Artec Design <jyrit@artecdesign.ee>
5
-- 
6
-- This source code is free hardware; you can redistribute it and/or
7
-- modify it under the terms of the GNU Lesser General Public
8
-- License as published by the Free Software Foundation; either
9
-- version 2.1 of the License, or (at your option) any later version.
10
-- 
11
-- This source code is distributed in the hope that it will be useful,
12
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
-- Lesser General Public License for more details.
15
-- 
16
-- You should have received a copy of the GNU Lesser General Public
17
-- License along with this library; if not, write to the Free Software
18
-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
-- 
20
-- 
21
-- The complete text of the GNU Lesser General Public License can be found in 
22
-- the file 'lesser.txt'.
23
 
24
 
25
--                   bit 0,A
26
--                 ----------
27
--                |          | 
28
--                |          |
29
--             5,F|          |  1,B
30
--                |    6,G   |
31
--                 ----------
32
--                |          |
33
--                |          |
34
--             4,E|          |  2,C
35
--                |    3,D   |
36
--                 ----------  
37
--                              # 7,H
38
 
39
 
40
-- Select signal order
41
--   ---    ---      ---    --- 
42
--  |   |  |   |    |   |  |   |  
43
--  |   |  |   |    |   |  |   |
44
--   ---    ---      ---    ---
45
--  |   |  |   |    |   |  |   |
46
--  |   |  |   |    |   |  |   |
47
--   ---    ---      ---    ---
48
--  sel(3) sel(2)   sel(1) sel(0)
49
 
50
 
51
 
52
library ieee;
53
use ieee.std_logic_1164.all;
54
use IEEE.std_logic_unsigned.all;
55
use IEEE.std_logic_arith.all;
56
 
57
 
58
entity led_sys is  --toplevel for led system
59
  generic(
60
        msn_hib : std_logic_vector(7 downto 0);  --Most signif. of hi byte
61
        lsn_hib : std_logic_vector(7 downto 0);  --Least signif. of hi byte
62
        msn_lob : std_logic_vector(7 downto 0);  --Most signif. of hi byte
63
        lsn_lob : std_logic_vector(7 downto 0)  --Least signif. of hi byte       
64
  );
65
  port (
66
    clk                         : in std_logic;
67
    reset_n                     : in std_logic;
68
        led_data_i              : in  std_logic_vector(15 downto 0);   --binary data in
69
    seg_out                     : out std_logic_vector(7 downto 0); --one segment out
70
    sel_out                     : out std_logic_vector(3 downto 0)  --segment scanner with one bit low
71
    );
72
end led_sys;
73
 
74
architecture rtl of led_sys is
75
 
76
component led_coder
77
  port (
78
    led_data_i : in  std_logic_vector(7 downto 0);
79
    hi_seg     : out std_logic_vector(7 downto 0);
80
    lo_seg     : out std_logic_vector(7 downto 0)
81
    );
82
end component;
83
 
84
component byte_scan
85
  port (
86
    clk          : in std_logic;
87
    hi_seg_1     : in std_logic_vector(7 downto 0);
88
    lo_seg_1     : in std_logic_vector(7 downto 0);
89
    hi_seg_0     : in std_logic_vector(7 downto 0);
90
    lo_seg_0     : in std_logic_vector(7 downto 0);
91
    seg_out      : out std_logic_vector(7 downto 0);
92
    sel_out      : out std_logic_vector(3 downto 0)
93
    );
94
end component;
95
 
96
 
97
-- input signals
98
signal    hi_seg1    : std_logic_vector(7 downto 0);
99
signal    lo_seg1    : std_logic_vector(7 downto 0);
100
signal    hi_seg0    : std_logic_vector(7 downto 0);
101
signal    lo_seg0    : std_logic_vector(7 downto 0);
102
 
103
--data containing signals
104
signal    data_hi_seg1    : std_logic_vector(7 downto 0);
105
signal    data_lo_seg1    : std_logic_vector(7 downto 0);
106
signal    data_hi_seg0    : std_logic_vector(7 downto 0);
107
signal    data_lo_seg0    : std_logic_vector(7 downto 0);
108
 
109
--constant display
110
--signal    cons_hi_seg1    : std_logic_vector(7 downto 0);
111
--signal    cons_lo_seg1    : std_logic_vector(7 downto 0);
112
--signal    cons_hi_seg0    : std_logic_vector(7 downto 0);
113
--signal    cons_lo_seg0    : std_logic_vector(7 downto 0);
114
 
115
signal    disp_cnt                : std_logic_vector(15 downto 0):=(others=>'0'); --this enables correct simulation
116
 
117
begin  -- rtl
118
 
119
process (clk)  --enable the scanning while in reset 
120
begin  -- process
121
  if clk'event and clk = '0' then    -- rising clock edge
122
         disp_cnt <= disp_cnt + 1;
123
  end if;
124
end process;
125
 
126
LED_CODE0: led_coder
127
  port map(
128
    led_data_i => led_data_i(7 downto 0), -- in  std_logic_vector(7 downto 0);
129
    hi_seg     => data_hi_seg0, -- out std_logic_vector(7 downto 0);
130
    lo_seg     => data_lo_seg0 -- out std_logic_vector(7 downto 0)
131
    );
132
 
133
LED_CODE1: led_coder
134
  port map(
135
    led_data_i => led_data_i(15 downto 8), -- in  std_logic_vector(7 downto 0);
136
    hi_seg     => data_hi_seg1, -- out std_logic_vector(7 downto 0);
137
    lo_seg     => data_lo_seg1 -- out std_logic_vector(7 downto 0)
138
    );
139
 
140
 
141
lo_seg1 <= data_lo_seg1; --when reset_n='1' else cons_hi_seg1;
142
hi_seg1 <= data_hi_seg1; --when reset_n='1' else cons_lo_seg1;
143
 
144
lo_seg0 <= data_lo_seg0; --when reset_n='1' else cons_hi_seg0;
145
hi_seg0 <= data_hi_seg0; --when reset_n='1' else cons_lo_seg0;
146
 
147
SCAN : byte_scan
148
  port map(
149
    clk          => disp_cnt(15), -- in std_logic;
150
    hi_seg_1     => hi_seg1, -- in std_logic_vector(7 downto 0);
151
    lo_seg_1     => lo_seg1, -- in std_logic_vector(7 downto 0);
152
    hi_seg_0     => hi_seg0, -- in std_logic_vector(7 downto 0);
153
    lo_seg_0     => lo_seg0, -- in std_logic_vector(7 downto 0);    
154
    seg_out      => seg_out, -- out std_logic_vector(7 downto 0);
155
    sel_out      => sel_out  -- out std_logic_vector(3 downto 0)
156
    );
157
 
158
 
159
 
160
 
161
end rtl;

powered by: WebSVN 2.1.0

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