From 4432635944ca96ba1edf64406e0bbcd3e6ee5180 Mon Sep 17 00:00:00 2001 From: Alessandro Mauri Date: Sun, 30 Oct 2022 12:55:44 +0100 Subject: [PATCH] Sun Oct 30 12:55:44 PM CET 2022 --- INSTRUCTIONS.md | 98 +++++-- alu.dig | 730 ++++++++++++++++++++++++++++++++++++++++++++++- main.dig | 2 +- multiply-add.dig | 253 ++++++++++++++++ registers.dig | 334 ++++++++++++++++++++++ signed_mul.dig | 137 ++++----- 6 files changed, 1445 insertions(+), 109 deletions(-) create mode 100644 multiply-add.dig diff --git a/INSTRUCTIONS.md b/INSTRUCTIONS.md index c76f689..9d79147 100644 --- a/INSTRUCTIONS.md +++ b/INSTRUCTIONS.md @@ -29,10 +29,6 @@ always referred to as `A`. The possible pairs are: ## LD load value into register -normal loading -syntax: `LD Rd, A` -action: `Rd = [A]` - post increment/decrement syntax: `LD Rd, A+q` action: `Rd = [A]; A += q` @@ -50,10 +46,6 @@ syntax: `LDIL Rd, imm32` action: `Rd = imm32` ## ST store value from register -normal storing -syntax: `ST A, Rd` -action: `[A] = Rd` - post increment/decrement syntax: `ST A+q, Rd` action: `[A] = Rd; A += q` @@ -63,10 +55,6 @@ syntax: `ST q+A, Rd` action: `A += q; [A] = Rd` ## STI store immediate into memory -normal store -syntax: `STI A, imm` -action: `[A] = imm` - post increment/decrement syntax: `STI A+q, imm` action: `[A] = imm; A += q` @@ -76,10 +64,6 @@ syntax: `STI q+A, imm` action: `A += q; [A] = imm` ## STIL store long immediate into memory -normal store -syntax: `STIL A, imm32` -action: `[A] = imm32` - post increment/decrement syntax: `STIL A+q, imm32` action: `[A] = imm32; A += q` @@ -87,3 +71,85 @@ action: `[A] = imm32; A += q` pre increment/decrement syntax: `STIL q+A, imm32` action: `A += q; [A] = imm32` + + +# Arithmetic operations + +## ADD +## ADDC +## ADDI +## ADDIC + +## MLA Multiply and add +syntax: `MLA A, Ra, Rb, Rc` +action: `A = Rc + (Ra * Rb)` + +## MLAI Multiply and add immediate +syntax: `MLAI A, Ra, Rb, imm` +action: `A = imm + (Ra * Rb)` + +## MLIA Multiply immediate and add +syntax: `MLIA A, Ra, imm, Rc` +action: `A = Rc + (Ra * imm)` + +## MLAC Multiply and add with carry +syntax: `MLAC A, Ra, Rb, Rc` +action: `A = F.C + Rc + (Ra * Rb)` + +## MLAIC Multiply and add immediate with carry +syntax: `MLAIC A, Ra, Rb, imm` +action: `A = F.C + imm + (Ra * Rb)` + +## MLIAC Multiply immediate and add with carry +syntax: `MLIAC A, Ra, imm, Rc` +action: `A = F.C + Rc + (Ra * imm)` + + +## SMLA Signed multiply and add +syntax: `SMLA A, Ra, Rb, Rc` +action: `A = Rc + (Ra * Rb)` + +## SMLAI Signed multiply and add immediate +syntax: `SMLAI A, Ra, Rb, imm` +action: `A = imm + (Ra * Rb)` + +## SMLIA Signed multiply immediate and add +syntax: `SMLIA A, Ra, imm, Rc` +action: `A = Rc + (Ra * imm)` + +## SMLAC Signed multiply and add with carry +syntax: `SMLAC A, Ra, Rb, Rc` +action: `A = F.C + Rc + (Ra * Rb)` + +## SMLAIC Signed multiply and add immediate with carry +syntax: `SMLAIC A, Ra, Rb, imm` +action: `A = F.C + imm + (Ra * Rb)` + +## SMLIAC Signed multiply immediate and add with carry +syntax: `SMLIAC A, Ra, imm, Rc` +action: `A = F.C + Rc + (Ra * imm)` + + +## SUB Subtract +## SUBC Subtract with carry +## SUBI Subtract immediate +## SBIC Subtract immediate with carry + +## AND +## ANDI with immediate +## OR +## ORI with immediate +## XOR +## XORI with immediate + +## NEG negate (two's complement) + +## ROR Rotate right +## ROL Rotate left +## SHR Shift right +## SHRC Shift right through carry +## SHL Shift left +## SHLC Shift left through carry + +# Conditional operations + diff --git a/alu.dig b/alu.dig index 99aea1f..c1ced12 100644 --- a/alu.dig +++ b/alu.dig @@ -6,34 +6,750 @@ shifter.dig + + + + Sub + + + Bits + 16 + + - Add + And Bits 16 + + wideShape + true + - + - Sub + Or + + + Bits + 32 + + + wideShape + true + + + + + + XOr + + Bits + 32 + + + wideShape + true + + + + + + In + + + Label + a + + + + + + In + + + Label + b + + + + + + multiply-add.dig + + + + + In + + + Label + c + Bits 16 - + - signed_mul.dig + Neg - + + + + Splitter + + + Input Splitting + 16 + + + Output Splitting + 1*16 + + + + + + Splitter + + + Input Splitting + 16 + + + Output Splitting + 1*16 + + + + + + NOr + + + wideShape + true + + + Inputs + 16 + + + + + + NOr + + + wideShape + true + + + Inputs + 16 + + + + + + NAnd + + + wideShape + true + + + + + + Out + + + Label + LZ + + + + + + Out + + + Label + Z + + + + + + Splitter + + + Input Splitting + 32 + + + Output Splitting + 31,1 + + + + + + Out + + + Label + N + + + + + + Add + + + Bits + 16 + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main.dig b/main.dig index 82ea1cf..6ac719a 100644 --- a/main.dig +++ b/main.dig @@ -11,7 +11,7 @@ alu.dig - + diff --git a/multiply-add.dig b/multiply-add.dig new file mode 100644 index 0000000..bd218fc --- /dev/null +++ b/multiply-add.dig @@ -0,0 +1,253 @@ + + + 1 + + + + In + + + Label + S + + + + + + In + + + Label + a + + + Bits + 16 + + + + + + In + + + Label + b + + + Bits + 16 + + + + + + Splitter + + + Input Splitting + 32 + + + Output Splitting + 16,16 + + + + + + Out + + + Label + m0 + + + Bits + 16 + + + + + + Out + + + Label + m1 + + + Bits + 16 + + + + + + Add + + + Bits + 32 + + + + + + In + + + Label + c + + + Bits + 16 + + + + + + BitExtender + + + inputBits + 16 + + + outputBits + 32 + + + + + + In + + + Label + C_i + + + + + + Out + + + Label + C_o + + + + + + signed_mul.dig + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/registers.dig b/registers.dig index c43af62..a36368c 100644 --- a/registers.dig +++ b/registers.dig @@ -641,8 +641,78 @@ + + Multiplexer + + + Selector Bits + 5 + + + Bits + 16 + + + + + + Out + + + Label + Rc + + + Bits + 16 + + + + + + Tunnel + + + rotation + + + + NetName + sc + + + + + + In + + + Label + Sc + + + Bits + 5 + + + + + + Tunnel + + + NetName + sc + + + + + + + + @@ -667,6 +737,10 @@ + + + + @@ -683,6 +757,10 @@ + + + + @@ -711,10 +789,18 @@ + + + + + + + + @@ -755,10 +841,18 @@ + + + + + + + + @@ -779,6 +873,10 @@ + + + + @@ -839,6 +937,10 @@ + + + + @@ -859,6 +961,10 @@ + + + + @@ -911,6 +1017,10 @@ + + + + @@ -967,6 +1077,10 @@ + + + + @@ -1003,6 +1117,10 @@ + + + + @@ -1023,6 +1141,10 @@ + + + + @@ -1087,6 +1209,14 @@ + + + + + + + + @@ -1107,10 +1237,22 @@ + + + + + + + + + + + + @@ -1151,10 +1293,18 @@ + + + + + + + + @@ -1163,6 +1313,10 @@ + + + + @@ -1187,10 +1341,18 @@ + + + + + + + + @@ -1199,6 +1361,10 @@ + + + + @@ -1235,6 +1401,14 @@ + + + + + + + + @@ -1311,6 +1485,10 @@ + + + + @@ -1327,6 +1505,10 @@ + + + + @@ -1427,6 +1609,10 @@ + + + + @@ -1459,6 +1645,10 @@ + + + + @@ -1535,6 +1725,10 @@ + + + + @@ -1551,6 +1745,10 @@ + + + + @@ -1595,6 +1793,10 @@ + + + + @@ -1615,6 +1817,10 @@ + + + + @@ -1623,10 +1829,18 @@ + + + + + + + + @@ -1663,6 +1877,10 @@ + + + + @@ -1675,6 +1893,10 @@ + + + + @@ -1707,6 +1929,10 @@ + + + + @@ -1763,6 +1989,10 @@ + + + + @@ -1791,6 +2021,10 @@ + + + + @@ -1803,6 +2037,10 @@ + + + + @@ -1831,6 +2069,10 @@ + + + + @@ -1859,6 +2101,10 @@ + + + + @@ -1887,6 +2133,10 @@ + + + + @@ -1935,6 +2185,10 @@ + + + + @@ -1955,6 +2209,10 @@ + + + + @@ -1975,6 +2233,10 @@ + + + + @@ -2011,6 +2273,10 @@ + + + + @@ -2027,6 +2293,10 @@ + + + + @@ -2035,6 +2305,10 @@ + + + + @@ -2099,6 +2373,10 @@ + + + + @@ -2155,6 +2433,10 @@ + + + + @@ -2167,6 +2449,10 @@ + + + + @@ -2187,6 +2473,10 @@ + + + + @@ -2203,6 +2493,10 @@ + + + + @@ -2219,6 +2513,10 @@ + + + + @@ -2231,6 +2529,10 @@ + + + + @@ -2331,6 +2633,10 @@ + + + + @@ -2359,10 +2665,18 @@ + + + + + + + + @@ -2383,6 +2697,10 @@ + + + + @@ -2403,6 +2721,10 @@ + + + + @@ -2423,6 +2745,10 @@ + + + + @@ -2479,6 +2805,10 @@ + + + + @@ -2491,6 +2821,10 @@ + + + + diff --git a/signed_mul.dig b/signed_mul.dig index 6562a5b..d1e2292 100644 --- a/signed_mul.dig +++ b/signed_mul.dig @@ -170,86 +170,53 @@ - Add + Multiplexer Bits 32 - + - Const - - - Value - 0 - - - + Probe + + - Const + Probe - Bits - 32 + intFormat + decSigned - + - Multiplexer + Probe - Bits - 32 + intFormat + decSigned - - - - Splitter - - - Input Splitting - 32 - - - Output Splitting - 16,16 - - - + Out Label - m0 + m Bits - 16 - - - - - - Out - - - Label - m1 - - - Bits - 16 + 32 - + @@ -263,20 +230,16 @@ - - - - - - - - - + + + + + @@ -285,6 +248,10 @@ + + + + @@ -303,11 +270,11 @@ - + - + @@ -318,12 +285,8 @@ - - - - - - + + @@ -351,6 +314,14 @@ + + + + + + + + @@ -365,14 +336,6 @@ - - - - - - - - @@ -391,11 +354,11 @@ - + - - + + @@ -458,20 +421,20 @@ - - + + - - + + - - + + - - + + @@ -485,6 +448,10 @@ + + + + \ No newline at end of file