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 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 liubenoff
--------------------------------------------------------------------------------
2 9 liubenoff
-- Entity: display_driver_wrapper
3 3 liubenoff
-- 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 9 liubenoff
entity display_driver_wrapper is
16 3 liubenoff
        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 9 liubenoff
        disp_data_q : out std_logic_vector(14 downto 0)
25 3 liubenoff
        );
26 5 liubenoff
        attribute syn_force_pad: boolean;
27 9 liubenoff
        attribute syn_force_pad of clk, n_rst, button, disp_data_q: signal is true;
28
end display_driver_wrapper;
29 3 liubenoff
 
30 9 liubenoff
--! @details The architecture consists of the display_driver_w_decoder itself (as DUT) plus
31 3 liubenoff
--! sample symbol generator triggered by the button on the dev board
32 9 liubenoff
architecture arch of display_driver_wrapper is
33 6 liubenoff
    signal rst: std_logic;
34
 
35
    --! Debounce the glitches shorter than 4 clock cycles. Expand at will according the clock speed and glitch duration to filter.
36
    signal bttn_state_fifo: unsigned(3 downto 0);
37
 
38
    --! Active high i.e. '1' means "button pressed"
39
    signal bttn_state: std_logic;
40
 
41
    --! Incremented by 1 each time button is clicked. Provides ASCII symbol code for test purposes
42
    --! Counter range is double the decoder table size because codes from 0x00 to 0x7F are the symbols with decimal point dark.
43
    --! Codes from 0x80 to 0xFF are the same symbols but with decimal point lit. The decoder should handle this. The counter is lineary incremented.
44
    signal symbol_scan_cntr: unsigned(7 downto 0);
45 3 liubenoff
begin
46
 
47 9 liubenoff
    --! invert n_rst to make it active high on design recommendation
48
    rst <= not n_rst;
49
 
50
    button_debouncer: process(clk)
51
    begin
52
        if rising_edge(clk) then
53
            if rst = '1' then
54
                bttn_state_fifo <= (others=>'1');                           -- active low
55
                bttn_state <= '0';                                          -- active high
56 6 liubenoff
            else
57 9 liubenoff
                bttn_state_fifo <= shift_left(bttn_state_fifo,1);
58
                bttn_state_fifo(bttn_state_fifo'right) <= button;
59
 
60
                if bttn_state_fifo = "0000" then                            -- button actuated for more than X clocks and no bounces present
61
                    bttn_state <= '1';                                      -- report button is actuated
62
                else
63
                    bttn_state <= '0';
64
                end if;
65 6 liubenoff
            end if;
66
        end if;
67 9 liubenoff
    end process;    -- button_debouncer
68
 
69
    --! @brief User control counter to emulate ASCII codes input
70
    --! @details Counter that goes through values from 0x00 to 0xFF in steps of 0x01 and then rolls naturally to 0x00. 
71
    --! With the counter output hex ASCII codes are emulated. The counter is incremented by clicking SW3 on ECP5-5G Versa Board. 
72
    address_scan_counter: process(rst,bttn_state)
73
    begin
74
        if rst='1' then
75
            symbol_scan_cntr <= (others=>'0');
76
        elsif rising_edge(bttn_state) then                                  -- TODO: Fix this to edge detector implementation
77
            symbol_scan_cntr <= symbol_scan_cntr + 1;                       -- I count ont the natural rolloff of this counter
78
        end if;
79
    end process;    -- address_scan_counter
80
 
81
 
82
    display_driver_with_decoder: entity work.display_driver_w_decoder
83
    port map(
84
        clk         => clk,
85
        reset       => rst,
86
        ascii_in    => std_logic_vector(symbol_scan_cntr),
87
        wr_en       => '0',
88
        disp_data_q => disp_data_q
89
    );
90 6 liubenoff
 
91 3 liubenoff
end arch;
92
 

powered by: WebSVN 2.1.0

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