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

Subversion Repositories signed_unsigned_multiplier_and_divider

[/] [signed_unsigned_multiplier_and_divider/] [trunk/] [fourdigitsevensegled.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 zpekic
----------------------------------------------------------------------------------
2
-- Company: @Home
3
-- Engineer: Zoltan Pekic (zpekic@hotmail.com)
4
-- 
5
-- Create Date:    15:42:44 02/20/2016 
6
-- Design Name: 
7
-- Module Name:    fourdigitsevensegled - Behavioral 
8
-- Project Name:   Alarm Clock
9
-- Target Devices: Mercury FPGA + Baseboard (http://www.micro-nova.com/mercury/)
10
-- Tool versions:  Xilinx ISE 14.7 (nt64)
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
 
23
-- Uncomment the following library declaration if using
24
-- arithmetic functions with Signed or Unsigned values
25
--use IEEE.NUMERIC_STD.ALL;
26
 
27
-- Uncomment the following library declaration if instantiating
28
-- any Xilinx primitives in this code.
29
--library UNISIM;
30
--use UNISIM.VComponents.all;
31
 
32
entity fourdigitsevensegled is
33
    Port ( -- inputs
34
                          data : in  STD_LOGIC_VECTOR (15 downto 0);
35
           digsel : in  STD_LOGIC_VECTOR (1 downto 0);
36
           showdigit : in  STD_LOGIC_VECTOR (3 downto 0);
37
           showdot : in  STD_LOGIC_VECTOR (3 downto 0);
38
           showsegments : in  STD_LOGIC;
39
                          -- outputs
40
           anode : out  STD_LOGIC_VECTOR (3 downto 0);
41
           segment : out  STD_LOGIC_VECTOR (7 downto 0)
42
                         );
43
end fourdigitsevensegled;
44
 
45
architecture structural of fourdigitsevensegled is
46
 
47
component nibble2sevenseg is
48
    Port ( nibble : in  STD_LOGIC_VECTOR (3 downto 0);
49
           segment : out  STD_LOGIC_VECTOR (6 downto 0)
50
                        );
51
end component;
52
 
53
component mux16to4
54
    Port ( a : in  STD_LOGIC_VECTOR (3 downto 0);
55
           b : in  STD_LOGIC_VECTOR (3 downto 0);
56
           c : in  STD_LOGIC_VECTOR (3 downto 0);
57
           d : in  STD_LOGIC_VECTOR (3 downto 0);
58
           sel : in  STD_LOGIC_VECTOR (1 downto 0);
59
                          nEnable : in  STD_LOGIC;
60
           y : out  STD_LOGIC_VECTOR (3 downto 0)
61
                         );
62
end component;
63
 
64
signal internalsegment: std_logic_vector(7 downto 0); -- 7th is the dot!
65
signal internalsel: std_logic_vector(3 downto 0);
66
signal digit: std_logic_vector(3 downto 0);
67
 
68
begin
69
-- decode position
70
   internalsel(3) <= digsel(1) and digsel(0);
71
   internalsel(2) <= digsel(1) and (not digsel(0));
72
   internalsel(1) <= (not digsel(1)) and digsel(0);
73
   internalsel(0) <= (not digsel(1)) and (not digsel(0));
74
-- select 1 digit out of 4 incoming     
75
   digitmux: mux16to4 port map (
76
                                                                a => data(3 downto 0),
77
                                                                b => data(7 downto 4),
78
                                                                c => data(11 downto 8),
79
                                                                d => data(15 downto 12),
80
                                                                nEnable => '0',
81
                                                                sel => digsel,
82
                                                                y => digit
83
                                                                        );
84
-- set the anodes with digit blanking
85
        anode(3) <= not (internalsel(3) and showdigit(3));
86
        anode(2) <= not (internalsel(2) and showdigit(2));
87
        anode(1) <= not (internalsel(1) and showdigit(1));
88
        anode(0) <= not (internalsel(0) and showdigit(0));
89
-- hook up the cathodes
90
   sevensegdriver: nibble2sevenseg port map (
91
                                                                nibble => digit,
92
                                                                segment => internalsegment(6 downto 0)
93
                                                                        );
94
-- set cathodes with blanking (seg7 == dot)
95
        segment(7) <= (not showsegments) or ((internalsel(3) and not showdot(3)) or (internalsel(2) and not showdot(2)) or (internalsel(1) and not showdot(1)) or (internalsel(0) and not showdot(0)));
96
        segs: for i in 6 downto 0 generate
97
                segment(i) <= (not showsegments) or internalsegment(i);
98
        end generate;
99
 
100
end structural;
101
 

powered by: WebSVN 2.1.0

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