OpenASIP  2.0
AssignmentQueue.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 AssignmentQueue.hh
26  *
27  * Declaration of AssignmentQueue class.
28  *
29  * @author Viljami Korhonen 2007 (viljami.korhonen-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef ASSIGNMENT_QUEUE_HH
34 #define ASSIGNMENT_QUEUE_HH
35 
36 #include <string>
37 #include <deque>
38 #include <boost/shared_ptr.hpp>
39 #include "SimValue.hh"
40 
41 /**
42  * This class is used for delayed assignments of SimValues to given targets.
43  *
44  * The implementation uses std::vector for a simple ring buffer
45  * Buffer size is directly the maximum possible latency
46  *
47  */
49 public:
50  AssignmentQueue(int maxLatency);
52 
53  void inline addAssignment(const SimValue& assignValue,
54  SimValue* assignTarget,
55  int latency);
56 
57  void inline advanceClock();
58 
59 private:
60  /// Copying not allowed.
62  /// Assignment not allowed.
64 
65  /// Type for the assignment: source value -> destination pointer
66  typedef std::pair< SimValue, SimValue*> Assignment;
67 
68  /// Type for the stored assignments
69  typedef std::deque< std::deque< Assignment > > Assignments;
70 
71  /// Our assignment queue
73 
74  /// Position in the ring buffer
75  int position_;
76 
77  /// Maximum possible latency
79 };
80 
81 #include "AssignmentQueue.icc"
82 
83 #endif
AssignmentQueue::AssignmentQueue
AssignmentQueue(int maxLatency)
Definition: AssignmentQueue.cc:40
AssignmentQueue::~AssignmentQueue
~AssignmentQueue()
Definition: AssignmentQueue.cc:48
AssignmentQueue
Definition: AssignmentQueue.hh:48
SimValue
Definition: SimValue.hh:96
AssignmentQueue::position_
int position_
Position in the ring buffer.
Definition: AssignmentQueue.hh:75
AssignmentQueue::Assignments
std::deque< std::deque< Assignment > > Assignments
Type for the stored assignments.
Definition: AssignmentQueue.hh:69
AssignmentQueue::Assignment
std::pair< SimValue, SimValue * > Assignment
Type for the assignment: source value -> destination pointer.
Definition: AssignmentQueue.hh:66
AssignmentQueue::addAssignment
void addAssignment(const SimValue &assignValue, SimValue *assignTarget, int latency)
SimValue.hh
AssignmentQueue::maxLatency_
int maxLatency_
Maximum possible latency.
Definition: AssignmentQueue.hh:78
AssignmentQueue.icc
AssignmentQueue::assignmentQueue_
Assignments assignmentQueue_
Our assignment queue.
Definition: AssignmentQueue.hh:72
AssignmentQueue::operator=
AssignmentQueue & operator=(const AssignmentQueue &)
Assignment not allowed.
AssignmentQueue::advanceClock
void advanceClock()