From d1cbd70abba43c47cbbbf759e225bd946538325a Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Thu, 12 Nov 1998 06:42:34 +0000 Subject: [PATCH] Add configury for mips-lsi-elf target (32 bit MIPS16). Fix numerous problems with PENDING_* code. In old gencode simulator, don't double tick each cycle. Add BREAK instruction to MIPS16 gencode simulator. --- sim/mips/ChangeLog | 26 ++++++++++ sim/mips/configure | 108 +++++++++++++++++++++--------------------- sim/mips/configure.in | 14 +++--- sim/mips/gencode.c | 9 ++++ sim/mips/interp.c | 3 -- sim/mips/sim-main.c | 43 +++++++++++------ sim/mips/sim-main.h | 16 +++++-- 7 files changed, 135 insertions(+), 84 deletions(-) diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog index baee5ecf1a6..4176bd57bac 100644 --- a/sim/mips/ChangeLog +++ b/sim/mips/ChangeLog @@ -1,3 +1,29 @@ +Sat Nov 7 09:54:38 1998 Andrew Cagney + + * gencode.c (build_instruction - BREAK): For MIPS16, handle BREAK + insn as a debug breakpoint. + + * sim-main.h (PENDING_SLOT_BIT): Fix, was incorrectly defined as + pending.slot_size. + (PENDING_SCHED): Clean up trace statement. + (PENDING_SCHED): Increment PENDING_IN and PENDING_TOTAL. + (PENDING_FILL): Delay write by only one cycle. + (PENDING_FILL): For FSRs, write fmt_uninterpreted to FPR_STATE. + + * sim-main.c (pending_tick): Clean up trace statements. Add trace + of pending writes. + (pending_tick): Fix sizes in switch statements, 4 & 8 instead of + 32 & 64. + (pending_tick): Move incrementing of index to FOR statement. + (pending_tick): Only update PENDING_OUT after a write has occured. + + * configure.in: Add explicit mips-lsi-* target. Use gencode to + build simulator. + * configure: Re-generate. + + * interp.c (sim_engine_run OLD): Delete explicit call to + PENDING_TICK. Now called via ENGINE_ISSUE_PREFIX_HOOK. + start-sanitize-r5900 Wed Nov 11 16:53:57 1998 Andrew Cagney diff --git a/sim/mips/configure b/sim/mips/configure index a26b818ee9a..706514db487 100755 --- a/sim/mips/configure +++ b/sim/mips/configure @@ -3948,15 +3948,9 @@ case "${target}" in sim_igen_machine="-M vr5000,vr5400 -G gen-multi-sim=vr5000" # end-sanitize-cygnus ;; -mips64vr4100-*-*) echo "NOTE: mips64vr4100 still uses gencode" - sim_default_gen=M16 - sim_igen_machine="-M tx19" - sim_m16_machine="-M tx19" - sim_igen_filter = "32,64,f" - sim_m16_filter = "16" - sim_use_gen=NO + mips64vr4100-*-*) echo "NOTE: mips64vr4100 still uses gencode" + sim_use_gen=NO ;; - mips64*-*-*) sim_default_gen=IGEN sim_igen_filter="32,64,f" sim_use_gen=IGEN @@ -3966,6 +3960,10 @@ mips64vr4100-*-*) echo "NOTE: mips64vr4100 still uses gencode" sim_m16_filter="16" sim_use_igen=NO ;; + mips-lsi-*) echo "NOTE: mips-lsi-elf still uses gencode" + sim_use_gen=NO + ;; + mips*-*-*) sim_default_gen=IGEN sim_igen_filter="32,f" sim_use_gen=IGEN @@ -4107,7 +4105,7 @@ esac # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:4111: checking for X" >&5 +echo "configure:4109: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -4169,12 +4167,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4178: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4176: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4243,14 +4241,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4252: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -4364,7 +4362,7 @@ then # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:4368: checking for X" >&5 +echo "configure:4366: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -4426,12 +4424,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4435: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4433: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4500,14 +4498,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -4597,12 +4595,12 @@ fi if test "$no_x" = ""; then if test "$x_includes" = ""; then cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4606: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4604: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -4622,15 +4620,15 @@ rm -f conftest* fi if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then echo $ac_n "checking for X11 header files""... $ac_c" 1>&6 -echo "configure:4626: checking for X11 header files" >&5 +echo "configure:4624: checking for X11 header files" >&5 XINCLUDES="# no special path needed" cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4634: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4632: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -4666,7 +4664,7 @@ rm -f conftest* if test "$no_x" = yes; then echo $ac_n "checking for X11 libraries""... $ac_c" 1>&6 -echo "configure:4670: checking for X11 libraries" >&5 +echo "configure:4668: checking for X11 libraries" >&5 XLIBSW=nope dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/lib/X11 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib" for i in $dirs ; do @@ -4686,7 +4684,7 @@ echo "configure:4670: checking for X11 libraries" >&5 fi if test "$XLIBSW" = nope ; then echo $ac_n "checking for XCreateWindow in -lXwindow""... $ac_c" 1>&6 -echo "configure:4690: checking for XCreateWindow in -lXwindow" >&5 +echo "configure:4688: checking for XCreateWindow in -lXwindow" >&5 ac_lib_var=`echo Xwindow'_'XCreateWindow | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4694,7 +4692,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXwindow $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4821,7 +4819,7 @@ fi #-------------------------------------------------------------------- echo $ac_n "checking for main in -lXbsd""... $ac_c" 1>&6 -echo "configure:4825: checking for main in -lXbsd" >&5 +echo "configure:4823: checking for main in -lXbsd" >&5 ac_lib_var=`echo Xbsd'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4829,14 +4827,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lXbsd $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4860,7 +4858,7 @@ fi # CYGNUS LOCAL: Store any socket library(ies) in the cache, and don't # mess up the cache values of the functions we check for. echo $ac_n "checking for socket libraries""... $ac_c" 1>&6 -echo "configure:4864: checking for socket libraries" >&5 +echo "configure:4862: checking for socket libraries" >&5 if eval "test \"`echo '$''{'sim_cv_lib_sockets'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4868,12 +4866,12 @@ else sim_checkBoth=0 unset ac_cv_func_connect echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:4872: checking for connect" >&5 +echo "configure:4870: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -4919,7 +4917,7 @@ fi if test "$sim_checkSocket" = 1; then unset ac_cv_func_connect echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6 -echo "configure:4923: checking for main in -lsocket" >&5 +echo "configure:4921: checking for main in -lsocket" >&5 ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4927,14 +4925,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4961,12 +4959,12 @@ fi SOCKLIBSW="$SOCKLIBSW -lsocket -lnsl" unset ac_cv_func_accept echo $ac_n "checking for accept""... $ac_c" 1>&6 -echo "configure:4965: checking for accept" >&5 +echo "configure:4963: checking for accept" >&5 if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4991: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_accept=yes" else @@ -5016,12 +5014,12 @@ fi sim_oldLibs=$SOCKLIBSW SOCKLIBSW="$SOCKLIBSW $sim_cv_lib_sockets" echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:5020: checking for gethostbyname" >&5 +echo "configure:5018: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5046: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -5062,7 +5060,7 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6 -echo "configure:5066: checking for main in -lnsl" >&5 +echo "configure:5064: checking for main in -lnsl" >&5 ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5070,14 +5068,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5079: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5137,17 +5135,17 @@ for ac_hdr in string.h strings.h stdlib.h stdlib.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5141: checking for $ac_hdr" >&5 +echo "configure:5139: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5151: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5149: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5174,7 +5172,7 @@ fi done echo $ac_n "checking for fabs in -lm""... $ac_c" 1>&6 -echo "configure:5178: checking for fabs in -lm" >&5 +echo "configure:5176: checking for fabs in -lm" >&5 ac_lib_var=`echo m'_'fabs | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5182,7 +5180,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5223,12 +5221,12 @@ fi for ac_func in aint anint sqrt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5227: checking for $ac_func" >&5 +echo "configure:5225: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else diff --git a/sim/mips/configure.in b/sim/mips/configure.in index 68d68739af8..d22a304ef04 100644 --- a/sim/mips/configure.in +++ b/sim/mips/configure.in @@ -187,15 +187,9 @@ case "${target}" in sim_igen_machine="-M vr5000,vr5400 -G gen-multi-sim=vr5000" # end-sanitize-cygnus ;; -mips64vr4100-*-*) echo "NOTE: mips64vr4100 still uses gencode" - sim_default_gen=M16 - sim_igen_machine="-M tx19" - sim_m16_machine="-M tx19" - sim_igen_filter = "32,64,f" - sim_m16_filter = "16" - sim_use_gen=NO + mips64vr4100-*-*) echo "NOTE: mips64vr4100 still uses gencode" + sim_use_gen=NO ;; - mips64*-*-*) sim_default_gen=IGEN sim_igen_filter="32,64,f" sim_use_gen=IGEN @@ -205,6 +199,10 @@ mips64vr4100-*-*) echo "NOTE: mips64vr4100 still uses gencode" sim_m16_filter="16" sim_use_igen=NO ;; + mips-lsi-*) echo "NOTE: mips-lsi-elf still uses gencode" + sim_use_gen=NO + ;; + mips*-*-*) sim_default_gen=IGEN sim_igen_filter="32,f" sim_use_gen=IGEN diff --git a/sim/mips/gencode.c b/sim/mips/gencode.c index 2e5ed289e9d..ca0dad3fb2e 100644 --- a/sim/mips/gencode.c +++ b/sim/mips/gencode.c @@ -2717,6 +2717,15 @@ build_instruction (doisa, features, mips16, insn) case BREAK: + if (mips16) + { + printf(" if (STATE & simDELAYSLOT)\n"); + printf(" PC = cia - 2; /* reference the branch instruction */\n"); + printf(" else\n"); + printf(" PC = cia;\n"); + printf(" sim_engine_halt (SD, CPU, NULL, cia, sim_stopped, SIM_SIGTRAP);\n"); + break; + } printf(" unsigned int break_code = instruction & HALT_INSTRUCTION_MASK;\n"); printf(" if ( break_code == (HALT_INSTRUCTION & HALT_INSTRUCTION_MASK)\n"); printf(" || break_code == (HALT_INSTRUCTION2 & HALT_INSTRUCTION_MASK))\n"); diff --git a/sim/mips/interp.c b/sim/mips/interp.c index ba3d6e51f24..f2db1250aa8 100644 --- a/sim/mips/interp.c +++ b/sim/mips/interp.c @@ -4277,9 +4277,6 @@ sim_engine_run (sd, next_cpu_nr, nr_cpus, siggnal) CANCELDELAYSLOT(); } - if (MIPSISA < 4) - PENDING_TICK(); - #if !defined(FASTSIM) if (sim_events_tickn (sd, pipeline_count)) { diff --git a/sim/mips/sim-main.c b/sim/mips/sim-main.c index 9e2ea40f94e..f82b182550f 100644 --- a/sim/mips/sim-main.c +++ b/sim/mips/sim-main.c @@ -791,7 +791,7 @@ pending_tick (SIM_DESC SD, address_word cia) { if (PENDING_TRACE) - sim_io_printf (SD, "PENDING_DRAIN - pending_in = %d, pending_out = %d, pending_total = %d\n", PENDING_IN, PENDING_OUT, PENDING_TOTAL); + sim_io_eprintf (SD, "PENDING_DRAIN - 0x%lx - pending_in = %d, pending_out = %d, pending_total = %d\n", (unsigned long) cia, PENDING_IN, PENDING_OUT, PENDING_TOTAL); if (PENDING_OUT != PENDING_IN) { int loop; @@ -799,17 +799,26 @@ pending_tick (SIM_DESC SD, int total = PENDING_TOTAL; if (PENDING_TOTAL == 0) sim_engine_abort (SD, CPU, cia, "PENDING_DRAIN - Mis-match on pending update pointers\n"); - for (loop = 0; (loop < total); loop++) + for (loop = 0, index = PENDING_OUT; + (loop < total); + loop++, index = (index + 1) % PSLOTS) { if (PENDING_SLOT_DEST[index] != NULL) { PENDING_SLOT_DELAY[index] -= 1; if (PENDING_SLOT_DELAY[index] == 0) { + if (PENDING_TRACE) + sim_io_eprintf (SD, "PENDING_DRAIN - drained - index %d, dest 0x%lx, bit %d, val 0x%lx, size %d\n", + index, + (unsigned long) PENDING_SLOT_DEST[index], + PENDING_SLOT_BIT[index], + (unsigned long) PENDING_SLOT_VALUE[index], + PENDING_SLOT_SIZE[index]); if (PENDING_SLOT_BIT[index] >= 0) switch (PENDING_SLOT_SIZE[index]) { - case 32: + case 4: if (PENDING_SLOT_VALUE[index]) *(unsigned32*)PENDING_SLOT_DEST[index] |= BIT32 (PENDING_SLOT_BIT[index]); @@ -817,7 +826,7 @@ pending_tick (SIM_DESC SD, *(unsigned32*)PENDING_SLOT_DEST[index] &= BIT32 (PENDING_SLOT_BIT[index]); break; - case 64: + case 8: if (PENDING_SLOT_VALUE[index]) *(unsigned64*)PENDING_SLOT_DEST[index] |= BIT64 (PENDING_SLOT_BIT[index]); @@ -825,30 +834,36 @@ pending_tick (SIM_DESC SD, *(unsigned64*)PENDING_SLOT_DEST[index] &= BIT64 (PENDING_SLOT_BIT[index]); break; - break; } else switch (PENDING_SLOT_SIZE[index]) { - case 32: + case 4: *(unsigned32*)PENDING_SLOT_DEST[index] = PENDING_SLOT_VALUE[index]; break; - case 64: + case 8: *(unsigned64*)PENDING_SLOT_DEST[index] = PENDING_SLOT_VALUE[index]; break; } + if (PENDING_OUT == index) + { + PENDING_SLOT_DEST[index] = NULL; + PENDING_OUT = (PENDING_OUT + 1) % PSLOTS; + PENDING_TOTAL--; + } } - if (PENDING_OUT == index) - { - PENDING_SLOT_DEST[index] = NULL; - PENDING_OUT = (PENDING_OUT + 1) % PSLOTS; - PENDING_TOTAL--; - } + else if (PENDING_TRACE && PENDING_SLOT_DELAY[index] > 0) + sim_io_eprintf (SD, "PENDING_DRAIN - queued - index %d, delay %d, dest 0x%lx, bit %d, val 0x%lx, size %d\n", + index, PENDING_SLOT_DELAY[index], + (unsigned long) PENDING_SLOT_DEST[index], + PENDING_SLOT_BIT[index], + (unsigned long) PENDING_SLOT_VALUE[index], + PENDING_SLOT_SIZE[index]); + } } - index = (index + 1) % PSLOTS; } } diff --git a/sim/mips/sim-main.h b/sim/mips/sim-main.h index 95b04fd5de7..42c152cb840 100644 --- a/sim/mips/sim-main.h +++ b/sim/mips/sim-main.h @@ -449,7 +449,7 @@ typedef struct _pending_write_queue { #define PENDING_OUT ((CPU)->pending.out) #define PENDING_TOTAL ((CPU)->pending.total) #define PENDING_SLOT_SIZE ((CPU)->pending.slot_size) -#define PENDING_SLOT_BIT ((CPU)->pending.slot_size) +#define PENDING_SLOT_BIT ((CPU)->pending.slot_bit) #define PENDING_SLOT_DELAY ((CPU)->pending.slot_delay) #define PENDING_SLOT_DEST ((CPU)->pending.slot_dest) #define PENDING_SLOT_VALUE ((CPU)->pending.slot_value) @@ -472,12 +472,17 @@ memset (&(CPU)->pending, 0, sizeof ((CPU)->pending)) sim_engine_abort (SD, CPU, cia, \ "PENDING_SCHED - buffer overflow\n"); \ if (PENDING_TRACE) \ - sim_io_printf (SD, "PENDING_SCHED - dest 0x%lx, val 0x%lx, pending_in %d, pending_out %d, pending_total %d\n", (unsigned long) (DEST), (unsigned long) (VAL), PENDING_IN, PENDING_OUT, PENDING_TOTAL); \ + sim_io_eprintf (SD, "PENDING_SCHED - 0x%lx - dest 0x%lx, val 0x%lx, bit %d, size %d, pending_in %d, pending_out %d, pending_total %d\n", \ + (unsigned long) cia, (unsigned long) &(DEST), \ + (unsigned long) (VAL), (BIT), (int) sizeof (DEST),\ + PENDING_IN, PENDING_OUT, PENDING_TOTAL); \ PENDING_SLOT_DELAY[PENDING_IN] = (DELAY) + 1; \ PENDING_SLOT_DEST[PENDING_IN] = &(DEST); \ PENDING_SLOT_VALUE[PENDING_IN] = (VAL); \ PENDING_SLOT_SIZE[PENDING_IN] = sizeof (DEST); \ PENDING_SLOT_BIT[PENDING_IN] = (BIT); \ + PENDING_IN = (PENDING_IN + 1) % PSLOTS; \ + PENDING_TOTAL += 1; \ } while (0) #define PENDING_WRITE(DEST,VAL,DELAY) PENDING_SCHED(DEST,VAL,DELAY,-1) @@ -492,9 +497,12 @@ memset (&(CPU)->pending, 0, sizeof ((CPU)->pending)) #define PENDING_FILL(R,VAL) \ { \ if ((R) >= FGRIDX && (R) < FGRIDX + NR_FGR) \ - PENDING_SCHED(FGR[(R) - FGRIDX], VAL, 2, -1); \ + { \ + PENDING_SCHED(FGR[(R) - FGRIDX], VAL, 1, -1); \ + PENDING_SCHED(FPR_STATE[(R) - FGRIDX], fmt_uninterpreted, 1, -1); \ + } \ else \ - PENDING_SCHED(GPR[(R)], VAL, 2, -1); \ + PENDING_SCHED(GPR[(R)], VAL, 1, -1); \ } -- 2.30.2