OpenCores
URL https://opencores.org/ocsvn/single-14-segment-display-driver-w-decoder/single-14-segment-display-driver-w-decoder/trunk

Subversion Repositories single-14-segment-display-driver-w-decoder

[/] [single-14-segment-display-driver-w-decoder/] [trunk/] [Project/] [Sources/] [display_driver_wrapper.vhd] - Blame information for rev 8

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

Line No. Rev Author Line
1 3 liubenoff
--------------------------------------------------------------------------------
2
-- Entity: DisplayDriverWrapper
3
-- Date:2017-01-06  
4
-- Author: GL     
5
--
6
-- Description: 
7
--------------------------------------------------------------------------------
8
library ieee;
9
use ieee.std_logic_1164.all;
10 6 liubenoff
use ieee.numeric_std.all;
11 3 liubenoff
 
12
--! @file
13
--! @brief Top wrapper for design FPGA prove.
14
--! @details This wrapper is designed for Lattice ECP5-5G Versa Development Kit.
15
entity DisplayDriverWrapper is
16
        port  (
17 6 liubenoff
        clk     : in std_logic;                                         --! input clock, xx MHz.
18
        n_rst   : in std_logic;                                         --! active low on board. active high in design.
19 3 liubenoff
 
20 6 liubenoff
        button  : in std_logic;                                         --! dev board tact switch to scroll through some test symbols, active low
21 3 liubenoff
 
22
        --! Typically the data fed to display (single or multiple) is provided for single display at a time.
23
        --! If multiple displays are required together with data goes display select (according typical dynamic display indication).
24 5 liubenoff
        disp_data : out std_logic_vector(14 downto 0);
25 3 liubenoff
 
26
        --! If more displays needs to be fed change disp_sel to vector with length equal to number of displays.
27
        --! Use principles of the standard dynamic indication: provide data then enable the displays sequentially.
28
        --! If brightness control is desired just AND the selector and the PWM controller output.
29
        disp_sel  : out std_logic
30
        );
31 5 liubenoff
        attribute syn_force_pad: boolean;
32 6 liubenoff
        attribute syn_force_pad of clk, n_rst, button, disp_sel, disp_data: signal is true;
33 3 liubenoff
end DisplayDriverWrapper;
34
 
35
--! @details The architecture consists of the DisplayDriverwDecoder_Top itself (as DUT) plus
36
--! sample symbol generator triggered by the button on the dev board
37
architecture arch of DisplayDriverWrapper is
38 6 liubenoff
    signal rst: std_logic;
39
 
40
    --! Debounce the glitches shorter than 4 clock cycles. Expand at will according the clock speed and glitch duration to filter.
41
    signal bttn_state_fifo: unsigned(3 downto 0);
42
 
43
    --! Active high i.e. '1' means "button pressed"
44
    signal bttn_state: std_logic;
45
 
46
    --! Incremented by 1 each time button is clicked. Provides ASCII symbol code for test purposes
47
    --! Counter range is double the decoder table size because codes from 0x00 to 0x7F are the symbols with decimal point dark.
48
    --! Codes from 0x80 to 0xFF are the same symbols but with decimal point lit. The decoder should handle this. The counter is lineary incremented.
49
    signal symbol_scan_cntr: unsigned(7 downto 0);
50 3 liubenoff
begin
51
 
52 6 liubenoff
--! invert n_rst to make it active high on design recommendation
53
rst <= not n_rst;
54
 
55
BtnDebouncer:process(clk)
56
begin
57
    if rising_edge(clk) then
58
        if rst = '1' then
59
            bttn_state_fifo <= (others=>'1');                           -- active low
60
            bttn_state <= '0';                                          -- active high
61
        else
62
            bttn_state_fifo <= shift_left(bttn_state_fifo,1);
63
            bttn_state_fifo(bttn_state_fifo'right) <= button;
64
 
65
            if bttn_state_fifo = "0000" then                            -- button actuated for more than X clocks and no bounces present
66
                bttn_state <= '1';                                      -- report button is actuated
67
            else
68
                bttn_state <= '0';
69
            end if;
70
        end if;
71
    end if;
72
end process;
73
 
74
 
75
AddrScanCntr:process(rst,bttn_state)
76
begin
77
    if rst='1' then
78
        symbol_scan_cntr <= (others=>'0');
79
    elsif rising_edge(bttn_state) then                                  -- TODO: Fix this to edge detector implementation
80
        symbol_scan_cntr <= symbol_scan_cntr + 1;                       -- I count ont the natural rolloff of this counter
81
    end if;
82
end process;
83
 
84
 
85 3 liubenoff
DDwD_Top:entity work.DisplayDriverwDecoder_Top
86
port map(
87 5 liubenoff
    clk         => clk,
88
    reset       => rst,
89 6 liubenoff
    ascii_in    => std_logic_vector(symbol_scan_cntr),
90 5 liubenoff
    wr_en       => '0',
91
    disp_data   => disp_data,
92
    disp_sel    => disp_sel
93 3 liubenoff
);
94
 
95 5 liubenoff
--disp_sel <= '1' when button = '1';
96 3 liubenoff
 
97
end arch;
98
 

powered by: WebSVN 2.1.0

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