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

Subversion Repositories graphicsaccelerator

[/] [graphicsaccelerator/] [trunk/] [SevenSegment.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 OmarMokhta
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Create Date:    00:27:13 11/30/2010 
6
-- Design Name: 
7
-- Module Name:    SevenSegment - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
use IEEE.numeric_std.all;
23
use IEEE.std_logic_unsigned.all;
24
 
25
-- Uncomment the following library declaration if using
26
-- arithmetic functions with Signed or Unsigned values
27
--use IEEE.NUMERIC_STD.ALL;
28
 
29
-- Uncomment the following library declaration if instantiating
30
-- any Xilinx primitives in this code.
31
--library UNISIM;
32
--use UNISIM.VComponents.all;
33
 
34
entity SevenSegment is
35
    Port ( Clk : in  STD_LOGIC;
36
           Enables : out  STD_LOGIC_VECTOR (3 downto 0);
37
           Segments : out  STD_LOGIC_VECTOR (6 downto 0);
38
           data : in  STD_LOGIC_VECTOR (15 downto 0));
39
end SevenSegment;
40
 
41
architecture Behavioral of SevenSegment is
42
 
43
signal Counter,nCounter : STD_LOGIC_VECTOR (16 downto 0);
44
signal Chosen : STD_LOGIC_VECTOR (3 downto 0);
45
 
46
begin
47
 
48
Chosen <= data(15  downto  12) when Counter(16 downto 15)="00" else
49
                         data(11  downto   8) when Counter(16 downto 15)="01" else
50
                         data(7   downto   4) when Counter(16 downto 15)="10" else
51
                         data(3   downto   0);
52
Enables <= "1110" when Counter(16 downto 15)="00" else
53
                          "1101" when Counter(16 downto 15)="01" else
54
                          "1011" when Counter(16 downto 15)="10" else
55
                          "0111";
56
with Chosen Select
57
Segments <= "1111001" when "0001",   --1
58
                                "0100100" when "0010",   --2
59
                                "0110000" when "0011",   --3
60
                                "0011001" when "0100",   --4
61
                                "0010010" when "0101",   --5
62
                                "0000010" when "0110",   --6
63
                                "1111000" when "0111",   --7
64
                                "0000000" when "1000",   --8
65
                                "0010000" when "1001",   --9
66
                                "0001000" when "1010",   --A
67
                                "0000011" when "1011",   --b
68
                                "1000110" when "1100",   --C
69
                                "0100001" when "1101",   --d
70
                                "0000110" when "1110",   --E
71
                                "0001110" when "1111",   --F
72
                                "1000000" when others;   --0
73
nCounter <= Counter+1;
74
 
75
process (Clk) begin
76
        if (rising_edge(Clk)) then
77
                Counter <= nCounter;
78
        end if;
79
end process;
80
 
81
end Behavioral;

powered by: WebSVN 2.1.0

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