OpenASIP 2.2
Loading...
Searching...
No Matches
RemoteController.cc
Go to the documentation of this file.
1/*
2 This file is part of TTA-Based Codesign Environment (TCE).
3
4 Permission is hereby granted, free of charge, to any person obtaining a
5 copy of this software and associated documentation files (the "Software"),
6 to deal in the Software without restriction, including without limitation
7 the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 and/or sell copies of the Software, and to permit persons to whom the
9 Software is furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 DEALINGS IN THE SOFTWARE.
21*/
22
23/**
24 * @file RemoteController.cc
25 * @author Kalle Raiskila 2014
26 */
27
28#include "RemoteController.hh"
29#include "SimValue.hh"
31#include "BinaryEncoding.hh"
32#include "BEMGenerator.hh"
33#include "Binary.hh"
34#include "ProgramWriter.hh"
35
36#define DEBUG_REMOTE_DEBUGGER_CONTROLLER
37#ifdef DEBUG_REMOTE_DEBUGGER_CONTROLLER
38#include <cstdio>
39#define _DPRINT(...) printf(__VA_ARGS__)
40#define _WHERE() printf("%s:%d - %s\n", __FILE__, __LINE__, __func__)
41#else
42#define _DPRINT(...)
43#define _WHERE()
44#endif
45
46#include <iostream>
47
56
57void
59
61 BinaryEncoding *theBE;
62 TPEF::Binary *binary;
63 // TODO. better name from somewhere?
64 std::string programName("the program");
65 // clear the old image
66 imemImage.str("");
67
68 // Binary encoding of the instruction sream
69 // TODO: loading of instruction compressors would happen here?
71 theBE = theBEMGen.generate();
72
74 binary = writer.createBinary();
76 // TODO: have some actual name for this program?
77 tmap[programName] = binary;
78
79 thePIG.loadBEM(*theBE);
81 thePIG.loadPrograms(tmap);
82 // clear the old image
83
84 // put the instructions into imemImage
86 programName, imemImage,
88
89 writeIMem(imemImage.str().c_str(), imemImage.str().size());
90
91 delete binary;
92 delete theBE;
93
94 return;
95
96}
97/* vim: set ts=4 expandtab: */
TTAMachine::Machine * machine
the architecture definition of the estimated processor
find Finds info of the inner loops in the program
BinaryEncoding * generate()
void loadPrograms(TPEFMap programs)
std::map< std::string, TPEF::Binary * > TPEFMap
@ BINARY
Real binary format.
void generateProgramImage(const std::string &programName, std::ostream &stream, OutputFormat format, int mausPerLine=0)
void loadMachine(const TTAMachine::Machine &machine)
void loadBEM(const BinaryEncoding &bem)
RemoteController(SimulatorFrontend &frontend, const TTAMachine::Machine &machine, const TTAProgram::Program &program)
virtual void loadIMemImage()
std::set< InstructionAddress > exitPoints
std::ostringstream imemImage
virtual void writeIMem(const char *data, int size)=0
TPEF::Binary * createBinary() const
const TTAMachine::Machine & sourceMachine_
The simulated Machine Object Model.
virtual std::set< InstructionAddress > findProgramExitPoints(const TTAProgram::Program &program, const TTAMachine::Machine &machine) const
const TTAProgram::Program & program_
Program object model of the simulated program.