From: <jo...@us...> - 2007-12-01 00:05:00
|
Revision: 34 http://mspsim.svn.sourceforge.net/mspsim/?rev=34&view=rev Author: joxe Date: 2007-11-30 16:04:48 -0800 (Fri, 30 Nov 2007) Log Message: ----------- some minor fixes Modified Paths: -------------- mspsim/se/sics/mspsim/core/MSP430.java mspsim/se/sics/mspsim/core/MSP430Constants.java mspsim/se/sics/mspsim/core/MSP430Core.java mspsim/se/sics/mspsim/util/StackUI.java Modified: mspsim/se/sics/mspsim/core/MSP430.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430.java 2007-11-30 23:09:51 UTC (rev 33) +++ mspsim/se/sics/mspsim/core/MSP430.java 2007-12-01 00:04:48 UTC (rev 34) @@ -56,7 +56,10 @@ // Debug time - measure cycles private long lastCycles = 0; + private long lastCpuCycles = 0; private long time; + private long nextSleep = 0; + private long nextOut = 0; private long instCtr = 0; @@ -103,11 +106,13 @@ } } + if (cycles > nextOut && !debug) { + printCPUSpeed(reg[PC]); + nextOut = cycles + 10000007; + } + if (emulateOP()) { instCtr++; - if ((instCtr % 1000007) == 0 && !debug) { - printCPUSpeed(reg[PC]); - } if (execCounter != null) { execCounter[reg[PC]]++; @@ -126,6 +131,15 @@ } } + /* Just a test to see if it gets down to a reasonable speed */ + if (cycles > nextSleep) { + try { + Thread.sleep(10); + } catch (Exception e) { + } + nextSleep = cycles + 50000; + } + // if ((instruction & 0xff80) == CALL) { // System.out.println("Call to PC = " + reg[PC]); // } @@ -260,14 +274,20 @@ private void printCPUSpeed(int pc) { int td = (int)(System.currentTimeMillis() - time); int cd = (int) (cycles - lastCycles); + int cpud = (int) (cpuCycles - lastCpuCycles); + if (td == 0 || cd == 0) return; + if (DEBUGGING_LEVEL > 0) { - System.out.println("Time elapsed: " + td - + " cycDiff: " + cd - + " => " + 1000 * (cd / td ) + " cycles / s"); + System.out.println("Elapsed: " + td + + " cycDiff: " + cd + " => " + 1000 * (cd / td ) + + " cyc/s cpuDiff:" + cpud + " => " + + 1000 * (cpud / td ) + " cyc/s " + + (10000 * cpud / cd)/100.0 + "%"); } time = System.currentTimeMillis(); lastCycles = cycles; + lastCpuCycles = cpuCycles; disAsm.disassemble(pc, memory, reg); } Modified: mspsim/se/sics/mspsim/core/MSP430Constants.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Constants.java 2007-11-30 23:09:51 UTC (rev 33) +++ mspsim/se/sics/mspsim/core/MSP430Constants.java 2007-12-01 00:04:48 UTC (rev 34) @@ -136,5 +136,5 @@ public static final int CLKCAPTURE_BOTH = 3; - public static final int DEBUGGING_LEVEL = 0; + public static final int DEBUGGING_LEVEL = 1; } Modified: mspsim/se/sics/mspsim/core/MSP430Core.java =================================================================== --- mspsim/se/sics/mspsim/core/MSP430Core.java 2007-11-30 23:09:51 UTC (rev 33) +++ mspsim/se/sics/mspsim/core/MSP430Core.java 2007-12-01 00:04:48 UTC (rev 34) @@ -337,7 +337,7 @@ servicedInterruptUnit = null; servicedInterrupt = -1; interruptMax = -1; - cpuOff = false; + writeRegister(SR, 0); } // Indicate that we have an interrupt now! Modified: mspsim/se/sics/mspsim/util/StackUI.java =================================================================== --- mspsim/se/sics/mspsim/util/StackUI.java 2007-11-30 23:09:51 UTC (rev 33) +++ mspsim/se/sics/mspsim/util/StackUI.java 2007-12-01 00:04:48 UTC (rev 34) @@ -49,7 +49,7 @@ public class StackUI extends JPanel implements CPUMonitor { - private static final int STACK_FRAME = 2048; + private static final int STACK_FRAME = 1024; private int updateCyclePeriod = 2500; private MSP430 cpu; @@ -106,8 +106,8 @@ if (this.maxData[pos] < size) { this.maxData[pos] = size; } - if (cpu.cycles - lastCycles > updateCyclePeriod) { - lastCycles = cpu.cycles; + if (cpu.cpuCycles - lastCycles > updateCyclePeriod) { + lastCycles = cpu.cpuCycles; //System.out.println("STACK UPDATE: " + type + "," + adr + "," + data); pos = (pos + 1) % this.minData.length; this.minData[pos] = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |