diff --git a/rtl/ibus/ibdr_deuna.vhd b/rtl/ibus/ibdr_deuna.vhd index a154cac2..ee6898b3 100644 --- a/rtl/ibus/ibdr_deuna.vhd +++ b/rtl/ibus/ibdr_deuna.vhd @@ -1,4 +1,4 @@ --- $Id: ibdr_deuna.vhd 874 2017-04-14 17:53:07Z mueller $ +-- $Id: ibdr_deuna.vhd 894 2017-05-07 07:18:32Z mueller $ -- -- Copyright 2014-2017 by Walter F.J. Mueller -- @@ -18,16 +18,18 @@ -- Dependencies: - -- Test bench: - -- Target Devices: generic --- Tool versions: ise 14.7; viv 2016.4; ghdl 0.33 +-- Tool versions: ise 14.7; viv 2016.4-2017.1; ghdl 0.33-0.34 -- -- Synthesized (xst): -- Date Rev ise Target flop lutl lutm slic t peri +-- 2017-05-06 894 14.7 131013 xc6slx16-2 53 92 0 42 s 4.4 -- 2017-04-14 874 14.7 131013 xc6slx16-2 50 79 0 40 s 4.1 -- 2017-01-29 847 14.7 131013 xc6slx16-2 42 70 0 36 s 4.1 -- -- Revision History: -- Date Rev Version Comment --- 2017-04-14 875 1.0 Initial version +-- 2017-05-06 894 1.0 Initial version (full functionality) +-- 2017-04-14 875 0.5 Initial version (partial functionality) -- 2014-06-09 561 0.1 First draft ------------------------------------------------------------------------------ @@ -74,11 +76,13 @@ architecture syn of ibdr_deuna is subtype pr0_ibf_pcmd is integer range 3 downto 0; -- additional rem view assignments subtype pr0_ibf_pcmdbp is integer range 15 downto 12; + constant pr0_ibf_pdmdwb: integer := 10; constant pr0_ibf_busy : integer := 9; constant pr0_ibf_pcwwb : integer := 8; constant pr0_ibf_brst : integer := 4; constant pcmd_noop : slv4 := "0000"; -- pcmd: noop (DNI not set !) + constant pcmd_pdmd : slv4 := "1000"; -- pcmd: pdmd constant pr1_ibf_xpwr : integer := 15; constant pr1_ibf_icab : integer := 14; @@ -110,6 +114,7 @@ architecture syn of ibdr_deuna is pr1deuna : slbit; -- pr1: bit 0 of ID (0=DEUNA;1=DELUA) pr1state : slv4; -- pr1: port status pcbb : slv18_1; -- pr2+3: port conrol block base + pdmdwb : slbit; -- restart for pdmd while busy busy : slbit; -- busy pcmdwwb : slbit; -- pcmd written while busy pcmdbp : slv4; -- pcmd busy protected @@ -128,7 +133,7 @@ architecture syn of ibdr_deuna is '0','0', -- pr1pcto,pr1deuna state_reset, -- pr1state (others=>'0'), -- pcbb - '0','0', -- busy,pcmdwwb + '0','0','0', -- pdmdwb,busy,pcmdwwb (others=>'0'), -- pcmdbp '0', -- resreq '0' -- ireq @@ -198,6 +203,7 @@ begin idout(pr0_ibf_usci) := r.pr0usci; else -- rem view of upper byte idout(pr0_ibf_pcmdbp) := r.pcmdbp; + idout(pr0_ibf_pdmdwb) := r.pdmdwb; idout(pr0_ibf_busy) := r.busy; idout(pr0_ibf_pcwwb) := r.pcmdwwb; end if; @@ -212,21 +218,39 @@ begin if IB_MREQ.we = '1' then if ibrem = '1' then -- rem write if IB_MREQ.din(pr0_ibf_seri) = '1' then n.pr0seri := '1'; end if; - if IB_MREQ.din(pr0_ibf_pcei) = '1' then n.pr0pcei := '1'; end if; + if IB_MREQ.din(pr0_ibf_pcei) = '1' then + n.pcmdwwb := '0'; + n.pdmdwb := '0'; + n.busy := '0'; + n.pr0pcei := '1'; + end if; if IB_MREQ.din(pr0_ibf_rxi) = '1' then n.pr0rxi := '1'; end if; if IB_MREQ.din(pr0_ibf_txi) = '1' then n.pr0txi := '1'; end if; - if IB_MREQ.din(pr0_ibf_dni) = '1' then n.pr0dni := '1'; end if; - if IB_MREQ.din(pr0_ibf_rcbi) = '1' then n.pr0rcbi := '1'; end if; - if IB_MREQ.din(pr0_ibf_usci) = '1' then n.pr0usci := '1'; end if; - if IB_MREQ.din(pr0_ibf_rset) = '1' then n.pr0rset := '0'; end if; - if IB_MREQ.din(pr0_ibf_brst) = '1' then n.pr0brst := '0'; end if; - if IB_MREQ.din(pr0_ibf_dni) = '1' or - IB_MREQ.din(pr0_ibf_pcei) = '1' or - IB_MREQ.din(pr0_ibf_busy) = '1' or - IB_MREQ.din(pr0_ibf_rset) = '1' or - IB_MREQ.din(pr0_ibf_brst) = '1' then - n.busy := '0'; + if IB_MREQ.din(pr0_ibf_dni) = '1' then + n.pcmdwwb := '0'; + n.pdmdwb := '0'; + -- if pdmd issued while busy, restart with pdmd, else end pcmd + if r.pcmdwwb = '1' and r.pr0pcmd = pcmd_pdmd then + n.pcmdbp := pcmd_pdmd; + n.pdmdwb := '1'; + ilam := '1'; -- rri lam: restart with pdmd + else + n.busy := '0'; + n.pr0dni := '1'; + end if; end if; + if IB_MREQ.din(pr0_ibf_rcbi) = '1' then n.pr0rcbi := '1'; end if; + if IB_MREQ.din(pr0_ibf_busy) = '1' then n.busy := '0'; end if; + if IB_MREQ.din(pr0_ibf_usci) = '1' then n.pr0usci := '1'; end if; + if IB_MREQ.din(pr0_ibf_rset) = '1' then + n.busy := '0'; + n.pr0rset := '0'; + end if; + if IB_MREQ.din(pr0_ibf_brst) = '1' then + n.busy := '0'; + n.pr0brst := '0'; + end if; + else -- loc write if IB_MREQ.be1 = '1' then if IB_MREQ.din(pr0_ibf_seri) = '1' then n.pr0seri := '0'; end if; @@ -260,10 +284,6 @@ begin end if; -- else ibrem = '1' end if; -- if IB_MREQ.we = '1' - if IB_MREQ.re = '1' and ibrem = '1' then -- for rem pr0 reads - n.pcmdwwb := '0'; -- clear pcmdwwb - end if; - when ibaddr_pr1 => -- PCSR1 - status ------------------ idout(pr1_ibf_xpwr) := r.pr1xpwr; idout(pr1_ibf_icab) := r.pr1icab; diff --git a/tools/oskit/hook/hook_ibmon_xua.tcl b/tools/oskit/hook/hook_ibmon_xua.tcl index 6f50a1a6..6be666ad 100644 --- a/tools/oskit/hook/hook_ibmon_xua.tcl +++ b/tools/oskit/hook/hook_ibmon_xua.tcl @@ -1,8 +1,9 @@ -# $Id: hook_ibmon_xua.tcl 899 2017-05-27 13:25:41Z mueller $ +# $Id: hook_ibmon_xua.tcl 901 2017-05-28 11:26:11Z mueller $ puts "hook: start ibmon for xua" -package require ibd_ibmon -ibd_ibmon::stop -cpu0 cp -wibr im.lolim [cpu0 imap xua.pr0] \ - -wibr im.hilim [cpu0 imap xua.pr3] -#ibd_ibmon::start cpu0 wena 0 -ibd_ibmon::start + +# set filter on xua registers +# repeat collapse for reads (211bsd driver does polling!) + +.imd +.imf xua.pr0 xua.pr3 +.ime R diff --git a/tools/src/librw11/Rw11CntlDEUNA.cpp b/tools/src/librw11/Rw11CntlDEUNA.cpp index 1907578b..26227ca9 100644 --- a/tools/src/librw11/Rw11CntlDEUNA.cpp +++ b/tools/src/librw11/Rw11CntlDEUNA.cpp @@ -1,4 +1,4 @@ -// $Id: Rw11CntlDEUNA.cpp 887 2017-04-28 19:32:52Z mueller $ +// $Id: Rw11CntlDEUNA.cpp 901 2017-05-28 11:26:11Z mueller $ // // Copyright 2014-2017 by Walter F.J. Mueller // @@ -13,7 +13,7 @@ // // Revision History: // Date Rev Version Comment -// 2017-04-17 880 0.5 Initial version (works w 211bsd; no err handling) +// 2017-04-17 880 0.5 Initial version (minimal functions, 211bsd ready) // 2014-06-09 561 0.1 First draft // --------------------------------------------------------------------------- @@ -81,6 +81,7 @@ const uint16_t Rw11CntlDEUNA::kPR0_M_PCMD; const uint16_t Rw11CntlDEUNA::kPR0_V_PCMDBP; const uint16_t Rw11CntlDEUNA::kPR0_B_PCMDBP; +const uint16_t Rw11CntlDEUNA::kPR0_M_PDMDWB; const uint16_t Rw11CntlDEUNA::kPR0_M_PCWWB; const uint16_t Rw11CntlDEUNA::kPCMD_NOOP; @@ -253,6 +254,9 @@ Rw11CntlDEUNA::Rw11CntlDEUNA() fStats.Define(kStatNPcmdHalt , "NPcmdHalt" , "pcmd HALT"); fStats.Define(kStatNPcmdRsrvd , "NPcmdRsrvd" , "pcmd reserved"); fStats.Define(kStatNPcmdUimpl , "NPcmdUimpl" , "pcmd not implemented"); + fStats.Define(kStatNPcmdWBPdmd , "NPcmdWBPdmd" , "pcmd write w/ busy: pdmd"); + fStats.Define(kStatNPcmdWBOther, "NPcmdWBOther", "pcmd write w/ busy: other"); + fStats.Define(kStatNPdmdRestart, "NPdmdRestart", "pcmd pdmd restart"); fStats.Define(kStatNFuncNoop , "NFuncNoop" , "func NOOP"); fStats.Define(kStatNFuncRdpa , "NFuncRdpa" , "func RDPA"); fStats.Define(kStatNFuncRpa , "NFuncRpa" , "func PRA"); @@ -726,15 +730,25 @@ int Rw11CntlDEUNA::AttnHandler(RlinkServer::AttnArgs& args) bool brst = fPr0Last & kPR0_M_BRST; uint16_t pcmd = (fPr0Last>>kPR0_V_PCMDBP) & kPR0_B_PCMDBP; - // check for pcmd write while busy (part 1) + // check for pcmd write while busy if (fPr0Last & kPR0_M_PCWWB) { - RlogMsg lmsg(LogFile()); - lmsg << "-E " << Name() << ": pcmd race" - << " pr0=" << RosPrintBvi(fPr0Last,8) - << " pcmd-1st=" << MnemoPcmd(pcmd) - << " pcmd-2nd=" << MnemoPcmd(fPr0Last & kPR0_M_PCMD); + uint16_t pcmdwwb = fPr0Last & kPR0_M_PCMD; + if (pcmdwwb == kPCMD_PDMD) { + fStats.Inc(kStatNPcmdWBPdmd); + } else { + fStats.Inc(kStatNPcmdWBOther); + RlogMsg lmsg(LogFile()); + lmsg << "-E " << Name() << ": pcmd write w/ busy" + << " pr0=" << RosPrintBvi(fPr0Last,8) + << " pcmd-1st=" << MnemoPcmd(pcmd) + << " pcmd-2nd=" << MnemoPcmd(pcmdwwb); + } } - + // check for pcmd pdmd while busy restarts + if (fPr0Last & kPR0_M_PDMDWB) { + fStats.Inc(kStatNPdmdRestart); + } + RlinkCommandList clist; fPr1Pcto = false; diff --git a/tools/src/librw11/Rw11CntlDEUNA.hpp b/tools/src/librw11/Rw11CntlDEUNA.hpp index 8da69a8e..bc16093c 100644 --- a/tools/src/librw11/Rw11CntlDEUNA.hpp +++ b/tools/src/librw11/Rw11CntlDEUNA.hpp @@ -1,4 +1,4 @@ -// $Id: Rw11CntlDEUNA.hpp 887 2017-04-28 19:32:52Z mueller $ +// $Id: Rw11CntlDEUNA.hpp 901 2017-05-28 11:26:11Z mueller $ // // Copyright 2014-2017 by Walter F.J. Mueller // @@ -13,7 +13,7 @@ // // Revision History: // Date Rev Version Comment -// 2017-04-14 875 1.0 Initial version +// 2017-04-14 875 0.5 Initial version (minimal functions, 211bsd ready) // 2014-06-09 561 0.1 First draft // --------------------------------------------------------------------------- @@ -97,8 +97,9 @@ namespace Retro { static const uint16_t kPR0_M_BRST = kWBit04; //!< RSET: breset seen static const uint16_t kPR0_M_PCMD = 00017; //!< PCMD: port command - static const uint16_t kPR0_V_PCMDBP= 12; //!< PCMDBP: port busy prot - static const uint16_t kPR0_B_PCMDBP= 00017; //!< PCMDBP: port busy prot + static const uint16_t kPR0_V_PCMDBP= 12; //!< PCMDBP: pcmd busy prot + static const uint16_t kPR0_B_PCMDBP= 00017; //!< PCMDBP: pcmd busy prot + static const uint16_t kPR0_M_PDMDWB= kWBit10; //!< PDMDWB: pdmd while busy static const uint16_t kPR0_M_PCWWB = kWBit08; //!< PCWWB: pcmd write w busy static const uint16_t kPCMD_NOOP = 0; //!< NOOP: noop @@ -222,6 +223,9 @@ namespace Retro { kStatNPcmdHalt, kStatNPcmdRsrvd, kStatNPcmdUimpl, + kStatNPcmdWBPdmd, + kStatNPcmdWBOther, + kStatNPdmdRestart, kStatNFuncNoop, kStatNFuncRdpa, kStatNFuncRpa, diff --git a/tools/tbench/deuna/test_deuna_func.tcl b/tools/tbench/deuna/test_deuna_func.tcl index da4dcb8e..3b9ffef1 100644 --- a/tools/tbench/deuna/test_deuna_func.tcl +++ b/tools/tbench/deuna/test_deuna_func.tcl @@ -1,11 +1,12 @@ -# $Id: test_deuna_func.tcl 874 2017-04-14 17:53:07Z mueller $ +# $Id: test_deuna_func.tcl 894 2017-05-07 07:18:32Z mueller $ # # Copyright 2017- by Walter F.J. Mueller # License disclaimer see License.txt in $RETROBASE directory # # Revision History: # Date Rev Version Comment -# 2017-04-14 874 1.0 Initial version +# 2017-05-06 894 1.0 Initial version (full functionality) +# 2017-04-14 874 0.5 Initial version (partial functionality) # 2017-01-30 848 0.1 First draft # # Test function response @@ -71,8 +72,32 @@ foreach pcmd {0x01 0x02 0x08 0x0f} { -rma xua.pr0 -edata 0 } -rlc log " A1.4: check pcmd busy protect logic----------------" +rlc log " A1.4: pcmd busy protect logic: 2nd not PDMD -------" # pr0 is clean from previous test ! +# issue 1st GETPCB and 2nd GETCMD +$cpu cp \ + -wma xua.pr0 [regbld ibd_deuna::PR0 {pcmd "GETPCB"}] \ + -rma xua.pr0 -edata [regbld ibd_deuna::PR0 {pcmd "GETPCB"}] \ + -wma xua.pr0 [regbld ibd_deuna::PR0 {pcmd "GETCMD"}] \ + -rma xua.pr0 -edata [regbld ibd_deuna::PR0 {pcmd "GETCMD"}] + +rlc wtlam 1. +rlc exec -attn -edata $attnmsk + +# simulate command handling in backend +# pcmd and pcmdbp differ now +# pcwwb is cleared by dni +$cpu cp \ + -ribr xua.pr0 -edata [regbldkv ibd_deuna::PR0RR \ + pcmdbp "GETPCB" busy 1 pcwwb 1 pcmd "GETCMD"] \ + -wibr xua.pr0 [regbld ibd_deuna::PR0RW dni] \ + -rma xua.pr0 -edata [regbldkv ibd_deuna::PR0 dni 1 intr 1 pcmd "GETCMD"] \ + -wma xua.pr0 [regbldkv ibd_deuna::PR0 dni 1] \ + -rma xua.pr0 -edata 0 + +rlc log " A1.5: pcmd busy protect logic: restart with PDMD --" +# pr0 is clean from previous test ! +# issue 1st GETCMD and 2nd PDMD $cpu cp \ -wma xua.pr0 [regbld ibd_deuna::PR0 {pcmd "GETCMD"}] \ -rma xua.pr0 -edata [regbld ibd_deuna::PR0 {pcmd "GETCMD"}] \ @@ -84,12 +109,25 @@ rlc exec -attn -edata $attnmsk # simulate command handling in backend # pcmd and pcmdbp differ now -# pcwwb is cleared by rem pr0 read (check by reading twice) +# dni will clear pcwwb, restart with attn, and not set dni (thus intr=0) + $cpu cp \ -ribr xua.pr0 -edata [regbldkv ibd_deuna::PR0RR \ pcmdbp "GETCMD" busy 1 pcwwb 1 pcmd "PDMD"] \ + -wibr xua.pr0 [regbld ibd_deuna::PR0RW dni] \ + -rma xua.pr0 -edata [regbldkv ibd_deuna::PR0 dni 0 intr 0 pcmd "PDMD"] + +# handle restarted pdmd +rlc wtlam 1. +rlc exec -attn -edata $attnmsk + +# simulate command handling in backend +# pcmd and pcmdbp equal now; pcwwb=0 now +# dni will end transaction now + +$cpu cp \ -ribr xua.pr0 -edata [regbldkv ibd_deuna::PR0RR \ - pcmdbp "GETCMD" busy 1 pcmd "PDMD"] \ + pcmdbp "PDMD" pdmdwb 1 busy 1 pcwwb 0 pcmd "PDMD"] \ -wibr xua.pr0 [regbld ibd_deuna::PR0RW dni] \ -rma xua.pr0 -edata [regbldkv ibd_deuna::PR0 dni 1 intr 1 pcmd "PDMD"] \ -wma xua.pr0 [regbldkv ibd_deuna::PR0 dni 1] \ diff --git a/tools/tbench/deuna/test_deuna_int.tcl b/tools/tbench/deuna/test_deuna_int.tcl index 3f355164..79c315a4 100644 --- a/tools/tbench/deuna/test_deuna_int.tcl +++ b/tools/tbench/deuna/test_deuna_int.tcl @@ -1,4 +1,4 @@ -# $Id: test_deuna_int.tcl 874 2017-04-14 17:53:07Z mueller $ +# $Id: test_deuna_int.tcl 895 2017-05-07 07:38:47Z mueller $ # # Copyright 2017- by Walter F.J. Mueller # License disclaimer see License.txt in $RETROBASE directory @@ -99,7 +99,7 @@ proc tmpproc_dotest {cpu symName args} { r3 $opts(o.r3) \ r4 $opts(o.r4) \ sp $sym(stack) - return "" + return } # -- Section A --------------------------------------------------------------- diff --git a/tools/tcl/ibd_deuna/util.tcl b/tools/tcl/ibd_deuna/util.tcl index 0387bb22..6a4b50d4 100644 --- a/tools/tcl/ibd_deuna/util.tcl +++ b/tools/tcl/ibd_deuna/util.tcl @@ -1,4 +1,4 @@ -# $Id: util.tcl 874 2017-04-14 17:53:07Z mueller $ +# $Id: util.tcl 894 2017-05-07 07:18:32Z mueller $ # # Copyright 2014-2017 by Walter F.J. Mueller # @@ -13,7 +13,8 @@ # # Revision History: # Date Rev Version Comment -# 2017-04-14 874 1.0 Initial version +# 2017-05-06 894 1.0 Initial version (full functionality) +# 2017-04-14 874 0.5 Initial version (partial functionality) # 2014-06-09 561 0.1 First draft # @@ -32,7 +33,7 @@ namespace eval ibd_deuna { regdsc PR0 {seri 15} {pcei 14} {rxi 13} {txi 12} {dni 11} {rcbi 10} \ {usci 8} {intr 7} {inte 6} {rset 5} \ [list "pcmd" 3 4 $pcmdtxt] - regdsc PR0RR [list "pcmdbp" 15 4 $pcmdtxt] {busy 9} {pcwwb 8}\ + regdsc PR0RR [list "pcmdbp" 15 4 $pcmdtxt] {pdmdwb 10} {busy 9} {pcwwb 8}\ {intr 7} {inte 6} {rset 5} {brst 4} \ [list "pcmd" 3 4 $pcmdtxt] regdsc PR0RW {seri 15} {pcei 14} {rxi 13} {txi 12} {dni 11} {rcbi 10} \