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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.7/] [rtl/] [bplib/] [bpgen/] [bp_swibtnled.vhd] - Blame information for rev 36

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

Line No. Rev Author Line
1 29 wfjm
-- $Id: bp_swibtnled.vhd 637 2015-01-25 18:36:40Z mueller $
2 12 wfjm
--
3
-- Copyright 2011- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
--
5
-- This program is free software; you may redistribute and/or modify it under
6
-- the terms of the GNU General Public License as published by the Free
7
-- Software Foundation, either version 2, or at your option any later version.
8
--
9
-- This program is distributed in the hope that it will be useful, but
10
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
-- for complete details.
13
--
14
------------------------------------------------------------------------------
15
-- Module Name:    bp_swibtnled - syn
16
-- Description:    Generic SWI, BTN and LED handling
17
--
18
-- Dependencies:   xlib/iob_reg_i_gen
19
--                 xlib/iob_reg_o_gen
20
--                 genlib/debounce_gen
21
--
22
-- Test bench:     -
23
--
24
-- Target Devices: generic
25 29 wfjm
-- Tool versions:  ise 11.4-14.7; viv 2014.4; ghdl 0.26-0.31
26 12 wfjm
--
27
-- Revision History: 
28
-- Date         Rev Version  Comment
29
-- 2011-07-01   386   1.0    Initial version, extracted from s3_humanio
30
------------------------------------------------------------------------------
31
--    
32
 
33
library ieee;
34
use ieee.std_logic_1164.all;
35
 
36
use work.slvtypes.all;
37
use work.xlib.all;
38
use work.genlib.all;
39
use work.bpgenlib.all;
40
 
41
-- ----------------------------------------------------------------------------
42
 
43
entity bp_swibtnled is                  -- generic SWI, BTN and LED handling
44
  generic (
45
    SWIDTH : positive := 4;             -- SWI port width
46
    BWIDTH : positive := 4;             -- BTN port width
47
    LWIDTH : positive := 4;             -- LED port width
48
    DEBOUNCE : boolean := true);        -- instantiate debouncer for SWI,BTN
49
  port (
50
    CLK : in slbit;                     -- clock
51
    RESET : in slbit := '0';            -- reset
52
    CE_MSEC : in slbit;                 -- 1 ms clock enable
53
    SWI : out slv(SWIDTH-1 downto 0);   -- switch settings, debounced
54
    BTN : out slv(BWIDTH-1 downto 0);   -- button settings, debounced
55
    LED : in slv(LWIDTH-1 downto 0);    -- led data
56
    I_SWI : in slv(SWIDTH-1 downto 0);  -- pad-i: switches
57
    I_BTN : in slv(BWIDTH-1 downto 0);  -- pad-i: buttons
58
    O_LED : out slv(LWIDTH-1 downto 0)  -- pad-o: leds
59
  );
60
end bp_swibtnled;
61
 
62
architecture syn of bp_swibtnled is
63
 
64
  signal RI_SWI :  slv(SWIDTH-1 downto 0) := (others=>'0');
65
  signal RI_BTN :  slv(BWIDTH-1 downto 0) := (others=>'0');
66
 
67
begin
68
 
69
  IOB_SWI : iob_reg_i_gen
70
    generic map (DWIDTH => SWIDTH)
71
    port map (CLK => CLK, CE => '1', DI => RI_SWI, PAD => I_SWI);
72
 
73
  IOB_BTN : iob_reg_i_gen
74
    generic map (DWIDTH => BWIDTH)
75
    port map (CLK => CLK, CE => '1', DI => RI_BTN, PAD => I_BTN);
76
 
77
  IOB_LED : iob_reg_o_gen
78
    generic map (DWIDTH => LWIDTH)
79
    port map (CLK => CLK, CE => '1', DO => LED,    PAD => O_LED);
80
 
81
  DEB: if DEBOUNCE generate
82
 
83
    DEB_SWI : debounce_gen
84
      generic map (
85
        CWIDTH => 2,
86
        CEDIV  => 3,
87
        DWIDTH => SWIDTH)
88
      port map (
89
        CLK    => CLK,
90
        RESET  => RESET,
91
        CE_INT => CE_MSEC,
92
        DI     => RI_SWI,
93
        DO     => SWI
94
      );
95
 
96
    DEB_BTN : debounce_gen
97
      generic map (
98
        CWIDTH => 2,
99
        CEDIV  => 3,
100
        DWIDTH => BWIDTH)
101
      port map (
102
        CLK    => CLK,
103
        RESET  => RESET,
104
        CE_INT => CE_MSEC,
105
        DI     => RI_BTN,
106
        DO     => BTN
107
      );
108
 
109
  end generate DEB;
110
 
111
  NODEB: if not DEBOUNCE generate
112
    SWI <= RI_SWI;
113
    BTN <= RI_BTN;
114
  end generate NODEB;
115
 
116
end syn;

powered by: WebSVN 2.1.0

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