w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
sys_w11a_br_arty.vhd
Go to the documentation of this file.
1-- $Id: sys_w11a_br_arty.vhd 1211 2021-08-28 11:20:34Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2016-2019 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: sys_w11a_br_arty - syn
7-- Description: w11a test design for arty
8--
9-- Dependencies: bplib/bpgen/s7_cmt_1ce1ce
10-- bplib/bpgen/bp_rs232_2line_iob
11-- vlib/rlink/rlink_sp2c
12-- w11a/pdp11_sys70
13-- ibus/ibdr_maxisys
14-- w11a/pdp11_bram_memctl
15-- vlib/rlink/ioleds_sp1c
16-- pdp11_hio70_arty
17-- bplib/bpgen/bp_swibtnled
18-- bplib/bpgen/rgbdrv_3x4mux
19-- bplib/sysmon/sysmonx_rbus_arty
20-- vlib/rbus/rbd_usracc
21-- vlib/rbus/rb_sres_or_3
22--
23-- Test bench: tb/tb_sys_w11a_br_arty
24--
25-- Target Devices: generic
26-- Tool versions: viv 2015.4-2018.3; ghdl 0.33-0.35
27--
28-- Synthesized:
29-- Date Rev viv Target flop lutl lutm bram slic
30-- 2019-05-19 1150 2017.2 xc7a35t-1 2829 6226 273 48.0 8150 +dz11
31-- 2019-02-02 1108 2018.3 xc7a35t-1 2571 5781 170 47.5 1780
32-- 2019-02-02 1108 2017.2 xc7a35t-1 2560 5496 170 47.5 1722
33-- 2018-10-13 1055 2017.2 xc7a35t-1 2560 5499 170 47.5 1699 +dmpcnt
34-- 2018-09-15 1045 2017.2 xc7a35t-1 2337 5188 138 47.5 1611 +KW11P
35-- 2018-08-11 1038 2018.2 xc7a35t-1 2283 5190 138 47.5 1602
36-- 2018-08-11 1038 2018.1 xc7a35t-1 2283 5193 138 47.5 1616
37-- 2018-08-11 1038 2017.4 xc7a35t-1 2278 5130 138 47.5 1541
38-- 2018-08-11 1038 2017.2 xc7a35t-1 2275 5104 138 47.5 1581
39-- 2018-08-11 1038 2017.1 xc7a35t-1 2275 5104 138 47.5 1581
40-- 2017-04-16 881 2016.4 xc7a35t-1 2275 5104 138 47.5 1611 +DEUNA
41-- 2017-01-29 846 2016.4 xc7a35t-1 2225 5100 138 47.5 1555 +int24
42-- 2016-05-26 768 2016.1 xc7a35t-1 2226 5080 138 47.5 1569 fsm+dsm=0
43-- 2016-03-29 756 2015.4 xc7a35t-1 2106 4428 138 48.5 1397 serport2
44-- 2016-03-27 753 2015.4 xc7a35t-1 1995 4298 138 48.5 1349 meminf
45-- 2016-03-13 742 2015.4 xc7a35t-1 1996 4309 162 48.5 1333 +XADC
46-- 2016-02-27 737 2015.4 xc7a35t-1 1952 4246 162 48.5 1316
47--
48-- Revision History:
49-- Date Rev Version Comment
50-- 2018-12-16 1086 1.4 use s7_cmt_1ce1ce
51-- 2018-10-13 1055 1.3 use DM_STAT_EXP; IDEC to maxisys; setup PERFEXT
52-- 2016-04-02 758 1.2.1 add rbd_usracc (bitfile+jtag timestamp access)
53-- 2016-03-28 755 1.2 use serport_2clock2
54-- 2016-03-19 748 1.1.2 define rlink SYSID
55-- 2016-03-13 742 1.1.1 add sysmon_rbus
56-- 2016-03-06 740 1.1 add A_VPWRN/P to baseline config
57-- 2016-02-27 736 1.0 Initial version (derived from sys_w11a_b3)
58------------------------------------------------------------------------------
59--
60-- w11a test design for arty (using BRAM as memory)
61-- w11a + rlink + serport
62--
63-- Usage of Arty switches, Buttons, LEDs
64--
65-- SWI(3:0): determine what is displayed in the LEDs and RGBLEDs
66-- 00xy LED shows IO
67-- y=1 enables CPU activities on RGB_G,RGB_R
68-- x=1 enables MEM activities on RGB_B
69-- 0100 LED+RGB give DR emulation 'light show'
70-- 1xyy LED+RGB show low (x=0) or high (x=1) byte of
71-- yy = 00: abclkdiv & abclkdiv_f
72-- 01: PC
73-- 10: DISPREG
74-- 11: DR emulation
75-- LED shows upper, RGB low nibble of the byte selected by x
76--
77-- LED and RGB assignment for SWI=00xy
78-- LED IO activity
79-- (3) not SER_MONI.txok (shows tx back pressure)
80-- (2) SER_MONI.txact (shows tx activity)
81-- (1) not SER_MONI.rxok (shows rx back pressure)
82-- (0) SER_MONI.rxact (shows rx activity)
83-- RGB_G CPU busy (active cpugo=1, enabled with SWI(0))
84-- (3) kernel mode, non-wait, pri>0
85-- (2) kernel mode, non-wait, pri=0
86-- (1) supervisor mode
87-- (0) user mode
88-- RGB_R CPU rust (active cpugo=0, enabled with SWI(0))
89-- (3:0) cpurust code
90-- RGB_B MEM/cmd busy (enabled with SWI(1))
91-- (3) MEM_ACT_W
92-- (2) MEM_ACT_R
93-- (1) cmdbusy (all rlink access, mostly rdma)
94-- (0) not cpugo
95--
96-- LED and RGB assignment for SWI=0100 (DR emulation)
97-- LED DR(15:12)
98-- RGB_B DR(11:08)
99-- RGB_G DR( 7:04)
100-- RGB_R DR( 3:00)
101--
102
103library ieee;
104use ieee.std_logic_1164.all;
105use ieee.numeric_std.all;
106
107use work.slvtypes.all;
108use work.serportlib.all;
109use work.rblib.all;
110use work.rbdlib.all;
111use work.rlinklib.all;
112use work.bpgenlib.all;
113use work.sysmonrbuslib.all;
114use work.iblib.all;
115use work.ibdlib.all;
116use work.pdp11.all;
117use work.sys_conf.all;
118
119-- ----------------------------------------------------------------------------
120
121entity sys_w11a_br_arty is -- top level
122 -- implements arty_aif
123 port (
124 I_CLK100 : in slbit; -- 100 MHz clock
125 I_RXD : in slbit; -- receive data (board view)
126 O_TXD : out slbit; -- transmit data (board view)
127 I_SWI : in slv4; -- arty switches
128 I_BTN : in slv4; -- arty buttons
129 O_LED : out slv4; -- arty leds
130 O_RGBLED0 : out slv3; -- arty rgb-led 0
131 O_RGBLED1 : out slv3; -- arty rgb-led 1
132 O_RGBLED2 : out slv3; -- arty rgb-led 2
133 O_RGBLED3 : out slv3; -- arty rgb-led 3
134 A_VPWRN : in slv4; -- arty pwrmon (neg)
135 A_VPWRP : in slv4 -- arty pwrmon (pos)
136 );
138
139architecture syn of sys_w11a_br_arty is
140
141 signal CLK : slbit := '0';
142
143 signal RESET : slbit := '0';
144 signal CE_USEC : slbit := '0';
145 signal CE_MSEC : slbit := '0';
146
147 signal CLKS : slbit := '0';
148 signal CES_MSEC : slbit := '0';
149
150 signal RXD : slbit := '1';
151 signal TXD : slbit := '0';
152
153 signal RB_MREQ : rb_mreq_type := rb_mreq_init;
154 signal RB_SRES : rb_sres_type := rb_sres_init;
155 signal RB_SRES_CPU : rb_sres_type := rb_sres_init;
156 signal RB_SRES_SYSMON : rb_sres_type := rb_sres_init;
157 signal RB_SRES_USRACC : rb_sres_type := rb_sres_init;
158
159 signal RB_LAM : slv16 := (others=>'0');
160 signal RB_STAT : slv4 := (others=>'0');
161
162 signal SER_MONI : serport_moni_type := serport_moni_init;
163
164 signal GRESET : slbit := '0'; -- general reset (from rbus)
165 signal CRESET : slbit := '0'; -- cpu reset (from cp)
166 signal BRESET : slbit := '0'; -- bus reset (from cp or cpu)
167 signal PERFEXT : slv8 := (others=>'0');
168
169 signal EI_PRI : slv3 := (others=>'0');
170 signal EI_VECT : slv9_2 := (others=>'0');
171 signal EI_ACKM : slbit := '0';
172 signal CP_STAT : cp_stat_type := cp_stat_init;
173 signal DM_STAT_EXP : dm_stat_exp_type := dm_stat_exp_init;
174
175 signal MEM_REQ : slbit := '0';
176 signal MEM_WE : slbit := '0';
177 signal MEM_BUSY : slbit := '0';
178 signal MEM_ACK_R : slbit := '0';
179 signal MEM_ACT_R : slbit := '0';
180 signal MEM_ACT_W : slbit := '0';
181 signal MEM_ADDR : slv20 := (others=>'0');
182 signal MEM_BE : slv4 := (others=>'0');
183 signal MEM_DI : slv32 := (others=>'0');
184 signal MEM_DO : slv32 := (others=>'0');
185
186 signal IB_MREQ : ib_mreq_type := ib_mreq_init;
187 signal IB_SRES_IBDR : ib_sres_type := ib_sres_init;
188
189 signal DISPREG : slv16 := (others=>'0');
190 signal ABCLKDIV : slv16 := (others=>'0');
191 signal IOLEDS : slv4 := (others=>'0');
192
193 signal SWI : slv4 := (others=>'0');
194 signal BTN : slv4 := (others=>'0');
195 signal LED : slv4 := (others=>'0');
196 signal RGB_R : slv4 := (others=>'0');
197 signal RGB_G : slv4 := (others=>'0');
198 signal RGB_B : slv4 := (others=>'0');
199
200 constant rbaddr_rbmon : slv16 := x"ffe8"; -- ffe8/0008: 1111 1111 1110 1xxx
201 constant rbaddr_sysmon: slv16 := x"fb00"; -- fb00/0080: 1111 1011 0xxx xxxx
202
203 constant sysid_proj : slv16 := x"0201"; -- w11a
204 constant sysid_board : slv8 := x"07"; -- arty
205 constant sysid_vers : slv8 := x"00";
206
207begin
208
209 assert (sys_conf_clksys mod 1000000) = 0
210 report "assert sys_conf_clksys on MHz grid"
211 severity failure;
212
213 GEN_CLKALL : s7_cmt_1ce1ce -- clock generator system ------------
214 generic map (
215 CLKIN_PERIOD => 10.0,
216 CLKIN_JITTER => 0.01,
217 STARTUP_WAIT => false,
218 CLK0_VCODIV => sys_conf_clksys_vcodivide,
219 CLK0_VCOMUL => sys_conf_clksys_vcomultiply,
220 CLK0_OUTDIV => sys_conf_clksys_outdivide,
221 CLK0_GENTYPE => sys_conf_clksys_gentype,
222 CLK0_CDUWIDTH => 7,
223 CLK0_USECDIV => sys_conf_clksys_mhz,
224 CLK0_MSECDIV => 1000,
225 CLK1_VCODIV => sys_conf_clkser_vcodivide,
226 CLK1_VCOMUL => sys_conf_clkser_vcomultiply,
227 CLK1_OUTDIV => sys_conf_clkser_outdivide,
228 CLK1_GENTYPE => sys_conf_clkser_gentype,
229 CLK1_CDUWIDTH => 7,
230 CLK1_USECDIV => sys_conf_clkser_mhz,
231 CLK1_MSECDIV => 1000)
232 port map (
233 CLKIN => I_CLK100,
234 CLK0 => CLK,
235 CE0_USEC => CE_USEC,
236 CE0_MSEC => CE_MSEC,
237 CLK1 => CLKS,
238 CE1_USEC => open,
239 CE1_MSEC => CES_MSEC,
240 LOCKED => open
241 );
242
243 IOB_RS232 : bp_rs232_2line_iob -- serport iob ----------------------
244 port map (
245 CLK => CLKS,
246 RXD => RXD,
247 TXD => TXD,
248 I_RXD => I_RXD,
249 O_TXD => O_TXD
250 );
251
252 RLINK : rlink_sp2c -- rlink for serport -----------------
253 generic map (
254 BTOWIDTH => 7, -- 128 cycles access timeout
255 RTAWIDTH => 12,
256 SYSID => sysid_proj & sysid_board & sysid_vers ,
257 IFAWIDTH => 5, -- 32 word input fifo
258 OFAWIDTH => 5, -- 32 word output fifo
259 ENAPIN_RLMON => sbcntl_sbf_rlmon,
260 ENAPIN_RBMON => sbcntl_sbf_rbmon,
261 CDWIDTH => 12,
262 CDINIT => sys_conf_ser2rri_cdinit,
263 RBMON_AWIDTH => sys_conf_rbmon_awidth,
264 RBMON_RBADDR => rbaddr_rbmon)
265 port map (
266 CLK => CLK,
267 CE_USEC => CE_USEC,
268 CE_MSEC => CE_MSEC,
269 CE_INT => CE_MSEC,
270 RESET => RESET,
271 CLKS => CLKS,
272 CES_MSEC => CES_MSEC,
273 ENAXON => '1', -- XON statically enabled !
274 ESCFILL => '0',
275 RXSD => RXD,
276 TXSD => TXD,
277 CTS_N => '0',
278 RTS_N => open,
279 RB_MREQ => RB_MREQ,
280 RB_SRES => RB_SRES,
281 RB_LAM => RB_LAM,
282 RB_STAT => RB_STAT,
283 RL_MONI => open,
284 SER_MONI => SER_MONI
285 );
286
287 PERFEXT(0) <= '0'; -- unused (ext_rdrhit)
288 PERFEXT(1) <= '0'; -- unused (ext_wrrhit)
289 PERFEXT(2) <= '0'; -- unused (ext_wrflush)
290 PERFEXT(3) <= SER_MONI.rxact; -- ext_rlrxact
291 PERFEXT(4) <= not SER_MONI.rxok; -- ext_rlrxback
292 PERFEXT(5) <= SER_MONI.txact; -- ext_rltxact
293 PERFEXT(6) <= not SER_MONI.txok; -- ext_rltxback
294 PERFEXT(7) <= CE_USEC; -- ext_usec
295
296 SYS70 : pdp11_sys70 -- 1 cpu system ----------------------
297 port map (
298 CLK => CLK,
299 RESET => RESET,
300 RB_MREQ => RB_MREQ,
301 RB_SRES => RB_SRES_CPU,
302 RB_STAT => RB_STAT,
303 RB_LAM_CPU => RB_LAM(0),
304 GRESET => GRESET,
305 CRESET => CRESET,
306 BRESET => BRESET,
307 CP_STAT => CP_STAT,
308 EI_PRI => EI_PRI,
309 EI_VECT => EI_VECT,
310 EI_ACKM => EI_ACKM,
311 PERFEXT => PERFEXT,
312 IB_MREQ => IB_MREQ,
313 IB_SRES => IB_SRES_IBDR,
314 MEM_REQ => MEM_REQ,
315 MEM_WE => MEM_WE,
316 MEM_BUSY => MEM_BUSY,
317 MEM_ACK_R => MEM_ACK_R,
318 MEM_ADDR => MEM_ADDR,
319 MEM_BE => MEM_BE,
320 MEM_DI => MEM_DI,
321 MEM_DO => MEM_DO,
322 DM_STAT_EXP => DM_STAT_EXP
323 );
324
325
326 IBDR_SYS : ibdr_maxisys -- IO system -------------------------
327 port map (
328 CLK => CLK,
329 CE_USEC => CE_USEC,
330 CE_MSEC => CE_MSEC,
331 RESET => GRESET,
332 BRESET => BRESET,
333 ITIMER => DM_STAT_EXP.se_itimer,
334 IDEC => DM_STAT_EXP.se_idec,
335 CPUSUSP => CP_STAT.cpususp,
336 RB_LAM => RB_LAM(15 downto 1),
337 IB_MREQ => IB_MREQ,
338 IB_SRES => IB_SRES_IBDR,
339 EI_ACKM => EI_ACKM,
340 EI_PRI => EI_PRI,
341 EI_VECT => EI_VECT,
342 DISPREG => DISPREG
343 );
344
345 BRAM_CTL: pdp11_bram_memctl -- memory controller -----------------
346 generic map (
347 MAWIDTH => sys_conf_memctl_mawidth,
348 NBLOCK => sys_conf_memctl_nblock)
349 port map (
350 CLK => CLK,
351 RESET => GRESET,
352 REQ => MEM_REQ,
353 WE => MEM_WE,
354 BUSY => MEM_BUSY,
355 ACK_R => MEM_ACK_R,
356 ACK_W => open,
357 ACT_R => MEM_ACT_R,
358 ACT_W => MEM_ACT_W,
359 ADDR => MEM_ADDR,
360 BE => MEM_BE,
361 DI => MEM_DI,
362 DO => MEM_DO
363 );
364
365 LED_IO : ioleds_sp1c -- hio leds from serport -------------
366 port map (
367 SER_MONI => SER_MONI,
368 IOLEDS => IOLEDS
369 );
370
371 ABCLKDIV <= SER_MONI.abclkdiv(11 downto 0) & '0' & SER_MONI.abclkdiv_f;
372
373 HIO70 : entity work.pdp11_hio70_arty -- hio from sys70 --------------------
374 port map (
375 CLK => CLK,
376 MODE => SWI,
379 CP_STAT => CP_STAT,
381 DISPREG => DISPREG,
382 IOLEDS => IOLEDS,
384 LED => LED,
385 RGB_R => RGB_R,
386 RGB_G => RGB_G,
387 RGB_B => RGB_B
388 );
389
390 HIO : bp_swibtnled
391 generic map (
392 SWIDTH => I_SWI'length,
393 BWIDTH => I_BTN'length,
394 LWIDTH => O_LED'length,
395 DEBOUNCE => sys_conf_hio_debounce)
396 port map (
397 CLK => CLK,
398 RESET => RESET,
399 CE_MSEC => CE_MSEC,
400 SWI => SWI,
401 BTN => BTN,
402 LED => LED,
403 I_SWI => I_SWI,
404 I_BTN => I_BTN,
405 O_LED => O_LED
406 );
407
408 HIORGB : rgbdrv_3x4mux
409 port map (
410 CLK => CLK,
411 RESET => RESET,
412 CE_USEC => CE_USEC,
413 DATR => RGB_R,
414 DATG => RGB_G,
415 DATB => RGB_B,
420 );
421
422 SMRB : if sys_conf_rbd_sysmon generate
424 generic map ( -- use default INIT_ (LP: Vccint=0.95)
425 CLK_MHZ => sys_conf_clksys_mhz,
427 port map (
428 CLK => CLK,
429 RESET => RESET,
430 RB_MREQ => RB_MREQ,
432 ALM => open,
433 OT => open,
434 TEMP => open,
435 VPWRN => A_VPWRN,
436 VPWRP => A_VPWRP
437 );
438 end generate SMRB;
439
440 UARB : rbd_usracc
441 port map (
442 CLK => CLK,
443 RB_MREQ => RB_MREQ,
445 );
446
447 RB_SRES_OR : rb_sres_or_3 -- rbus or ---------------------------
448 port map (
449 RB_SRES_1 => RB_SRES_CPU,
450 RB_SRES_2 => RB_SRES_SYSMON,
451 RB_SRES_3 => RB_SRES_USRACC,
452 RB_SRES_OR => RB_SRES
453 );
454
455end syn;
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
Definition: iblib.vhd:33
in CP_STAT cp_stat_type
in DM_STAT_EXP dm_stat_exp_type
Definition: pdp11.vhd:123
in CLK slbit
Definition: rbd_usracc.vhd:40
in RB_MREQ rb_mreq_type
Definition: rbd_usracc.vhd:41
out RB_SRES rb_sres_type
Definition: rbd_usracc.vhd:43
Definition: rblib.vhd:32
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
std_logic_vector( 19 downto 0) slv20
Definition: slvtypes.vhd:53
std_logic_vector( 3 downto 0) slv4
Definition: slvtypes.vhd:36
std_logic_vector( 2 downto 0) slv3
Definition: slvtypes.vhd:35
std_logic_vector( 8 downto 2) slv9_2
Definition: slvtypes.vhd:65
std_logic_vector( 31 downto 0) slv32
Definition: slvtypes.vhd:59
std_logic_vector( 15 downto 0) slv16
Definition: slvtypes.vhd:48
std_logic slbit
Definition: slvtypes.vhd:30
std_logic_vector( 7 downto 0) slv8
Definition: slvtypes.vhd:40
slv9_2 :=( others => '0') EI_VECT
slv8 :=( others => '0') PERFEXT
slv16 := x"ffe8" rbaddr_rbmon
slv16 :=( others => '0') DISPREG
ib_mreq_type := ib_mreq_init IB_MREQ
bp_swibtnled hiohio
slv3 :=( others => '0') EI_PRI
slv4 :=( others => '0') RGB_R
slv4 :=( others => '0') RB_STAT
slv32 :=( others => '0') MEM_DI
rb_sres_type := rb_sres_init RB_SRES_SYSMON
rb_mreq_type := rb_mreq_init RB_MREQ
serport_moni_type := serport_moni_init SER_MONI
slv16 :=( others => '0') ABCLKDIV
slv32 :=( others => '0') MEM_DO
rlink_sp2c rlinkrlink
rb_sres_type := rb_sres_init RB_SRES
slv4 :=( others => '0') SWI
slv4 :=( others => '0') RGB_G
cp_stat_type := cp_stat_init CP_STAT
slv4 :=( others => '0') RGB_B
rb_sres_type := rb_sres_init RB_SRES_CPU
slv16 := x"0201" sysid_proj
slv4 :=( others => '0') BTN
slv16 := x"fb00" rbaddr_sysmon
ib_sres_type := ib_sres_init IB_SRES_IBDR
rb_sres_type := rb_sres_init RB_SRES_USRACC
slv16 :=( others => '0') RB_LAM
slv4 :=( others => '0') MEM_BE
dm_stat_exp_type := dm_stat_exp_init DM_STAT_EXP
slv4 :=( others => '0') IOLEDS
slv4 :=( others => '0') LED
slv20 :=( others => '0') MEM_ADDR
in VPWRP slv4 :=( others => '0')
CLK_MHZ integer := 250
RB_ADDR slv16 := x"fb00"
in RB_MREQ rb_mreq_type
out RB_SRES rb_sres_type
in VPWRN slv4 :=( others => '0')
in RESET slbit := '0'