OpenASIP 2.2
Loading...
Searching...
No Matches
IPXactFileGenerator.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 IPXactFileGenerator.hh
26 *
27 * Implementation of IPXactFileGenerator class.
28 *
29 * @author Otto Esko 2010 (otto.esko-no.spam-tut.fi)
30 * @note rating: red
31 */
32#include <string>
33#include <vector>
34#include "PlatformIntegrator.hh"
35#include "NetlistBlock.hh"
36#include "NetlistPort.hh"
38#include "IPXactSerializer.hh"
39#include "IPXactModel.hh"
40#include "HDLPort.hh"
41#include "IPXactInterface.hh"
43#include "IPXactClkInterface.hh"
45#include "IPXactAddressSpace.hh"
46#include "AddressSpace.hh"
47#include "Machine.hh"
50using std::pair;
51
52const TCEString DEF_VENDOR = "TCE";
53const TCEString DEF_LIBRARY = "ip.hwp.tta";
54const TCEString DEF_VERSION = "1.0";
55
56
58 TCEString toplevelEntity,
59 const PlatformIntegrator* integrator):
60 ProjectFileGenerator(toplevelEntity, integrator),
61 ipXactWriter_(new IPXactSerializer()) {
62
63}
64
69
70
71void
73
74 IPXactModel* ip = new IPXactModel();
76
77 const ProGe::NetlistBlock& toplevel = integrator()->toplevelBlock();
78 for (size_t i = 0; i < toplevel.portCount(); i++) {
79 HDLPort port(toplevel.port(i));
80 ip->addSignal(port);
81 }
82
83 for (size_t i = 0; i < toplevel.parameterCount(); i++) {
84 ip->addParameter(toplevel.parameter(i));
85 }
86
88
90
92 for (unsigned int i = 0; i < memInitFileList().size(); i++) {
93 ip->setFile(memInitFileList().at(i));
94 }
95
98 delete ip;
99}
100
101void
103
104 std::vector<IPXactInterface*> interfaces;
105 interfaces.push_back(new IPXactClkInterface());
106 interfaces.push_back(new IPXactResetInterface());
107 interfaces.push_back(new IPXactHibiInterface());
108
109
110 const NetlistBlock& toplevel = integrator()->toplevelBlock();
111 for (unsigned int i = 0; i < interfaces.size(); i++) {
112 if (interfaces.at(i)->mapPortsToInterface(toplevel)) {
113 // mapping was successful, add interface
114 model->addBusInterface(interfaces.at(i));
115 } else {
116 delete interfaces.at(i);
117 interfaces.at(i) = NULL;
118 }
119 }
120}
121
122
123void
125
126 IPXactAddressSpace* imemAs =
127 new IPXactAddressSpace(integrator()->imemInfo());
128 model->addAddressSpace(imemAs);
129
130 for (int i = 0; i < integrator()->dmemCount(); i++) {
131 IPXactAddressSpace* dmemAs =
132 new IPXactAddressSpace(integrator()->dmemInfo(i));
133 model->addAddressSpace(dmemAs);
134 }
135}
136
137
140
141 return "spirit_comp_def_" + toplevelEntity() + ".xml";
142}
const TCEString DEF_LIBRARY
const TCEString DEF_VERSION
const TCEString DEF_VENDOR
virtual void writeProjectFiles()
IPXactSerializer * ipXactWriter_
IPXactFileGenerator(TCEString toplevelEntity, const PlatformIntegrator *integrator)
void addBusInterfaces(IPXactModel *model)
TCEString outputFileName() const
void addAddressSpaces(IPXactModel *model)
void setVLNV(TCEString vendor, TCEString library, TCEString name, TCEString version)
void addAddressSpace(IPXactAddressSpace *addrSpace)
void addParameter(const ProGe::Parameter &parameter)
void setHdlFiles(const std::vector< TCEString > &files)
void setFile(const TCEString &file)
void addSignal(const HDLPort &signal)
void addBusInterface(IPXactInterface *interface)
void writeIPXactModel(const IPXactModel &model)
const ProGe::NetlistBlock & toplevelBlock() const
virtual size_t parameterCount() const
virtual const Parameter & parameter(const std::string &name) const
virtual NetlistPort * port(const std::string &portName, bool partialMatch=true)
virtual size_t portCount() const
const PlatformIntegrator * integrator() const
const std::vector< TCEString > & hdlFileList() const
const std::vector< TCEString > & memInitFileList() const
TCEString toplevelEntity() const
void setDestinationFile(const std::string &fileName)