Line 1... |
Line 1... |
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
-- Entity: DisplayDriverWrapper
|
-- Entity: display_driver_wrapper
|
-- Date:2017-01-06
|
-- Date:2017-01-06
|
-- Author: GL
|
-- Author: GL
|
--
|
--
|
-- Description:
|
-- Description:
|
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
Line 10... |
Line 10... |
use ieee.numeric_std.all;
|
use ieee.numeric_std.all;
|
|
|
--! @file
|
--! @file
|
--! @brief Top wrapper for design FPGA prove.
|
--! @brief Top wrapper for design FPGA prove.
|
--! @details This wrapper is designed for Lattice ECP5-5G Versa Development Kit.
|
--! @details This wrapper is designed for Lattice ECP5-5G Versa Development Kit.
|
entity DisplayDriverWrapper is
|
entity display_driver_wrapper is
|
port (
|
port (
|
clk : in std_logic; --! input clock, xx MHz.
|
clk : in std_logic; --! input clock, xx MHz.
|
n_rst : in std_logic; --! active low on board. active high in design.
|
n_rst : in std_logic; --! active low on board. active high in design.
|
|
|
button : in std_logic; --! dev board tact switch to scroll through some test symbols, active low
|
button : in std_logic; --! dev board tact switch to scroll through some test symbols, active low
|
|
|
--! Typically the data fed to display (single or multiple) is provided for single display at a time.
|
--! Typically the data fed to display (single or multiple) is provided for single display at a time.
|
--! If multiple displays are required together with data goes display select (according typical dynamic display indication).
|
--! If multiple displays are required together with data goes display select (according typical dynamic display indication).
|
disp_data : out std_logic_vector(14 downto 0);
|
disp_data_q : out std_logic_vector(14 downto 0)
|
|
|
--! If more displays needs to be fed change disp_sel to vector with length equal to number of displays.
|
|
--! Use principles of the standard dynamic indication: provide data then enable the displays sequentially.
|
|
--! If brightness control is desired just AND the selector and the PWM controller output.
|
|
disp_sel : out std_logic
|
|
);
|
);
|
attribute syn_force_pad: boolean;
|
attribute syn_force_pad: boolean;
|
attribute syn_force_pad of clk, n_rst, button, disp_sel, disp_data: signal is true;
|
attribute syn_force_pad of clk, n_rst, button, disp_data_q: signal is true;
|
end DisplayDriverWrapper;
|
end display_driver_wrapper;
|
|
|
--! @details The architecture consists of the DisplayDriverwDecoder_Top itself (as DUT) plus
|
--! @details The architecture consists of the display_driver_w_decoder itself (as DUT) plus
|
--! sample symbol generator triggered by the button on the dev board
|
--! sample symbol generator triggered by the button on the dev board
|
architecture arch of DisplayDriverWrapper is
|
architecture arch of display_driver_wrapper is
|
signal rst: std_logic;
|
signal rst: std_logic;
|
|
|
--! Debounce the glitches shorter than 4 clock cycles. Expand at will according the clock speed and glitch duration to filter.
|
--! Debounce the glitches shorter than 4 clock cycles. Expand at will according the clock speed and glitch duration to filter.
|
signal bttn_state_fifo: unsigned(3 downto 0);
|
signal bttn_state_fifo: unsigned(3 downto 0);
|
|
|
Line 50... |
Line 45... |
begin
|
begin
|
|
|
--! invert n_rst to make it active high on design recommendation
|
--! invert n_rst to make it active high on design recommendation
|
rst <= not n_rst;
|
rst <= not n_rst;
|
|
|
BtnDebouncer:process(clk)
|
button_debouncer: process(clk)
|
begin
|
begin
|
if rising_edge(clk) then
|
if rising_edge(clk) then
|
if rst = '1' then
|
if rst = '1' then
|
bttn_state_fifo <= (others=>'1'); -- active low
|
bttn_state_fifo <= (others=>'1'); -- active low
|
bttn_state <= '0'; -- active high
|
bttn_state <= '0'; -- active high
|
Line 67... |
Line 62... |
else
|
else
|
bttn_state <= '0';
|
bttn_state <= '0';
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process; -- button_debouncer
|
|
|
|
|
AddrScanCntr:process(rst,bttn_state)
|
--! @brief User control counter to emulate ASCII codes input
|
|
--! @details Counter that goes through values from 0x00 to 0xFF in steps of 0x01 and then rolls naturally to 0x00.
|
|
--! With the counter output hex ASCII codes are emulated. The counter is incremented by clicking SW3 on ECP5-5G Versa Board.
|
|
address_scan_counter: process(rst,bttn_state)
|
begin
|
begin
|
if rst='1' then
|
if rst='1' then
|
symbol_scan_cntr <= (others=>'0');
|
symbol_scan_cntr <= (others=>'0');
|
elsif rising_edge(bttn_state) then -- TODO: Fix this to edge detector implementation
|
elsif rising_edge(bttn_state) then -- TODO: Fix this to edge detector implementation
|
symbol_scan_cntr <= symbol_scan_cntr + 1; -- I count ont the natural rolloff of this counter
|
symbol_scan_cntr <= symbol_scan_cntr + 1; -- I count ont the natural rolloff of this counter
|
end if;
|
end if;
|
end process;
|
end process; -- address_scan_counter
|
|
|
|
|
DDwD_Top:entity work.DisplayDriverwDecoder_Top
|
display_driver_with_decoder: entity work.display_driver_w_decoder
|
port map(
|
port map(
|
clk => clk,
|
clk => clk,
|
reset => rst,
|
reset => rst,
|
ascii_in => std_logic_vector(symbol_scan_cntr),
|
ascii_in => std_logic_vector(symbol_scan_cntr),
|
wr_en => '0',
|
wr_en => '0',
|
disp_data => disp_data,
|
disp_data_q => disp_data_q
|
disp_sel => disp_sel
|
|
);
|
);
|
|
|
--disp_sel <= '1' when button = '1';
|
|
|
|
end arch;
|
end arch;
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|