OpenASIP  2.0
ADFSerializer.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 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 ADFSerializer.hh
26  *
27  * Declaration of ADFSerializer class.
28  *
29  * @author Lasse Laasonen 2004 (lasse.laasonen-no.spam-tut.fi)
30  * @note reviewed 15 Jun 2004 by pj, vpj, ml, ll
31  * @note rating: red
32  */
33 
34 #ifndef TTA_MDF_SERIALIZER_HH
35 #define TTA_MDF_SERIALIZER_HH
36 
37 #include "XMLSerializer.hh"
38 
39 namespace TTAMachine {
40  class Machine;
41 }
42 
43 /**
44  * This class is used to generate a machine object model from MDF file and to
45  * generate MDF file from a machine object model.
46  *
47  * By default ADFSerializer validates the files it reads with ADF Schema.
48  */
49 class ADFSerializer : public XMLSerializer {
50 public:
51  ADFSerializer();
52  virtual ~ADFSerializer();
53 
54  void writeState(const ObjectState* machineState);
58 
59 protected:
60  /// Copying forbidden.
62  /// Assingment forbidden.
64 
65 private:
66  // machine format to MDF format conversion functions
67  static ObjectState* convertToMDFFormat(const ObjectState* machineState);
68  static ObjectState* busToMDF(const ObjectState* busState);
69  static ObjectState* socketToMDF(const ObjectState* socketState);
70  static ObjectState* bridgeToMDF(const ObjectState* bridgeState);
71  static ObjectState* functionUnitToMDF(const ObjectState* fuState);
72  static ObjectState* registerFileToMDF(const ObjectState* rfState);
74  const ObjectState* iuState,
75  const ObjectState* machineState);
76  static ObjectState* addressSpaceToMDF(const ObjectState* asState);
77  static ObjectState* controlUnitToMDF(const ObjectState* cuState);
78  static ObjectState* immediateSlotToMDF(const ObjectState* isState);
79 
80  // MDF format to machine format conversion functions
81  static ObjectState* convertToMachineFormat(const ObjectState* mdfState);
82  static ObjectState* busToMachine(const ObjectState* busState);
83  static ObjectState* socketToMachine(const ObjectState* socketState);
84  static ObjectState* bridgeToMachine(const ObjectState* bridgeState);
86  const ObjectState* fuState,
87  const int orderNumber);
88  static ObjectState* registerFileToMachine(const ObjectState* rfState);
89  static ObjectState* addressSpaceToMachine(const ObjectState* asState);
90  static ObjectState* controlUnitToMachine(const ObjectState* cuState);
92  const ObjectState* iuState, ObjectState* machineState);
93  static ObjectState* immediateSlotToMachine(const ObjectState* isState);
94 
95  // small helper functions
96  static ObjectState* machineSRPort(const ObjectState* mdfSRPortState);
97  static ObjectState* mdfSRPort(const ObjectState* machineSRPortState);
98  static void setIUExtensionMode(
99  const ObjectState* mdfIUState,
100  ObjectState* momIUState);
101  static ObjectState* machineRFPort(const ObjectState* mdfPortState);
102  static ObjectState* mdfPort(const ObjectState* machinePortState);
103  static ObjectState* machineFUPort(const ObjectState* mdfFUPortState);
104  static ObjectState* mdfFUPort(const ObjectState* machineFUPortState);
106  const ObjectState* mdfOperationState);
107  static ObjectState* mdfOperation(
108  const ObjectState* machineOperationState);
109  static ObjectState* machinePipeline(const ObjectState* mdfPipelineState);
110  static ObjectState* mdfPipeline(const ObjectState* machinePipelineState);
111  static void instructionTemplateToMDF(
112  const ObjectState* momITState,
113  ObjectState* mdfIUState);
114  static void instructionTemplateToMachine(
115  const ObjectState* mdfITState, ObjectState* momMachineState,
116  const std::string& iuName = std::string(""));
118  const ObjectState* momITState,
119  const std::string& busName);
120  static bool hasEmptyInstructionTemplate(
121  const ObjectState* momMachineState);
122 
123 };
124 
125 
126 #endif
ADFSerializer::mdfPipeline
static ObjectState * mdfPipeline(const ObjectState *machinePipelineState)
Definition: ADFSerializer.cc:2095
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
ADFSerializer::socketToMachine
static ObjectState * socketToMachine(const ObjectState *socketState)
Definition: ADFSerializer.cc:1176
ADFSerializer::machinePipeline
static ObjectState * machinePipeline(const ObjectState *mdfPipelineState)
Definition: ADFSerializer.cc:2035
ADFSerializer::functionUnitToMDF
static ObjectState * functionUnitToMDF(const ObjectState *fuState)
Definition: ADFSerializer.cc:629
ADFSerializer::mdfSRPort
static ObjectState * mdfSRPort(const ObjectState *machineSRPortState)
Definition: ADFSerializer.cc:1712
ADFSerializer::mdfPort
static ObjectState * mdfPort(const ObjectState *machinePortState)
Definition: ADFSerializer.cc:1826
ADFSerializer::operator=
ADFSerializer & operator=(const ADFSerializer &)
Assingment forbidden.
ObjectState
Definition: ObjectState.hh:59
ADFSerializer::machineRFPort
static ObjectState * machineRFPort(const ObjectState *mdfPortState)
Definition: ADFSerializer.cc:1792
ADFSerializer::busToMDF
static ObjectState * busToMDF(const ObjectState *busState)
Definition: ADFSerializer.cc:419
ADFSerializer::controlUnitToMachine
static ObjectState * controlUnitToMachine(const ObjectState *cuState)
Definition: ADFSerializer.cc:1446
ADFSerializer::controlUnitToMDF
static ObjectState * controlUnitToMDF(const ObjectState *cuState)
Definition: ADFSerializer.cc:905
ADFSerializer::bridgeToMachine
static ObjectState * bridgeToMachine(const ObjectState *bridgeState)
Definition: ADFSerializer.cc:1232
XMLSerializer.hh
ADFSerializer::convertToMDFFormat
static ObjectState * convertToMDFFormat(const ObjectState *machineState)
Definition: ADFSerializer.cc:292
ADFSerializer::hasEmptyInstructionTemplate
static bool hasEmptyInstructionTemplate(const ObjectState *momMachineState)
Definition: ADFSerializer.cc:2332
ADFSerializer::setIUExtensionMode
static void setIUExtensionMode(const ObjectState *mdfIUState, ObjectState *momIUState)
Definition: ADFSerializer.cc:1756
ADFSerializer::functionUnitToMachine
static ObjectState * functionUnitToMachine(const ObjectState *fuState, const int orderNumber)
Definition: ADFSerializer.cc:1260
ADFSerializer
Definition: ADFSerializer.hh:49
ADFSerializer::addressSpaceToMDF
static ObjectState * addressSpaceToMDF(const ObjectState *asState)
Definition: ADFSerializer.cc:852
ADFSerializer::addressSpaceToMachine
static ObjectState * addressSpaceToMachine(const ObjectState *asState)
Definition: ADFSerializer.cc:1391
ADFSerializer::mdfFUPort
static ObjectState * mdfFUPort(const ObjectState *machineFUPortState)
Definition: ADFSerializer.cc:1914
ADFSerializer::immediateSlotToMachine
static ObjectState * immediateSlotToMachine(const ObjectState *isState)
Definition: ADFSerializer.cc:1636
ADFSerializer::ADFSerializer
ADFSerializer()
Definition: ADFSerializer.cc:203
ADFSerializer::machineOperation
static ObjectState * machineOperation(const ObjectState *mdfOperationState)
Definition: ADFSerializer.cc:1949
ADFSerializer::machineFUPort
static ObjectState * machineFUPort(const ObjectState *mdfFUPortState)
Definition: ADFSerializer.cc:1863
ADFSerializer::~ADFSerializer
virtual ~ADFSerializer()
Definition: ADFSerializer.cc:212
ADFSerializer::instructionTemplateToMDF
static void instructionTemplateToMDF(const ObjectState *momITState, ObjectState *mdfIUState)
Definition: ADFSerializer.cc:2149
ADFSerializer::machineSRPort
static ObjectState * machineSRPort(const ObjectState *mdfSRPortState)
Definition: ADFSerializer.cc:1659
ADFSerializer::bridgeToMDF
static ObjectState * bridgeToMDF(const ObjectState *bridgeState)
Definition: ADFSerializer.cc:597
ADFSerializer::readState
ObjectState * readState()
Definition: ADFSerializer.cc:238
ADFSerializer::immediateSlotToMDF
static ObjectState * immediateSlotToMDF(const ObjectState *isState)
Definition: ADFSerializer.cc:976
ADFSerializer::writeState
void writeState(const ObjectState *machineState)
Definition: ADFSerializer.cc:224
ADFSerializer::convertToMachineFormat
static ObjectState * convertToMachineFormat(const ObjectState *mdfState)
Definition: ADFSerializer.cc:995
ADFSerializer::mdfOperation
static ObjectState * mdfOperation(const ObjectState *machineOperationState)
Definition: ADFSerializer.cc:1994
ADFSerializer::writeMachine
void writeMachine(const TTAMachine::Machine &machine)
Definition: ADFSerializer.cc:259
ADFSerializer::readMachine
TTAMachine::Machine * readMachine()
Definition: ADFSerializer.cc:275
ADFSerializer::busToMachine
static ObjectState * busToMachine(const ObjectState *busState)
Definition: ADFSerializer.cc:1064
TTAMachine
Definition: Assembler.hh:48
ADFSerializer::registerFileToMDF
static ObjectState * registerFileToMDF(const ObjectState *rfState)
Definition: ADFSerializer.cc:671
ADFSerializer::registerFileToMachine
static ObjectState * registerFileToMachine(const ObjectState *rfState)
Definition: ADFSerializer.cc:1304
XMLSerializer
Definition: XMLSerializer.hh:62
ADFSerializer::instructionTemplateToMachine
static void instructionTemplateToMachine(const ObjectState *mdfITState, ObjectState *momMachineState, const std::string &iuName=std::string(""))
Definition: ADFSerializer.cc:2215
ADFSerializer::momTemplateSlot
static ObjectState * momTemplateSlot(const ObjectState *momITState, const std::string &busName)
Definition: ADFSerializer.cc:2308
ADFSerializer::immediateUnitToMachine
static ObjectState * immediateUnitToMachine(const ObjectState *iuState, ObjectState *machineState)
Definition: ADFSerializer.cc:1517
ADFSerializer::immediateUnitToMDF
static ObjectState * immediateUnitToMDF(const ObjectState *iuState, const ObjectState *machineState)
Definition: ADFSerializer.cc:751
TTAMachine::Machine
Definition: Machine.hh:73
ADFSerializer::socketToMDF
static ObjectState * socketToMDF(const ObjectState *socketState)
Definition: ADFSerializer.cc:543