source: icGREP/icgrep-devel/icgrep/pablo/carry_data.h @ 5353

Last change on this file since 5353 was 5353, checked in by nmedfort, 2 years ago

Progress on parenthesis matching example

File size: 1.6 KB
Line 
1/*
2 *  Copyright (c) 2015 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6
7#ifndef CARRY_DATA_H
8#define CARRY_DATA_H
9
10/*
11 * Carry Data system.
12 *
13 * Each PabloBlock (Main, If, While) has a contiguous data area for carry information.
14 * The data area may be at a fixed or variable base offset from the base of the
15 * main function carry data area.
16 * The data area for each block consists of contiguous space for the local carries and
17 * advances of the block plus the areas of any ifs/whiles nested within the block.
18
19*/
20
21namespace pablo {
22
23class CarryData {
24    friend class CarryManager;
25public:
26
27    enum SummaryType : int {
28        NoSummary
29        , ImplicitSummary
30        , BorrowedSummary
31        , ExplicitSummary
32    };
33
34    CarryData()
35    : summaryType(NoSummary)   
36    , carryCollapsingMode(false) {
37
38    }
39             
40    bool hasSummary() const {
41        return (summaryType != NoSummary);
42    }
43   
44    bool hasImplicitSummary() const {
45        return (summaryType == ImplicitSummary);
46    }
47
48    bool hasBorrowedSummary() const {
49        return (summaryType == BorrowedSummary);
50    }
51
52    bool hasExplicitSummary() const {
53        return (summaryType == ExplicitSummary);
54    }
55
56    bool nonCarryCollapsingMode() const {
57        return carryCollapsingMode;
58    }
59
60    void setNonCarryCollapsingMode(const bool value = true) {
61        carryCollapsingMode = value;
62    }
63   
64protected:
65
66    SummaryType             summaryType;
67    bool                    carryCollapsingMode;
68
69};
70
71
72}
73
74
75#endif // CARRY_DATA_H
Note: See TracBrowser for help on using the repository browser.