diff options
author | Test_User <hax@andrewyu.org> | 2023-02-16 14:57:20 -0500 |
---|---|---|
committer | Test_User <hax@andrewyu.org> | 2023-02-16 14:57:20 -0500 |
commit | cf81293d79cf3a5cfbcdb55eb6368bbcb5f06fd7 (patch) | |
tree | 9b7405bbd5f9aa15c7eec892647a6c0113e62e78 | |
parent | 9d1465f1c859ca97517c26f4bf751b682ec337e9 (diff) | |
download | specification-cf81293d79cf3a5cfbcdb55eb6368bbcb5f06fd7.tar.gz specification-cf81293d79cf3a5cfbcdb55eb6368bbcb5f06fd7.zip |
Finish adding basic arithmetic instructions
-rw-r--r-- | cpu/instructions/arithmetic/add_with_carry.txt | 10 | ||||
-rw-r--r-- | cpu/instructions/arithmetic/signed_divide.txt | 10 | ||||
-rw-r--r-- | cpu/instructions/arithmetic/signed_multiply.txt | 14 | ||||
-rw-r--r-- | cpu/instructions/arithmetic/subtract_with_borrow.txt | 10 | ||||
-rw-r--r-- | cpu/instructions/arithmetic/unsigned_divide.txt | 10 | ||||
-rw-r--r-- | cpu/instructions/arithmetic/unsigned_multiply.txt | 14 |
6 files changed, 68 insertions, 0 deletions
diff --git a/cpu/instructions/arithmetic/add_with_carry.txt b/cpu/instructions/arithmetic/add_with_carry.txt new file mode 100644 index 0000000..b5d4652 --- /dev/null +++ b/cpu/instructions/arithmetic/add_with_carry.txt @@ -0,0 +1,10 @@ +Number of parameters: 5 + +Usage: + add_with_carry <output> <value0> <value1> <reference> <offset> + +Effect: + Adds (<value0> + bit <offset> in <reference>) to <value1> and stores it in <output> + +Exceptions: + None diff --git a/cpu/instructions/arithmetic/signed_divide.txt b/cpu/instructions/arithmetic/signed_divide.txt new file mode 100644 index 0000000..2746f71 --- /dev/null +++ b/cpu/instructions/arithmetic/signed_divide.txt @@ -0,0 +1,10 @@ +Number of parameters: 4 + +Usage: + signed_divide <result> <remainder> <numerand> <divisor> + +Effect: + Performs the signed division <numerand>/<divisor>, storing the integer result in <result> and the remainder in <remainder> + +Exceptions: + Division by 0 diff --git a/cpu/instructions/arithmetic/signed_multiply.txt b/cpu/instructions/arithmetic/signed_multiply.txt new file mode 100644 index 0000000..8f5a8ac --- /dev/null +++ b/cpu/instructions/arithmetic/signed_multiply.txt @@ -0,0 +1,14 @@ +Number of parameters: 4 + +Usage: + signed_multiply <overflow> <result> <value0> <value1> + +Effect: + Performs the signed multiplication <value0>*<value1>, storing the integer result in <result> and any overflowing bits into <overflow> + +Exceptions: + None + +Flags: + Sets the overflow flag if <overflow>:<result> != <result> + Carry flag is never set diff --git a/cpu/instructions/arithmetic/subtract_with_borrow.txt b/cpu/instructions/arithmetic/subtract_with_borrow.txt new file mode 100644 index 0000000..8f06e37 --- /dev/null +++ b/cpu/instructions/arithmetic/subtract_with_borrow.txt @@ -0,0 +1,10 @@ +Number of parameters: 5 + +Usage: + subtract_with_borrow <output> <value0> <value1> <reference> <offset> + +Effect: + Subtracts (<value0> + bit <offset> in <reference>) from <value1> + +Exceptions: + None diff --git a/cpu/instructions/arithmetic/unsigned_divide.txt b/cpu/instructions/arithmetic/unsigned_divide.txt new file mode 100644 index 0000000..b08f2ea --- /dev/null +++ b/cpu/instructions/arithmetic/unsigned_divide.txt @@ -0,0 +1,10 @@ +Number of parameters: 4 + +Usage: + unsigned_divide <result> <remainder> <numerand> <divisor> + +Effect: + Performs the unsigned division <numerand>/<divisor>, storing the integer result in <result> and the remainder in <remainder> + +Exceptions: + Division by 0 diff --git a/cpu/instructions/arithmetic/unsigned_multiply.txt b/cpu/instructions/arithmetic/unsigned_multiply.txt new file mode 100644 index 0000000..da1cfbb --- /dev/null +++ b/cpu/instructions/arithmetic/unsigned_multiply.txt @@ -0,0 +1,14 @@ +Number of parameters: 4 + +Usage: + unsigned_multiply <overflow> <result> <value0> <value1> + +Effect: + Performs the unsigned multiplication <value0>*<value1>, storing the integer result in <result> and any overflowing bits into <overflow> + +Exceptions: + None + +Flags: + Sets the carry flag if the overflow was non-zero + The overflow flag is never set |