Ignore:
Timestamp:
Sep 30, 2014, 3:32:13 PM (10 years ago)
Author:
devigne
Message:

RWT Commit : Cosmetic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/RWT/modules/vci_mem_cache/caba/source/include/update_tab.h

    r814 r823  
    1212class UpdateTabEntry {
    1313
    14   typedef uint32_t size_t;
    15   typedef sc_dt::sc_uint<40> addr_t;
    16 
    17   public:
    18 
    19   bool   valid;   // It is a valid pending transaction
    20   bool   update;  // It is an update transaction
    21   bool   brdcast; // It is a broadcast invalidate
    22   bool   rsp;     // Response to the initiator required
    23   bool   ack;     // Acknowledge to the CONFIG FSM required
    24   size_t srcid;   // The srcid of the initiator which wrote the data
    25   size_t trdid;   // The trdid of the initiator which wrote the data
    26   size_t pktid;   // The pktid of the initiator which wrote the data
    27   addr_t nline;   // The identifier of the cache line
    28   size_t count;   // The number of acknowledge responses to receive
    29 
    30   UpdateTabEntry()
    31   {
    32     valid   = false;
    33     update  = false;
    34     brdcast = false;
    35     rsp     = false;
    36     ack     = false;
    37     srcid   = 0;
    38     trdid   = 0;
    39     pktid   = 0;
    40     nline   = 0;
    41     count   = 0;
    42   }
    43 
    44   UpdateTabEntry(bool   i_valid,
    45                  bool   i_update,
    46                  bool   i_brdcast,
    47                  bool   i_rsp,
    48                  bool   i_ack,
    49                  size_t i_srcid,
    50                  size_t i_trdid,
    51                  size_t i_pktid,
    52                  addr_t i_nline,
    53                  size_t i_count)
    54   {
    55     valid   = i_valid;
    56     update  = i_update;
    57     brdcast = i_brdcast;
    58     rsp     = i_rsp;
    59     ack     = i_ack;
    60     srcid   = i_srcid;
    61     trdid   = i_trdid;
    62     pktid   = i_pktid;
    63     nline   = i_nline;
    64     count   = i_count;
    65   }
    66 
    67   UpdateTabEntry(const UpdateTabEntry &source)
    68   {
    69     valid   = source.valid;
    70     update  = source.update;
    71     brdcast = source.brdcast;
    72     rsp     = source.rsp;
    73     ack     = source.ack;
    74     srcid   = source.srcid;
    75     trdid   = source.trdid;
    76     pktid   = source.pktid;
    77     nline   = source.nline;
    78     count   = source.count;
    79   }
    80 
    81   ////////////////////////////////////////////////////
    82   // The init() function initializes the entry
    83   ///////////////////////////////////////////////////
    84   void init()
    85   {
    86     valid   = false;
    87     update  = false;
    88     brdcast = false;
    89     rsp     = false;
    90     ack     = false;
    91     srcid   = 0;
    92     trdid   = 0;
    93     pktid   = 0;
    94     nline   = 0;
    95     count   = 0;
    96   }
    97 
    98   ////////////////////////////////////////////////////////////////////
    99   // The copy() function copies an existing entry
    100   // Its arguments are :
    101   // - source : the update tab entry to copy
    102   ////////////////////////////////////////////////////////////////////
    103   void copy(const UpdateTabEntry &source)
    104   {
    105     valid  = source.valid;
    106     update = source.update;
    107     brdcast= source.brdcast;
    108     rsp    = source.rsp;
    109     ack    = source.ack  ;
    110     srcid  = source.srcid;
    111     trdid  = source.trdid;
    112     pktid  = source.pktid;
    113     nline  = source.nline;
    114     count  = source.count;
    115   }
    116 
    117   ////////////////////////////////////////////////////////////////////
    118   // The print() function prints the entry
    119   ////////////////////////////////////////////////////////////////////
    120   void print()
    121   {
    122     std::cout << " val = " << std::dec << valid
    123               << " / updt = " << update
    124               << " / bc = " << brdcast
    125               << " / rsp = " << rsp
    126               << " / ack = " << ack
    127               << " / count = " << count
    128               << " / srcid = " << std::hex << srcid
    129               << " / trdid = " << trdid
    130               << " / pktid = " << pktid
    131               << " / nline = " << nline << std::endl;
    132   }
     14    typedef uint32_t size_t;
     15    typedef sc_dt::sc_uint<40> addr_t;
     16
     17    public:
     18
     19    bool   valid;   // It is a valid pending transaction
     20    bool   update;  // It is an update transaction
     21    bool   brdcast; // It is a broadcast invalidate
     22    bool   rsp;     // Response to the initiator required
     23    bool   ack;     // Acknowledge to the CONFIG FSM required
     24    size_t srcid;   // The srcid of the initiator which wrote the data
     25    size_t trdid;   // The trdid of the initiator which wrote the data
     26    size_t pktid;   // The pktid of the initiator which wrote the data
     27    addr_t nline;   // The identifier of the cache line
     28    size_t count;   // The number of acknowledge responses to receive
     29
     30    UpdateTabEntry()
     31    {
     32        valid   = false;
     33        update  = false;
     34        brdcast = false;
     35        rsp     = false;
     36        ack     = false;
     37        srcid   = 0;
     38        trdid   = 0;
     39        pktid   = 0;
     40        nline   = 0;
     41        count   = 0;
     42    }
     43
     44    UpdateTabEntry(bool   i_valid,
     45                   bool   i_update,
     46                   bool   i_brdcast,
     47                   bool   i_rsp,
     48                   bool   i_ack,
     49                   size_t i_srcid,
     50                   size_t i_trdid,
     51                   size_t i_pktid,
     52                   addr_t i_nline,
     53                   size_t i_count)
     54    {
     55        valid   = i_valid;
     56        update  = i_update;
     57        brdcast = i_brdcast;
     58        rsp     = i_rsp;
     59        ack     = i_ack;
     60        srcid   = i_srcid;
     61        trdid   = i_trdid;
     62        pktid   = i_pktid;
     63        nline   = i_nline;
     64        count   = i_count;
     65    }
     66
     67    UpdateTabEntry(const UpdateTabEntry &source)
     68    {
     69        valid   = source.valid;
     70        update  = source.update;
     71        brdcast = source.brdcast;
     72        rsp     = source.rsp;
     73        ack     = source.ack;
     74        srcid   = source.srcid;
     75        trdid   = source.trdid;
     76        pktid   = source.pktid;
     77        nline   = source.nline;
     78        count   = source.count;
     79    }
     80
     81    ////////////////////////////////////////////////////
     82    // The init() function initializes the entry
     83    ///////////////////////////////////////////////////
     84    void init()
     85    {
     86        valid   = false;
     87        update  = false;
     88        brdcast = false;
     89        rsp     = false;
     90        ack     = false;
     91        srcid   = 0;
     92        trdid   = 0;
     93        pktid   = 0;
     94        nline   = 0;
     95        count   = 0;
     96    }
     97
     98    ////////////////////////////////////////////////////////////////////
     99    // The copy() function copies an existing entry
     100    // Its arguments are :
     101    // - source : the update tab entry to copy
     102    ////////////////////////////////////////////////////////////////////
     103    void copy(const UpdateTabEntry &source)
     104    {
     105        valid   = source.valid;
     106        update = source.update;
     107        brdcast = source.brdcast;
     108        rsp     = source.rsp;
     109        ack     = source.ack;
     110        srcid   = source.srcid;
     111        trdid   = source.trdid;
     112        pktid   = source.pktid;
     113        nline   = source.nline;
     114        count   = source.count;
     115    }
     116
     117    ////////////////////////////////////////////////////////////////////
     118    // The print() function prints the entry
     119    ////////////////////////////////////////////////////////////////////
     120    void print()
     121    {
     122        std::cout << " val = " << std::dec << valid
     123                  << " / updt = " << update
     124                  << " / bc = " << brdcast
     125                  << " / rsp = " << rsp
     126                  << " / ack = " << ack
     127                  << " / count = " << count
     128                  << " / srcid = " << std::hex << srcid
     129                  << " / trdid = " << trdid
     130                  << " / pktid = " << pktid
     131                  << " / nline = " << nline << std::endl;
     132    }
    133133};
    134134
     
    138138class UpdateTab{
    139139
    140   typedef uint64_t addr_t;
    141 
    142   private:
    143   size_t                      size_tab;
    144   std::vector<UpdateTabEntry> tab;
    145 
    146   public:
    147 
    148   UpdateTab()
    149     : tab(0)
    150   {
    151     size_tab=0;
    152   }
    153 
    154   UpdateTab(size_t size_tab_i)
    155     : tab(size_tab_i)
    156   {
    157     size_tab=size_tab_i;
    158   }
    159 
    160   ////////////////////////////////////////////////////////////////////
    161   // The size() function returns the size of the tab
    162   ////////////////////////////////////////////////////////////////////
    163   const size_t size()
    164   {
    165     return size_tab;
    166   }
    167 
    168   ////////////////////////////////////////////////////////////////////
    169   // The print() function diplays the tab content
    170   ////////////////////////////////////////////////////////////////////
    171   void print()
    172   {
    173     std::cout << "UPDATE TABLE Content" << std::endl;
    174     for(size_t i=0; i<size_tab; i++)
    175     {
    176       std::cout << "[" << std::dec << i << "] ";
    177       tab[i].print();
    178     }
    179     return;
    180   }
    181 
    182   /////////////////////////////////////////////////////////////////////
    183   // The init() function initializes the tab
    184   /////////////////////////////////////////////////////////////////////
    185   void init()
    186   {
    187     for ( size_t i=0; i<size_tab; i++) tab[i].init();
    188   }
    189 
    190   /////////////////////////////////////////////////////////////////////
    191   // The reads() function reads an entry
    192   // Arguments :
    193   // - entry : the entry to read
    194   // This function returns a copy of the entry.
    195   /////////////////////////////////////////////////////////////////////
    196   UpdateTabEntry read (size_t entry)
    197   {
    198     assert(entry<size_tab && "Bad Update Tab Entry");
    199     return UpdateTabEntry(tab[entry]);
    200   }
    201 
    202   ///////////////////////////////////////////////////////////////////////////
    203   // The set() function writes an entry in the Update Table
    204   // Arguments :
    205   // - update : transaction type (bool)
    206   // - srcid : srcid of the initiator
    207   // - trdid : trdid of the initiator
    208   // - pktid : pktid of the initiator
    209   // - count : number of expected responses
    210   // - index : (return argument) index of the selected entry
    211   // This function returns true if the write successed (an entry was empty).
    212   ///////////////////////////////////////////////////////////////////////////
    213   bool set(const bool   update,
    214            const bool   brdcast,
    215            const bool   rsp,
    216            const bool   ack,
    217            const size_t srcid,
    218            const size_t trdid,
    219            const size_t pktid,
    220            const addr_t nline,
    221            const size_t count,
    222            size_t       &index)
    223   {
    224     for ( size_t i=0 ; i<size_tab ; i++ )
    225     {
    226       if( !tab[i].valid )
    227       {
    228         tab[i].valid   = true;
    229         tab[i].update  = update;
    230         tab[i].brdcast = brdcast;
    231         tab[i].rsp     = rsp;
    232         tab[i].ack     = ack;
    233         tab[i].srcid   = (size_t) srcid;
    234         tab[i].trdid   = (size_t) trdid;
    235         tab[i].pktid   = (size_t) pktid;
    236         tab[i].nline   = (addr_t) nline;
    237         tab[i].count   = (size_t) count;
    238         index          = i;
     140    typedef uint64_t addr_t;
     141
     142    private:
     143    size_t size_tab;
     144    std::vector<UpdateTabEntry> tab;
     145
     146    public:
     147
     148    UpdateTab()
     149        : tab(0)
     150    {
     151        size_tab = 0;
     152    }
     153
     154    UpdateTab(size_t size_tab_i)
     155        : tab(size_tab_i)
     156    {
     157        size_tab = size_tab_i;
     158    }
     159
     160    ////////////////////////////////////////////////////////////////////
     161    // The size() function returns the size of the tab
     162    ////////////////////////////////////////////////////////////////////
     163    const size_t size()
     164    {
     165        return size_tab;
     166    }
     167
     168    ////////////////////////////////////////////////////////////////////
     169    // The print() function diplays the tab content
     170    ////////////////////////////////////////////////////////////////////
     171    void print()
     172    {
     173        std::cout << "UPDATE TABLE Content" << std::endl;
     174        for (size_t i = 0; i < size_tab; i++)
     175        {
     176            std::cout << "[" << std::dec << i << "] ";
     177            tab[i].print();
     178        }
     179        return;
     180    }
     181
     182    /////////////////////////////////////////////////////////////////////
     183    // The init() function initializes the tab
     184    /////////////////////////////////////////////////////////////////////
     185    void init()
     186    {
     187        for (size_t i = 0; i < size_tab; i++)
     188        {
     189            tab[i].init();
     190        }
     191    }
     192
     193    /////////////////////////////////////////////////////////////////////
     194    // The reads() function reads an entry
     195    // Arguments :
     196    // - entry : the entry to read
     197    // This function returns a copy of the entry.
     198    /////////////////////////////////////////////////////////////////////
     199    UpdateTabEntry read(size_t entry)
     200    {
     201        assert(entry < size_tab && "Bad Update Tab Entry");
     202        return UpdateTabEntry(tab[entry]);
     203    }
     204
     205    ///////////////////////////////////////////////////////////////////////////
     206    // The set() function writes an entry in the Update Table
     207    // Arguments :
     208    // - update : transaction type (bool)
     209    // - srcid : srcid of the initiator
     210    // - trdid : trdid of the initiator
     211    // - pktid : pktid of the initiator
     212    // - count : number of expected responses
     213    // - index : (return argument) index of the selected entry
     214    // This function returns true if the write successed (an entry was empty).
     215    ///////////////////////////////////////////////////////////////////////////
     216    bool set(const bool   update,
     217             const bool   brdcast,
     218             const bool   rsp,
     219             const bool   ack,
     220             const size_t srcid,
     221             const size_t trdid,
     222             const size_t pktid,
     223             const addr_t nline,
     224             const size_t count,
     225             size_t       &index)
     226    {
     227        for (size_t i = 0; i < size_tab; i++)
     228        {
     229            if (!tab[i].valid)
     230            {
     231                tab[i].valid   = true;
     232                tab[i].update  = update;
     233                tab[i].brdcast = brdcast;
     234                tab[i].rsp     = rsp;
     235                tab[i].ack     = ack;
     236                tab[i].srcid   = (size_t) srcid;
     237                tab[i].trdid   = (size_t) trdid;
     238                tab[i].pktid   = (size_t) pktid;
     239                tab[i].nline   = (addr_t) nline;
     240                tab[i].count   = (size_t) count;
     241                index          = i;
     242                return true;
     243            }
     244        }
     245        return false;
     246    } // end set()
     247
     248    /////////////////////////////////////////////////////////////////////
     249    // The decrement() function decrements the counter for a given entry.
     250    // Arguments :
     251    // - index   : the index of the entry
     252    // - counter : (return argument) value of the counter after decrement
     253    // This function returns true if the entry is valid.
     254    /////////////////////////////////////////////////////////////////////
     255    bool decrement(const size_t index,
     256                   size_t       &counter)
     257    {
     258        assert((index < size_tab) && "Bad Update Tab Entry");
     259        if (tab[index].valid)
     260        {
     261            tab[index].count--;
     262            counter = tab[index].count;
     263            return true;
     264        }
     265        else
     266        {
     267            return false;
     268        }
     269    }
     270
     271    /////////////////////////////////////////////////////////////////////
     272    // The is_full() function returns true if the table is full
     273    /////////////////////////////////////////////////////////////////////
     274    bool is_full()
     275    {
     276        for (size_t i = 0; i < size_tab; i++)
     277        {
     278            if (!tab[i].valid)
     279            {
     280                return false;
     281            }
     282        }
    239283        return true;
    240       }
    241     }
    242     return false;
    243   } // end set()
    244 
    245   /////////////////////////////////////////////////////////////////////
    246   // The decrement() function decrements the counter for a given entry.
    247   // Arguments :
    248   // - index   : the index of the entry
    249   // - counter : (return argument) value of the counter after decrement
    250   // This function returns true if the entry is valid.
    251   /////////////////////////////////////////////////////////////////////
    252   bool decrement( const size_t index,
    253                   size_t &counter )
    254   {
    255     assert((index<size_tab) && "Bad Update Tab Entry");
    256     if ( tab[index].valid )
    257     {
    258       tab[index].count--;
    259       counter = tab[index].count;
    260       return true;
    261     }
    262     else
    263     {
    264       return false;
    265     }
    266   }
    267 
    268   /////////////////////////////////////////////////////////////////////
    269   // The is_full() function returns true if the table is full
    270   /////////////////////////////////////////////////////////////////////
    271   bool is_full()
    272   {
    273     for(size_t i = 0 ; i < size_tab ; i++)
    274     {
    275       if(!tab[i].valid) return false;
    276     }
    277     return true;
    278   }
    279 
    280   /////////////////////////////////////////////////////////////////////
    281   // The is_not_empty() function returns true if the table is not empty
    282   /////////////////////////////////////////////////////////////////////
    283   bool is_not_empty()
    284   {
    285     for(size_t i = 0 ; i < size_tab ; i++)
    286     {
    287       if(tab[i].valid) return true;
    288     }
    289     return false;
    290   }
    291 
    292   /////////////////////////////////////////////////////////////////////
    293   // The need_rsp() function returns the need of a response
    294   // Arguments :
    295   // - index : the index of the entry
    296   /////////////////////////////////////////////////////////////////////
    297   bool need_rsp(const size_t index)
    298   {
    299     assert(index<size_tab && "Bad Update Tab Entry");
    300     return tab[index].rsp;
    301   }
    302 
    303   /////////////////////////////////////////////////////////////////////
    304   // The need_ack() function returns the need of an acknowledge
    305   // Arguments :
    306   // - index : the index of the entry
    307   /////////////////////////////////////////////////////////////////////
    308   bool need_ack(const size_t index)
    309   {
    310     assert(index<size_tab && "Bad Update Tab Entry");
    311     return tab[index].ack;
    312   }
    313 
    314   /////////////////////////////////////////////////////////////////////
    315   // The is_brdcast() function returns the transaction type
    316   // Arguments :
    317   // - index : the index of the entry
    318   /////////////////////////////////////////////////////////////////////
    319   bool is_brdcast(const size_t index)
    320   {
    321     assert(index<size_tab && "Bad Update Tab Entry");
    322     return tab[index].brdcast;
    323   }
    324 
    325   /////////////////////////////////////////////////////////////////////
    326   // The is_update() function returns the transaction type
    327   // Arguments :
    328   // - index : the index of the entry
    329   /////////////////////////////////////////////////////////////////////
    330   bool is_update(const size_t index)
    331   {
    332     assert(index<size_tab && "Bad Update Tab Entry");
    333     return tab[index].update;
    334   }
    335 
    336   /////////////////////////////////////////////////////////////////////
    337   // The srcid() function returns the srcid value
    338   // Arguments :
    339   // - index : the index of the entry
    340   /////////////////////////////////////////////////////////////////////
    341   size_t srcid(const size_t index)
    342   {
    343     assert(index<size_tab && "Bad Update Tab Entry");
    344     return tab[index].srcid;
    345   }
    346 
    347   /////////////////////////////////////////////////////////////////////
    348   // The trdid() function returns the trdid value
    349   // Arguments :
    350   // - index : the index of the entry
    351   /////////////////////////////////////////////////////////////////////
    352   size_t trdid(const size_t index)
    353   {
    354     assert(index<size_tab && "Bad Update Tab Entry");
    355     return tab[index].trdid;
    356   }
    357 
    358   /////////////////////////////////////////////////////////////////////
    359   // The pktid() function returns the pktid value
    360   // Arguments :
    361   // - index : the index of the entry
    362   /////////////////////////////////////////////////////////////////////
    363   size_t pktid(const size_t index)
    364   {
    365     assert(index<size_tab && "Bad Update Tab Entry");
    366     return tab[index].pktid;
    367   }
    368 
    369   /////////////////////////////////////////////////////////////////////
    370   // The nline() function returns the nline value
    371   // Arguments :
    372   // - index : the index of the entry
    373   /////////////////////////////////////////////////////////////////////
    374   addr_t nline(const size_t index)
    375   {
    376     assert(index<size_tab && "Bad Update Tab Entry");
    377     return tab[index].nline;
    378   }
    379 
    380   /////////////////////////////////////////////////////////////////////
    381   // The search_inval() function returns the index of the entry in UPT
    382   // Arguments :
    383   // - nline : the line number of the entry in the directory
    384   /////////////////////////////////////////////////////////////////////
    385   bool search_inval(const addr_t nline,size_t &index)
    386   {
    387     size_t i ;
    388 
    389     for (i = 0 ; i < size_tab ; i++)
    390     {
    391       if ( (tab[i].nline == nline) and tab[i].valid and not tab[i].update )
    392       {
    393         index = i ;
    394         return true;
    395       }
    396     }
    397     return false;
    398   }
    399 
    400   /////////////////////////////////////////////////////////////////////
    401   // The read_nline() function returns the index of the entry in UPT
    402   // Arguments :
    403   // - nline : the line number of the entry in the directory
    404   /////////////////////////////////////////////////////////////////////
    405   bool read_nline(const addr_t nline,size_t &index)
    406   {
    407     size_t i ;
    408 
    409     for (i = 0 ; i < size_tab ; i++)
    410     {
    411       if ( (tab[i].nline == nline) and tab[i].valid )
    412       {
    413         index = i ;
    414         return true;
    415       }
    416     }
    417     return false;
    418   }
    419 
    420   /////////////////////////////////////////////////////////////////////
    421   // The clear() function erases an entry of the tab
    422   // Arguments :
    423   // - index : the index of the entry
    424   /////////////////////////////////////////////////////////////////////
    425   void clear(const size_t index)
    426   {
    427     assert(index<size_tab && "Bad Update Tab Entry");
    428     tab[index].valid=false;
    429     return;
    430   }
     284    }
     285
     286    /////////////////////////////////////////////////////////////////////
     287    // The is_not_empty() function returns true if the table is not empty
     288    /////////////////////////////////////////////////////////////////////
     289    bool is_not_empty()
     290    {
     291        for (size_t i = 0; i < size_tab; i++)
     292        {
     293            if (tab[i].valid)
     294            {
     295                return true;
     296            }
     297        }
     298        return false;
     299    }
     300
     301    /////////////////////////////////////////////////////////////////////
     302    // The need_rsp() function returns the need of a response
     303    // Arguments :
     304    // - index : the index of the entry
     305    /////////////////////////////////////////////////////////////////////
     306    bool need_rsp(const size_t index)
     307    {
     308        assert(index < size_tab && "Bad Update Tab Entry");
     309        return tab[index].rsp;
     310    }
     311
     312    /////////////////////////////////////////////////////////////////////
     313    // The need_ack() function returns the need of an acknowledge
     314    // Arguments :
     315    // - index : the index of the entry
     316    /////////////////////////////////////////////////////////////////////
     317    bool need_ack(const size_t index)
     318    {
     319        assert(index < size_tab && "Bad Update Tab Entry");
     320        return tab[index].ack;
     321    }
     322
     323    /////////////////////////////////////////////////////////////////////
     324    // The is_brdcast() function returns the transaction type
     325    // Arguments :
     326    // - index : the index of the entry
     327    /////////////////////////////////////////////////////////////////////
     328    bool is_brdcast(const size_t index)
     329    {
     330        assert(index < size_tab && "Bad Update Tab Entry");
     331        return tab[index].brdcast;
     332    }
     333
     334    /////////////////////////////////////////////////////////////////////
     335    // The is_update() function returns the transaction type
     336    // Arguments :
     337    // - index : the index of the entry
     338    /////////////////////////////////////////////////////////////////////
     339    bool is_update(const size_t index)
     340    {
     341        assert(index < size_tab && "Bad Update Tab Entry");
     342        return tab[index].update;
     343    }
     344
     345    /////////////////////////////////////////////////////////////////////
     346    // The srcid() function returns the srcid value
     347    // Arguments :
     348    // - index : the index of the entry
     349    /////////////////////////////////////////////////////////////////////
     350    size_t srcid(const size_t index)
     351    {
     352        assert(index < size_tab && "Bad Update Tab Entry");
     353        return tab[index].srcid;
     354    }
     355
     356    /////////////////////////////////////////////////////////////////////
     357    // The trdid() function returns the trdid value
     358    // Arguments :
     359    // - index : the index of the entry
     360    /////////////////////////////////////////////////////////////////////
     361    size_t trdid(const size_t index)
     362    {
     363        assert(index < size_tab && "Bad Update Tab Entry");
     364        return tab[index].trdid;
     365    }
     366
     367    /////////////////////////////////////////////////////////////////////
     368    // The pktid() function returns the pktid value
     369    // Arguments :
     370    // - index : the index of the entry
     371    /////////////////////////////////////////////////////////////////////
     372    size_t pktid(const size_t index)
     373    {
     374        assert(index < size_tab && "Bad Update Tab Entry");
     375        return tab[index].pktid;
     376    }
     377
     378    /////////////////////////////////////////////////////////////////////
     379    // The nline() function returns the nline value
     380    // Arguments :
     381    // - index : the index of the entry
     382    /////////////////////////////////////////////////////////////////////
     383    addr_t nline(const size_t index)
     384    {
     385        assert(index < size_tab && "Bad Update Tab Entry");
     386        return tab[index].nline;
     387    }
     388
     389    /////////////////////////////////////////////////////////////////////
     390    // The search_inval() function returns the index of the entry in UPT
     391    // Arguments :
     392    // - nline : the line number of the entry in the directory
     393    /////////////////////////////////////////////////////////////////////
     394    bool search_inval(const addr_t nline, size_t &index)
     395    {
     396        size_t i;
     397
     398        for (i = 0; i < size_tab; i++)
     399        {
     400            if ((tab[i].nline == nline) and tab[i].valid and not tab[i].update)
     401            {
     402                index = i;
     403                return true;
     404            }
     405        }
     406        return false;
     407    }
     408
     409    /////////////////////////////////////////////////////////////////////
     410    // The read_nline() function returns the index of the entry in UPT
     411    // Arguments :
     412    // - nline : the line number of the entry in the directory
     413    /////////////////////////////////////////////////////////////////////
     414    bool read_nline(const addr_t nline, size_t &index)
     415    {
     416        size_t i;
     417
     418        for (i = 0; i < size_tab; i++)
     419        {
     420            if ((tab[i].nline == nline) and tab[i].valid)
     421            {
     422                index = i;
     423                return true;
     424            }
     425        }
     426        return false;
     427    }
     428
     429    /////////////////////////////////////////////////////////////////////
     430    // The clear() function erases an entry of the tab
     431    // Arguments :
     432    // - index : the index of the entry
     433    /////////////////////////////////////////////////////////////////////
     434    void clear(const size_t index)
     435    {
     436        assert(index < size_tab && "Bad Update Tab Entry");
     437        tab[index].valid = false;
     438        return;
     439    }
    431440
    432441};
Note: See TracChangeset for help on using the changeset viewer.