summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTest_User <hax@andrewyu.org>2023-02-13 20:17:31 -0500
committerTest_User <hax@andrewyu.org>2023-02-13 20:17:31 -0500
commit22029d37cbf391a35304d32778bd01ecf40de482 (patch)
tree3e7a89a00280a181ea4742c7ce4387bad9a32a3d
parente46a052aade6e343fb8482fff9183589bbbfad8d (diff)
downloadspecification-22029d37cbf391a35304d32778bd01ecf40de482.tar.gz
specification-22029d37cbf391a35304d32778bd01ecf40de482.zip
Rewrite/improve conditional instructions
-rw-r--r--cpu/instructions/execution_control/call_conditional.txt22
-rw-r--r--cpu/instructions/execution_control/jump_conditional.txt21
-rw-r--r--cpu/instructions/opcode.txt18
-rw-r--r--cpu/instructions/overview.txt11
4 files changed, 26 insertions, 46 deletions
diff --git a/cpu/instructions/execution_control/call_conditional.txt b/cpu/instructions/execution_control/call_conditional.txt
deleted file mode 100644
index 7663e54..0000000
--- a/cpu/instructions/execution_control/call_conditional.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-Number of parameters: 2
-
-Usage: call_conditional <type_and_index> <target>
- type_and_index:
- Lowest 3 bits: flags for each of the following checked, from lowest to highest:
- Zero
- Overflow
- Carry
- Next 3 bits:
- Value for each of the above that it should match
- Remaining bits:
- Index into instruction queue for which result is to be compared
-
-Effect:
- If all of the checked flags match the value to compare to:
- IP pushed to stack
- IP moved to <target>
-
- If no flags are to be checked, it will always set IP
-
-Exceptions:
- Instruction reference nonexistent
diff --git a/cpu/instructions/execution_control/jump_conditional.txt b/cpu/instructions/execution_control/jump_conditional.txt
deleted file mode 100644
index 52f323b..0000000
--- a/cpu/instructions/execution_control/jump_conditional.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-Number of parameters: 2
-
-Usage: jump_conditional <type_and_index> <target>
- type_and_index:
- Lowest 3 bits: flags for each of the following checked, from lowest to highest:
- Zero
- Overflow
- Carry
- Next 3 bits:
- Value for each of the above that it should match
- Remaining bits:
- Index into instruction queue for which result is to be compared
-
-Effect:
- If all of the checked flags match the value to compare to:
- IP moved to <target>
-
- If no flags are to be checked, it will always set IP
-
-Exceptions:
- Instruction reference nonexistent
diff --git a/cpu/instructions/opcode.txt b/cpu/instructions/opcode.txt
new file mode 100644
index 0000000..d69eda4
--- /dev/null
+++ b/cpu/instructions/opcode.txt
@@ -0,0 +1,18 @@
+Binary format:
+ is_conditional[1], instruction id[remaining bits]
+
+
+is_conditional:
+ Appends 1 parameter to the normal parameter list for the instruction:
+ Lowest 3 bits: flags for each of the following checked, from lowest to highest:
+ Zero
+ Overflow
+ Carry
+ Next 3 bits:
+ Value for each of the above that it should match
+ Remaining bits:
+ Index into instruction queue for which result is to be compared
+
+ Conditional instructions will be executed after unconditional ones
+
+ Conditional instructions will never set flags, if a conditional instruction references another, it will always be based on null flags
diff --git a/cpu/instructions/overview.txt b/cpu/instructions/overview.txt
index 5545697..1c945fb 100644
--- a/cpu/instructions/overview.txt
+++ b/cpu/instructions/overview.txt
@@ -7,9 +7,14 @@ Dynamic VLIW
If any exception occurs during the execution of the queued instructions, all output will be discarded
If multiple exceptions would have theoretically occurred, which one is triggered is undefined
- If outputs from multiple instructions overlap, which one is written to the overlapping area is undefined
- If an exception would be generated by attempting to write one value there but not the other, the exception might not occur if the other value is what is written in the end
- This includes indirect writes via instructions such as `jmp` and `push`
+
+ If outputs from multiple instructions overlap:
+ Conditional instructions will be preferred above all others
+ Indirect writes, such as `jmp` and `push`, will be preferred over direct writes
+
+ If a conflict still remains, which value will be written to the overlapping area is undefined
+
+ If an exception would be generated by attempting to write one value there but not the other, the exception might not occur if the other value is what is written
Current format ideas:
A)