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

Last change on this file since 138 was 138, checked in by rosiere, 14 years ago

1) add counters_t type for interface
2) fix in check load in load_store_unit
3) add parameters (but not yet implemented)
4) change environment and add script (distcc_env.sh ...)
5) add warning if an unser change rename flag with l.mtspr instruction
6) ...

  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
1#include "../include/Segment.h"
2#include "../../Common/include/Debug.h"
3
4namespace environment {
5namespace data {
6 
7  bool Segment::init (const char * filename,const char ** sections)
8  {
9    void * ptab;
10    int    size   = this->size;
11//  int    size   = 0;
12    int    offset = 0;
13
14    loadexec(&ptab,&size,&offset,filename,sections);
15
16    // std::cout << "  - name           : " << name         << std::endl;
17    // std::cout << "    - size         : " << size         << std::endl;
18    // std::cout << "    - size         : " << this->size   << std::endl;
19    // std::cout << "    - offset       : " << offset       << std::endl;
20   
21    if (size > (int)this->size)
22      {
23        std::cerr << "<segment.init> : segment \"" << name << "\" is to small : size is " << this->size << " and requiert is " << size << std::endl;
24        return false;
25      }
26   
27    memcpy(data, ptab, size);
28
29    free  (ptab);
30
31//     {
32//       _cout(DATA,"Segment Init\n");
33//       _cout(DATA," * size : %d\n",size);
34//       _cout(DATA," * size : %d\n",this->size);
35//       _cout(DATA,"%s\n",print(0).c_str());
36     
37//       uint32_t addr = base;
38//       uint32_t step1 = 4;
39//       uint32_t step2 = step1*8;
40
41//       for (int32_t i=0; i<size; ++i)
42//         {
43//           if ((i%step1) == 0)
44//             _cout(DATA," ");
45//           if ((i%step2) ==0)
46//             {
47//               _cout(DATA,"\n%.8x : ",addr);
48//               addr += step2;
49//             }
50//           _cout(DATA,"%.2x",0xff&static_cast<uint32_t>(data[i]));
51//         }
52//       _cout(DATA,"\n");
53//     }
54   
55    return true;
56  }
57 
58};
59};
Note: See TracBrowser for help on using the repository browser.