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_coder.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
 
41
library ieee;
42
use ieee.std_logic_1164.all;
43
use IEEE.std_logic_unsigned.all;
44
use IEEE.std_logic_arith.all;
45
 
46
 
47
entity led_coder is
48
  port (
49
    led_data_i : in  std_logic_vector(7 downto 0);
50
    hi_seg     : out std_logic_vector(7 downto 0);
51
    lo_seg     : out std_logic_vector(7 downto 0)
52
    );
53
end led_coder;
54
 
55
architecture rtl of led_coder is
56
signal r_led_data : std_logic_vector(7 downto 0);
57
signal decoded_lo,decoded_hi : std_logic_vector(7 downto 0);
58
 
59
begin  -- rtl
60
hi_seg <= not decoded_hi;
61
lo_seg <= not decoded_lo;
62
 
63
  -- purpose: binary to led segments decoder
64
  -- type   : combinational
65
  -- inputs : nibble,reset
66
  -- outputs: 
67
  decode_nibble_lo: process (led_data_i)
68
  begin  -- process decode_nibble
69
      case led_data_i(3 downto 0) is--HGFEDCBA
70
        when "0000" => decoded_lo <= "00111111";  -- 0
71
        when "0001" => decoded_lo <= "00000110";  -- 1
72
        when "0010" => decoded_lo <= "01011011";  -- 2
73
        when "0011" => decoded_lo <= "01001111";  -- 3
74
        when "0100" => decoded_lo <= "01100110";  -- 4
75
        when "0101" => decoded_lo <= "01101101";  -- 5
76
        when "0110" => decoded_lo <= "01111101";  -- 6
77
        when "0111" => decoded_lo <= "00000111";  -- 7
78
        when "1000" => decoded_lo <= "01111111";  -- 8
79
        when "1001" => decoded_lo <= "01101111";  -- 9
80
        when "1010" => decoded_lo <= "01110111";  -- a
81
        when "1011" => decoded_lo <= "01111100";  -- b
82
        when "1100" => decoded_lo <= "00111001";  -- c
83
        when "1101" => decoded_lo <= "01011110";  -- d
84
        when "1110" => decoded_lo <= "01111001";  -- e
85
        when others => decoded_lo <= "01110001";  -- f
86
      end case;
87
  end process decode_nibble_lo;
88
 
89
  decode_nibble_hi: process (led_data_i)
90
  begin  -- process decode_nibble
91
      case led_data_i(7 downto 4) is--HGFEDCBA
92
        when "0000" => decoded_hi <= "00111111";  -- 0
93
        when "0001" => decoded_hi <= "00000110";  -- 1
94
        when "0010" => decoded_hi <= "01011011";  -- 2
95
        when "0011" => decoded_hi <= "01001111";  -- 3
96
        when "0100" => decoded_hi <= "01100110";  -- 4
97
        when "0101" => decoded_hi <= "01101101";  -- 5
98
        when "0110" => decoded_hi <= "01111101";  -- 6
99
        when "0111" => decoded_hi <= "00000111";  -- 7
100
        when "1000" => decoded_hi <= "01111111";  -- 8
101
        when "1001" => decoded_hi <= "01101111";  -- 9
102
        when "1010" => decoded_hi <= "01110111";  -- a
103
        when "1011" => decoded_hi <= "01111100";  -- b
104
        when "1100" => decoded_hi <= "00111001";  -- c
105
        when "1101" => decoded_hi <= "01011110";  -- d
106
        when "1110" => decoded_hi <= "01111001";  -- e
107
        when others => decoded_hi <= "01110001";  -- f
108
      end case;
109
  end process decode_nibble_hi;
110
 
111
 
112
end rtl;

powered by: WebSVN 2.1.0

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