OpenASIP 2.2
Loading...
Searching...
No Matches
IUResource.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 IUResource.hh
26 *
27 * Declaration of prototype of Resource Model:
28 * declaration of the IUResource class.
29 *
30 * @author Vladimir Guzma 2006 (vladimir.guzma-no.spam-tut.fi)
31 * @note rating: red
32 */
33
34#ifndef TTA_IURESOURCE_HH
35#define TTA_IURESOURCE_HH
36
37#include <string>
38#include <vector>
39#include <memory>
40
41#include "SchedulingResource.hh"
42
43namespace TTAProgram {
44 class TerminalImmediate;
45}
46
47namespace TTAMachine {
48 class Machine;
49}
50
51/**
52 * An interface for scheduling resources of Resource Model
53 * The derived class IUResource
54 */
55
57public:
58 virtual ~IUResource();
60 const TTAMachine::Machine& mach,
61 const std::string& name,
62 const int registers,
63 const int width,
64 const int latency,
65 const bool signExtension,
66 unsigned int initiationInterval = 0);
67
68 virtual bool isInUse(const int cycle) const override;
69 virtual bool isAvailable(const int cycle, int immRegIndex) const;
70 virtual bool isAvailable(const int cycle) const override;
71 virtual bool canAssign(const int, const MoveNode&)const override;
72 virtual bool canAssign(
73 const int defCycle,
74 const int useCycle,
75 const MoveNode& node,
76 int immRegIndex) const;
77 virtual void assign(const int cycle, MoveNode& node) override;
78 virtual void assign(
79 const int defCycle,
80 const int useCycle,
81 MoveNode& node,
82 int& index);
83
84 virtual void unassign(const int cycle, MoveNode& node) override;
85
86 virtual bool isIUResource() const override;
87
88 int registerCount() const;
89 std::shared_ptr<TTAProgram::TerminalImmediate>
90 immediateValue(const MoveNode& node) const;
91 int immediateWriteCycle(const MoveNode& node) const;
92 int width() const;
93
94 void clearOldResources();
95 void clear() override;
96
97protected:
98 virtual bool validateDependentGroups() override;
99 virtual bool validateRelatedGroups() override;
100 void setRegisterCount(const int registers);
101
102private:
103 bool canAssignUse(int useCycle) const;
104
105 // Stores first and last cycle register is marked for use
106 // also the actual value of constant to be stored in register
108 ResourceRecordType(int definition, int use, TTAProgram::TerminalImmediate* val);
110 int use_;
111 std::shared_ptr<TTAProgram::TerminalImmediate> immediateValue_;
112 };
113 // For each register, there are several def-use combinations
114 // non overlapping
115 typedef std::vector<ResourceRecordType*> ResourceRecordVectorType;
116 // Copying forbidden
118 // Assignment forbidden
120 int findAvailable(
121 const int defCycle, const int useCycle, int immRegIndex) const;
122
123 std::vector<ResourceRecordVectorType> resourceRecord_;
124 // Number of registers in given IU
126 // The bit width of registers in IU
128 // The latency of IU
130 //Extention of IU, true == sign extends, false == zero extends
132
134};
135#endif
virtual bool canAssign(const int, const MoveNode &) const override
virtual void unassign(const int cycle, MoveNode &node) override
virtual bool validateDependentGroups() override
IUResource & operator=(const IUResource &)
virtual void assign(const int cycle, MoveNode &node) override
void setRegisterCount(const int registers)
virtual bool validateRelatedGroups() override
std::vector< ResourceRecordType * > ResourceRecordVectorType
virtual bool isIUResource() const override
std::shared_ptr< TTAProgram::TerminalImmediate > immediateValue(const MoveNode &node) const
int registerCount_
const TTAMachine::Machine & machine_
virtual bool isAvailable(const int cycle, int immRegIndex) const
void clearOldResources()
virtual bool isInUse(const int cycle) const override
Definition IUResource.cc:86
bool signExtension_
void clear() override
virtual ~IUResource()
Definition IUResource.cc:74
int findAvailable(const int defCycle, const int useCycle, int immRegIndex) const
int width() const
int immediateWriteCycle(const MoveNode &node) const
bool canAssignUse(int useCycle) const
IUResource(const IUResource &)
std::vector< ResourceRecordVectorType > resourceRecord_
int registerCount() const
virtual const std::string & name() const
std::shared_ptr< TTAProgram::TerminalImmediate > immediateValue_