From 4569aee76022206bf70cbb67e474046d93725a25 Mon Sep 17 00:00:00 2001 From: "Walter F.J. Mueller" Date: Mon, 26 Dec 2016 20:15:47 +0100 Subject: [PATCH] ps init with pri=0, as on real 11/70 (ECO-028) --- doc/CHANGELOG-w11a_V0.60-w11a_V0.70.md | 6 +++--- doc/CHANGELOG-w11a_V0.70-w11a_V0.74.md | 4 ++-- doc/CHANGELOG.md | 3 ++- doc/ECO-028-ps_init.md | 28 ++++++++++++++++++++++++++ rtl/w11a/pdp11.vhd | 9 +++++---- rtl/w11a/tb/tb_pdp11core_stim.dat | 11 +++++----- 6 files changed, 46 insertions(+), 15 deletions(-) create mode 100644 doc/ECO-028-ps_init.md diff --git a/doc/CHANGELOG-w11a_V0.60-w11a_V0.70.md b/doc/CHANGELOG-w11a_V0.60-w11a_V0.70.md index 153a2ae5..eab417e7 100644 --- a/doc/CHANGELOG-w11a_V0.60-w11a_V0.70.md +++ b/doc/CHANGELOG-w11a_V0.60-w11a_V0.70.md @@ -3,10 +3,10 @@ ### Release highlights - bugfix for DIV instruction (in [w11a_V0.61](#user-content-w11a_V0.61), - see [ECO-026-div.md](ECO-026-div.md)) + see [ECO-026](ECO-026-div.md)) - revised rbus protocol V4 (in [w11a_V0.62](#user-content-w11a_V0.62), - see [README_Rlink_V4.md](README_Rlink_V4.md)) + see [README_Rlink_V4(README_Rlink_V4.md)) - add basic Vivado support (in [w11a_V0.64](#user-content-w11a_V0.64)) - add Nexys4 and Basys3 port of w11a @@ -585,7 +585,7 @@ Notes: ### Summary - The `div` instruction gave wrong results in some corner cases when either divisor or quotient were the largest negative integer (100000 or -32768). - This is corrected now, for details see [ECO-026-div.md](ECO-026-div.md). + This is corrected now, for details see [ECO-026](ECO-026-div.md). - some minor updates and fixes to support scripts - `xtwi` usage and `XTWI_PATH` setup explained in INSTALL.txt diff --git a/doc/CHANGELOG-w11a_V0.70-w11a_V0.74.md b/doc/CHANGELOG-w11a_V0.70-w11a_V0.74.md index 6c881f38..4bfb2cf0 100644 --- a/doc/CHANGELOG-w11a_V0.70-w11a_V0.74.md +++ b/doc/CHANGELOG-w11a_V0.70-w11a_V0.74.md @@ -4,7 +4,7 @@ - bugfix for mmu trap handling (done in [w11a_V0.71](#user-content-w11a_V0.71), reported in [w11a_V0.72](#user-content-w11a_V0.72), - see [ECO-027-trap_mmu.md](ECO-027-trap_mmu.md)) + see [ECO-027](ECO-027-trap_mmu.md)) - add debug and monitoring units (in [w11a_V0.71](#user-content-w11a_V0.71)) - add Arty port of w11a @@ -398,7 +398,7 @@ - added support for the Vivado simulator. Simple test benches work fine. Rlink based test benches don't work due to a bug in Vivado 2015.4. - A rather esoteric CPU bug was fixed in release V0.71 but forgotten to - mention in the README. See [ECO-027-trap_mmu.md](ECO-027-trap_mmu.md) + mention in the README. See [ECO-027](ECO-027-trap_mmu.md) for details. ### Summary diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index b89a7763..4cff6ae5 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -10,6 +10,7 @@ --- ## HEAD +- `PS` initialized now with `000000` (see [ECO-028](ECO-028-ps_init.md)) --- @@ -20,4 +21,4 @@ - moved w11 project pages from OpenCores to GitHub-Pages [wfjm.github.io/home/w11](https://wfjm.github.io/home/w11/) - converted existing documentation from plain text to markdown -- added README.md files +- added README.md files in sub-directories diff --git a/doc/ECO-028-ps_init.md b/doc/ECO-028-ps_init.md new file mode 100644 index 00000000..bf31fada --- /dev/null +++ b/doc/ECO-028-ps_init.md @@ -0,0 +1,28 @@ +# ECO-028: `PS` init fix (2016-12-26) + +### Scope +- Was in w11a from the very beginning +- Affects: all w11a systems + +### Symptom summary +The `PS` was at start-up and after CPU reset initialized to `000340`, thus +`psw.pri = 7`, thus with interrupts disabled. The real 11/70 actually started +with `000000` and `psw.pri = 0`, thus with interrupts enabled. + +### Background +The `PS` reset behavior in the w11a was simply copied from the `simh` +simulator in 2007, which at this time initialized the `PS` with `000340`. +Only in 2013 (!) it was realized by Bob Supnik that this was incorrect. +See the full story in the exhaustive commit message for +[simh commit f0d41f1](https://github.com/simh/simh/commit/f0d41f15d792b9abc31e8530ee275453c7440a8c). + +### Fixes +`PS` now initialized with `000000` to stay in line with the real 11/70 and simh. + +### Side effects +Hopefully none. All `ibus` devices come up with interrupts disabled, so there +shouldn't be any spurious interrupts at start-up. + +### Provisos +Even a very plausible behavior like _"disable all interrupts at power on"_ can +be the incorrect one. diff --git a/rtl/w11a/pdp11.vhd b/rtl/w11a/pdp11.vhd index 0bc83a79..57270e21 100644 --- a/rtl/w11a/pdp11.vhd +++ b/rtl/w11a/pdp11.vhd @@ -1,6 +1,6 @@ --- $Id: pdp11.vhd 750 2016-03-24 23:11:51Z mueller $ +-- $Id: pdp11.vhd 829 2016-12-26 18:56:17Z mueller $ -- --- Copyright 2006-2015 by Walter F.J. Mueller +-- Copyright 2006-2016 by Walter F.J. Mueller -- -- This program is free software; you may redistribute and/or modify it under -- the terms of the GNU General Public License as published by the Free @@ -16,10 +16,11 @@ -- Description: Definitions for pdp11 components -- -- Dependencies: - --- Tool versions: ise 8.2-14.7; viv 2014.4; ghdl 0.18-0.31 +-- Tool versions: ise 8.2-14.7; viv 2016.2; ghdl 0.18-0.33 -- -- Revision History: -- Date Rev Version Comment +-- 2016-12-26 829 1.6.6 BUGFIX: psw init with pri=0, as on real 11/70 -- 2015-11-01 712 1.6.5 define sbcntl_sbf_tmu := 12; use for pdp11_tmu_sb -- 2015-07-19 702 1.6.4 change DM_STAT_(DP|CO); add DM_STAT_SE -- 2015-07-10 700 1.6.3 define c_cpurust_hbpt; @@ -122,7 +123,7 @@ package pdp11 is constant psw_init : psw_type := ( "00","00", -- cmode, pmode (=kernel) - '0',"111",'0', -- rset, pri (=7), tflag + '0',"000",'0', -- rset, pri (=0), tflag "0000" -- cc NZVC=0 ); diff --git a/rtl/w11a/tb/tb_pdp11core_stim.dat b/rtl/w11a/tb/tb_pdp11core_stim.dat index e7e7b940..392d4540 100644 --- a/rtl/w11a/tb/tb_pdp11core_stim.dat +++ b/rtl/w11a/tb/tb_pdp11core_stim.dat @@ -1,7 +1,8 @@ -# $Id: tb_pdp11core_stim.dat 716 2015-12-22 21:44:33Z mueller $ +# $Id: tb_pdp11core_stim.dat 829 2016-12-26 18:56:17Z mueller $ # # Revision History: # Date Rev Version Comment +# 2016-12-26 829 2.8 PSW now 000000 after cpu reset (cres) # 2015-12-22 716 2.7 comment out test 20.13 (fails since r708) # 2015-05-08 675 2.6 start/stop/suspend overhaul # 2014-12-26 621 2.5 adopt wmembe,ribr,wibr emulation to new 4k window @@ -420,7 +421,7 @@ rpc d=000020 -- ! pc wal 001374 brm 2 d=002206 -- ! (sp) old pc - d=000341 -- ! 2(sp) old ps + d=000001 -- ! 2(sp) old ps #----------------------------------------------------------------------------- C Setup code 3 [base 2300] (bpt against trap handler doing inc r0; rtt) # @@ -816,7 +817,7 @@ rr5 d=003424 -- ! r5=3424 rpc d=003356 -- ! pc wal 003400 brm 10 - d=000340 -- ! mem(3400) after start + d=000000 -- ! mem(3400) after start d=030000 -- ! mem(3402) after mov #030000,(r0) d=030003 -- ! mem(3404) after se(v,c) (VC) d=030341 -- ! mem(3406) after spl 7 (pri=7,C) @@ -1100,7 +1101,7 @@ cres stapc 004030 -- start @ 4030 (just HALT, testing console reset) wtgo rpc d=004032 -- ! pc=4032 -rps d=000340 -- ! psw: reset by CRESET +rps d=000000 -- ! psw: reset by CRESET wal 172516 -- SSR3 rmi d=000000 -- ! cleared by CRESET wal 177572 -- SSR0 @@ -5373,7 +5374,7 @@ rsp d=001374 -- ! sp=1374 wal 001374 -- check stack brm 2 d=100002 -- trap address: PC inc'ed expected for 11/70 [[s:100000]] - d=000340 -- PSW + d=000000 -- PSW cres -- console reset (to clear CPUERR reg) # # simh notes: