OpenASIP  2.0
ProjectFileGenerator.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2010 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file ProjectFileGenerator.cc
26  *
27  * Implementation of ProjectFileGenerator class.
28  *
29  * @author Otto Esko 2010 (otto.esko-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #include <vector>
34 #include <iostream>
35 #include "ProjectFileGenerator.hh"
36 #include "PlatformIntegrator.hh"
37 #include "StringTools.hh"
39 
41  TCEString coreEntity,
42  const PlatformIntegrator* integrator):
43  coreEntity_(coreEntity), integrator_(integrator) {
44 }
45 
46 
48 
49  for (unsigned int i = 0; i < signalMap_.size(); i++) {
50  delete signalMap_.at(i);
51  }
52 }
53 
54 
55 void
57 
58  hdlFiles_.push_back(file);
59 }
60 
61 
62 void
63 ProjectFileGenerator::addHdlFiles(const std::vector<TCEString>& files) {
64 
65  for (unsigned int i = 0; i < files.size(); i++) {
66  hdlFiles_.push_back(files.at(i));
67  }
68 }
69 
70 
71 void
73 
74  memInitFiles_.push_back(memInit);
75 }
76 
77 
78 void
80 
81  SignalMapping* signalMap = new SignalMapping(mapping);
82  signalMap_.push_back(signalMap);
83 }
84 
85 
86 const std::vector<TCEString>&
88 
89  return hdlFiles_;
90 }
91 
92 
93 const std::vector<TCEString>&
95 
96  return memInitFiles_;
97 }
98 
99 
100 const PlatformIntegrator*
102  return integrator_;
103 }
104 
105 int
107 
108  return signalMap_.size();
109 }
110 
111 
112 const SignalMapping*
114 
115  return signalMap_.at(index);
116 }
117 
118 
119 TCEString
121  const TCEString& port,
122  const TCEString& delimiter) const {
123 
124  TCEString::size_type pos = port.find(delimiter);
125  if (pos == TCEString::npos || pos == 0) {
126  return port;
127  }
128 
129  TCEString fuName = port.substr(0, pos);
130  return StringTools::trim(fuName);
131 }
ProjectFileGenerator::integrator
const PlatformIntegrator * integrator() const
Definition: ProjectFileGenerator.cc:101
ProjectFileGenerator::signalMapping
const PlatInt::SignalMapping * signalMapping(int index) const
Definition: ProjectFileGenerator.cc:113
ProjectFileGenerator::memInitFiles_
std::vector< TCEString > memInitFiles_
Definition: ProjectFileGenerator.hh:84
ProjectFileGenerator::extractFUName
TCEString extractFUName(const TCEString &port, const TCEString &delimiter) const
Definition: ProjectFileGenerator.cc:120
ProjectFileGenerator::signalMappingCount
int signalMappingCount() const
Definition: ProjectFileGenerator.cc:106
PlatInt::SignalMapping
std::pair< TCEString, TCEString > SignalMapping
Definition: PlatformIntegratorTypes.hh:42
ProjectFileGenerator::addHdlFiles
void addHdlFiles(const std::vector< TCEString > &files)
Definition: ProjectFileGenerator.cc:63
ProjectFileGenerator::signalMap_
PlatInt::SignalMappingList signalMap_
Definition: ProjectFileGenerator.hh:85
StringTools.hh
ProjectFileGenerator::ProjectFileGenerator
ProjectFileGenerator(TCEString coreEntity, const PlatformIntegrator *integrator)
Definition: ProjectFileGenerator.cc:40
ProjectFileGenerator::memInitFileList
const std::vector< TCEString > & memInitFileList() const
Definition: ProjectFileGenerator.cc:94
ProjectFileGenerator::integrator_
const PlatformIntegrator * integrator_
Definition: ProjectFileGenerator.hh:81
ProjectFileGenerator::~ProjectFileGenerator
virtual ~ProjectFileGenerator()
Definition: ProjectFileGenerator.cc:47
ProjectFileGenerator::addHdlFile
void addHdlFile(const TCEString &file)
Definition: ProjectFileGenerator.cc:56
ProjectFileGenerator.hh
StringTools::trim
static std::string trim(const std::string &source)
Definition: StringTools.cc:55
TCEString
Definition: TCEString.hh:53
PlatformIntegrator.hh
ProjectFileGenerator::addMemInitFile
void addMemInitFile(const TCEString &memInit)
Definition: ProjectFileGenerator.cc:72
ProjectFileGenerator::hdlFileList
const std::vector< TCEString > & hdlFileList() const
Definition: ProjectFileGenerator.cc:87
PlatformIntegrator
Definition: PlatformIntegrator.hh:65
ProjectFileGenerator::addSignalMapping
void addSignalMapping(const PlatInt::SignalMapping &mapping)
Definition: ProjectFileGenerator.cc:79
ProjectFileGenerator::hdlFiles_
std::vector< TCEString > hdlFiles_
Definition: ProjectFileGenerator.hh:83