1 |
29 |
wfjm |
-- $Id: bpgenrbuslib.vhd 637 2015-01-25 18:36:40Z mueller $
|
2 |
12 |
wfjm |
--
|
3 |
29 |
wfjm |
-- Copyright 2013-2015 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
4 |
12 |
wfjm |
--
|
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 |
19 |
wfjm |
-- Package Name: bpgenrbuslib
|
16 |
|
|
-- Description: Generic Board/Part components using rbus
|
17 |
12 |
wfjm |
--
|
18 |
|
|
-- Dependencies: -
|
19 |
29 |
wfjm |
-- Tool versions: ise 12.1-14.7; viv 2014.4; ghdl 0.26-0.31
|
20 |
12 |
wfjm |
-- Revision History:
|
21 |
|
|
-- Date Rev Version Comment
|
22 |
29 |
wfjm |
-- 2015-01-25 637 1.2 add generics to sn_humanio_rbus
|
23 |
27 |
wfjm |
-- 2014-08-15 583 1.1 rb_mreq addr now 16 bit
|
24 |
19 |
wfjm |
-- 2013-01-26 476 1.0 Initial version (extracted from bpgenlib)
|
25 |
12 |
wfjm |
------------------------------------------------------------------------------
|
26 |
|
|
|
27 |
|
|
library ieee;
|
28 |
|
|
use ieee.std_logic_1164.all;
|
29 |
13 |
wfjm |
use ieee.numeric_std.all;
|
30 |
12 |
wfjm |
|
31 |
|
|
use work.slvtypes.all;
|
32 |
|
|
use work.rblib.all;
|
33 |
|
|
|
34 |
19 |
wfjm |
package bpgenrbuslib is
|
35 |
12 |
wfjm |
|
36 |
|
|
component bp_swibtnled_rbus is -- swi,btn,led handling /w rbus icept
|
37 |
|
|
generic (
|
38 |
|
|
SWIDTH : positive := 4; -- SWI port width
|
39 |
|
|
BWIDTH : positive := 4; -- BTN port width
|
40 |
|
|
LWIDTH : positive := 4; -- LED port width
|
41 |
|
|
DEBOUNCE : boolean := true; -- instantiate debouncer for SWI,BTN
|
42 |
29 |
wfjm |
RB_ADDR : slv16 := slv(to_unsigned(16#fef0#,16)));
|
43 |
12 |
wfjm |
port (
|
44 |
|
|
CLK : in slbit; -- clock
|
45 |
|
|
RESET : in slbit := '0'; -- reset
|
46 |
|
|
CE_MSEC : in slbit; -- 1 ms clock enable
|
47 |
|
|
RB_MREQ : in rb_mreq_type; -- rbus: request
|
48 |
|
|
RB_SRES : out rb_sres_type; -- rbus: response
|
49 |
|
|
SWI : out slv(SWIDTH-1 downto 0); -- switch settings, debounced
|
50 |
|
|
BTN : out slv(BWIDTH-1 downto 0); -- button settings, debounced
|
51 |
|
|
LED : in slv(LWIDTH-1 downto 0); -- led data
|
52 |
|
|
I_SWI : in slv(SWIDTH-1 downto 0); -- pad-i: switches
|
53 |
|
|
I_BTN : in slv(BWIDTH-1 downto 0); -- pad-i: buttons
|
54 |
|
|
O_LED : out slv(LWIDTH-1 downto 0) -- pad-o: leds
|
55 |
|
|
);
|
56 |
|
|
end component;
|
57 |
|
|
|
58 |
|
|
component sn_humanio_rbus is -- human i/o handling /w rbus intercept
|
59 |
|
|
generic (
|
60 |
29 |
wfjm |
SWIDTH : positive := 8; -- SWI port width
|
61 |
12 |
wfjm |
BWIDTH : positive := 4; -- BTN port width
|
62 |
29 |
wfjm |
LWIDTH : positive := 8; -- LED port width
|
63 |
|
|
DCWIDTH : positive := 2; -- digit counter width (2 or 3)
|
64 |
12 |
wfjm |
DEBOUNCE : boolean := true; -- instantiate debouncer for SWI,BTN
|
65 |
29 |
wfjm |
RB_ADDR : slv16 := slv(to_unsigned(16#fef0#,16)));
|
66 |
12 |
wfjm |
port (
|
67 |
|
|
CLK : in slbit; -- clock
|
68 |
|
|
RESET : in slbit := '0'; -- reset
|
69 |
|
|
CE_MSEC : in slbit; -- 1 ms clock enable
|
70 |
|
|
RB_MREQ : in rb_mreq_type; -- rbus: request
|
71 |
|
|
RB_SRES : out rb_sres_type; -- rbus: response
|
72 |
29 |
wfjm |
SWI : out slv(SWIDTH-1 downto 0); -- switch settings, debounced
|
73 |
12 |
wfjm |
BTN : out slv(BWIDTH-1 downto 0); -- button settings, debounced
|
74 |
29 |
wfjm |
LED : in slv(LWIDTH-1 downto 0); -- led data
|
75 |
|
|
DSP_DAT : in slv(4*(2**DCWIDTH)-1 downto 0); -- display data
|
76 |
|
|
DSP_DP : in slv((2**DCWIDTH)-1 downto 0); -- display decimal points
|
77 |
|
|
I_SWI : in slv(SWIDTH-1 downto 0); -- pad-i: switches
|
78 |
12 |
wfjm |
I_BTN : in slv(BWIDTH-1 downto 0); -- pad-i: buttons
|
79 |
29 |
wfjm |
O_LED : out slv(LWIDTH-1 downto 0); -- pad-o: leds
|
80 |
|
|
O_ANO_N : out slv((2**DCWIDTH)-1 downto 0); -- pad-o: disp: anodes (act.low)
|
81 |
|
|
O_SEG_N : out slv8 -- pad-o: disp: segments (act.low)
|
82 |
12 |
wfjm |
);
|
83 |
|
|
end component;
|
84 |
|
|
|
85 |
18 |
wfjm |
component sn_humanio_demu_rbus is -- human i/o swi,btn,led only /w rbus
|
86 |
|
|
generic (
|
87 |
|
|
DEBOUNCE : boolean := true; -- instantiate debouncer for SWI,BTN
|
88 |
29 |
wfjm |
RB_ADDR : slv16 := slv(to_unsigned(16#fef0#,16)));
|
89 |
18 |
wfjm |
port (
|
90 |
|
|
CLK : in slbit; -- clock
|
91 |
|
|
RESET : in slbit := '0'; -- reset
|
92 |
|
|
CE_MSEC : in slbit; -- 1 ms clock enable
|
93 |
|
|
RB_MREQ : in rb_mreq_type; -- rbus: request
|
94 |
|
|
RB_SRES : out rb_sres_type; -- rbus: response
|
95 |
|
|
SWI : out slv8; -- switch settings, debounced
|
96 |
|
|
BTN : out slv4; -- button settings, debounced
|
97 |
|
|
LED : in slv8; -- led data
|
98 |
|
|
DSP_DAT : in slv16; -- display data
|
99 |
|
|
DSP_DP : in slv4; -- display decimal points
|
100 |
|
|
I_SWI : in slv8; -- pad-i: switches
|
101 |
|
|
I_BTN : in slv6; -- pad-i: buttons
|
102 |
|
|
O_LED : out slv8 -- pad-o: leds
|
103 |
|
|
);
|
104 |
|
|
end component;
|
105 |
|
|
|
106 |
19 |
wfjm |
end package bpgenrbuslib;
|