ahmed-alllam / AlphaLogos

Boolean Function Analyzer and Synthesis Optimization Tool
http://alpha-logos-1464863388.eu-west-3.elb.amazonaws.com/
MIT License
1 stars 0 forks source link

Implementing canonical SoP and PoS #19

Closed MohamedEbrahem1 closed 1 year ago

MohamedEbrahem1 commented 1 year ago

Feature Request: Implementation of Canonical SoP (sum of products) and PoS (product of sums) Function

Problem: There isn't a function that provides canonical SoP and PoS based on a given truth table.

Proposed Solution:

  1. Inputs:

    • Truth table from generateTruthTable function.
    • Tokens from tokenize function.
  2. Variable Sequence:

    • Extract the variable sequence from the tokenize function.
    • Identify tokens that are of type Var.
    • Store these variables in a vector, ensuring uniqueness.
  3. Output Structure: The function will return its outputs in a vector of Tokens. The process is as follows:

    a. For SoP:

    • Identify minterms.
    • Map each variable to its corresponding logic.
      • For instance, a logic '1' for variable A translates to A while a logic '0' becomes A'.
    • Append a + symbol after each minterm permutation, and a * between each variable within a minterm.

    b. For PoS:

    • Identify maxterms.
    • Map each variable to its inverse logic.
      • For instance, a logic '1' for variable A' translates to A while a logic '0' becomes A'.
    • Append a * symbol after each maxterm permutation, and a + between each variable within a maxterm.
  4. Return Value:

    • Return the final vector of tokens, which will represent the canonical SoP or PoS.