OpenASIP  2.0
BlocksModel.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2021 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 BlocksModel.hh
26  *
27  * Declaration of the BlocksModel class which contains a Blocks model.
28  *
29  * @author Maarten Molendijk 2020 (m.j.molendijk@tue.nl)
30  * @author Kanishkan Vadivel 2021 (k.vadivel@tue.nl)
31  */
32 
33 #ifndef BLOCKS_MODEL_HH
34 #define BLOCKS_MODEL_HH
35 
36 #include <list>
37 #include <map>
38 #include <string>
39 
40 #include "ObjectState.hh"
41 #include "XMLSerializer.hh"
42 
43 namespace BlocksTranslator {
44 enum class FU_TYPE {
45  ID,
46  IU, // Immediate unit
47  ALU,
48  RF,
49  MUL,
50  LSU, // Load store unit
51  ABU
52 };
53 }
54 
55 class BlocksModel {
56 private:
57  void LoadModelFromXml();
58  bool VerifyXmlStructure();
59 
60  const std::map<std::string, BlocksTranslator::FU_TYPE> stringToEnum{
68 
69  struct FunctionalUnit {
71  std::string name;
72  std::list<std::string> src;
73  bool usesOut0;
74  bool usesOut1;
75  // TODO(mm): add config bit
76  };
77 
79 
80 public:
81  // Parse Blocks architecture into program memory
82  BlocksModel(std::string filename) {
83  XMLSerializer* serializer = new XMLSerializer();
84  serializer->setSourceFile(filename);
85  mdfState_ = serializer->readState();
87  };
88  std::list<FunctionalUnit> mFunctionalUnitList;
89 };
90 #endif
BlocksTranslator::FU_TYPE::ABU
@ ABU
BlocksTranslator
Definition: BlocksModel.hh:43
BlocksTranslator::FU_TYPE
FU_TYPE
Definition: BlocksModel.hh:44
XMLSerializer::setSourceFile
void setSourceFile(const std::string &fileName)
Definition: XMLSerializer.cc:115
BlocksModel::VerifyXmlStructure
bool VerifyXmlStructure()
Definition: BlocksModel.cc:74
BlocksTranslator::FU_TYPE::RF
@ RF
BlocksTranslator::FU_TYPE::ID
@ ID
ObjectState
Definition: ObjectState.hh:59
BlocksModel::stringToEnum
const std::map< std::string, BlocksTranslator::FU_TYPE > stringToEnum
Definition: BlocksModel.hh:60
BlocksModel::FunctionalUnit::name
std::string name
Definition: BlocksModel.hh:71
BlocksTranslator::FU_TYPE::LSU
@ LSU
XMLSerializer.hh
BlocksModel::FunctionalUnit::type
BlocksTranslator::FU_TYPE type
Definition: BlocksModel.hh:70
BlocksTranslator::FU_TYPE::IU
@ IU
BlocksModel::mdfState_
ObjectState * mdfState_
Definition: BlocksModel.hh:78
XMLSerializer::readState
virtual ObjectState * readState()
Definition: XMLSerializer.cc:200
ObjectState.hh
BlocksModel::FunctionalUnit::usesOut1
bool usesOut1
Definition: BlocksModel.hh:74
BlocksModel::FunctionalUnit
Definition: BlocksModel.hh:69
BlocksTranslator::FU_TYPE::MUL
@ MUL
BlocksModel::FunctionalUnit::src
std::list< std::string > src
Definition: BlocksModel.hh:72
BlocksTranslator::FU_TYPE::ALU
@ ALU
BlocksModel
Definition: BlocksModel.hh:55
BlocksModel::mFunctionalUnitList
std::list< FunctionalUnit > mFunctionalUnitList
Definition: BlocksModel.hh:87
BlocksModel::BlocksModel
BlocksModel(std::string filename)
Definition: BlocksModel.hh:82
BlocksModel::FunctionalUnit::usesOut0
bool usesOut0
Definition: BlocksModel.hh:73
BlocksModel::LoadModelFromXml
void LoadModelFromXml()
Definition: BlocksModel.cc:44
XMLSerializer
Definition: XMLSerializer.hh:62