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 3

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
-- Project Name:    spi_master_slave
8
-- Target Devices:  Spartan-6 LX45
9
-- Tool versions:   ISE 13.1
10
-- Description: 
11
--          This is a verification project for the Digilent Atlys board, to test the SPI_MASTER, SPI_SLAVE and GRP_DEBOUNCE cores.
12
--          It uses the board's 100MHz clock input, and clocks all sequential logic at this clock.
13
--
14
--          See the "spi_master_atlys.ucf" file for pin assignments.
15
--          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
--
33
--
34
----------------------------------------------------------------------------------
35
library ieee;
36
use ieee.std_logic_1164.all;
37
use ieee.std_logic_arith.all;
38
 
39
entity debounce_atlys_top is
40
    Port (
41
        gclk_i : in std_logic := 'X';                           -- board clock input 100MHz
42
        --- input slide switches ---            
43
        sw_i : in std_logic_vector (7 downto 0);                -- 8 input slide switches
44
        --- output LEDs ----            
45
        led_o : out std_logic_vector (7 downto 0);              -- output leds
46
        --- debug outputs ---
47
        strb_o : out std_logic;                                 -- core strobe output
48
        dbg_o : out std_logic_vector (15 downto 0)              -- 16 generic debug pins
49
    );
50
end debounce_atlys_top;
51
 
52
architecture rtl of debounce_atlys_top is
53
 
54
    --=============================================================================================
55
    -- Constants
56
    --=============================================================================================
57
    -- debounce generics
58
    constant N          : integer   := 8;           -- 8 bits (8 switch inputs)
59
    constant CNT_VAL    : integer   := 1000;        -- debounce period = 1000 * 10 ns (10 us)
60
 
61
    --=============================================================================================
62
    -- Signals for internal operation
63
    --=============================================================================================
64
    --- switch debouncer signals ---
65
    signal sw_data          : std_logic_vector (7 downto 0) := (others => '0'); -- debounced switch data
66
    signal sw_reg           : std_logic_vector (7 downto 0) := (others => '0'); -- registered switch data 
67
    signal sw_new           : std_logic := '0';
68
    -- debug output signals
69
    signal leds_reg         : std_logic_vector (7 downto 0) := (others => '0');
70
    signal dbg              : std_logic_vector (15 downto 0) := (others => '0');
71
begin
72
 
73
    --=============================================================================================
74
    -- COMPONENT INSTANTIATIONS FOR THE CORES UNDER TEST
75
    --=============================================================================================
76
    -- debounce for the input switches, with new data strobe output
77
    Inst_sw_debouncer: entity work.grp_debouncer(rtl)
78
        generic map (N => N, CNT_VAL => CNT_VAL)
79
        port map(
80
            clk_i => gclk_i,                    -- system clock
81
            data_i => sw_i,                     -- noisy input data
82
            data_o => sw_data,                  -- registered stable output data
83
            strb_o => sw_new                    -- transition detection
84
        );
85
 
86
    --=============================================================================================
87
    --  REGISTER TRANSFER PROCESSES
88
    --=============================================================================================
89
    -- data registers: synchronous to the system clock
90
    dat_reg_proc : process (gclk_i) is
91
    begin
92
        -- transfer switch data when new switch is detected
93
        if gclk_i'event and gclk_i = '1' then
94
            if sw_new = '1' then                -- clock enable
95
                sw_reg <= sw_data;              -- only provide local reset for the state registers
96
            end if;
97
        end if;
98
    end process dat_reg_proc;
99
 
100
    --=============================================================================================
101
    --  COMBINATORIAL LOGIC PROCESSES
102
    --=============================================================================================
103
    -- LED register update
104
    leds_reg_proc: leds_reg <= sw_reg;          -- leds register is a copy of the updated switch register
105
 
106
    -- update debug register
107
    dbg_lo_proc: dbg(7 downto 0) <= sw_i;       -- lower debug port has debounced switch data
108
    dbg_hi_proc: dbg(15 downto 8) <= sw_data;   -- upper debug port has direct switch connections
109
 
110
 
111
    --=============================================================================================
112
    --  OUTPUT LOGIC PROCESSES
113
    --=============================================================================================
114
    -- connect leds_reg signal to LED outputs
115
    led_o_proc: led_o <= leds_reg;              -- drive the output leds
116
 
117
    --=============================================================================================
118
    --  DEBUG LOGIC PROCESSES
119
    --=============================================================================================
120
    -- connect the debug vector outputs
121
    strb_o_proc: strb_o <= sw_new;              -- connect strobe debug out
122
    dbg_o_proc: dbg_o <= dbg;                   -- drive the logic analyzer port
123
 
124
end rtl;
125
 

powered by: WebSVN 2.1.0

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