From 22029d37cbf391a35304d32778bd01ecf40de482 Mon Sep 17 00:00:00 2001 From: Test_User Date: Mon, 13 Feb 2023 20:17:31 -0500 Subject: Rewrite/improve conditional instructions --- .../execution_control/call_conditional.txt | 22 ---------------------- .../execution_control/jump_conditional.txt | 21 --------------------- cpu/instructions/opcode.txt | 18 ++++++++++++++++++ cpu/instructions/overview.txt | 11 ++++++++--- 4 files changed, 26 insertions(+), 46 deletions(-) delete mode 100644 cpu/instructions/execution_control/call_conditional.txt delete mode 100644 cpu/instructions/execution_control/jump_conditional.txt create mode 100644 cpu/instructions/opcode.txt (limited to 'cpu/instructions') 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: - 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 - - 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: - 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 - - 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) -- cgit v1.2.3