source: trunk/IPs/systemC/Environment/Data/src/Data.cpp @ 112

Last change on this file since 112 was 81, checked in by rosiere, 17 years ago
  • Finish Environment (and test)
  • Continue predictor_unit
  • Add external tools
  • svn keyword "Id" set
  • Property svn:keywords set to Id
File size: 966 bytes
Line 
1#include "../include/Data.h"
2
3namespace environment {
4namespace data {
5
6  Data::Data (std::string name, Parameters * param)
7  {
8    this->name  = name;
9    this->param = param;
10
11    std::list<SEGMENT_TABLE_ENTRY> seglist = param->segtab->getSegmentList(param->globalIndex,param->localIndex);
12    nb_seg = seglist.size();
13
14    if (nb_seg >= param->max_seg)
15      {
16        std::cerr << "The number of seg can't be higher that " << param->max_seg << std::endl;
17        exit (1);
18      }
19   
20    segment = new Segment * [param->max_seg];
21   
22    uint32_t i=0;
23    for (std::list<SEGMENT_TABLE_ENTRY>::iterator iter = seglist.begin(); iter != seglist.end() ; ++iter)
24      {
25        SEGMENT_TABLE_ENTRY * entry = &(*iter);
26
27        segment [i] = new Segment (entry);
28       
29        param->segtab->setAddrAlloc(entry->getBase(),(void *)(segment [i]->data_addr()));
30
31        i ++;
32      }
33  }
34
35  Data::~Data (void)
36  {
37    for (uint32_t i=0; i<nb_seg; i++)
38      delete segment [i];
39    delete [] segment;
40  }
41
42};
43};
Note: See TracBrowser for help on using the repository browser.