From 50fe0e2267a3dc8073a90b94e0fbbc3edf68c5a7 Mon Sep 17 00:00:00 2001 From: Alessandro Mauri Date: Wed, 19 Oct 2022 23:35:58 +0200 Subject: [PATCH] mer 19 ott 2022, 23:35:58, CEST --- ALU_OPCODES.md | 21 +++ alu.dig | 33 ++++ revert.dig | 202 ++++++++++++++++++++ shifter.dig | 384 +++++++++++++++++++++++++++++++++++++- signed_mul.dig | 490 +++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 1123 insertions(+), 7 deletions(-) create mode 100644 ALU_OPCODES.md create mode 100644 revert.dig create mode 100644 signed_mul.dig diff --git a/ALU_OPCODES.md b/ALU_OPCODES.md new file mode 100644 index 0000000..862526d --- /dev/null +++ b/ALU_OPCODES.md @@ -0,0 +1,21 @@ +# ALU opcodes + +| mnemonic | operands | outputs | opcode | +|----------|----------|-----------------------|--------| +| ADD | I1, I2 | U0 = I1 + I2 + C | | +| SUB | I1, I2 | U0 = I1 - I2 - C | | +| MULU | I1, I2 | U1:U0 = I1 * I2 | | +| MULS | I1, I2 | U1:U0 = (s)I1 * (s)I2 | | +| DIVU | I1, I2 | U0 = I1 / I2 | | +| | | U1 = I1 % I2 | | +| DIVS | I1, I2 | U0 = (s)I1 / (s)I2 | | +| | | U1 = U1 % Rd2 > 0 | | +| SHL | I1, I2 | U0 = I1 << I2 | | +| ROL | I1, I2 | U0 = I1 rot_l I2) | | +| SHR | I1, I2 | U0 = I1 >> I2 | | +| ROR | I1, I2 | U0 = I1 rot_r I2 | | +| AND | I1, I2 | U0 = I1 & I2 | | +| OR | I1, I2 | U0 = I1 or I2 | | +| NOT | I1 | U0 = !I1 | | +| XOR | I1, I2 | U0 = I1 xor I2 | | + diff --git a/alu.dig b/alu.dig index c429bcb..b32a592 100644 --- a/alu.dig +++ b/alu.dig @@ -8,6 +8,39 @@ + + Add + + + Label + ADD/C + + + Bits + 16 + + + + + + Sub + + + Label + SUB/C + + + Bits + 16 + + + + + + signed_mul.dig + + + diff --git a/revert.dig b/revert.dig new file mode 100644 index 0000000..9b110d6 --- /dev/null +++ b/revert.dig @@ -0,0 +1,202 @@ + + + 1 + + + + Splitter + + + Input Splitting + 16 + + + Output Splitting + 1*16 + + + + + + Multiplexer + + + Bits + 16 + + + + + + Splitter + + + mirror + true + + + Input Splitting + 1*16 + + + Output Splitting + 16 + + + + + + In + + + Label + I + + + Bits + 16 + + + + + + In + + + Label + Rev + + + + + + Out + + + Label + O + + + Bits + 16 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shifter.dig b/shifter.dig index 2dee982..4bccfbf 100644 --- a/shifter.dig +++ b/shifter.dig @@ -404,28 +404,28 @@ Label - i + I Bits 16 - + Out Label - o + O Bits 16 - + And @@ -625,7 +625,7 @@ Label - R + Rot @@ -1060,6 +1060,284 @@ + + Or + + + wideShape + true + + + Inputs + 15 + + + + + + Tunnel + + + rotation + + + + NetName + f0 + + + + + + Tunnel + + + rotation + + + + NetName + f1 + + + + + + Tunnel + + + rotation + + + + NetName + f2 + + + + + + Tunnel + + + rotation + + + + NetName + f3 + + + + + + Tunnel + + + rotation + + + + NetName + f4 + + + + + + Tunnel + + + rotation + + + + NetName + f5 + + + + + + Tunnel + + + rotation + + + + NetName + f6 + + + + + + Tunnel + + + rotation + + + + NetName + f7 + + + + + + Tunnel + + + rotation + + + + NetName + f8 + + + + + + Tunnel + + + rotation + + + + NetName + f9 + + + + + + Tunnel + + + rotation + + + + NetName + f10 + + + + + + Tunnel + + + rotation + + + + NetName + f11 + + + + + + Tunnel + + + rotation + + + + NetName + f12 + + + + + + Tunnel + + + rotation + + + + NetName + f13 + + + + + + Tunnel + + + rotation + + + + NetName + f14 + + + + + + Out + + + Label + Co + + + + + + revert.dig + + + + + In + + + Label + SR + + + + + + Tunnel + + + NetName + sr + + + + + + revert.dig + + + + + Tunnel + + + rotation + + + + NetName + sr + + + + @@ -1150,6 +1428,10 @@ + + + + @@ -1170,6 +1452,10 @@ + + + + @@ -1294,6 +1580,10 @@ + + + + @@ -1306,6 +1596,10 @@ + + + + @@ -1442,6 +1736,10 @@ + + + + @@ -1574,6 +1872,14 @@ + + + + + + + + @@ -1702,6 +2008,10 @@ + + + + @@ -1818,6 +2128,10 @@ + + + + @@ -1898,6 +2212,10 @@ + + + + @@ -1946,6 +2264,10 @@ + + + + @@ -2039,7 +2361,7 @@ - + @@ -2078,6 +2400,10 @@ + + + + @@ -2174,6 +2500,14 @@ + + + + + + + + @@ -2214,6 +2548,10 @@ + + + + @@ -2330,6 +2668,10 @@ + + + + @@ -2338,6 +2680,10 @@ + + + + @@ -2454,6 +2800,10 @@ + + + + @@ -2462,6 +2812,10 @@ + + + + @@ -2554,6 +2908,10 @@ + + + + @@ -2582,6 +2940,10 @@ + + + + @@ -2696,7 +3058,7 @@ - + @@ -2718,6 +3080,10 @@ + + + + @@ -3342,6 +3708,10 @@ + + + + diff --git a/signed_mul.dig b/signed_mul.dig new file mode 100644 index 0000000..6562a5b --- /dev/null +++ b/signed_mul.dig @@ -0,0 +1,490 @@ + + + 1 + + + + Mul + + + Bits + 16 + + + + + + In + + + Label + S + + + + + + In + + + Label + a + + + Bits + 16 + + + + + + In + + + Label + b + + + Bits + 16 + + + + + + Splitter + + + Input Splitting + 16 + + + Output Splitting + 15,1 + + + + + + And + + + wideShape + true + + + + + + Neg + + + Bits + 16 + + + + + + Multiplexer + + + Bits + 16 + + + + + + Splitter + + + Input Splitting + 16 + + + Output Splitting + 15,1 + + + + + + And + + + wideShape + true + + + + + + Neg + + + Bits + 16 + + + + + + Multiplexer + + + Bits + 16 + + + + + + XOr + + + wideShape + true + + + + + + And + + + wideShape + true + + + + + + Neg + + + Bits + 32 + + + + + + Add + + + Bits + 32 + + + + + + Const + + + Value + 0 + + + + + + Const + + + Bits + 32 + + + + + + Multiplexer + + + Bits + 32 + + + + + + Splitter + + + Input Splitting + 32 + + + Output Splitting + 16,16 + + + + + + Out + + + Label + m0 + + + Bits + 16 + + + + + + Out + + + Label + m1 + + + Bits + 16 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file