aboutsummaryrefslogtreecommitdiff
path: root/MicSim/components/ijvm.py
diff options
context:
space:
mode:
authorLoic GUEGAN <loic.guegan@yahoo.fr>2018-09-02 16:31:49 +0200
committerLoic GUEGAN <loic.guegan@yahoo.fr>2018-09-02 16:31:49 +0200
commita110465a4261e582025b6344facb7fa65c0acd56 (patch)
tree69f92f3186d47e2dc4a6b811c35238b02b0ec37d /MicSim/components/ijvm.py
parentcec2994481b3df8422603f864c1286524d5b3eff (diff)
Add unit tests, refactoring
Diffstat (limited to 'MicSim/components/ijvm.py')
-rw-r--r--MicSim/components/ijvm.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/MicSim/components/ijvm.py b/MicSim/components/ijvm.py
new file mode 100644
index 0000000..86f5f63
--- /dev/null
+++ b/MicSim/components/ijvm.py
@@ -0,0 +1,30 @@
+
+# Quick link about opcode: https://users-cs.au.dk/bouvin/dComArk/2015/noter/Note_2/#Instructions
+
+# Build IJVM
+ijvm=dict({
+ "BIPUSH":0x10,
+ "DUP":0x59,
+ "GOTO":0xA7,
+ "IADD":0x60,
+ "IAND":0x7E,
+ "IFEQ":0x99,
+ "IFLT":0x9B,
+ "IF_ICMPEQ":0x9F,
+ "IINC":0x84,
+ "ILOAD":0x15,
+ "INVOKEVIRTUAL":0xB6,
+ "IOR":0x80,
+ "IRETURN":0xAC,
+ "ISTORE":0x36,
+ "ISUB":0x64,
+ "LDC_W":0x13,
+ "NOP":0x00,
+ "POP":0x57,
+ "SWAP":0x5F,
+ "WIDE":0xC4
+})
+
+# Add extras instructions
+ijvm["OUT"]=0x23 # Print next byte as char
+ijvm["HALT"]=0x2F # Stop simulator