OpenASIP  2.0
KoskiIntegrator.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 KoskiIntegrator.cc
26  *
27  * Implementation of KoskiIntegrator class.
28  *
29  * @author Otto Esko 2010 (otto.esko-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #include "Exception.hh"
34 #include "KoskiIntegrator.hh"
35 #include "MemoryGenerator.hh"
37 #include "StringTools.hh"
38 #include "NetlistBlock.hh"
39 #include "IPXactFileGenerator.hh"
40 #include "FileSystem.hh"
41 using std::vector;
42 using std::endl;
43 
46 
48  AlteraIntegrator(), ipXactGen_(NULL),
49  deviceFamily_(DEFAULT_DEVICE_FAMILY_), dmemGen_(NULL) {
50 }
51 
52 
55  const IDF::MachineImplementation* idf,
56  ProGe::HDL hdl,
57  TCEString progeOutputDir,
58  TCEString coreEntityName,
59  TCEString outputDir,
60  TCEString programName,
61  int targetClockFreq,
62  std::ostream& warningStream,
63  std::ostream& errorStream,
64  const MemInfo& imem,
65  MemType dmemType):
66  AlteraIntegrator(machine, idf, hdl, progeOutputDir, coreEntityName,
67  outputDir, programName, targetClockFreq, warningStream,
68  errorStream, imem, dmemType),
69  ipXactGen_(new IPXactFileGenerator(coreEntityName, this)),
70  deviceFamily_(DEFAULT_DEVICE_FAMILY_), dmemGen_(NULL) {
71 }
72 
73 
75 
76  if (ipXactGen_ != NULL) {
77  delete ipXactGen_;
78  }
79  if (dmemGen_ != NULL) {
80  delete dmemGen_;
81  }
82 }
83 
86 
87  return PIN_TAG_;
88 }
89 
90 
91 bool
93 
94  return false;
95 }
96 
97 
100 
101  return ipXactGen_;
102 }
103 
106  MemInfo dmem, TTAMachine::FunctionUnit& lsuArch,
107  std::vector<std::string> lsuPorts) {
108  if (dmem.type == ONCHIP) {
109  if (dmemGen_ == NULL) {
110  TCEString initFile = programName() + "_" + dmem.asName + ".mif";
111  // onchip mem size is scalable, use value from adf's Address Space
112  int addrw = dmem.portAddrw;
113  dmemGen_ =
115  dmem.mauWidth, dmem.widthInMaus, addrw, initFile,
116  this, warningStream(), errorStream());
117  ipXactGen_->addMemInitFile(initFile);
118  dmemGen_->addLsu(lsuArch, lsuPorts);
119  }
120  } else {
121  TCEString msg = "Unsupported data memory type";
122  InvalidData exc(__FILE__, __LINE__, "KoskiIntegrator",
123  msg);
124  throw exc;
125  }
126 
127  return *dmemGen_;
128 }
129 
130 void
131 KoskiIntegrator::printInfo(std::ostream& stream) const {
132 
133  stream
134  << "Integrator name: KoskiIntegrator" << endl
135  << "---------------------------------" << endl
136  << "Integrates TTA core to Koski flow compatible IP-block. "
137  << "Processor must have a HIBIs-LSU. " << endl
138  << "Creates an IP-XACT description of the created IP." << endl
139  << "This integrator works with Altera tools and FPGAs." << endl
140  << "Supported instruction memory types are 'onchip' and 'vhdl_array."
141  << endl << "Supported data memory type is 'onchip'." << endl
142  << "FPGA device family can be changed. Default device family is "
143  << DEFAULT_DEVICE_FAMILY_ << endl << endl;
144 }
145 
146 TCEString
148 
149  return deviceFamily_;
150 }
151 
152 void
154 
155  deviceFamily_ = devFamily;
156 }
157 
158 TCEString
160  return "";
161 }
162 
163 TCEString
165  return "";
166 }
167 
168 int
170  return 1;
171 }
FileSystem.hh
KoskiIntegrator::projectFileGenerator
virtual ProjectFileGenerator * projectFileGenerator() const
Definition: KoskiIntegrator.cc:99
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
Exception.hh
MemInfo
Definition: MemoryGenerator.hh:67
KoskiIntegrator::deviceFamily_
TCEString deviceFamily_
Definition: KoskiIntegrator.hh:89
MemoryGenerator.hh
KoskiIntegrator::DEFAULT_DEVICE_FAMILY_
static const TCEString DEFAULT_DEVICE_FAMILY_
Definition: KoskiIntegrator.hh:94
StringTools.hh
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
KoskiIntegrator::dmemGen_
MemoryGenerator * dmemGen_
Definition: KoskiIntegrator.hh:91
MemInfo::type
MemType type
Definition: MemoryGenerator.hh:68
InvalidData
Definition: Exception.hh:149
KoskiIntegrator.hh
IPXactFileGenerator
Definition: IPXactFileGenerator.hh:43
ProjectFileGenerator
Definition: ProjectFileGenerator.hh:41
MemInfo::asName
TCEString asName
Definition: MemoryGenerator.hh:74
KoskiIntegrator::deviceFamily
virtual TCEString deviceFamily() const
Definition: KoskiIntegrator.cc:147
KoskiIntegrator::dmemInstance
virtual MemoryGenerator & dmemInstance(MemInfo dmem, TTAMachine::FunctionUnit &lsuArch, std::vector< std::string > lsuPorts)
Definition: KoskiIntegrator.cc:105
NetlistBlock.hh
AlteraHibiDpRamGenerator.hh
KoskiIntegrator::pinTag
virtual TCEString pinTag() const
Definition: KoskiIntegrator.cc:85
KoskiIntegrator::targetClockFrequency
virtual int targetClockFrequency() const
Definition: KoskiIntegrator.cc:169
MemoryGenerator::addLsu
void addLsu(TTAMachine::FunctionUnit &lsuArch, std::vector< std::string > lsuPorts)
Definition: MemoryGenerator.cc:376
MemInfo::widthInMaus
int widthInMaus
Definition: MemoryGenerator.hh:70
MemInfo::mauWidth
int mauWidth
Definition: MemoryGenerator.hh:69
KoskiIntegrator::deviceSpeedClass
virtual TCEString deviceSpeedClass() const
Definition: KoskiIntegrator.cc:164
KoskiIntegrator::setDeviceFamily
virtual void setDeviceFamily(TCEString devFamily)
Definition: KoskiIntegrator.cc:153
PlatformIntegrator::programName
TCEString programName() const
Definition: PlatformIntegrator.cc:133
MemType
MemType
Definition: MemoryGenerator.hh:57
ONCHIP
@ ONCHIP
Definition: MemoryGenerator.hh:61
KoskiIntegrator::printInfo
virtual void printInfo(std::ostream &stream) const
Definition: KoskiIntegrator.cc:131
KoskiIntegrator::devicePackage
virtual TCEString devicePackage() const
Definition: KoskiIntegrator.cc:159
TCEString
Definition: TCEString.hh:53
PlatformIntegrator::warningStream
std::ostream & warningStream() const
Definition: PlatformIntegrator.cc:271
AlteraIntegrator
Definition: AlteraIntegrator.hh:39
KoskiIntegrator::KoskiIntegrator
KoskiIntegrator()
Definition: KoskiIntegrator.cc:47
ProGe::HDL
HDL
HDLs supported by ProGe.
Definition: ProGeTypes.hh:40
ProjectFileGenerator::addMemInitFile
void addMemInitFile(const TCEString &memInit)
Definition: ProjectFileGenerator.cc:72
KoskiIntegrator::PIN_TAG_
static const TCEString PIN_TAG_
Definition: KoskiIntegrator.hh:93
MemInfo::portAddrw
int portAddrw
Definition: MemoryGenerator.hh:71
PlatformIntegrator::errorStream
std::ostream & errorStream() const
Definition: PlatformIntegrator.cc:278
IPXactFileGenerator.hh
KoskiIntegrator::ipXactGen_
ProjectFileGenerator * ipXactGen_
Definition: KoskiIntegrator.hh:87
IDF::MachineImplementation
Definition: MachineImplementation.hh:54
AlteraHibiDpRamGenerator
Definition: AlteraHibiDpRamGenerator.hh:43
KoskiIntegrator::~KoskiIntegrator
virtual ~KoskiIntegrator()
Definition: KoskiIntegrator.cc:74
TTAMachine::Machine
Definition: Machine.hh:73
MemoryGenerator
Definition: MemoryGenerator.hh:85
KoskiIntegrator::chopTaggedSignals
virtual bool chopTaggedSignals() const
Definition: KoskiIntegrator.cc:92