Ignore:
Timestamp:
Feb 4, 2017, 6:49:46 AM (2 years ago)
Author:
cameron
Message:

Ability to set input/output signatures for Pablo functions in the constructor

Location:
icGREP/icgrep-devel/icgrep/cc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/cc/cc_compiler.cpp

    r5283 r5299  
    1919namespace cc {
    2020
    21 CC_Compiler::CC_Compiler(PabloKernel * kernel, const unsigned encodingBits, const std::string prefix)
    22 : mBuilder(kernel->getEntryBlock())
    23 , mBasisBit(encodingBits)
    24 , mEncodingBits(encodingBits) {
    25 
    26     // TODO: basisBits should be defined prior and only retrieved here.
    27     Var * const basisBits = kernel->addInput(prefix, kernel->getStreamSetTy(encodingBits));
    28     for (unsigned i = 0; i != mEncodingBits; i++) {
    29         mBasisBit[i] = mBuilder.createExtract(basisBits, mBuilder.getInteger(i)); assert (mBasisBit[i]);
    30     }
    31     mEncodingMask = (static_cast<unsigned>(1) << encodingBits) - static_cast<unsigned>(1);
    32 }
     21    CC_Compiler::CC_Compiler(PabloKernel * kernel, const unsigned encodingBits, const std::string prefix)
     22    : mBuilder(kernel->getEntryBlock())
     23    , mEncodingBits(encodingBits)
     24    , mBasisBit(encodingBits) {
     25       
     26        // TODO: basisBits should be defined prior and only retrieved here.
     27        Var * const basisBits = kernel->addInput(prefix, kernel->getStreamSetTy(encodingBits));
     28        for (unsigned i = 0; i != mEncodingBits; i++) {
     29            mBasisBit[i] = mBuilder.createExtract(basisBits, mBuilder.getInteger(i)); assert (mBasisBit[i]);
     30        }
     31        mEncodingMask = (static_cast<unsigned>(1) << encodingBits) - static_cast<unsigned>(1);
     32    }
     33   
     34   
     35    CC_Compiler::CC_Compiler(pablo::PabloKernel * kernel, pablo::Var * basisBits)
     36    : mBuilder(kernel->getEntryBlock())
     37    , mEncodingBits(dyn_cast<ArrayType>(basisBits->getType())->getNumElements())
     38    , mBasisBit(mEncodingBits) {
     39        for (unsigned i = 0; i != mEncodingBits; i++) {
     40            mBasisBit[i] = mBuilder.createExtract(basisBits, mBuilder.getInteger(i)); assert (mBasisBit[i]);
     41        }
     42        mEncodingMask = (static_cast<unsigned>(1) << mEncodingBits) - static_cast<unsigned>(1);
     43    }
     44   
     45   
    3346
    3447PabloAST * CC_Compiler::compileCC(const std::string & canonicalName, const CC *cc, PabloBlock & block) {
  • icGREP/icgrep-devel/icgrep/cc/cc_compiler.h

    r5267 r5299  
    1111#include <re/re_cc.h>
    1212#include <pablo/builder.hpp>
     13#include <kernels/interface.h>
    1314#include <string>
    1415
     
    2425
    2526    CC_Compiler(pablo::PabloKernel * kernel, const unsigned encodingBits = 8, const std::string prefix = "basis");
    26 
     27   
     28    CC_Compiler(pablo::PabloKernel * kernel, pablo::Var * basisBitSet);
     29   
    2730    pablo::PabloAST * compileCC(const re::CC *cc);
    2831
     
    6366private:   
    6467    pablo::PabloBuilder             mBuilder;
     68    const unsigned                  mEncodingBits;
    6569    std::vector<pablo::PabloAST *>  mBasisBit;
    66     const unsigned                  mEncodingBits;
    6770    unsigned                        mEncodingMask;
    6871};
Note: See TracChangeset for help on using the changeset viewer.