**Name : G.Nishchith** **Roll No: CS22B021** --- **Ternary System:** The Ternary system is a base - 3 system, numnerical representation is based on 3 different symbols here typically 0,1,2. These symbols represent possible states in the system. Each digit in a ternary number represent power of 3, same like how a decimal system number represent power of 10. Digits and Values: 1. In Ternary logic, each digit can represent one of three states: 0,1,2. 2. 0 represents the absence state. 3. 1 represents the true state. 4. 2 represents the indeterminate state. --- **Ternary Arithmetic Operations:** Addition: Ternary addition involves adding ternary digits, the result will be either 0 or 1 or 2 and carry will 0 or 1 **Truth Table:** |A|B|C|Sum|Cout| |-|-|-|-|-| |0|0|0|0|0| |0|0|1|1|0| |0|0|2|2|0| |0|1|0|1|0| |0|1|1|2|0| |0|1|2|0|1| |1|0|0|1|0| |1|0|1|2|0| |1|0|2|0|1| |1|1|0|2|0| |1|1|1|0|1| |1|1|2|1|1| |2|0|0|2|0| |2|0|1|0|1| |2|0|2|1|1| |2|1|0|0|1| |2|1|1|1|1| |2|1|2|2|1| |2|2|0|1|1| |2|2|1|2|1| |2|2|2|0|2| Subtraction: Ternary subtraction involves subtracting ternary digits, the result will be either 0 or 1 or 2 and borrow will 0 or 1. **Truth Table:** |A|B|C|Diff|Borrow| |-|-|-|-|-| |0|0|0|0|0| |0|0|1|2|0| |0|0|2|1|1| |0|1|0|2|0| |0|1|1|0|1| |0|1|2|1|1| |1|0|0|1|0| |1|0|1|0|1| |1|0|2|0|1| |1|1|0|2|0| |1|1|1|0|1| |1|1|2|1|1| |2|0|0|1|1| |2|0|1|0|0| |2|0|2|2|1| |2|1|0|0|1| |2|1|1|1|1| |2|1|2|2|1| |2|2|0|0|0| |2|2|1|1|1| |2|2|2|2|1| Multiplication: Ternary multiplication involves mutliplying ternary digits, the result will be either 0 or 1 or 2. **Truth Table:** |A|B|C|Product| |-|-|-|-| |0|0|0|0| |0|0|1|0| |0|0|2|0| |0|1|0|0| |0|1|1|1| |0|1|2|2| |1|0|0|0| |1|0|1|1| |1|0|2|2| |1|1|0|1| |1|1|1|2| |1|1|2|0| |2|0|0|0| |2|0|1|2| |2|0|2|1| |2|1|0|2| |2|1|1|0| |2|1|2|1| |2|2|0|1| |2|2|1|2| |2|2|2|0| --- **Logical operations:** Ternary AND: Ternary AND operation involving ternary digits, the result will be either 0 or 1 or 2. **Truth Table** |A|B|Result| |-|-|-| |0|0|0| |0|1|0| |0|2|0| |1|0|0| |1|1|1| |1|2|1| |2|0|0| |2|1|1| |2|2|2| Ternary OR: Ternary OR operation involving ternary digits, the result will be either 0 or 1 or 2. **Truth Table** |A|B|Result| |-|-|-| |0|0|0| |0|1|1| |0|2|2| |1|0|1| |1|1|1| |1|2|1| |2|0|2| |2|1|1| |2|2|2| Ternary NOT: Ternary NOT operation involving ternary digits, the result will be either 0 or 1 or 2. |A|~A| |-|-| |0|2| |1|1| |2|0| --- **Ternary Bitwise:** ##### Representation: Any number can be represent in ternary form. For any n it can be written as n = x<sub>0</sub> * 3<sup>0</sup>+x<sub>1</sub> * 3<sup>1</sup>+x<sub>2</sub> * 3<sup>2</sup>+x<sub>3</sub> * 3<sup>3</sup>+x<sub>4</sub> * 3<sup>4</sup>+........ where x<sub>i</sub> belongs to {0,1,2}. Example: 77 = 2 * 3 <sup>3</sup> + 2 * 3 <sup>2</sup> + 1 * 3<sup>1</sup> + 2 * 3<sup>0</sup>. --- **Instruction Encoding:** 1. Opcode Field: * The opcode says about the operations which are going to perform like addition, subtraction or any logical operations etc. * We allocate a fixed number of bits around 3 bits to represent opcode. Example: * For additon: 000 * For subtraction: 001 * For multiplication: 002 * For OR: 010 * For NOT: 020 * For XOR: 011 * etc..... 2. Register Fields: * Same like binary systems here also we use register fields to specify the source and destination registers * Each register field can be represent by a fixed number around 4 bits. * For ternary system we can use three registers. 3. Immediate Field: * For instructions with immediates (e.g., addi, subi), we allocate a field to represent the immediate value. * The immediate field can be sign-extended to 32 bits (similar to two’s complement representation). For example if given instruction is add x18 x12 x3. It can be written 000 0020 0110 0010 * 000 represents add * 0020 represents 18 * 0110 represents 12 * 0010 represents 3. --- **Pipeline Architecture:** I consider the same architecture which is there presently and do some modifications which supports ternary systems. Pipeline: * Instruction Fetch(IF) * Instruction Decode(ID) * Register Fetch(Rf) * Execution (Ex) * Memory(Mem) * Write Back(WB). --- **Ternary Addressing System** * Address Representation: In a ternary addressing system, memory addresses are expressed using trits (ternary digits). Each trit can take one of three values: 0, 1, or 2. By using trits instead of binary bits, we can represent a larger address space with fewer digits. For example: A single trit can represent three unique values (0, 1, or 2). Two trits can represent nine unique values (00, 01, 02, 10, 11, 12, 20, 21, 22). * Address Range: The address range in a ternary system grows exponentially with the number of trits. If we allocate n trits for addressing, we can address up to 3<sup>n</sup> memory locations. This exponential growth enables us to access a significantly larger memory space compared to binary systems. * For instance: With 10 trits, we can address 3<sup>10</sup> = 59,049 memory locations. With 20 trits, we can address 3<sup>20</sup> = 3,486,784,401 memory locations. Implications for Physical Memory Size .Expanding the addressable memory space has implications for physical memory size: * Memory Cells: We need more memory cells to accommodate the increased address range. Ternary memory modules must be designed to store and retrieve ternary data efficiently. * Storage Density: Ternary storage cells (e.g., using alien transistors) can achieve higher storage density due to the compact representation of ternary values. * Access Speed: Ternary memory access involves reading or writing ternary data. While ternary memory cells can store more information per cell, access speed may be slightly slower due to the additional state (0, 1, or 2). However, optimizations can mitigate this impact. * Conclusion By adopting a ternary addressing system, we unlock vast memory spaces previously unattainable in binary systems. Our challenge lies in designing memory modules that efficiently handle ternary data while balancing storage density and access speed. --- ### Ternary Memory Organization Strategies 1. Ternary Content-Addressable Memory (TCAM): * TCAM is an associative memory that allows searching based on content rather than addresses. * In a ternary TCAM, each memory cell stores a ternary value (0, 1, or 2). * Efficient for applications like pattern matching, routing tables, and database queries. 2. Ternary Cache Memory: * Ternary cache lines can store more information per cell compared to binary caches. * Exploiting ternary values can lead to denser cache storage. * Consider trade-offs between cache size, access speed, and power consumption. 3. Ternary RAM (TRAM): * TRAM modules store data in ternary format. * Ternary storage cells can represent more information per cell, leading to higher memory density. * Addressing TRAM requires ternary addressing circuits. 4. Hybrid Binary-Ternary Memory: * Combine binary and ternary memory cells in a hybrid structure. * Use ternary cells for dense storage and binary cells for faster access. * Optimize memory organization based on access patterns and data types. ### Implications * Storage Density: Ternary memory cells can store more information per cell, leading to denser memory modules. * Access Speed: Ternary memory access may be slightly slower due to the additional state (0, 1, or 2). Optimize access circuits accordingly. * Addressing: Implement ternary addressing circuits to efficiently access ternary memory locations.