Ignore:
Timestamp:
Jul 14, 2015, 6:29:35 PM (4 years ago)
Author:
cameron
Message:

Carry Manager progress

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/pablo/carry_data.h

    r4644 r4670  
    3333class PabloBlockCarryData {
    3434public:
    35     PabloBlockCarryData(): blockCarryDataIndex(0),
    36                            ifDepth(0), whileDepth (0),
    37                            localCarries(0), unitAdvances(0),
    38                            shortAdvances(0), shortAdvanceTotal(0),
    39                            longAdvances(0), longAdvanceTotalBlocks(0),
    40                            nestedBlockCount(0), nestedCarryDataSize(0),
    41                            localCarryDataSize(0), totalCarryDataSize(0),
    42                            carryOffset(0), unitAdvanceOffset(0),
    43                            shortAdvanceOffset(0), longAdvanceOffset(0)
     35    PabloBlockCarryData(): framePosition(0),
     36                           ifDepth(0), whileDepth (0), maxNestingDepth(0),
     37                           longAdvance({0, 0, 0}),
     38                           shortAdvance({0, 0, 0}),
     39                           advance1({0, 0}),
     40                           addWithCarry({0, 0}),
     41                           nested({0, 0, 0}),
     42                           summary({0, 0}),
     43                           totalCarryDataBits(0)
    4444                           {}
    45    
    46    
    47     void setBlockCarryDataIndex (unsigned idx) {blockCarryDataIndex = idx;}
    48    
    49     void setIfDepth (unsigned depth) {ifDepth = depth;}
    50    
    51     void setWhileDepth (unsigned depth) {whileDepth = depth;}
    52    
     45       
    5346    unsigned enumerate(PabloBlock & p);
    5447   
    5548    unsigned getBlockCarryDataIndex()  const {
    56         return blockCarryDataIndex;
     49        return framePosition/BLOCK_SIZE;
    5750    }
    5851   
     
    6457        return whileDepth;
    6558    }
    66    
     59       
    6760    unsigned longAdvanceCarryDataOffset(unsigned advanceIndex)  const {
    68         return blockCarryDataIndex + longAdvanceOffset + advanceIndex;
     61        return longAdvance.frameOffsetinBits / BLOCK_SIZE + advanceIndex;
    6962    }
    7063   
     
    7770    }
    7871   
    79     bool blockHasLongAdvances() const { return longAdvances > 0;}
     72    bool blockHasLongAdvances() const { return longAdvance.entries > 0;}
    8073   
    8174    unsigned shortAdvanceCarryDataOffset(unsigned advanceIndex)  const {
    82         return blockCarryDataIndex + shortAdvanceOffset + advanceIndex;
     75        return shortAdvance.frameOffsetinBits / BLOCK_SIZE + advanceIndex;
    8376    }
    8477   
    8578    unsigned unitAdvanceCarryDataOffset(unsigned advanceIndex)  const {
    86         return blockCarryDataIndex + unitAdvanceOffset + advanceIndex;
     79        return advance1.frameOffsetinBits / BLOCK_SIZE + advanceIndex;
    8780    }
    8881   
    8982    unsigned carryOpCarryDataOffset(unsigned idx)  const {
    90         return blockCarryDataIndex + carryOffset + idx;
     83        return addWithCarry.frameOffsetinBits / BLOCK_SIZE + idx;
    9184    }
    9285   
    93     bool blockHasCarries() const { return totalCarryDataSize > 0;}
     86    unsigned summaryCarryDataIndex()  const {
     87        return summary.frameOffsetinBits / BLOCK_SIZE;
     88    }
    9489   
    95     bool explicitSummaryRequired() const { return totalCarryDataSize > 1;}
     90    unsigned getLocalCarryDataSize () { return nested.frameOffsetinBits / BLOCK_SIZE; }
     91
     92    unsigned getTotalCarryDataSize () { return totalCarryDataBits / BLOCK_SIZE; }
     93   
     94    bool blockHasCarries() const { return totalCarryDataBits > 0;}
     95   
     96    bool explicitSummaryRequired() const { return totalCarryDataBits > BLOCK_SIZE;}
    9697   
    9798    bool summaryNeededInParentBlock() const {return (ifDepth > 0) && blockHasCarries();}
    9899   
    99     unsigned summaryCarryDataIndex()  const {
    100         return blockCarryDataIndex + totalCarryDataSize - 1;
    101     }
     100private:
    102101   
    103     unsigned getLocalCarryDataSize()  const {
    104         return localCarryDataSize;
    105     }
     102    unsigned framePosition;
    106103   
    107     unsigned getTotalCarryDataSize()  const {
    108         return totalCarryDataSize;
    109     }
    110    
    111 private:
    112     unsigned blockCarryDataIndex;
    113104    unsigned ifDepth;
    114105    unsigned whileDepth;
    115     unsigned localCarries;
    116     unsigned unitAdvances;
    117     unsigned shortAdvances;
    118     unsigned shortAdvanceTotal;
    119     unsigned longAdvances;
    120     unsigned longAdvanceTotalBlocks;
    121     unsigned nestedBlockCount;
    122     unsigned nestedCarryDataSize;
    123     unsigned localCarryDataSize;
    124     unsigned totalCarryDataSize;
    125     unsigned carryOffset;
    126     unsigned unitAdvanceOffset;
    127     unsigned shortAdvanceOffset;
    128     unsigned longAdvanceOffset;
     106    unsigned maxNestingDepth;   
     107   
     108    struct {unsigned frameOffsetinBits; unsigned entries; unsigned allocatedBitBlocks;} longAdvance;
     109    struct {unsigned frameOffsetinBits; unsigned entries; unsigned allocatedBits;} shortAdvance;
     110    struct {unsigned frameOffsetinBits; unsigned entries;} advance1;
     111    struct {unsigned frameOffsetinBits; unsigned entries;} addWithCarry;
     112    struct {unsigned frameOffsetinBits; unsigned entries; unsigned allocatedBits;} nested;
     113    struct {unsigned frameOffsetinBits; unsigned allocatedBits;} summary;
     114
     115    unsigned totalCarryDataBits;
    129116   
    130117};
Note: See TracChangeset for help on using the changeset viewer.