w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
sys_w11a_b3.vhd
Go to the documentation of this file.
1-- $Id: sys_w11a_b3.vhd 1325 2022-12-07 11:52:36Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2015-2022 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: sys_w11a_b3 - syn
7-- Description: w11a test design for basys3
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-- w11a/pdp11_hio70
17-- bplib/bpgen/sn_humanio_rbus
18-- bplib/sysmon/sysmonx_rbus_base
19-- vlib/rbus/rbd_usracc
20-- vlib/rbus/rb_sres_or_4
21--
22-- Test bench: tb/tb_sys_w11a_b3
23--
24-- Target Devices: generic
25-- Tool versions: viv 2014.4-2022.1; ghdl 0.31-2.0.0
26--
27-- Synthesized:
28-- Date Rev viv Target flop lutl lutm bram slic
29-- 2022-12-06 1324 2022.1 xc7a35t-1 3050 5501 267 48.0 1829
30-- 2022-07-05 1247 2022.1 xc7a35t-1 3011 5669 267 48.0 1906
31-- 2019-05-19 1150 2017.2 xc7a35t-1 2968 6360 273 48.0 1963 +dz11
32-- 2019-04-27 1140 2017.2 xc7a35t-1 2835 6032 248 47.5 1879 +*buf
33-- 2019-03-02 1116 2017.2 xc7a35t-1 2748 5725 186 47.5 1811 +ibtst
34-- 2019-02-02 1108 2018.3 xc7a35t-1 2711 5910 170 47.5 1825
35-- 2019-02-02 1108 2017.2 xc7a35t-1 2698 5636 170 47.5 1728
36-- 2018-10-13 1055 2017.2 xc7a35t-1 2698 5636 170 47.5 1723 +dmpcnt
37-- 2018-09-15 1045 2017.2 xc7a35t-1 2475 5282 138 47.5 1643 +KW11P
38-- 2017-04-16 881 2016.4 xc7a35t-1 2412 5228 138 47.5 1608 +DEUNA
39-- 2017-01-29 846 2016.4 xc7a35t-1 2362 5239 138 47.5 1619 +int24
40-- 2016-05-26 768 2016.1 xc7a35t-1 2361 5203 138 47.5 1600 fsm+dsm=0
41-- 2016-05-22 767 2016.1 xc7a35t-1 2362 5340 138 48.5 1660 fsm
42-- 2016-03-29 756 2015.4 xc7a35t-1 2240 4518 138 48.5 1430 serport2
43-- 2016-03-27 753 2015.4 xc7a35t-1 2131 4398 138 48.5 1362 meminf
44-- 2016-03-13 742 2015.4 xc7a35t-1 2135 4420 162 48.5 1396 +XADC
45-- 2015-06-04 686 2014.4 xc7a35t-1 1919 4372 162 47.5 1408 +TM11 17%
46-- 2015-05-14 680 2014.4 xc7a35t-1 1837 4304 162 47.5 1354 +RHRP 17%
47-- 2015-02-21 649 2014.4 xc7a35t-1 1637 3767 146 47.5 1195
48--
49-- Revision History:
50-- Date Rev Version Comment
51-- 2018-12-16 1086 1.5 use s7_cmt_1ce1ce
52-- 2018-10-13 1055 2.4 use DM_STAT_EXP; IDEC to maxisys; setup PERFEXT
53-- 2016-04-02 758 2.3.1 add rbd_usracc (bitfile+jtag timestamp access)
54-- 2016-03-28 755 2.3 use serport_2clock2
55-- 2016-03-19 748 2.2.2 define rlink SYSID
56-- 2016-03-18 745 2.2.1 hardwire XON=1
57-- 2016-03-13 742 2.2 add sysmon_rbus
58-- 2015-05-09 677 2.1 start/stop/suspend overhaul; reset overhaul
59-- 2015-05-01 672 2.0 use pdp11_sys70 and pdp11_hio70
60-- 2015-04-11 666 1.1.1 rearrange XON handling
61-- 2015-02-21 649 1.1 use ioleds_sp1c,pdp11_(statleds,ledmux,dspmux)
62-- 2015-02-08 644 1.0 Initial version (derived from sys_w11a_n4)
63------------------------------------------------------------------------------
64--
65-- w11a test design for basys3
66-- w11a + rlink + serport
67--
68-- Usage of Basys 3 Switches, Buttons, LEDs
69--
70-- SWI(15:6): no function (only connected to sn_humanio_rbus)
71-- SWI(5:4): select DSP
72-- 00 abclkdiv & abclkdiv_f
73-- 01 PC
74-- 10 DISPREG
75-- 11 DR emulation
76-- SWI(3): select LED display
77-- 0 overall status
78-- 1 DR emulation
79-- SWI(2): unused-reserved (USB port select)
80-- SWI(1): unused-reserved (XON, is hardwired to '1')
81-- SWI(0): unused-reserved (serial port select)
82--
83-- LEDs if SWI(3) = 1
84-- (15:0) DR emulation; shows R0 during wait like 11/45+70
85--
86-- LEDs if SWI(3) = 0
87-- (7) MEM_ACT_W
88-- (6) MEM_ACT_R
89-- (5) cmdbusy (all rlink access, mostly rdma)
90-- (4:0) if cpugo=1 show cpu mode activity
91-- (4) kernel mode, pri>0
92-- (3) kernel mode, pri=0
93-- (2) kernel mode, wait
94-- (1) supervisor mode
95-- (0) user mode
96-- if cpugo=0 shows cpurust
97-- (4) '1'
98-- (3:0) cpurust code
99--
100-- DSP(7:4) shows abclkdiv & abclkdiv_f or PS depending on SWI(4)
101-- DSP(3:0) shows DISPREG
102-- DP(3:0) shows IO activity
103-- (3) not SER_MONI.txok (shows tx back pressure)
104-- (2) SER_MONI.txact (shows tx activity)
105-- (1) not SER_MONI.rxok (shows rx back pressure)
106-- (0) SER_MONI.rxact (shows rx activity)
107--
108
109library ieee;
110use ieee.std_logic_1164.all;
111use ieee.numeric_std.all;
112
113use work.slvtypes.all;
114use work.serportlib.all;
115use work.rblib.all;
116use work.rbdlib.all;
117use work.rlinklib.all;
118use work.bpgenlib.all;
119use work.bpgenrbuslib.all;
120use work.sysmonrbuslib.all;
121use work.iblib.all;
122use work.ibdlib.all;
123use work.pdp11.all;
124use work.sys_conf.all;
125
126-- ----------------------------------------------------------------------------
127
128entity sys_w11a_b3 is -- top level
129 -- implements basys3_aif
130 port (
131 I_CLK100 : in slbit; -- 100 MHz clock
132 I_RXD : in slbit; -- receive data (board view)
133 O_TXD : out slbit; -- transmit data (board view)
134 I_SWI : in slv16; -- b3 switches
135 I_BTN : in slv5; -- b3 buttons
136 O_LED : out slv16; -- b3 leds
137 O_ANO_N : out slv4; -- 7 segment disp: anodes (act.low)
138 O_SEG_N : out slv8 -- 7 segment disp: segments (act.low)
139 );
140end sys_w11a_b3;
141
142architecture syn of sys_w11a_b3 is
143
144 signal CLK : slbit := '0';
145
146 signal RESET : slbit := '0';
147 signal CE_USEC : slbit := '0';
148 signal CE_MSEC : slbit := '0';
149
150 signal CLKS : slbit := '0';
151 signal CES_MSEC : slbit := '0';
152
153 signal RXD : slbit := '1';
154 signal TXD : slbit := '0';
155
156 signal RB_MREQ : rb_mreq_type := rb_mreq_init;
157 signal RB_SRES : rb_sres_type := rb_sres_init;
158 signal RB_SRES_CPU : rb_sres_type := rb_sres_init;
159 signal RB_SRES_HIO : rb_sres_type := rb_sres_init;
160 signal RB_SRES_SYSMON : rb_sres_type := rb_sres_init;
161 signal RB_SRES_USRACC : rb_sres_type := rb_sres_init;
162
163 signal RB_LAM : slv16 := (others=>'0');
164 signal RB_STAT : slv4 := (others=>'0');
165
166 signal SER_MONI : serport_moni_type := serport_moni_init;
167
168 signal GRESET : slbit := '0'; -- general reset (from rbus)
169 signal CRESET : slbit := '0'; -- cpu reset (from cp)
170 signal BRESET : slbit := '0'; -- bus reset (from cp or cpu)
171 signal PERFEXT : slv8 := (others=>'0');
172
173 signal EI_PRI : slv3 := (others=>'0');
174 signal EI_VECT : slv9_2 := (others=>'0');
175 signal EI_ACKM : slbit := '0';
176 signal CP_STAT : cp_stat_type := cp_stat_init;
177 signal DM_STAT_EXP : dm_stat_exp_type := dm_stat_exp_init;
178
179 signal MEM_REQ : slbit := '0';
180 signal MEM_WE : slbit := '0';
181 signal MEM_BUSY : slbit := '0';
182 signal MEM_ACK_R : slbit := '0';
183 signal MEM_ACT_R : slbit := '0';
184 signal MEM_ACT_W : slbit := '0';
185 signal MEM_ADDR : slv20 := (others=>'0');
186 signal MEM_BE : slv4 := (others=>'0');
187 signal MEM_DI : slv32 := (others=>'0');
188 signal MEM_DO : slv32 := (others=>'0');
189
190 signal IB_MREQ : ib_mreq_type := ib_mreq_init;
191 signal IB_SRES_IBDR : ib_sres_type := ib_sres_init;
192
193 signal DISPREG : slv16 := (others=>'0');
194 signal ABCLKDIV : slv16 := (others=>'0');
195
196 signal SWI : slv16 := (others=>'0');
197 signal BTN : slv5 := (others=>'0');
198 signal LED : slv16 := (others=>'0');
199 signal DSP_DAT : slv16 := (others=>'0');
200 signal DSP_DP : slv4 := (others=>'0');
201
202 constant rbaddr_rbmon : slv16 := x"ffe8"; -- ffe8/0008: 1111 1111 1110 1xxx
203 constant rbaddr_hio : slv16 := x"fef0"; -- fef0/0008: 1111 1110 1111 0xxx
204 constant rbaddr_sysmon: slv16 := x"fb00"; -- fb00/0080: 1111 1011 0xxx xxxx
205
206 constant sysid_proj : slv16 := x"0201"; -- w11a
207 constant sysid_board : slv8 := x"06"; -- basys3
208 constant sysid_vers : slv8 := x"00";
209
210begin
211
212 assert (sys_conf_clksys mod 1000000) = 0
213 report "assert sys_conf_clksys on MHz grid"
214 severity failure;
215
216 GEN_CLKALL : s7_cmt_1ce1ce -- clock generator system ------------
217 generic map (
218 CLKIN_PERIOD => 10.0,
219 CLKIN_JITTER => 0.01,
220 STARTUP_WAIT => false,
221 CLK0_VCODIV => sys_conf_clksys_vcodivide,
222 CLK0_VCOMUL => sys_conf_clksys_vcomultiply,
223 CLK0_OUTDIV => sys_conf_clksys_outdivide,
224 CLK0_GENTYPE => sys_conf_clksys_gentype,
225 CLK0_CDUWIDTH => 7,
226 CLK0_USECDIV => sys_conf_clksys_mhz,
227 CLK0_MSECDIV => 1000,
228 CLK1_VCODIV => sys_conf_clkser_vcodivide,
229 CLK1_VCOMUL => sys_conf_clkser_vcomultiply,
230 CLK1_OUTDIV => sys_conf_clkser_outdivide,
231 CLK1_GENTYPE => sys_conf_clkser_gentype,
232 CLK1_CDUWIDTH => 7,
233 CLK1_USECDIV => sys_conf_clkser_mhz,
234 CLK1_MSECDIV => 1000)
235 port map (
236 CLKIN => I_CLK100,
237 CLK0 => CLK,
238 CE0_USEC => CE_USEC,
239 CE0_MSEC => CE_MSEC,
240 CLK1 => CLKS,
241 CE1_USEC => open,
242 CE1_MSEC => CES_MSEC,
243 LOCKED => open
244 );
245
246 IOB_RS232 : bp_rs232_2line_iob -- serport iob ----------------------
247 port map (
248 CLK => CLKS,
249 RXD => RXD,
250 TXD => TXD,
251 I_RXD => I_RXD,
252 O_TXD => O_TXD
253 );
254
255 RLINK : rlink_sp2c -- rlink for serport -----------------
256 generic map (
257 BTOWIDTH => 7, -- 128 cycles access timeout
258 RTAWIDTH => 12,
259 SYSID => sysid_proj & sysid_board & sysid_vers ,
260 IFAWIDTH => 5, -- 32 word input fifo
261 OFAWIDTH => 5, -- 32 word output fifo
262 ENAPIN_RLMON => sbcntl_sbf_rlmon,
263 ENAPIN_RBMON => sbcntl_sbf_rbmon,
264 CDWIDTH => 12,
265 CDINIT => sys_conf_ser2rri_cdinit,
266 RBMON_AWIDTH => sys_conf_rbmon_awidth,
267 RBMON_RBADDR => rbaddr_rbmon)
268 port map (
269 CLK => CLK,
270 CE_USEC => CE_USEC,
271 CE_MSEC => CE_MSEC,
272 CE_INT => CE_MSEC,
273 RESET => RESET,
274 CLKS => CLKS,
275 CES_MSEC => CES_MSEC,
276 ENAXON => '1',
277 ESCFILL => '0',
278 RXSD => RXD,
279 TXSD => TXD,
280 CTS_N => '0',
281 RTS_N => open,
282 RB_MREQ => RB_MREQ,
283 RB_SRES => RB_SRES,
284 RB_LAM => RB_LAM,
285 RB_STAT => RB_STAT,
286 RL_MONI => open,
287 SER_MONI => SER_MONI
288 );
289
290 PERFEXT(0) <= '0'; -- unused (ext_rdrhit)
291 PERFEXT(1) <= '0'; -- unused (ext_wrrhit)
292 PERFEXT(2) <= '0'; -- unused (ext_wrflush)
293 PERFEXT(3) <= SER_MONI.rxact; -- ext_rlrxact
294 PERFEXT(4) <= not SER_MONI.rxok; -- ext_rlrxback
295 PERFEXT(5) <= SER_MONI.txact; -- ext_rltxact
296 PERFEXT(6) <= not SER_MONI.txok; -- ext_rltxback
297 PERFEXT(7) <= CE_USEC; -- ext_usec
298
299 SYS70 : pdp11_sys70 -- 1 cpu system ----------------------
300 port map (
301 CLK => CLK,
302 RESET => RESET,
303 RB_MREQ => RB_MREQ,
304 RB_SRES => RB_SRES_CPU,
305 RB_STAT => RB_STAT,
306 RB_LAM_CPU => RB_LAM(0),
307 GRESET => GRESET,
308 CRESET => CRESET,
309 BRESET => BRESET,
310 CP_STAT => CP_STAT,
311 EI_PRI => EI_PRI,
312 EI_VECT => EI_VECT,
313 EI_ACKM => EI_ACKM,
314 PERFEXT => PERFEXT,
315 IB_MREQ => IB_MREQ,
316 IB_SRES => IB_SRES_IBDR,
317 MEM_REQ => MEM_REQ,
318 MEM_WE => MEM_WE,
319 MEM_BUSY => MEM_BUSY,
320 MEM_ACK_R => MEM_ACK_R,
321 MEM_ADDR => MEM_ADDR,
322 MEM_BE => MEM_BE,
323 MEM_DI => MEM_DI,
324 MEM_DO => MEM_DO,
325 DM_STAT_EXP => DM_STAT_EXP
326 );
327
328
329 IBDR_SYS : ibdr_maxisys -- IO system -------------------------
330 port map (
331 CLK => CLK,
332 CE_USEC => CE_USEC,
333 CE_MSEC => CE_MSEC,
334 RESET => GRESET,
335 BRESET => BRESET,
336 ITIMER => DM_STAT_EXP.se_itimer,
337 IDEC => DM_STAT_EXP.se_idec,
338 CPUSUSP => CP_STAT.cpususp,
339 RB_LAM => RB_LAM(15 downto 1),
340 IB_MREQ => IB_MREQ,
341 IB_SRES => IB_SRES_IBDR,
342 EI_ACKM => EI_ACKM,
343 EI_PRI => EI_PRI,
344 EI_VECT => EI_VECT,
345 DISPREG => DISPREG
346 );
347
348 BRAM_CTL: pdp11_bram_memctl -- memory controller -----------------
349 generic map (
350 MAWIDTH => sys_conf_memctl_mawidth,
351 NBLOCK => sys_conf_memctl_nblock)
352 port map (
353 CLK => CLK,
354 RESET => GRESET,
355 REQ => MEM_REQ,
356 WE => MEM_WE,
357 BUSY => MEM_BUSY,
358 ACK_R => MEM_ACK_R,
359 ACK_W => open,
360 ACT_R => MEM_ACT_R,
361 ACT_W => MEM_ACT_W,
362 ADDR => MEM_ADDR,
363 BE => MEM_BE,
364 DI => MEM_DI,
365 DO => MEM_DO
366 );
367
368 LED_IO : ioleds_sp1c -- hio leds from serport -------------
369 port map (
370 SER_MONI => SER_MONI,
371 IOLEDS => DSP_DP
372 );
373
374 ABCLKDIV <= SER_MONI.abclkdiv(11 downto 0) & '0' & SER_MONI.abclkdiv_f;
375
376 HIO70 : pdp11_hio70 -- hio from sys70 --------------------
377 generic map (
378 LWIDTH => LED'length,
379 DCWIDTH => 2)
380 port map (
381 SEL_LED => SWI(3),
382 SEL_DSP => SWI(5 downto 4),
383 MEM_ACT_R => MEM_ACT_R,
384 MEM_ACT_W => MEM_ACT_W,
385 CP_STAT => CP_STAT,
386 DM_STAT_EXP => DM_STAT_EXP,
387 ABCLKDIV => ABCLKDIV,
388 DISPREG => DISPREG,
389 LED => LED,
390 DSP_DAT => DSP_DAT
391 );
392
393 HIO : sn_humanio_rbus -- hio manager -----------------------
394 generic map (
395 SWIDTH => 16,
396 BWIDTH => 5,
397 LWIDTH => 16,
398 DCWIDTH => 2,
399 DEBOUNCE => sys_conf_hio_debounce,
400 RB_ADDR => rbaddr_hio)
401 port map (
402 CLK => CLK,
403 RESET => RESET,
404 CE_MSEC => CE_MSEC,
405 RB_MREQ => RB_MREQ,
406 RB_SRES => RB_SRES_HIO,
407 SWI => SWI,
408 BTN => BTN,
409 LED => LED,
410 DSP_DAT => DSP_DAT,
411 DSP_DP => DSP_DP,
412 I_SWI => I_SWI,
413 I_BTN => I_BTN,
414 O_LED => O_LED,
415 O_ANO_N => O_ANO_N,
416 O_SEG_N => O_SEG_N
417 );
418
419 SMRB : if sys_conf_rbd_sysmon generate
421 generic map ( -- use default INIT_ (Vccint=1.00)
422 CLK_MHZ => sys_conf_clksys_mhz,
424 port map (
425 CLK => CLK,
426 RESET => RESET,
427 RB_MREQ => RB_MREQ,
429 ALM => open,
430 OT => open,
431 TEMP => open
432 );
433 end generate SMRB;
434
435 UARB : rbd_usracc
436 port map (
437 CLK => CLK,
438 RB_MREQ => RB_MREQ,
440 );
441
442 RB_SRES_OR : rb_sres_or_4 -- rbus or ---------------------------
443 port map (
444 RB_SRES_1 => RB_SRES_CPU,
445 RB_SRES_2 => RB_SRES_HIO,
446 RB_SRES_3 => RB_SRES_SYSMON,
447 RB_SRES_4 => RB_SRES_USRACC,
448 RB_SRES_OR => RB_SRES
449 );
450
451end syn;
Definition: iblib.vhd:33
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
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( 4 downto 0) slv5
Definition: slvtypes.vhd:37
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
slbit := '0' CLKS
slv9_2 :=( others => '0') EI_VECT
slv16 :=( others => '0') DSP_DAT
slbit := '0' RESET
slbit := '0' GRESET
slv8 :=( others => '0') PERFEXT
slv16 := x"ffe8" rbaddr_rbmon
slv16 := x"fef0" rbaddr_hio
slbit := '0' EI_ACKM
slv16 :=( others => '0') DISPREG
ib_mreq_type := ib_mreq_init IB_MREQ
slbit := '0' MEM_WE
sn_humanio_rbus hiohio
slv3 :=( others => '0') EI_PRI
slbit := '0' MEM_ACT_R
slv16 :=( others => '0') SWI
slv4 :=( others => '0') RB_STAT
slv32 :=( others => '0') MEM_DI
rb_sres_type := rb_sres_init RB_SRES_SYSMON
slbit := '0' MEM_BUSY
rb_mreq_type := rb_mreq_init RB_MREQ
serport_moni_type := serport_moni_init SER_MONI
slbit := '0' MEM_REQ
slbit := '0' CE_USEC
slbit := '1' RXD
pdp11_sys70 sys70sys70
slbit := '0' CE_MSEC
slbit := '0' MEM_ACT_W
slbit := '0' CES_MSEC
slv16 :=( others => '0') ABCLKDIV
slv32 :=( others => '0') MEM_DO
rlink_sp2c rlinkrlink
rb_sres_type := rb_sres_init RB_SRES
slv16 :=( others => '0') LED
slv4 :=( others => '0') DSP_DP
cp_stat_type := cp_stat_init CP_STAT
slv8 := x"00" sysid_vers
slbit := '0' CLK
rb_sres_type := rb_sres_init RB_SRES_CPU
slv16 := x"0201" sysid_proj
slv8 := x"06" sysid_board
slbit := '0' BRESET
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
rb_sres_type := rb_sres_init RB_SRES_HIO
slbit := '0' MEM_ACK_R
slbit := '0' CRESET
slv4 :=( others => '0') MEM_BE
slv5 :=( others => '0') BTN
dm_stat_exp_type := dm_stat_exp_init DM_STAT_EXP
slbit := '0' TXD
slv20 :=( others => '0') MEM_ADDR
out O_TXD slbit
in I_RXD slbit
out O_LED slv16
in I_SWI slv16
in I_BTN slv5
out O_SEG_N slv8
in I_CLK100 slbit
out O_ANO_N slv4
CLK_MHZ integer := 250
RB_ADDR slv16 := x"fb00"
in RB_MREQ rb_mreq_type
out RB_SRES rb_sres_type
in RESET slbit := '0'