OpenASIP  2.0
SimControlLanguageCommand.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 SimControlLanguageCommand.hh
26  *
27  * Declaration of SimControlLanguageCommand class.
28  *
29  * @author Pekka J��skel�inen 2005 (pjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_SIMCONLANG_COMMAND
34 #define TTA_SIMCONLANG_COMMAND
35 
36 #include <string>
37 #include <vector>
38 #include <iostream>
39 
40 #include "DataObject.hh"
41 #include "CustomCommand.hh"
42 #include "Exception.hh"
43 #include "SimulatorConstants.hh"
44 #include "Address.hh"
45 #include "MemorySystem.hh"
46 
47 class SimulatorFrontend;
48 class Breakpoint;
49 class TclConditionScript;
50 class ExpressionScript;
51 class TCEString;
52 
53 ///////////////////////////////////////////////////////////////////////////////
54 // SimControlLanguageCommand
55 ///////////////////////////////////////////////////////////////////////////////
56 
57 /**
58  * This is a base class for Simulator Control Language commands.
59  *
60  * Provides services command and useful for all Simulator Control Language
61  * commands.
62  */
64 public:
65  SimControlLanguageCommand(const std::string& name);
67 
70  virtual void printNextInstruction();
71  virtual void printStopInformation();
72  virtual void printStopReasons();
73  virtual bool printBreakpointInfo(unsigned int breakpointHandle);
74  virtual void printSimulationTime();
75 
76  virtual std::ostream& outputStream();
77 
81  bool checkSimulationEnded();
82  bool checkProgramLoaded();
83  bool checkMachineLoaded();
84 
86  const std::string& expression);
87 
89  const std::string& expression);
90 
91  bool parseBreakpoint(
92  const std::vector<DataObject>& arguments,
93  Breakpoint& target);
94 
97 
99  const std::vector<DataObject>& arguments,
100  std::size_t startIndex = 1);
101 
102  void setErrorMessage(const TCEString& errorMsg);
103 protected:
104  bool setMemoryAddress(
105  const std::string& addressString,
106  std::string& addressSpaceName,
107  std::size_t& memoryAddress);
108  bool setMemoryPointer(
109  MemorySystem::MemoryPtr& memory,
110  const std::string& addressSpaceName);
111 
112 };
113 
114 ///////////////////////////////////////////////////////////////////////////////
115 // SimControlLanguageSubCommand
116 ///////////////////////////////////////////////////////////////////////////////
117 
118 /**
119  * Base class for classes that implement subcommands of Simulator Control
120  * Language.
121  */
123 public:
126  virtual bool execute(const std::vector<DataObject>& arguments) = 0;
128 private:
129  /// the main command
131 };
132 
133 
134 #endif
SimControlLanguageSubCommand::~SimControlLanguageSubCommand
virtual ~SimControlLanguageSubCommand()
Definition: SimControlLanguageCommand.cc:833
SimControlLanguageSubCommand::parent
virtual SimControlLanguageCommand & parent()
Definition: SimControlLanguageCommand.cc:842
CustomCommand::name
std::string name() const
InstructionAddress
UInt32 InstructionAddress
Definition: BaseType.hh:175
SimControlLanguageSubCommand::SimControlLanguageSubCommand
SimControlLanguageSubCommand(SimControlLanguageCommand &parentCommand)
Definition: SimControlLanguageCommand.cc:824
SimControlLanguageCommand::outputStream
virtual std::ostream & outputStream()
Definition: SimControlLanguageCommand.cc:351
SimControlLanguageCommand::checkSimulationStopped
bool checkSimulationStopped()
Definition: SimControlLanguageCommand.cc:135
SimControlLanguageCommand::checkSimulationNotAlreadyRunning
bool checkSimulationNotAlreadyRunning()
Definition: SimControlLanguageCommand.cc:111
TTAProgram::Address
Definition: Address.hh:51
Exception.hh
Breakpoint
Definition: Breakpoint.hh:50
SimControlLanguageCommand::setMemoryPointer
bool setMemoryPointer(MemorySystem::MemoryPtr &memory, const std::string &addressSpaceName)
Definition: SimControlLanguageCommand.cc:780
SimControlLanguageCommand::parseDataAddressExpression
TTAProgram::Address parseDataAddressExpression(const std::string &expression)
Definition: SimControlLanguageCommand.cc:471
SimControlLanguageCommand::printNextInstruction
virtual void printNextInstruction()
Definition: SimControlLanguageCommand.cc:228
ExpressionScript
Definition: ExpressionScript.hh:44
SimControlLanguageCommand::checkProgramLoaded
bool checkProgramLoaded()
Definition: SimControlLanguageCommand.cc:180
SimControlLanguageCommand::simulatorFrontendConst
const SimulatorFrontend & simulatorFrontendConst()
TclConditionScript
Definition: TclConditionScript.hh:50
MemorySystem.hh
SimControlLanguageCommand::printStopReasons
virtual void printStopReasons()
Definition: SimControlLanguageCommand.cc:257
SimControlLanguageCommand::setMemoryAddress
bool setMemoryAddress(const std::string &addressString, std::string &addressSpaceName, std::size_t &memoryAddress)
Definition: SimControlLanguageCommand.cc:753
MemorySystem::MemoryPtr
boost::shared_ptr< Memory > MemoryPtr
Definition: MemorySystem.hh:57
SimulatorConstants.hh
SimControlLanguageCommand::verifyBreakpointHandles
bool verifyBreakpointHandles(const std::vector< DataObject > &arguments, std::size_t startIndex=1)
Definition: SimControlLanguageCommand.cc:712
SimControlLanguageCommand::setErrorMessage
void setErrorMessage(const TCEString &errorMsg)
Definition: SimControlLanguageCommand.cc:738
SimControlLanguageCommand::checkSimulationEnded
bool checkSimulationEnded()
Definition: SimControlLanguageCommand.cc:158
SimControlLanguageCommand::printStopInformation
virtual void printStopInformation()
Definition: SimControlLanguageCommand.cc:243
CustomCommand.hh
SimControlLanguageCommand::SimControlLanguageCommand
SimControlLanguageCommand(const std::string &name)
Definition: SimControlLanguageCommand.cc:67
SimControlLanguageCommand::~SimControlLanguageCommand
virtual ~SimControlLanguageCommand()
Definition: SimControlLanguageCommand.cc:77
SimControlLanguageSubCommand::parentCommand_
SimControlLanguageCommand & parentCommand_
the main command
Definition: SimControlLanguageCommand.hh:130
SimControlLanguageCommand::parseInstructionAddressExpression
InstructionAddress parseInstructionAddressExpression(const std::string &expression)
Definition: SimControlLanguageCommand.cc:378
SimControlLanguageCommand::askConditionFromUser
bool askConditionFromUser(TclConditionScript &target)
Definition: SimControlLanguageCommand.cc:513
SimControlLanguageSubCommand::execute
virtual bool execute(const std::vector< DataObject > &arguments)=0
CustomCommand
Definition: CustomCommand.hh:54
SimControlLanguageCommand::checkSimulationInitialized
bool checkSimulationInitialized()
Definition: SimControlLanguageCommand.cc:88
DataObject.hh
SimControlLanguageCommand::checkMachineLoaded
bool checkMachineLoaded()
Definition: SimControlLanguageCommand.cc:199
SimControlLanguageCommand::parseBreakpoint
bool parseBreakpoint(const std::vector< DataObject > &arguments, Breakpoint &target)
Definition: SimControlLanguageCommand.cc:593
Address.hh
TCEString
Definition: TCEString.hh:53
SimControlLanguageCommand
Definition: SimControlLanguageCommand.hh:63
SimControlLanguageCommand::simulatorFrontend
SimulatorFrontend & simulatorFrontend()
Definition: SimControlLanguageCommand.cc:214
SimControlLanguageSubCommand
Definition: SimControlLanguageCommand.hh:122
SimulatorFrontend
Definition: SimulatorFrontend.hh:89
SimControlLanguageCommand::printBreakpointInfo
virtual bool printBreakpointInfo(unsigned int breakpointHandle)
Definition: SimControlLanguageCommand.cc:678
SimControlLanguageCommand::askExpressionFromUser
bool askExpressionFromUser(ExpressionScript &target)
Definition: SimControlLanguageCommand.cc:551
SimControlLanguageCommand::printSimulationTime
virtual void printSimulationTime()
Definition: SimControlLanguageCommand.cc:322