Multiplier (BCT): Difference between revisions
From TernaryWiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
Ternary multiplication works similarly to decimal long multiplication. The multiplicand is multiplied by each digit of the multiplier. Which results in a list of partial products, and each next partial product is multiplied by 10; shifted to the left. The list of partial products is then added together for the total product. | |||
The difference with ternary is the multiplicand is EORed by each digit of the multiplier. This results in all the partial products being the A input buffered, zeroed, or negated depending on the value of B at that digit. | |||
All the partial products are added up for the final total.  | |||
== Ternary Multiplication Example == | |||
{| class="wikitable" style="text-align: center; font-family: monospace; font-size: 18px;" | {| class="wikitable" style="text-align: center; font-family: monospace; font-size: 18px;" | ||
|+ | |+<big>4435 * 472</big> | ||
! | ! | ||
!3<sup>16</sup> | !3<sup>16</sup> | ||
!3<sup>15</sup> | !3<sup>15</sup> | ||
Line 25: | Line 31: | ||
! colspan="9" |A | ! colspan="9" |A | ||
|- | |- | ||
| | | | ||
| | | | ||
Line 44: | Line 49: | ||
| - | | - | ||
| + | | + | ||
!= | |||
| + | | + | ||
| rowspan=" | | rowspan="9" |[[EOR (Ternary Gate)|EOR]] | ||
| rowspan=" | | rowspan="9" | + | ||
| rowspan=" | | rowspan="9" | - | ||
| rowspan=" | | rowspan="9" |0 | ||
| rowspan=" | | rowspan="9" |0 | ||
| rowspan=" | | rowspan="9" | + | ||
| rowspan=" | | rowspan="9" | - | ||
| rowspan=" | | rowspan="9" | + | ||
| rowspan=" | | rowspan="9" | - | ||
| rowspan=" | | rowspan="9" | + | ||
|- | |- | ||
| | | | ||
| | | | ||
Line 76: | Line 80: | ||
| + | | + | ||
| | | | ||
!= | |||
| + | | + | ||
|- | |- | ||
| | | | ||
| | | | ||
Line 98: | Line 101: | ||
| | | | ||
| | | | ||
!= | |||
| + | | + | ||
|- | |- | ||
| | | | ||
| | | | ||
Line 120: | Line 122: | ||
| | | | ||
| | | | ||
!= | |||
| - | | - | ||
|- | |- | ||
| | | | ||
| | | | ||
Line 142: | Line 143: | ||
| | | | ||
| | | | ||
!= | |||
|0 | |0 | ||
|- | |- | ||
| | | | ||
| | | | ||
Line 164: | Line 164: | ||
| | | | ||
| | | | ||
!= | |||
| - | | - | ||
|- | |- | ||
| | | | ||
| | | | ||
Line 186: | Line 185: | ||
| | | | ||
| | | | ||
!= | |||
| + | | + | ||
|- | |- | ||
| | | | ||
| | | | ||
Line 208: | Line 206: | ||
| | | | ||
| | | | ||
!= | |||
|0 | |0 | ||
|- | |- | ||
| | | | ||
|0 | |0 | ||
Line 230: | Line 227: | ||
| | | | ||
| | | | ||
!= | |||
|0 | |0 | ||
|- | |||
! colspan="30" |<hr /> | |||
|- | |- | ||
| | | | ||
|0 | |||
|0 | |||
|0 | |||
| + | |||
| + | | + | ||
|0 | |||
| - | | - | ||
| + | |||
| + | |||
|0 | |0 | ||
|0 | |0 | ||
| + | | + | ||
| + | | + | ||
| + | | + | ||
| + | | + | ||
| | |0 | ||
| colspan=" | | + | ||
!'''=''' | |||
| colspan="11" |<big>2,093,320</big> | |||
|} | |} |
Revision as of 18:07, 4 August 2025
Ternary multiplication works similarly to decimal long multiplication. The multiplicand is multiplied by each digit of the multiplier. Which results in a list of partial products, and each next partial product is multiplied by 10; shifted to the left. The list of partial products is then added together for the total product.
The difference with ternary is the multiplicand is EORed by each digit of the multiplier. This results in all the partial products being the A input buffered, zeroed, or negated depending on the value of B at that digit.
All the partial products are added up for the final total. 
Ternary Multiplication Example
316 | 315 | 314 | 313 | 312 | 311 | 310 | 39 | 38 | 37 | 36 | 35 | 34 | 33 | 32 | 31 | 30 | B | A | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ | - | 0 | 0 | + | - | + | - | + | = | + | EOR | + | - | 0 | 0 | + | - | + | - | + | |||||||||
+ | - | 0 | 0 | + | - | + | - | + | = | + | |||||||||||||||||||
+ | - | 0 | 0 | + | - | + | - | + | = | + | |||||||||||||||||||
- | + | 0 | 0 | - | + | - | + | - | = | - | |||||||||||||||||||
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | = | 0 | |||||||||||||||||||
- | + | 0 | 0 | - | + | - | + | - | = | - | |||||||||||||||||||
+ | - | 0 | 0 | + | - | + | - | + | = | + | |||||||||||||||||||
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | = | 0 | |||||||||||||||||||
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | = | 0 | |||||||||||||||||||
0 | 0 | 0 | + | + | 0 | - | + | + | 0 | 0 | + | + | + | + | 0 | + | = | 2,093,320 |