[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Simulavr-devel] [PATCH] Add BREAK-instruction, causes simulavr to halt.
From: |
Stan Behrens |
Subject: |
[Simulavr-devel] [PATCH] Add BREAK-instruction, causes simulavr to halt. |
Date: |
Fri, 30 Dec 2011 10:44:57 +0100 |
TODO: Check if execution is continuable on a real MCU.
---
src/decoder.cpp | 9 +++++++++
src/decoder.h | 20 ++++++++++++++++++++
src/decoder_trace.cpp | 6 ++++++
3 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/src/decoder.cpp b/src/decoder.cpp
index f7cf3cb..f350c26 100644
--- a/src/decoder.cpp
+++ b/src/decoder.cpp
@@ -28,6 +28,7 @@
#include "flash.h"
#include "hwwado.h"
#include "hwsreg.h"
+#include "global.h" //only 2 defines here... please move that sometimes
womewhere TODO XXX
#include "avrerror.h"
#include "ioregs.h"
@@ -1767,6 +1768,13 @@ int avr_op_WDR::operator()() {
return 1;
}
+avr_op_BREAK::avr_op_BREAK(word opcode, AvrDevice *c):
+ DecodedInstruction(c) {}
+
+int avr_op_BREAK::operator()() {
+ return BREAK_POINT;
+}
+
avr_op_ILLEGAL::avr_op_ILLEGAL(word opcode, AvrDevice *c):
DecodedInstruction(c) {}
@@ -1996,6 +2004,7 @@ DecodedInstruction* lookup_opcode( word opcode, AvrDevice
*core )
else
return new avr_op_ILLEGAL(opcode, core);
case 0x95A8: return new avr_op_WDR(opcode, core); /*
1001 0101 1010 1000 | WDR */
+ case 0x9598: return new avr_op_BREAK(opcode, core); /*
1001 0101 1001 1000 | BREAK */
default:
{
/* opcodes with two 5-bit register (Rd and Rr)
operands */
diff --git a/src/decoder.h b/src/decoder.h
index 4e5d13f..b810fef 100644
--- a/src/decoder.h
+++ b/src/decoder.h
@@ -2055,6 +2055,26 @@ class avr_op_WDR: public DecodedInstruction
int Trace();
};
+class avr_op_BREAK: public DecodedInstruction
+{
+ /*
+ * Halts execution
+ *
+ * TODO Check if execution is continuable on a real MCU
+ *
+ * Opcode : 1001 0101 1001 1000
+ * Usage : BREAK
+ * Operation : (see specific hardware specification for BREAK)
+ * Flags : None
+ * Num Clocks : N/A
+ */
+
+ public:
+ avr_op_BREAK(word opcode, AvrDevice *c);
+ int operator()();
+ int Trace();
+};
+
class avr_op_ILLEGAL: public DecodedInstruction
diff --git a/src/decoder_trace.cpp b/src/decoder_trace.cpp
index 4e2e5eb..3bfc30f 100644
--- a/src/decoder_trace.cpp
+++ b/src/decoder_trace.cpp
@@ -750,6 +750,12 @@ int avr_op_WDR::Trace() {
return ret;
}
+int avr_op_BREAK::Trace() {
+ traceOut << "BREAK ";
+ int ret = this->operator()();
+ return ret;
+}
+
int avr_op_ILLEGAL::Trace() {
traceOut << "Invalid Instruction! ";
int ret = this->operator()();
--
1.7.5.4
- [Simulavr-devel] [PATCH] Add BREAK-instruction, causes simulavr to halt.,
Stan Behrens <=