From 943af9d98e837053bbf45dd23579057593aa04d7 Mon Sep 17 00:00:00 2001 From: joxe Date: Fri, 26 Oct 2007 13:02:55 +0000 Subject: [PATCH] fixed reset to call reset on all IOUnits git-svn-id: https://mspsim.svn.sourceforge.net/svnroot/mspsim/mspsim@13 23d1a52b-0c3c-0410-b72d-8f29ab48fe35 --- se/sics/mspsim/core/MSP430.java | 4 ---- se/sics/mspsim/core/MSP430Core.java | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/se/sics/mspsim/core/MSP430.java b/se/sics/mspsim/core/MSP430.java index b1b6744..7cd2f05 100644 --- a/se/sics/mspsim/core/MSP430.java +++ b/se/sics/mspsim/core/MSP430.java @@ -213,10 +213,6 @@ public class MSP430 extends MSP430Core { running = false; } - public void reset() { - reg[PC] = memory[0xfffe] + (memory[0xffff] << 8); - } - public int getExecCount(int address) { if (execCounter != null) { return execCounter[address]; diff --git a/se/sics/mspsim/core/MSP430Core.java b/se/sics/mspsim/core/MSP430Core.java index c195763..efb9b7f 100644 --- a/se/sics/mspsim/core/MSP430Core.java +++ b/se/sics/mspsim/core/MSP430Core.java @@ -312,6 +312,20 @@ public class MSP430Core implements MSP430Constants { } } + private void resetIOUnits() { + for (int i = 0, n = lastIOUnitPos; i < n; i++) { + ioUnits[i].reset(); + } + for (int i = 0, n = passiveIOUnits.length; i < n; i++) { + passiveIOUnits[i].reset(); + } + } + + public void reset() { + resetIOUnits(); + reg[PC] = memory[0xfffe] + (memory[0xffff] << 8); + } + // Indicate that we have an interrupt now! // We should only get same IOUnit for same interrupt level public void flagInterrupt(int interrupt, IOUnit source, boolean triggerIR) { @@ -920,4 +934,5 @@ public class MSP430Core implements MSP430Constants { writeRegister(SR, sr); } } + }