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

Last change on this file since 123 was 123, checked in by rosiere, 15 years ago

1) Fix performance
2) add auto generation to SPECINT2000
3) add reset in genMoore and genMealy

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