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