w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
bpgenlib.vhd
Go to the documentation of this file.
1-- $Id: bpgenlib.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Package Name: bpgenlib
7-- Description: Generic Board/Part components
8--
9-- Dependencies: -
10-- Tool versions: ise 12.1-14.7; viv 2014.4-2018.2; ghdl 0.26-0.34
11-- Revision History:
12-- Date Rev Version Comment
13-- 2018-12-16 1086 1.2.3 add s7_cmt_1ce1ce
14-- 2018-08-11 1038 1.2.2 add rgbdrv_3x2mux
15-- 2017-06-05 907 1.2.1 rgbdrv_analog: add ACTLOW generic
16-- 2016-02-27 737 1.2 add rgbdrv entity
17-- 2015-01-24 637 1.1.2 add generics to sn_humanio and sn_7segctl
18-- 2013-09-21 534 1.1.1 add bp_rs232_4l4l_iob
19-- 2013-01-26 476 1.1 moved rbus depended components to bpgenrbuslib
20-- 2013-01-06 472 1.0.7 add sn_humanio_demu_rbus
21-- 2011-11-16 426 1.0.6 now numeric_std clean
22-- 2011-10-10 413 1.0.5 add sn_humanio_demu
23-- 2011-08-07 404 1.0.4 add RELAY generic for bp_rs232_2l4l_iob
24-- 2011-08-06 403 1.0.3 add RESET port for bp_rs232_2l4l_iob
25-- 2011-07-09 391 1.0.2 move in bp_rs232_2l4l_iob from s3boardlib
26-- 2011-07-08 390 1.0.1 move in sn_(4x7segctl|humanio*) from s3boardlib
27-- 2011-07-01 386 1.0 Initial version (with rs232_iob's and bp_swibtnled)
28------------------------------------------------------------------------------
29
30library ieee;
31use ieee.std_logic_1164.all;
32use ieee.numeric_std.all;
33
34use work.slvtypes.all;
35
36package bpgenlib is
37
38component bp_rs232_2line_iob is -- iob's for 2 line rs232 (RXD,TXD)
39 port (
40 CLK : in slbit; -- clock
41 RXD : out slbit; -- receive data (board view)
42 TXD : in slbit; -- transmit data (board view)
43 I_RXD : in slbit; -- pad-i: receive data (board view)
44 O_TXD : out slbit -- pad-o: transmit data (board view)
45 );
46end component;
47
48component bp_rs232_4line_iob is -- iob's for 4 line rs232 (w/ RTS,CTS)
49 port (
50 CLK : in slbit; -- clock
51 RXD : out slbit; -- receive data (board view)
52 TXD : in slbit; -- transmit data (board view)
53 CTS_N : out slbit; -- clear to send (act. low)
54 RTS_N : in slbit; -- request to send (act. low)
55 I_RXD : in slbit; -- pad-i: receive data (board view)
56 O_TXD : out slbit; -- pad-o: transmit data (board view)
57 I_CTS_N : in slbit; -- pad-i: clear to send (act. low)
58 O_RTS_N : out slbit -- pad-o: request to send (act. low)
59 );
60end component;
61
62component bp_rs232_2l4l_iob is -- iob's for dual 2l+4l rs232, w/ select
63 generic (
64 RELAY : boolean := false); -- add a relay stage towards IOB's
65 port (
66 CLK : in slbit; -- clock
67 RESET : in slbit := '0'; -- reset
68 SEL : in slbit; -- select, '0' for port 0
69 RXD : out slbit; -- receive data (board view)
70 TXD : in slbit; -- transmit data (board view)
71 CTS_N : out slbit; -- clear to send (act. low)
72 RTS_N : in slbit; -- request to send (act. low)
73 I_RXD0 : in slbit; -- pad-i: p0: receive data (board view)
74 O_TXD0 : out slbit; -- pad-o: p0: transmit data (board view)
75 I_RXD1 : in slbit; -- pad-i: p1: receive data (board view)
76 O_TXD1 : out slbit; -- pad-o: p1: transmit data (board view)
77 I_CTS1_N : in slbit; -- pad-i: p1: clear to send (act. low)
78 O_RTS1_N : out slbit -- pad-o: p1: request to send (act. low)
79 );
80end component;
81
82component bp_rs232_4l4l_iob is -- iob's for dual 4l+4l rs232, w/ select
83 generic (
84 RELAY : boolean := false); -- add a relay stage towards IOB's
85 port (
86 CLK : in slbit; -- clock
87 RESET : in slbit := '0'; -- reset
88 SEL : in slbit; -- select, '0' for port 0
89 RXD : out slbit; -- receive data (board view)
90 TXD : in slbit; -- transmit data (board view)
91 CTS_N : out slbit; -- clear to send (act. low)
92 RTS_N : in slbit; -- request to send (act. low)
93 I_RXD0 : in slbit; -- pad-i: p0: receive data (board view)
94 O_TXD0 : out slbit; -- pad-o: p0: transmit data (board view)
95 I_CTS0_N : in slbit; -- pad-i: p0: clear to send (act. low)
96 O_RTS0_N : out slbit; -- pad-o: p0: request to send (act. low)
97 I_RXD1 : in slbit; -- pad-i: p1: receive data (board view)
98 O_TXD1 : out slbit; -- pad-o: p1: transmit data (board view)
99 I_CTS1_N : in slbit; -- pad-i: p1: clear to send (act. low)
100 O_RTS1_N : out slbit -- pad-o: p1: request to send (act. low)
101 );
102end component;
103
104component bp_swibtnled is -- generic SWI, BTN and LED handling
105 generic (
106 SWIDTH : positive := 4; -- SWI port width
107 BWIDTH : positive := 4; -- BTN port width
108 LWIDTH : positive := 4; -- LED port width
109 DEBOUNCE : boolean := true); -- instantiate debouncer for SWI,BTN
110 port (
111 CLK : in slbit; -- clock
112 RESET : in slbit := '0'; -- reset
113 CE_MSEC : in slbit; -- 1 ms clock enable
114 SWI : out slv(SWIDTH-1 downto 0); -- switch settings, debounced
115 BTN : out slv(BWIDTH-1 downto 0); -- button settings, debounced
116 LED : in slv(LWIDTH-1 downto 0); -- led data
117 I_SWI : in slv(SWIDTH-1 downto 0); -- pad-i: switches
118 I_BTN : in slv(BWIDTH-1 downto 0); -- pad-i: buttons
119 O_LED : out slv(LWIDTH-1 downto 0) -- pad-o: leds
120 );
121end component;
122
123component sn_7segctl is -- 7 segment display controller
124 generic (
125 DCWIDTH : positive := 2; -- digit counter width (2 or 3)
126 CDWIDTH : positive := 6); -- clk divider width (must be >= 5)
127 port (
128 CLK : in slbit; -- clock
129 DIN : in slv(4*(2**DCWIDTH)-1 downto 0); -- data 16 or 32
130 DP : in slv((2**DCWIDTH)-1 downto 0); -- decimal points 4 or 8
131 ANO_N : out slv((2**DCWIDTH)-1 downto 0); -- anodes (act.low) 4 or 8
132 SEG_N : out slv8 -- segements (act.low)
133 );
134end component;
135
136component sn_humanio is -- human i/o handling: swi,btn,led,dsp
137 generic (
138 SWIDTH : positive := 8; -- SWI port width
139 BWIDTH : positive := 4; -- BTN port width
140 LWIDTH : positive := 8; -- LED port width
141 DCWIDTH : positive := 2; -- digit counter width (2 or 3)
142 DEBOUNCE : boolean := true); -- instantiate debouncer for SWI,BTN
143 port (
144 CLK : in slbit; -- clock
145 RESET : in slbit := '0'; -- reset
146 CE_MSEC : in slbit; -- 1 ms clock enable
147 SWI : out slv(SWIDTH-1 downto 0); -- switch settings, debounced
148 BTN : out slv(BWIDTH-1 downto 0); -- button settings, debounced
149 LED : in slv(LWIDTH-1 downto 0); -- led data
150 DSP_DAT : in slv(4*(2**DCWIDTH)-1 downto 0); -- display data
151 DSP_DP : in slv((2**DCWIDTH)-1 downto 0); -- display decimal points
152 I_SWI : in slv(SWIDTH-1 downto 0); -- pad-i: switches
153 I_BTN : in slv(BWIDTH-1 downto 0); -- pad-i: buttons
154 O_LED : out slv(LWIDTH-1 downto 0); -- pad-o: leds
155 O_ANO_N : out slv((2**DCWIDTH)-1 downto 0); -- pad-o: disp: anodes (act.low)
156 O_SEG_N : out slv8 -- pad-o: disp: segments (act.low)
157 );
158end component;
159
160component sn_humanio_demu is -- human i/o handling: swi,btn,led only
161 generic (
162 DEBOUNCE : boolean := true); -- instantiate debouncer for SWI,BTN
163 port (
164 CLK : in slbit; -- clock
165 RESET : in slbit := '0'; -- reset
166 CE_MSEC : in slbit; -- 1 ms clock enable
167 SWI : out slv8; -- switch settings, debounced
168 BTN : out slv4; -- button settings, debounced
169 LED : in slv8; -- led data
170 DSP_DAT : in slv16; -- display data
171 DSP_DP : in slv4; -- display decimal points
172 I_SWI : in slv8; -- pad-i: switches
173 I_BTN : in slv6; -- pad-i: buttons
174 O_LED : out slv8 -- pad-o: leds
175 );
176end component;
177
178component rgbdrv_master is -- rgbled driver: master
179 generic (
180 DWIDTH : positive := 8); -- dimmer width
181 port (
182 CLK : in slbit; -- clock
183 RESET : in slbit := '0'; -- reset
184 CE_USEC : in slbit; -- 1 us clock enable
185 RGBCNTL : out slv3; -- rgb control
186 DIMCNTL : out slv(DWIDTH-1 downto 0) -- dim control
187 );
188end component;
189
190component rgbdrv_analog is -- rgbled driver: analog channel
191 generic (
192 DWIDTH : positive := 8; -- dimmer width
193 ACTLOW : slbit := '0'); -- invert output polarity
194 port (
195 CLK : in slbit; -- clock
196 RESET : in slbit := '0'; -- reset
197 RGBCNTL : in slv3; -- rgb control
198 DIMCNTL : in slv(DWIDTH-1 downto 0);-- dim control
199 DIMR : in slv(DWIDTH-1 downto 0); -- dim red
200 DIMG : in slv(DWIDTH-1 downto 0); -- dim green
201 DIMB : in slv(DWIDTH-1 downto 0); -- dim blue
202 O_RGBLED : out slv3 -- pad-o: rgb led
203 );
204end component;
205
206component rgbdrv_binary is -- rgbled driver: binary channel
207 generic (
208 DWIDTH : positive := 8); -- dimmer width
209 port (
210 CLK : in slbit; -- clock
211 RESET : in slbit := '0'; -- reset
212 RGBCNTL : in slv3; -- rgb control
213 DIMCNTL : in slv(DWIDTH-1 downto 0);-- dim control
214 DIM : in slv(DWIDTH-1 downto 0); -- dim
215 ENARGB : in slv3; -- enable [0] red [1] green [2] blue
216 O_RGBLED : out slv3 -- pad-o: rgb led
217 );
218end component;
219
220component rgbdrv_3x4mux is -- rgbled driver: mux three 4bit inputs
221 port (
222 CLK : in slbit; -- clock
223 RESET : in slbit := '0'; -- reset
224 CE_USEC : in slbit; -- 1 us clock enable
225 DATR : in slv4; -- red data
226 DATG : in slv4; -- green data
227 DATB : in slv4; -- blue data
228 O_RGBLED0 : out slv3; -- pad-o: rgb led 0
229 O_RGBLED1 : out slv3; -- pad-o: rgb led 1
230 O_RGBLED2 : out slv3; -- pad-o: rgb led 2
231 O_RGBLED3 : out slv3 -- pad-o: rgb led 3
232 );
233end component;
234
235component rgbdrv_3x2mux is -- rgbled driver: mux three 2bit inputs
236 port (
237 CLK : in slbit; -- clock
238 RESET : in slbit := '0'; -- reset
239 CE_USEC : in slbit; -- 1 us clock enable
240 DATR : in slv2; -- red data
241 DATG : in slv2; -- green data
242 DATB : in slv2; -- blue data
243 O_RGBLED0 : out slv3; -- pad-o: rgb led 0
244 O_RGBLED1 : out slv3 -- pad-o: rgb led 1
245 );
246end component;
247
248component s7_cmt_1ce1ce is -- clocking block: 2 clk+CEs
249 generic (
250 CLKIN_PERIOD : real := 10.0; -- CLKIN period (def is 10.0 ns)
251 CLKIN_JITTER : real := 0.01; -- CLKIN jitter (def is 10 ps)
252 STARTUP_WAIT : boolean := false; -- hold FPGA startup till LOCKED
253 CLK0_VCODIV : positive := 1; -- clk0: vco clock divide
254 CLK0_VCOMUL : positive := 1; -- clk0: vco clock multiply
255 CLK0_OUTDIV : positive := 1; -- clk0: output divide
256 CLK0_GENTYPE : string := "PLL"; -- clk0: PLL or MMCM
257 CLK0_CDUWIDTH : positive := 7; -- clk0: usec clock divider width
258 CLK0_USECDIV : positive := 50; -- clk0: divider ratio for usec pulse
259 CLK0_MSECDIV : positive := 1000; -- clk0: divider ratio for msec pulse
260 CLK1_VCODIV : positive := 1; -- clk1: vco clock divide
261 CLK1_VCOMUL : positive := 1; -- clk1: vco clock multiply
262 CLK1_OUTDIV : positive := 1; -- clk1: output divide
263 CLK1_GENTYPE : string := "MMCM"; -- clk1: PLL or MMCM
264 CLK1_CDUWIDTH : positive := 7; -- clk1: usec clock divider width
265 CLK1_USECDIV : positive := 50; -- clk1: divider ratio for usec pulse
266 CLK1_MSECDIV : positive := 1000); -- clk1: divider ratio for msec pulse
267 port (
268 CLKIN : in slbit; -- clock input
269 CLK0 : out slbit; -- clk0: clock output
270 CE0_USEC : out slbit; -- clk0: usec pulse
271 CE0_MSEC : out slbit; -- clk0: msec pulse
272 CLK1 : out slbit; -- clk1: clock output
273 CE1_USEC : out slbit; -- clk1: usec pulse
274 CE1_MSEC : out slbit; -- clk1: msec pulse
275 LOCKED : out slbit -- all PLL/MMCM locked
276 );
277end component;
278
279component s7_cmt_1ce1ce2c is -- clocking block: 2 clk+CEs; 2 clk
280 generic (
281 CLKIN_PERIOD : real := 10.0; -- CLKIN period (def is 10.0 ns)
282 CLKIN_JITTER : real := 0.01; -- CLKIN jitter (def is 10 ps)
283 STARTUP_WAIT : boolean := false; -- hold FPGA startup till LOCKED
284 CLK0_VCODIV : positive := 1; -- clk0: vco clock divide
285 CLK0_VCOMUL : positive := 1; -- clk0: vco clock multiply
286 CLK0_OUTDIV : positive := 1; -- clk0: output divide
287 CLK0_GENTYPE : string := "PLL"; -- clk0: PLL or MMCM
288 CLK0_CDUWIDTH : positive := 7; -- clk0: usec clock divider width
289 CLK0_USECDIV : positive := 50; -- clk0: divider ratio for usec pulse
290 CLK0_MSECDIV : positive := 1000; -- clk0: divider ratio for msec pulse
291 CLK1_VCODIV : positive := 1; -- clk1: vco clock divide
292 CLK1_VCOMUL : positive := 1; -- clk1: vco clock multiply
293 CLK1_OUTDIV : positive := 1; -- clk1: output divide
294 CLK1_GENTYPE : string := "MMCM"; -- clk1: PLL or MMCM
295 CLK1_CDUWIDTH : positive := 7; -- clk1: usec clock divider width
296 CLK1_USECDIV : positive := 50; -- clk1: divider ratio for usec pulse
297 CLK1_MSECDIV : positive := 1000; -- clk1: divider ratio for msec pulse
298 CLK23_VCODIV : positive := 1; -- clk2+3: vco clock divide
299 CLK23_VCOMUL : positive := 1; -- clk2+3: vco clock multiply
300 CLK2_OUTDIV : positive := 1; -- clk2: output divide
301 CLK3_OUTDIV : positive := 1; -- clk3: output divide
302 CLK23_GENTYPE : string := "PLL"); -- clk2+3: PLL or MMCM
303 port (
304 CLKIN : in slbit; -- clock input
305 CLK0 : out slbit; -- clk0: clock output
306 CE0_USEC : out slbit; -- clk0: usec pulse
307 CE0_MSEC : out slbit; -- clk0: msec pulse
308 CLK1 : out slbit; -- clk1: clock output
309 CE1_USEC : out slbit; -- clk1: usec pulse
310 CE1_MSEC : out slbit; -- clk1: msec pulse
311 CLK2 : out slbit; -- clk2: clock output
312 CLK3 : out slbit; -- clk3: clock output
313 LOCKED : out slbit -- all PLL/MMCM locked
314 );
315end component;
316
317end package bpgenlib;
RELAY boolean := false
in RESET slbit := '0'
DEBOUNCE boolean := true
SWIDTH positive := 4
out O_LED slv( LWIDTH- 1 downto 0)
out SWI slv( SWIDTH- 1 downto 0)
in I_BTN slv( BWIDTH- 1 downto 0)
LWIDTH positive := 4
in I_SWI slv( SWIDTH- 1 downto 0)
out BTN slv( BWIDTH- 1 downto 0)
in CLK slbit
BWIDTH positive := 4
in LED slv( LWIDTH- 1 downto 0)
in RESET slbit := '0'
in CE_MSEC slbit
in CE_USEC slbit
in CLK slbit
out O_RGBLED0 slv3
in RESET slbit := '0'
out O_RGBLED1 slv3
in CE_USEC slbit
out O_RGBLED3 slv3
in CLK slbit
out O_RGBLED0 slv3
out O_RGBLED2 slv3
in RESET slbit := '0'
out O_RGBLED1 slv3
in RGBCNTL slv3
DWIDTH positive := 8
out O_RGBLED slv3
in DIMB slv( DWIDTH- 1 downto 0)
in DIMCNTL slv( DWIDTH- 1 downto 0)
in DIMG slv( DWIDTH- 1 downto 0)
ACTLOW slbit := '0'
in CLK slbit
in DIMR slv( DWIDTH- 1 downto 0)
in RESET slbit := '0'
DWIDTH positive := 8
in CE_USEC slbit
in CLK slbit
in RESET slbit := '0'
out RGBCNTL slv3
out DIMCNTL slv( DWIDTH- 1 downto 0)
CLK1_GENTYPE string := "MMCM"
CLK0_VCODIV positive := 1
CLKIN_PERIOD real := 10.0
out CE0_MSEC slbit
CLK1_MSECDIV positive := 1000
CLK0_CDUWIDTH positive := 7
CLK2_OUTDIV positive := 1
CLK1_VCOMUL positive := 1
CLK1_VCODIV positive := 1
out CE0_USEC slbit
CLK23_VCODIV positive := 1
CLK0_MSECDIV positive := 1000
CLK1_CDUWIDTH positive := 7
CLKIN_JITTER real := 0.01
STARTUP_WAIT boolean := false
out CE1_USEC slbit
CLK0_USECDIV positive := 50
CLK23_GENTYPE string := "PLL"
out CE1_MSEC slbit
CLK0_OUTDIV positive := 1
CLK23_VCOMUL positive := 1
CLK0_GENTYPE string := "PLL"
CLK1_OUTDIV positive := 1
CLK0_VCOMUL positive := 1
CLK1_USECDIV positive := 50
CLK3_OUTDIV positive := 1
CLK1_GENTYPE string := "MMCM"
CLK0_VCODIV positive := 1
CLKIN_PERIOD real := 10.0
out CE0_MSEC slbit
CLK1_MSECDIV positive := 1000
CLK0_CDUWIDTH positive := 7
in CLKIN slbit
CLK1_VCOMUL positive := 1
CLK1_VCODIV positive := 1
out CE0_USEC slbit
out CLK0 slbit
CLK0_MSECDIV positive := 1000
CLK1_CDUWIDTH positive := 7
out CLK1 slbit
CLKIN_JITTER real := 0.01
STARTUP_WAIT boolean := false
out CE1_USEC slbit
CLK0_USECDIV positive := 50
out CE1_MSEC slbit
CLK0_OUTDIV positive := 1
out LOCKED slbit
CLK0_GENTYPE string := "PLL"
CLK1_OUTDIV positive := 1
CLK0_VCOMUL positive := 1
CLK1_USECDIV positive := 50
std_logic_vector( 3 downto 0) slv4
Definition: slvtypes.vhd:36
std_logic_vector( 2 downto 0) slv3
Definition: slvtypes.vhd:35
std_logic slbit
Definition: slvtypes.vhd:30
std_logic_vector( 7 downto 0) slv8
Definition: slvtypes.vhd:40
std_logic_vector( 1 downto 0) slv2
Definition: slvtypes.vhd:34
std_logic_vector slv
Definition: slvtypes.vhd:31
in DIN slv( 4*( 2** DCWIDTH)- 1 downto 0)
Definition: sn_7segctl.vhd:46
out ANO_N slv(( 2** DCWIDTH)- 1 downto 0)
Definition: sn_7segctl.vhd:48
DCWIDTH positive := 2
Definition: sn_7segctl.vhd:42
in CLK slbit
Definition: sn_7segctl.vhd:45
CDWIDTH positive := 6
Definition: sn_7segctl.vhd:43
out SEG_N slv8
Definition: sn_7segctl.vhd:50
in DP slv(( 2** DCWIDTH)- 1 downto 0)
Definition: sn_7segctl.vhd:47
in DSP_DP slv(( 2** DCWIDTH)- 1 downto 0)
Definition: sn_humanio.vhd:63
DEBOUNCE boolean := true
Definition: sn_humanio.vhd:54
out O_LED slv( LWIDTH- 1 downto 0)
Definition: sn_humanio.vhd:66
in DSP_DAT slv( 4*( 2** DCWIDTH)- 1 downto 0)
Definition: sn_humanio.vhd:62
DCWIDTH positive := 2
Definition: sn_humanio.vhd:53
out SWI slv( SWIDTH- 1 downto 0)
Definition: sn_humanio.vhd:59
in I_BTN slv( BWIDTH- 1 downto 0)
Definition: sn_humanio.vhd:65
LWIDTH positive := 8
Definition: sn_humanio.vhd:52
in I_SWI slv( SWIDTH- 1 downto 0)
Definition: sn_humanio.vhd:64
out O_SEG_N slv8
Definition: sn_humanio.vhd:69
SWIDTH positive := 8
Definition: sn_humanio.vhd:50
out BTN slv( BWIDTH- 1 downto 0)
Definition: sn_humanio.vhd:60
in CLK slbit
Definition: sn_humanio.vhd:56
BWIDTH positive := 4
Definition: sn_humanio.vhd:51
out O_ANO_N slv(( 2** DCWIDTH)- 1 downto 0)
Definition: sn_humanio.vhd:67
in LED slv( LWIDTH- 1 downto 0)
Definition: sn_humanio.vhd:61
in RESET slbit := '0'
Definition: sn_humanio.vhd:57
in CE_MSEC slbit
Definition: sn_humanio.vhd:58