OpenASIP  2.0
CUOpcodeGenerator.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2014 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 CUOpcodeGenerator.hh
26  *
27  * Declaration of ProcessorGenerator class.
28  *
29  * @author Henry Linjamäki 2014 (henry.linjamaki-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef GCUOPCODEGENERATOR_HH
34 #define GCUOPCODEGENERATOR_HH
35 
36 #include <fstream>
37 #include <string>
38 #include <map>
39 
40 #include "TCEString.hh"
41 #include "MachineInfo.hh"
42 #include "ProGeTypes.hh"
43 
44 #include "Exception.hh"
45 
46 namespace TTAMachine {
47  class Machine;
48 }
49 
50 namespace ProGe {
51 
52 /**
53  * Class that for given ADF generates encodings for Global Control Unit and
54  * RTL package that holds encoding information for CU RTL source codes.
55  *
56  */
58 public:
59 
60  typedef std::string OperationType;
61  typedef size_t EncodingType;
62  typedef std::map<OperationType, EncodingType, TCEString::ICLess>
64 
66  const TTAMachine::Machine& mach,
67  const std::string& entityName = "tta0");
68  virtual ~CUOpcodeGenerator();
69 
71  size_t encoding(const std::string& operName) const;
72  size_t opcodeWidth() const;
73  void generateOpcodePackage(HDL language, std::ofstream& stream) const;
74  static size_t gcuOpcodeWidth(const TTAMachine::Machine& mach);
75 
76 private:
80  std::ofstream& stream) const;
83  std::ofstream& stream) const;
84 
86  const std::string entityStr_;
87 };
88 
89 } /* namespace ProGe */
90 
91 #endif /* GCUOPCODEGENERATOR_HH */
ProGe::CUOpcodeGenerator::OperationType
std::string OperationType
Definition: CUOpcodeGenerator.hh:60
Exception.hh
MachineInfo.hh
ProGe::CUOpcodeGenerator
Definition: CUOpcodeGenerator.hh:57
ProGe::CUOpcodeGenerator::WriteVerilogOpcodePackage
void WriteVerilogOpcodePackage(const OperationEncodingMapType &encodings, std::ofstream &stream) const
Definition: CUOpcodeGenerator.cc:173
TCEString.hh
ProGe::CUOpcodeGenerator::gcuOpcodeWidth
static size_t gcuOpcodeWidth(const TTAMachine::Machine &mach)
Definition: CUOpcodeGenerator.cc:140
ProGe::CUOpcodeGenerator::generateOpcodePackage
void generateOpcodePackage(HDL language, std::ofstream &stream) const
Definition: CUOpcodeGenerator.cc:114
ProGe::CUOpcodeGenerator::EncodingType
size_t EncodingType
Definition: CUOpcodeGenerator.hh:61
ProGe::CUOpcodeGenerator::mach_
const TTAMachine::Machine * mach_
Definition: CUOpcodeGenerator.hh:85
ProGe::CUOpcodeGenerator::entityStr_
const std::string entityStr_
Definition: CUOpcodeGenerator.hh:86
ProGeTypes.hh
ProGe::CUOpcodeGenerator::encoding
size_t encoding(const std::string &operName) const
Definition: CUOpcodeGenerator.cc:84
ProGe
Definition: FUGen.hh:54
ProGe::CUOpcodeGenerator::~CUOpcodeGenerator
virtual ~CUOpcodeGenerator()
Definition: CUOpcodeGenerator.cc:61
ProGe::CUOpcodeGenerator::WriteVhdlOpcodePackage
void WriteVhdlOpcodePackage(const OperationEncodingMapType &encodings, std::ofstream &stream) const
Definition: CUOpcodeGenerator.cc:154
ProGe::HDL
HDL
HDLs supported by ProGe.
Definition: ProGeTypes.hh:40
ProGe::CUOpcodeGenerator::encodings
OperationEncodingMapType encodings() const
Definition: CUOpcodeGenerator.cc:67
ProGe::CUOpcodeGenerator::opcodeWidth
size_t opcodeWidth() const
Definition: CUOpcodeGenerator.cc:98
TTAMachine
Definition: Assembler.hh:48
ProGe::CUOpcodeGenerator::OperationEncodingMapType
std::map< OperationType, EncodingType, TCEString::ICLess > OperationEncodingMapType
Definition: CUOpcodeGenerator.hh:63
ProGe::CUOpcodeGenerator::CUOpcodeGenerator
CUOpcodeGenerator()
Definition: CUOpcodeGenerator.cc:59
TTAMachine::Machine
Definition: Machine.hh:73