OpenASIP  2.0
SOPCInterface.hh
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 SOPCInterface.hh
26  *
27  * Declaration of SOPCInterface class.
28  *
29  * @author Otto Esko 2010 (otto.esko-no.spam-tut.fi)
30  * @note rating: red
31  */
32 #ifndef TTA_SOPC_INTERFACE_HH
33 #define TTA_SOPC_INTERFACE_HH
34 
35 #include <iostream>
36 #include <map>
37 #include <vector>
38 #include "ProGeTypes.hh"
39 #include "TCEString.hh"
40 
42 public:
43 
44  SOPCInterface(TCEString name, TCEString declaration);
45 
46  virtual ~SOPCInterface();
47 
48  void setProperty(
49  const TCEString& propertyName,
50  const TCEString& propertyValue);
51  void setProperty(
52  const TCEString& propertyName,
53  int propertyValue);
54 
55  void setPort(
56  const TCEString& hdlName,
57  const TCEString& interfaceName,
58  ProGe::Direction direction,
59  int width);
60 
61  TCEString name() const;
62 
63  bool hasPorts() const;
64 
65  virtual void writeInterface(std::ostream& stream) const;
66 
71 
74 
77 
81 
84 
85  static const TCEString SOPC_INPUT;
86  static const TCEString SOPC_OUTPUT;
87  static const TCEString SOPC_BIDIR;
88 
89 protected:
90 
91  struct SOPCPort {
95  int width;
96  };
97 
98  typedef std::map<TCEString, TCEString> PropertyMap;
99  typedef std::vector<SOPCPort> PortList;
100 
101  const PropertyMap* properties() const;
102 
103  const PortList* ports() const;
104 
105  void writeProperties(std::ostream& stream) const;
106  void writePorts(std::ostream& stream) const;
107 
108 private:
109 
110  SOPCInterface();
111  SOPCInterface(const SOPCInterface& old);
113 
118 };
119 
120 #endif
SOPCInterface::properties
const PropertyMap * properties() const
Definition: SOPCInterface.cc:121
SOPCInterface::~SOPCInterface
virtual ~SOPCInterface()
Definition: SOPCInterface.cc:70
SOPCInterface::hasPorts
bool hasPorts() const
Definition: SOPCInterface.cc:104
SOPCInterface::setProperty
void setProperty(const TCEString &propertyName, const TCEString &propertyValue)
Definition: SOPCInterface.cc:73
SOPCInterface::SOPCPort
Definition: SOPCInterface.hh:91
SOPCInterface::SOPC_ADD_INT_PORT
static const TCEString SOPC_ADD_INT_PORT
Definition: SOPCInterface.hh:69
SOPCInterface::SOPC_ASSOCIATED_CLOCK
static const TCEString SOPC_ASSOCIATED_CLOCK
Definition: SOPCInterface.hh:70
SOPCInterface::PortList
std::vector< SOPCPort > PortList
Definition: SOPCInterface.hh:99
SOPCInterface
Definition: SOPCInterface.hh:41
SOPCInterface::SOPC_CLOCK_INT_DECLR
static const TCEString SOPC_CLOCK_INT_DECLR
Definition: SOPCInterface.hh:76
SOPCInterface::SOPC_IRQ_RECV_INT_NAME
static const TCEString SOPC_IRQ_RECV_INT_NAME
Definition: SOPCInterface.hh:82
SOPCInterface::declaration_
TCEString declaration_
Definition: SOPCInterface.hh:115
SOPCInterface::writeInterface
virtual void writeInterface(std::ostream &stream) const
Definition: SOPCInterface.cc:110
SOPCInterface::SOPCPort::width
int width
Definition: SOPCInterface.hh:95
TCEString.hh
SOPCInterface::SOPC_ADD_INTERFACE
static const TCEString SOPC_ADD_INTERFACE
Definition: SOPCInterface.hh:67
SOPCInterface::SOPC_EXPORT_NAME
static const TCEString SOPC_EXPORT_NAME
Definition: SOPCInterface.hh:80
SOPCInterface::writePorts
void writePorts(std::ostream &stream) const
Definition: SOPCInterface.cc:147
SOPCInterface::setPort
void setPort(const TCEString &hdlName, const TCEString &interfaceName, ProGe::Direction direction, int width)
Definition: SOPCInterface.cc:90
SOPCInterface::SOPC_MASTER_INT_DECLR
static const TCEString SOPC_MASTER_INT_DECLR
Definition: SOPCInterface.hh:73
SOPCInterface::name
TCEString name() const
Definition: SOPCInterface.cc:98
SOPCInterface::ports
const PortList * ports() const
Definition: SOPCInterface.cc:127
SOPCInterface::SOPC_IRQ_RECV_INT_DECLR
static const TCEString SOPC_IRQ_RECV_INT_DECLR
Definition: SOPCInterface.hh:83
SOPCInterface::SOPC_BIDIR
static const TCEString SOPC_BIDIR
Definition: SOPCInterface.hh:87
ProGeTypes.hh
SOPCInterface::SOPC_EXPORT_INT_NAME
static const TCEString SOPC_EXPORT_INT_NAME
Definition: SOPCInterface.hh:78
SOPCInterface::SOPC_SET_INT_PROPERTY
static const TCEString SOPC_SET_INT_PROPERTY
Definition: SOPCInterface.hh:68
SOPCInterface::SOPC_MASTER_INT_NAME
static const TCEString SOPC_MASTER_INT_NAME
Definition: SOPCInterface.hh:72
SOPCInterface::SOPCInterface
SOPCInterface()
SOPCInterface::SOPC_OUTPUT
static const TCEString SOPC_OUTPUT
Definition: SOPCInterface.hh:86
SOPCInterface::ports_
PortList ports_
Definition: SOPCInterface.hh:117
SOPCInterface::SOPC_CLOCK_INT_NAME
static const TCEString SOPC_CLOCK_INT_NAME
Definition: SOPCInterface.hh:75
SOPCInterface::SOPC_EXPORT_INT_DECLR
static const TCEString SOPC_EXPORT_INT_DECLR
Definition: SOPCInterface.hh:79
SOPCInterface::SOPCPort::interfaceName
TCEString interfaceName
Definition: SOPCInterface.hh:93
TCEString
Definition: TCEString.hh:53
SOPCInterface::SOPCPort::direction
ProGe::Direction direction
Definition: SOPCInterface.hh:94
SOPCInterface::operator=
SOPCInterface & operator=(SOPCInterface old)
SOPCInterface::SOPC_INPUT
static const TCEString SOPC_INPUT
Definition: SOPCInterface.hh:85
SOPCInterface::PropertyMap
std::map< TCEString, TCEString > PropertyMap
Definition: SOPCInterface.hh:98
SOPCInterface::properties_
PropertyMap properties_
Definition: SOPCInterface.hh:116
SOPCInterface::name_
TCEString name_
Definition: SOPCInterface.hh:114
SOPCInterface::writeProperties
void writeProperties(std::ostream &stream) const
Definition: SOPCInterface.cc:134
ProGe::Direction
Direction
Direction of the port.
Definition: ProGeTypes.hh:52
SOPCInterface::SOPCPort::hdlName
TCEString hdlName
Definition: SOPCInterface.hh:92