tilak-reddy
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Assignment 4 Name - Tilak Reddy Roll No. - CS22B047 ## Logic Operations ### Bitwise operations NAND and NOR are universal gates. So, if we can design these gates rest all gates can be designed form them.The proposed truth table for these operations is given below. #### Truth table for ternary NAND gate: | Input 1 | Input 2 | NAND | NOR | |---------|---------|------|-----| |0|0|2|2| |0|1|2|1| |0|2|2|0| |1|0|2|1| |1|1|1|1| |1|2|1|0| |2|0|2|0| |2|1|1|0| |2|2|0|0| ### Ternary Full adder A full adder is nothing but XOR operations on 3 inputs.We can easily derive logic for XOR from truth table proposed for NAND and NOR. #### Truth table for Full Adder: | A | B | cin | cout | sum | |---|---|-----|------|-----| |0|0|0|0|0| |0|0|1|0|1| |0|0|2|0|2| |0|1|0|0|1| |0|1|1|0|2| |0|1|2|1|0| |0|2|0|0|2| |0|2|1|1|0| |0|2|2|1|1| |1|0|0|0|1| |1|0|1|0|2| |1|0|2|1|0| |1|1|0|0|2| |1|1|1|1|0| |1|1|2|1|1| |1|2|0|1|0| |1|2|1|1|1| |1|2|2|1|2| |2|0|0|0|2| |2|0|1|1|0| |2|0|2|1|1| |2|1|0|1|0| |2|1|1|1|1| |2|1|2|1|2| |2|2|0|1|1| |2|2|1|1|2| |2|2|2|2|0| ## Instruction Encoding To devise an efficient encoding scheme for ternary instructions, we'd want to optimize both the representation of instructions and their execution. Here's a proposed encoding scheme: #### Opcode Design: Use a compact opcode format that indicates the operation type and addressing modes. Since ternary logic encompasses arithmetic, bitwise, and logical operations, allocate opcode bits to represent these categories. For example: - Bits [0-1]: Operation type (e.g., 00 for arithmetic, 01 for bitwise, 10 for logical). - Bits [2-4]: Addressing mode for Operand A. - Bits [5-7]: Addressing mode for Operand B. - Bits [8-10]: Addressing mode for Operand C. #### Operand Encoding: Since ternary logic involves three possible values (0, 1, 2), each operand can be represented using a small number of bits. For example: Use 2 bits for each operand to represent values 0, 1, and 2. #### Addressing Modes: Support various addressing modes like immediate, register, and memory addressing for operands. Allocate specific bits in the instruction to specify the addressing mode for each operand. #### Instruction Length: Aim for fixed-length instructions to simplify decoding. This ensures uniform instruction fetching and decoding. #### Efficient Use of Opcode Space: Assign opcodes to frequently used instructions and operations that represent common tasks. Leave room for future expansion or special instructions. #### Decoding Logic: Design efficient decoding logic that can quickly interpret the encoded instructions. Use bit manipulation techniques to extract opcode fields and operand values efficiently. #### Alignment: Align instructions to natural boundaries to facilitate efficient memory access and decoding. #### Special Instructions: Introduce special instructions for commonly used operations or sequences to optimize performance in specific scenarios. ## Pipeline Adapting a pipeline architecture to accommodate ternary logic involves several considerations to leverage the benefits of ternary operations efficiently. Here's how the pipeline architecture might be adjusted: #### Instruction Fetch Stage: Modify the instruction fetch unit to handle ternary instructions. This includes fetching ternary instructions from memory and decoding them into their respective operation types and operands. #### Instruction Decode Stage: Enhance the instruction decoder to interpret ternary instructions, extract opcode fields, and decode addressing modes for operands. This stage must be able to handle the compact opcode format designed for ternary instructions. #### Execution Units: Introduce specialized execution units capable of performing ternary arithmetic, bitwise, and logical operations. These units should support ternary operands and produce ternary results efficiently. #### Data Paths: Adjust the data paths to accommodate ternary operands and results. This may involve widening the data paths to support ternary values (0, 1, 2) or introducing specialized ternary data paths alongside existing binary ones. #### Pipeline Stages: Potentially introduce additional pipeline stages to handle the unique characteristics of ternary operations. For example, stages dedicated to ternary operation execution, result calculation, and forwarding. #### Hazard Detection and Forwarding: Enhance hazard detection and forwarding mechanisms to handle dependencies and hazards arising from ternary instructions. This ensures efficient execution without stalls or data hazards. #### Memory Access: Adapt memory access units to support ternary data if needed. This may involve modifications to memory interfaces and data buses to handle ternary values during loads and stores. #### Control Logic: Adjust control logic to manage the flow of ternary instructions through the pipeline, including branch prediction, speculative execution, and exception handling. #### Testing and Validation: Develop thorough testing procedures to validate the functionality and performance of the modified pipeline architecture with ternary logic. This includes verifying correctness, throughput, and latency under various conditions. #### Optimization Opportunities: Explore optimization opportunities specific to ternary logic, such as exploiting parallelism inherent in ternary operations or minimizing energy consumption through efficient ternary arithmetic. ## Address range and capacity Implementing a ternary addressing system can indeed exponentially increase the addressable memory space compared to a binary system. Here's how it could be done, along with considerations for physical memory size and access speed: #### Ternary Addressing System: In a ternary addressing system, each address line can have three possible states (0, 1, 2) instead of just two (0, 1) in a binary system. With n ternary address lines, the total addressable memory space becomes 3^n instead of 2^n in a binary system. This exponential increase allows for significantly larger memory capacity. #### Physical Memory Size: Implementing a ternary addressing system requires additional hardware support to handle ternary addresses. This includes ternary address decoders, multiplexers, and memory cells capable of storing ternary values. The physical memory size needs to be increased to accommodate the larger addressable space. However, the actual increase depends on the number of ternary address lines and the memory organization. Ternary memory cells can store ternary values (0, 1, 2) instead of binary values (0, 1), which requires modifications to memory cell design and storage mechanisms. #### Memory Organization: Ternary memory organization can vary based on the specific requirements of the system. It can include flat memory models, hierarchical memory structures, or specialized memory architectures optimized for ternary addressing. Efficient memory organization is essential to maximize the utilization of the expanded addressable space while maintaining access speed and minimizing latency. #### Access Speed: Access speed in a ternary memory system depends on various factors, including memory technology, access mechanisms, and memory organization. Ternary memory access may introduce additional complexity compared to binary memory access due to the increased number of address states and memory cell configurations. Access speed can be affected by factors such as memory latency, bus contention, and access patterns. Optimizing memory access algorithms and hardware design is crucial to ensure efficient access speed. #### Trade-offs: Implementing a ternary addressing system offers the advantage of exponentially increasing the addressable memory space. However, it comes with trade-offs such as increased hardware complexity, higher implementation costs, and potentially slower access speed due to additional processing overhead. Balancing these trade-offs is essential to ensure that the benefits of the expanded memory capacity outweigh the associated drawbacks.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully