From 3134c8ac8281b275942cf04ebfab6a627ac7dbbf Mon Sep 17 00:00:00 2001 From: wfjm Date: Thu, 6 Oct 2022 11:25:15 +0200 Subject: [PATCH] finalize fix for I space mode=1 in s_dstr_def --- rtl/w11a/pdp11.vhd | 6 ++-- rtl/w11a/pdp11_decode.vhd | 9 ++++-- rtl/w11a/pdp11_sequencer.vhd | 5 ++-- tools/tcode/cpu_mmu.mac | 56 ++++++++++++++++++++++++++++++------ 4 files changed, 62 insertions(+), 14 deletions(-) diff --git a/rtl/w11a/pdp11.vhd b/rtl/w11a/pdp11.vhd index eba96e9c..a3abf238 100644 --- a/rtl/w11a/pdp11.vhd +++ b/rtl/w11a/pdp11.vhd @@ -1,4 +1,4 @@ --- $Id: pdp11.vhd 1279 2022-08-14 08:02:21Z mueller $ +-- $Id: pdp11.vhd 1301 2022-10-06 08:53:46Z mueller $ -- SPDX-License-Identifier: GPL-3.0-or-later -- Copyright 2006-2022 by Walter F.J. Mueller -- @@ -11,6 +11,7 @@ -- -- Revision History: -- Date Rev Version Comment +-- 2022-10-03 1301 1.6.14 add decode_stat_type.is_dstpcmode1 -- 2022-08-13 1279 1.6.13 ssr->mmr rename -- 2019-06-02 1159 1.6.12 add rbaddr_ constants -- 2019-03-01 1116 1.6.11 define c_init_rbf_greset @@ -253,6 +254,7 @@ package pdp11 is is_srcpc : slbit; -- source is pc is_srcpcmode1 : slbit; -- source is pc and mode=1 is_dstpc : slbit; -- dest. is pc + is_dstpcmode1 : slbit; -- dest. is pc and mode=1 is_dstw_reg : slbit; -- dest. register to be written is_dstw_pc : slbit; -- pc register to be written is_rmwop : slbit; -- read-modify-write operation @@ -286,7 +288,7 @@ package pdp11 is end record decode_stat_type; constant decode_stat_init : decode_stat_type := ( - '0','0','0','0','0','0','0','0','0', -- is_ + '0','0','0','0','0','0','0','0','0','0', -- is_ '0','0',"000",'0','0', -- op_, trap_, force_, updt_ "00","00","00",'0',"000", -- aunit_ "0000","00","000", -- lunit_, munit_, res_ diff --git a/rtl/w11a/pdp11_decode.vhd b/rtl/w11a/pdp11_decode.vhd index 8ad4aef9..776ff5b9 100644 --- a/rtl/w11a/pdp11_decode.vhd +++ b/rtl/w11a/pdp11_decode.vhd @@ -1,4 +1,4 @@ --- $Id: pdp11_decode.vhd 1181 2019-07-08 17:00:50Z mueller $ +-- $Id: pdp11_decode.vhd 1301 2022-10-06 08:53:46Z mueller $ -- SPDX-License-Identifier: GPL-3.0-or-later -- Copyright 2006-2011 by Walter F.J. Mueller -- @@ -9,9 +9,10 @@ -- Dependencies: - -- Test bench: tb/tb_pdp11_core (implicit) -- Target Devices: generic --- Tool versions: ise 8.2-14.7; viv 2014.4; ghdl 0.18-0.31 +-- Tool versions: ise 8.2-14.7; viv 2014.4-2022.1; ghdl 0.18-2.0.0 -- Revision History: -- Date Rev Version Comment +-- 2022-10-03 1301 1.0.7 add STAT.is_dstpcmode1 -- 2011-11-18 427 1.0.6 now numeric_std clean -- 2010-09-18 300 1.0.5 rename (adlm)box->(oalm)unit -- 2008-11-30 174 1.0.4 BUGFIX: add updt_dstadsrc; set for MFP(I/D) @@ -85,6 +86,7 @@ begin nstat.is_srcpc := '0'; nstat.is_srcpcmode1 := '0'; nstat.is_dstpc := '0'; + nstat.is_dstpcmode1 := '0'; nstat.is_dstw_reg := '0'; nstat.is_dstw_pc := '0'; nstat.is_rmwop := '0'; @@ -140,6 +142,9 @@ begin if DSTREG = c_gpr_pc then nstat.is_dstpc := '1'; + if DSTMODF = "001" then + nstat.is_dstpcmode1 := '1'; + end if; end if; if OPPRIM = "000" then diff --git a/rtl/w11a/pdp11_sequencer.vhd b/rtl/w11a/pdp11_sequencer.vhd index 082fe4c7..1a3aa7ed 100644 --- a/rtl/w11a/pdp11_sequencer.vhd +++ b/rtl/w11a/pdp11_sequencer.vhd @@ -1,4 +1,4 @@ --- $Id: pdp11_sequencer.vhd 1297 2022-09-10 13:04:37Z mueller $ +-- $Id: pdp11_sequencer.vhd 1301 2022-10-06 08:53:46Z mueller $ -- SPDX-License-Identifier: GPL-3.0-or-later -- Copyright 2006-2022 by Walter F.J. Mueller -- @@ -13,6 +13,7 @@ -- -- Revision History: -- Date Rev Version Comment +-- 2022-10-03 1301 1.6.15 finalize fix for I space mode=1 in s_dstr_def -- 2022-09-08 1296 1.6.14 BUGFIX: use I space for all mode=1,2,3 if reg=pc -- 2022-08-13 1279 1.6.13 ssr->mmr rename -- 2019-08-17 1203 1.6.12 fix for ghdl V0.36 -Whide warnings @@ -1189,7 +1190,7 @@ begin ndpcntl.vmaddr_sel := c_dpath_vmaddr_ddst; -- VA = DDST do_memread_d(nstate, nvmcntl, s_dstr_def_w, pbytop=>R_IDSTAT.is_bytop, pmacc=>R_IDSTAT.is_rmwop, - pispace=>R_IDSTAT.is_dstpc); + pispace=>R_IDSTAT.is_dstpcmode1); when s_dstr_def_w => -- ----------------------------------- nstate := s_dstr_def_w; diff --git a/tools/tcode/cpu_mmu.mac b/tools/tcode/cpu_mmu.mac index f90f5bfe..655296af 100644 --- a/tools/tcode/cpu_mmu.mac +++ b/tools/tcode/cpu_mmu.mac @@ -1,4 +1,4 @@ -; $Id: cpu_mmu.mac 1297 2022-09-10 13:04:37Z mueller $ +; $Id: cpu_mmu.mac 1301 2022-10-06 08:53:46Z mueller $ ; SPDX-License-Identifier: GPL-3.0-or-later ; Copyright 2022- by Walter F.J. Mueller ; @@ -1596,7 +1596,7 @@ te0102: mov #vhmmut,v..mmu ; setup MMU trap handler ; ; Test F1: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ; -; Test F1.1 -- test D-to-I mapping for (PC) address modes ++++++++++++ +; Test F1.1 -- test D-to-I mapping for (PC) address modes I ++++++++++ ; In case of immediate (pc)+ and absolute @(pc)+ addressing the first read ; comes from I space. Same holds for (pc) specifiers. The remaining two modes ; -(pc) and @-(pc) have no practical use and cant even be tested. @@ -1605,22 +1605,22 @@ te0102: mov #vhmmut,v..mmu ; setup MMU trap handler ; non-resident, the vector fetch will fail and the CPU halts with an F:vecfet. ; ; Summary -; (pc)+ src: mov #nnn,r0 +; (pc)+ srcr: mov #nnn,r0 ; (pc)+ dstr: tst #nnn ; (pc)+ dstr: cmp r0,#nnn ; (pc)+ dstw: mov r0,#nnn -; @(pc)+ src: mov @#val,r0 +; @(pc)+ srcr: mov @#val,r0 ; @(pc)+ dstr: tst @#val ; @(pc)+ dstr: cmp r0,@#val ; @(pc)+ dstw: mov r0,@#val -; (pc) src: mov (pc),r0 +; (pc) srcr: mov (pc),r0 ; (pc) dstr: tst (pc) ; (pc) dstr: cmp r0,(pc) ; (pc) dstw: mov r0,(pc) ; tf0101: mov #m3.dkm,mmr3 ; enable D space for kernel clr kdpdr0 ; ensure D space non-resident - mov kipdr6,kdpdr6 ; set up page 6 D space 1-to-0 + mov kipdr6,kdpdr6 ; set up page 6 D space 1-to-1 mov kipar6,kdpar6 ; mov #234,100$+2 ; restore target @@ -1662,10 +1662,50 @@ tf0101: mov #m3.dkm,mmr3 ; enable D space for kernel ; 9999$: iot ; end of test F1.1 ; -; END OF ALL TESTS - loop closure ============================================ +; Test F1.2 -- test D-to-I mapping for (PC) address modes II +++++++++ +; In case of absolute @(pc)+ addressing the first access goes to I space +; and the second to D space. The test uses page 6 as target and runs with +; D page 6 mapped and the I page 6 set non-resident. +; +; Summary +; @(pc)+ srcr: mov @#val,r0 +; @(pc)+ dstr: cmp r0,@#val +; @(pc)+ dstw: mov r0,@#val +; +tf0102: mov #154345,@#p6base ; inititialize target + mov #m3.dkm,mmr3 ; enable D space for kernel + mov kipdr6,kdpdr6 ; set up page 6 D space 1-to-1 + mov kipar6,kdpar6 + push kipdr6 ; save I page 6 + clr kipdr6 ; ensure I page 6 non-resident + mov #m0.ena,mmr0 ; enable mmu ;! MMU 18 +; +; @(pc)+ srcr + mov @#p6base,r1 +; @(pc)+ dstr + cmp r1,@#p6base + beq 100$ + halt +100$: mov r1,r2 + inc r2 +; @(pc)+ dstw + mov r2,@#p6base +; + reset ; mmu off ;! MMU off + pop kipdr6 ; restore I page 6 + clr kdpdr6 ; reset kdpdr6 + clr kdpar6 ; reset kdpar6 +; + hcmpeq r1,#154345 + hcmpeq @#p6base,#154346 +; +9999$: iot ; end of test F1.2 +; +; Summary +;; END OF ALL TESTS - loop closure ============================================ ; mov tstno,r0 ; hack, for easy monitoring ... - hcmpeq tstno,#16. ; all tests done ? + hcmpeq tstno,#17. ; all tests done ? ; jmp loop ;