Ignore:
Timestamp:
Dec 23, 2015, 4:28:42 PM (3 years ago)
Author:
nmedfort
Message:

Work on lowering + minor bug fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/optimizers/pablo_automultiplexing.cpp

    r4896 r4899  
    1010#include <boost/range/iterator_range.hpp>
    1111#include <pablo/analysis/pabloverifier.hpp>
     12#include <pablo/optimizers/pablo_simplifier.hpp>
    1213#include <stack>
    1314#include <queue>
     
    172173        PabloVerifier::verify(function, "post-multiplexing");
    173174        #endif
     175
     176        Simplifier::optimize(function);
    174177    }
    175178
     
    931934            const size_t m = log2_plus_one(n);
    932935            Advance * input[n];
    933             Advance * muxed[m];
     936            PabloAST * muxed[m];
     937            PabloAST * muxed_n[m];
    934938            // The multiplex set graph is a DAG with edges denoting the set relationships of our independent sets.
    935939            unsigned i = 0;
     
    939943            Advance * const adv = input[0];
    940944            PabloBlock * const block = adv->getParent(); assert (block);
    941             block->setInsertPoint(nullptr);
     945            block->setInsertPoint(nullptr);           
    942946            /// Perform n-to-m Multiplexing
    943947            for (size_t j = 0; j != m; ++j) {
     
    951955                    }
    952956                }
    953                 muxed[j] = cast<Advance>(block->createAdvance(muxing, adv->getOperand(1), prefix.str()));
     957                muxed[j] = block->createAdvance(muxing, adv->getOperand(1), prefix.str());
     958                muxed_n[j] = block->createNot(muxed[j]);
    954959            }
    955960            /// Perform m-to-n Demultiplexing
    956961            for (size_t i = 0; i != n; ++i) {
    957962                // Construct the demuxed values and replaces all the users of the original advances with them.               
    958                 PabloAST * demuxing[m];
    959                 for (size_t j = 0; j != m; ++j) {
    960                     demuxing[j] = muxed[j];
    961                     if (((i + 1) & (1UL << j)) == 0) {
    962                         demuxing[j] = block->createNot(muxed[j]);
    963                     }
    964                 }
    965963                And * demuxed = block->createAnd(m);
    966964                for (size_t j = 0; j != m; ++j) {
    967                     demuxed->addOperand(demuxing[j]);
     965                    demuxed->addOperand((((i + 1) & (1UL << j)) != 0) ? muxed[j] : muxed_n[j]);
    968966                }
    969967                input[i]->replaceWith(demuxed, true, true);
Note: See TracChangeset for help on using the changeset viewer.