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

Subversion Repositories debouncer_vhdl

[/] [debouncer_vhdl/] [trunk/] [bench/] [debounce_atlys_top.vhd] - Blame information for rev 7

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

Line No. Rev Author Line
1 3 jdoin
----------------------------------------------------------------------------------
2
-- Author:          Jonny Doin, jdoin@opencores.org, jonnydoin@gmail.com
3
-- 
4
-- Create Date:     01:21:32 06/30/2011 
5
-- Design Name: 
6
-- Module Name:     debounce_atlys_top
7 4 jdoin
-- Project Name:    debounce_vhdl
8 3 jdoin
-- Target Devices:  Spartan-6 LX45
9
-- Tool versions:   ISE 13.1
10
-- Description: 
11 4 jdoin
--          This is a verification project for the Digilent Atlys board, to test the GRP_DEBOUNCE core.
12 3 jdoin
--          It uses the board's 100MHz clock input, and clocks all sequential logic at this clock.
13
--
14 4 jdoin
--          See the "debounce_atlys.ucf" file for pin assignments.
15 3 jdoin
--          The test circuit uses the VHDCI connector on the Atlys to implement a 16-pin debug port to be used
16
--          with a Tektronix MSO2014. The 16 debug pins are brought to 2 8x2 headers that form a umbilical
17
--          digital pod port.
18
--
19
------------------------------ REVISION HISTORY -----------------------------------------------------------------------
20
--
21
-- 2011/07/02   v0.01.0010  [JD]    implemented a wire-through from switches to LEDs, just to test the toolchain. It worked!
22
-- 2011/07/03   v0.01.0020  [JD]    added clock input, and a simple LED blinker for each LED. 
23
-- 2011/07/03   v0.01.0030  [JD]    added clear input, and instantiated a SPI_MASTER from my OpenCores project. 
24
-- 2011/07/04   v0.01.0040  [JD]    changed all clocks to clock enables, and use the 100MHz board gclk_i to clock all registers.
25
--                                  this change made the design go up to 288MHz, after synthesis.
26
-- 2011/07/07   v0.03.0050  [JD]    implemented a 16pin umbilical port for the MSO2014 in the Atlys VmodBB board, and moved all
27
--                                  external monitoring pins to the VHDCI ports.
28
-- 2011/07/10   v1.10.0075  [JD]    verified spi_master_slave at 50MHz, 25MHz, 16.666MHz, 12.5MHz, 10MHz, 8.333MHz, 7.1428MHz, 
29
--                                  6.25MHz, 1MHz and 500kHz 
30
-- 2011/07/29   v1.12.0105  [JD]    spi_master.vhd and spi_slave_vhd changed to fix CPHA='1' bug.
31
-- 2011/08/02   v1.13.0110  [JD]    testbed for continuous transfer in FPGA hardware.
32 4 jdoin
-- 2011/08/10   v1.01.0025  [JD]    changed to test the grp_debouncer.vhd module alone.
33 7 jdoin
-- 2011/08/11   v1.01.0026  [JD]    reduced switch inputs to 7, to save digital pins to the strobe signal.
34 3 jdoin
--
35
--
36
----------------------------------------------------------------------------------
37
library ieee;
38
use ieee.std_logic_1164.all;
39
use ieee.std_logic_arith.all;
40
 
41
entity debounce_atlys_top is
42
    Port (
43
        gclk_i : in std_logic := 'X';                           -- board clock input 100MHz
44
        --- input slide switches ---            
45 7 jdoin
        sw_i : in std_logic_vector (6 downto 0);                -- 7 input slide switches
46 3 jdoin
        --- output LEDs ----            
47 7 jdoin
        led_o : out std_logic_vector (6 downto 0);              -- 7 output leds
48 3 jdoin
        --- debug outputs ---
49
        dbg_o : out std_logic_vector (15 downto 0)              -- 16 generic debug pins
50
    );
51
end debounce_atlys_top;
52
 
53
architecture rtl of debounce_atlys_top is
54
 
55
    --=============================================================================================
56
    -- Constants
57
    --=============================================================================================
58
    -- debounce generics
59 7 jdoin
    constant N          : integer   := 7;           -- 7 bits (7 switch inputs)
60 6 jdoin
    constant CNT_VAL    : integer   := 5000;        -- debounce period = 1000 * 10 ns (50 us)
61 3 jdoin
 
62
    --=============================================================================================
63
    -- Signals for internal operation
64
    --=============================================================================================
65
    --- switch debouncer signals ---
66 7 jdoin
    signal sw_data          : std_logic_vector (6 downto 0) := (others => '0'); -- debounced switch data
67
    signal sw_reg           : std_logic_vector (6 downto 0) := (others => '0'); -- registered switch data 
68 3 jdoin
    signal sw_new           : std_logic := '0';
69
    -- debug output signals
70 7 jdoin
    signal leds_reg         : std_logic_vector (6 downto 0) := (others => '0');
71 3 jdoin
    signal dbg              : std_logic_vector (15 downto 0) := (others => '0');
72
begin
73
 
74
    --=============================================================================================
75
    -- COMPONENT INSTANTIATIONS FOR THE CORES UNDER TEST
76
    --=============================================================================================
77
    -- debounce for the input switches, with new data strobe output
78
    Inst_sw_debouncer: entity work.grp_debouncer(rtl)
79
        generic map (N => N, CNT_VAL => CNT_VAL)
80
        port map(
81
            clk_i => gclk_i,                    -- system clock
82
            data_i => sw_i,                     -- noisy input data
83
            data_o => sw_data,                  -- registered stable output data
84
            strb_o => sw_new                    -- transition detection
85
        );
86
 
87
    --=============================================================================================
88
    --  REGISTER TRANSFER PROCESSES
89
    --=============================================================================================
90
    -- data registers: synchronous to the system clock
91
    dat_reg_proc : process (gclk_i) is
92
    begin
93
        -- transfer switch data when new switch is detected
94
        if gclk_i'event and gclk_i = '1' then
95
            if sw_new = '1' then                -- clock enable
96
                sw_reg <= sw_data;              -- only provide local reset for the state registers
97
            end if;
98
        end if;
99
    end process dat_reg_proc;
100
 
101
    --=============================================================================================
102
    --  COMBINATORIAL LOGIC PROCESSES
103
    --=============================================================================================
104
    -- LED register update
105
    leds_reg_proc: leds_reg <= sw_reg;          -- leds register is a copy of the updated switch register
106
 
107
    -- update debug register
108 7 jdoin
    dbg_in_proc:    dbg(6 downto 0) <= sw_i;        -- lower debug port has direct switch connections
109
    dbg_out_proc:   dbg(13 downto 7) <= sw_data;    -- upper debug port has debounced switch data
110
    dbg_strb_proc:  dbg(14) <= sw_new;              -- monitor new data strobe
111 3 jdoin
 
112
 
113
    --=============================================================================================
114
    --  OUTPUT LOGIC PROCESSES
115
    --=============================================================================================
116
    -- connect leds_reg signal to LED outputs
117
    led_o_proc: led_o <= leds_reg;              -- drive the output leds
118
 
119
    --=============================================================================================
120
    --  DEBUG LOGIC PROCESSES
121
    --=============================================================================================
122
    -- connect the debug vector outputs
123
    dbg_o_proc: dbg_o <= dbg;                   -- drive the logic analyzer port
124
 
125
end rtl;
126
 

powered by: WebSVN 2.1.0

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