OpenASIP 2.2
Loading...
Searching...
No Matches
SimulatorTextGenerator.cc
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 SimulatorTextGenerator.cc
26 *
27 * Implementation of the SimulatorTextGenerator class.
28 *
29 * @author Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
34
35/**
36 * The Constructor.
37 *
38 * Initializes string templates to the text generator.
39 */
41 addText(
43 "No ADF defined in the processor configuration file.");
44 addText(Texts::TXT_ILLEGAL_ADF_FILE, "Illegal machine file.");
45 addText(Texts::TXT_REGISTER_NOT_FOUND, "Register not found.");
46 addText(Texts::TXT_REGISTER_FILE_NOT_FOUND, "Register file not found.");
47 addText(Texts::TXT_IMMEDIATE_UNIT_NOT_FOUND, "Immediate unit not found.");
48 addText(Texts::TXT_FU_NOT_FOUND, "Function unit not found.");
49 addText(Texts::TXT_FUPORT_NOT_FOUND, "Function unit port not found.");
50 addText(Texts::TXT_BUS_NOT_FOUND, "Bus not found.");
51 addText(
53 "Loads the simulated program. TPEF file name is given as "
54 "argument.");
55 addText(
57 "Loads the simulated processor. ADF file name is given as "
58 "argument.");
59 addText(
61 "Loads the simulated processor using a processor configuration "
62 "file. PCF file name is given as argument.");
63 addText(Texts::TXT_INTERP_HELP_QUIT, "Quits the simulator immediately.");
64 addText(
66 "Prints a range of instructions of the loaded program.\n\n"
67 "When two arguments are given, the first argument specifies "
68 "the first address of the range to display, and the second "
69 "argument specifies the last address (not displayed).\n\n"
70 "If only one argument, is given, then the function that "
71 "contains the given address is disassembled. The argument can also be "
72 "a procedure name. If no argument is "
73 "given, the default memory range is the function surrounding "
74 "the program counter of the selected frame.");
75
76 addText(
78 "Starts simulation of the program currently loaded into the "
79 "simulator.\n\nThe program can be loaded by 'prog' command.\n\n"
80 "Simulation runs until either a breakpoint is encountered or "
81 "after the last instruction of the first executed procedure is "
82 "executed.");
83
84 addText(
86 "Advances simulation to the next machine instruction, stepping "
87 "into the first instruction of a new procedure if the instruction "
88 "is a function call.\n\n"
89 "The count argument gives the number of machine instruction "
90 "to simulate, default is to step one instruction.");
91
92 addText(
94 "Displays the last N commands in the command history log. "
95 "If the argument is omitted, 10 last commands are printed.");
96
97 addText(
99 "Advances simulation to the next machine instructions in current "
100 "procedure.\n\n"
101
102 "If the instruction contains a function call, simulation proceeds "
103 "until control returns from it, to the instruction past the function "
104 "call. The argument gives the number of machine instruction to "
105 "simulate. Default is one.");
106
107 addText(
109 "Continue running until the program location specified by "
110 "the given argument is reached.\n\n"
111 "Any valid argument that applies "
112 "to command 'bp' is also a valid argument for until.");
113
114 addText(
116 "Prints the data in memory starting at specified address.\n\n"
117
118 "Parameter /a can be used to select the address space if there are "
119 "multiple address spaces in the target machine.\n\n"
120
121 "\t/a [address space name]\n\n"
122
123 "The optional parameteres /n and /u specify how much memory to "
124 "display.\n\n"
125
126 "\t/n\n\n"
127
128 "Repeat count: how many data words (counting by units u) to "
129 "display. If omitted, defaults to 1.\n\n"
130
131 "\t/u\n\n"
132
133 "Unit size: `b' (MAU, a byte in byte-addressed memories), `h' "
134 "(double MAU), `w' (quadruple word, a `word' in byte-adressed "
135 "32-bit architectures). For example, 'x /a data /n 8 /u w 1024' "
136 "displays 8 words starting from address 1024 in address space "
137 "'data'.\n\n"
138
139 "\t/f [file name]\n\n"
140
141 "Target filename. Setting this causes the memory contents to be "
142 "printed as binary data to the given file.\n\n"
143
144
145 "If addr is omitted, then the first address past the last address "
146 "displayed by the previous x command is implied. If the value of n, "
147 "or u is not specified, the value given in the most recent x "
148 "command is maintained. ");
149
150 addText(
152 "Reads binary data from filename to the specified address in "
153 "memory\n\n"
154
155 "\tload_data [/a address_space_name] address filename [size]\n\n"
156
157 "Parameter /a can be used to select the address space if there are "
158 "multiple address spaces in the target machine.\n\n"
159
160 "Read [size] in bytes is optional."
161 );
162
163 addText(
165 "The interactive simulation can be controlled by using "
166 "simulator control language, which is based on the Toolset "
167 "Control Language (Tcl). It extends the predefined set of Tcl "
168 "commands with a set of commands that are used to control "
169 "simulation.\n\nAll basic properties of Tcl (expression evaluation, "
170 "parameter substitution rules, operators, and so on) are "
171 "supported. ");
172
173 addText(
175 "Usage: ttasim [options]\n\n"
176 "In case program file is given and no script is given using '-e', "
177 "executes the simulation until the simulated program ends. Use "
178 "'help' in the interactive/debugging mode to get help and listing "
179 "of commands of simulator control language.");
180
181 addText(
183 "Instruction referring to a nonexisting immediate unit.");
184
185 addText(
187 "Instruction referring to a nonexisting register file.");
188
189 addText(
191 "Instruction referring to a nonexisting function unit port.");
192
193 addText(
195 "Instruction referring to a nonexisting bus.");
196
197 addText(
199 "Move with an unsupported terminal type found.");
200
201 addText(
203 "A move without an opcode writing to an opcode setting port "
204 "found.");
205
206 addText(
208 "Operation definition for %s not found.");
209
210 addText(
212 "Simulation not initialized.");
213
214 addText(
216 "Simulation already running.");
217
218 addText(
220 "No simulation running.");
221
222 addText(
224 "Simulation has not ended.");
225
226 addText(
228 "Modify and inspect simulation settings.\n\n"
229 "If no arguments are given, all simulator settings and their "
230 "current values are listed. If one argument is given, it's expected "
231 "to be a simulator setting, of which current value is printed. "
232 "If two arguments are given, the first argument tells the name of "
233 "the setting to modify, and second argument the new value to give "
234 "for the setting.");
235
236 addText(
238 "Resume simulation of the program until the simulation is finished "
239 "or a breakpoint is reached.\n\n"
240 "The optional argument gives the number of times the continue command "
241 "is repeated, that is, the number of times breakpoints should be "
242 "ignored.");
243
244 addText(
246 "Prints a help message for the given command.\n\n"
247 "If no command is given, prints general help and a listing of "
248 "available commands.");
249
250 addText(
252 "Prints info about simulation. Subcommand defines the type of info "
253 "printed.\n\n"
254
255 "Supported subcommands:\n\n"
256
257 "\tbusses [busname]\n\n"
258
259 "Prints the names of all the busses and their segments of the loaded "
260 "machine. If name of the bus is given, prints only its segments.\n\n"
261
262 "\tbreakpoints [num]\n\n"
263
264 "Prints a table of all breakpoints. Each breakpoint is printed in "
265 "a separate line. If argument is given, only the breakpoint with "
266 "handle num is printed.\n\n"
267
268 "\tfunits\n\n"
269
270 "Prints the names of all of the function units in the loaded "
271 "machine.\n\n"
272
273 "\timmediates [iunit] [regname]\n\n"
274
275 "Prints the value of register regname in immediate unit iunit.\n\n"
276
277 "\tiunits\n\n"
278
279 "Prints the names of all of the immediate units in the loaded "
280 "machine.\n\n"
281
282 "\tports funit [portname]\n\n"
283
284 "Prints values of all ports in the given function unit. If "
285 "port name is given, prints only the value of the given port.\n\n"
286
287 "If regname is omitted, values of all registers of the specified "
288 "register file are displayed. In sequential simulation, only regname "
289 "can be given. If no arguments are given while in sequential "
290 "simulation, all registers and their values written so far by the "
291 "program are printed.\n\n"
292
293 "\tproc cycles\n\n"
294
295 "Displays the total execution cycle count.\n\n"
296
297 "\tproc mapping\n\n"
298
299 "Displays information of address spaces of the loaded processor.\n\n"
300
301 "\tproc stats\n\n"
302
303 "Displays processor utilization data.\n\n"
304
305 "\tprogram\n\n"
306
307 "Displays information about the status of the program: whether it "
308 "is loaded or running, why it stopped.\n\n"
309
310 "\tprogram is_instruction_reference [ins_addr] [move_index]\n\n"
311
312 "Returns 1 if the source of the given move refers to an instruction "
313 "address, 0 otherwise.\n\n"
314
315 "\tregfiles\n\n"
316
317 "Prints the names of all of the register files in the loaded "
318 "machine.\n\n"
319
320 "\tregisters [regfile] [regname]\n\n"
321
322 "Prints the value of register regname in register file regfile.\n\n"
323
324 "\tsegments [busname]\n\n"
325
326 "Prints the value in the given bus. Segments are not yet supported.\n\n"
327
328 "\tstats executed_operations\n\n"
329
330 "Prints the total count of executed operations.\n\n"
331
332 "\tstats register_reads\n\n"
333
334 "Prints the total count of register reads.\n\n"
335
336 "\tstats register_writes\n\n"
337
338 "Prints the total count of register writes.");
339
340 addText(
342 "Creates a new breakpoint.\n\n"
343
344 "A breakpoint stops the simulation whenever the simulator reaches "
345 "a certain point in the program. It is possible to add a condition "
346 "to a breakpoint, to control when the simulator must stop with "
347 "increased precision.\n\n"
348
349 "Possible arguments to the command:\n\n"
350
351 "\t[none]\n\n"
352
353 "Sets a breakpoint to the address following the current instruction "
354 "address.\n\n"
355
356 "\taddress\n\n"
357
358 "Sets a breakpoint at address. Address can be a label or an "
359 "absolute instruction address.\n\n"
360
361 "\targs if\n\n"
362
363 "Sets a conditional breakpoint. The arguments args are the same as "
364 "for unconditional breakpoints. The expression condition is evaluated "
365 "each time the breakpoint is reached, and the simulation is stopped "
366 "only when the condition evaluates as true. Simulator prompts for "
367 "the condition expression after user has entered this command.");
368
369 addText(
371 "Creates a new watch.\n\n"
372
373 "A watch stops the simulation whenever the given expression changes "
374 "its value. Interpreter prompts for the expression after this command "
375 "is entered. It is possible to add a condition to a watch, to control "
376 "when the simulator must stop with increased precision.\n\n");
377
378 addText(
380 "Creates a new temporary breakpoint.\n\n"
381
382 "Sets a temporary breakpoint, which is automatically deleted "
383 "after the first time it stops the simulation. The arguments are "
384 "the same as for the 'bp' command (see 'help bp').");
385
386 addText(
388 "Specifies a condition under which the given breakpoint stops "
389 "simulation.\n\n"
390 "Simulator evaluates the entered condition expression whenever "
391 "the breakpoint is reached, and stops simulation only if the "
392 "expression evaluates as true (nonzero). Simulator checks expr "
393 "for syntactic correctness after the expression is entered.\n\n"
394
395 "When condition is an empty expression, any condition attached "
396 "to the breakpoint is removed, thus the breakpoint becomes "
397 "an ordinary unconditional breakpoint.");
398
399 addText(
401 "Sets the number of times the breakpoint must be ignored when "
402 "reached.\n\n"
403 "First argument is the handle of the breakpoint of which condition "
404 "to modify, second argument is the new ignore count. A count value "
405 "zero means that the breakpoint will stop simulation next time it "
406 "is reached.");
407
408 addText(
410 "Deletes the specified breakpoint(s).\n\n"
411
412 "If no arguments are given, deletes all breakpoints currently set, "
413 "asking first for comfirmation.");
414
415 addText(
417 "Are you sure you want to delete all the breakpoints? ");
418
419 addText(
421 "Are you sure you want to restart simulation? ");
422
423 addText(
425 "Enables the specified breakpoint(s).\n\n"
426
427 "If the second argument is 'once', the breakpoint(s) will be "
428 "automatically disabled after reached once. If the second argument "
429 "is 'delete', the breakpoint(s) will be automatically deleted after "
430 "reached once.");
431
432 addText(
434 "Disables the specified breakpoint(s).\n\n"
435
436 "A disabled breakpoint has no effect, but all its options "
437 "(ignore-counts, conditions, etc.) are remembered in case the "
438 "breakpoint is enabled again.");
439
440
442 "Writing of the basic execution trace.");
443
445 "Writing of the bus trace.");
446
447 addText(
449 "Function unit resource conflict detection (disable for speedup).");
450
451 addText(
453 "Concurrent register file access tracking (shown in 'info "
454 "proc stats').");
455
456 addText(
458 "Tracking of program procedure execution paths.");
459
460 addText(
462 "Tracking of memory reads and writes.");
463
464 addText(
466 "Save processor utilization data to trace database after simulation.");
467
468 addText(
470 "Save program profile data to trace database after simulation.");
471
472 addText(
474 "File to store the command history log in.");
475
476 addText(
478 "Saving of command history to a file.");
479
480 addText(
482 "Maximum size of the command history log.");
483
484 addText(
486 "Printing of the next executed instruction when simulation stops.");
487
488 addText(
490 "Invalid setting value. Should be %s.");
491
492 addText(
494 "Simulator control language commands available "
495 "(use help [command] to get command specific help):");
496
497 addText(
499 "Printing of the time statistics for the last command ran "
500 "(run, until, nexti).");
501
502 addText(
504 "Simulation timeout in seconds. Use zero to disable this setting.");
505
506 addText(
508 "Use static compilation when running compiled simulation. ");
509
510 addText(Texts::TXT_STATUS_STOPPED, "Program stopped at address %d.");
511 addText(Texts::TXT_STATUS_FINISHED, "Simulation finished.");
512 addText(
514 "Loaded program not being simulated.");
515 addText(Texts::TXT_STATUS_NOT_INITIALIZED, "Program not loaded.");
516
517 addText(Texts::TXT_STOPREASON_BREAKPOINT, "Stopped at breakpoint %d.");
518 addText(
520 "Stopped at a breakpoint that has since been deleted.");
521
522 addText(
524 "Stopped after reaching the address defined with "
525 "an 'until' or a 'nexti' commmand.");
526
527 addText(
529 "Stopped after simulation timeout.");
530
531 addText(
533 "Terminate the simulation.\n\n"
534
535 "The program being simulated remains loaded and the simulation "
536 "can be restarted from the beginning by means of command 'run'. "
537 "Simulator will prompt the user for comfirmation before "
538 "terminating the simulation.");
539
540 addText(Texts::TXT_STOPREASON_STEPPING, "Stopped after being stepped.");
541 addText(
543 "Stopped after a stop request from the user.");
544
545 addText(
547 "Stopped because of a runtime error in the simulated program.");
548
549 addText(Texts::TXT_LABEL_NOT_FOUND, "Label not found.");
550 addText(
552 "Illegal address expression.");
553
554 addText(Texts::TXT_BREAKPOINT_NOT_FOUND, "Breakpoint not found.");
555
558 addText(
559 Texts::TXT_EXPRESSION_EMPTY, "Expression script must not be empty.");
560 addText(Texts::TXT_ADDRESS_OUT_OF_RANGE, "Address out of range.");
561 addText(Texts::TXT_ADDRESS_SPACE_NOT_FOUND, "Address space not found.");
562 addText(
564 "Not running parallel simulation.");
565
566 addText(Texts::TXT_UNABLE_TO_LOAD_PROGRAM, "Unable to load program.");
567 addText(Texts::TXT_UNABLE_TO_LOAD_MACHINE, "Unable to load machine.");
568 addText(
569 Texts::TXT_NO_ADDRESS_SPACE_GIVEN, "No address space given (use /a).");
570 addText(Texts::TXT_NO_PROGRAM_LOADED, "No program loaded.");
572 "Unable to detect the program exit point. Simulation cannot be "
573 "finished automatically. Use 'until' instead of 'run'.");
575 "Warning! Settings affecting simulation startup have been changed. "
576 "Please reload the program and/or the machine.");
577}
578
579/**
580 * The Destructor.
581 */
584
585
586/**
587 * Replaces and generates texts specific to compiled simulation only.
588 */
589void
593 "Attempts to simulate program by given number of instructions.\n\n"
594 "The count argument gives the number of machine instructions "
595 "to attempt to simulate. Default is to step one instruction, "
596 "which means executing to the end of the current basic block.");
597}
598
virtual void replaceText(int textId, const std::string &newString)
virtual void addText(int textId, const std::string &templateString)
@ TXT_INTERP_SETTING_HISTORY_SIZE
Description of the execution trace setting.
@ TXT_ILLEGAL_PROGRAM_IU_STATE_NOT_FOUND
Text of the exception thrown when Immediate Unit state could not be found and there is instruction re...
@ TXT_STATUS_INITIALIZED
Status string of initialized simulation (program loaded).
@ TXT_INTERP_HELP_ENABLEBP
Help text for command "enablebp" of the CLI.
@ TXT_INTERP_HELP_RESUME
Help text for command "resume" of the CLI.
@ TXT_CLI_ONLINE_HELP
Online help text.
@ TXT_INTERP_HELP_DISASSEMBLE
Help text for command "disassemble" of the CLI.
@ TXT_STATIC_COMPILATION
Use static compilation when using compiled simulator.
@ TXT_INTERP_HELP_HELP
Help text for command "help" of the CLI.
@ TXT_CONFIRM_DELETE_ALL_BREAKPOINTS
@ TXT_ILLEGAL_PROGRAM_BUS_STATE_NOT_FOUND
Text of the exception thrown when FUPortState could not be found and there is instruction referring t...
@ TXT_ILLEGAL_PROGRAM_OPCODE_NOT_FOUND
Text of the exception thrown when a port to be written is an opcode setting port and no opcode is fou...
@ TXT_INTERP_HELP_NEXTI
Help text for command "nexti" of the CLI.
@ TXT_INTERP_HELP_SETTING
Help text for command "setting" of the CLI.
@ TXT_INTERP_HELP_DELETEBP
Help text for command "deletebp" of the CLI.
@ TXT_SIMULATION_TIME_STATISTICS
Description of the simulation time statistics setting.
@ TXT_INTERP_HELP_CONF
Help text for command "conf" of the CLI.
@ TXT_INTERP_SETTING_PROFILE_SAVING
@ TXT_INTERP_SETTING_MEMORY_ACCESS_TRACKING
@ TXT_STATUS_STOPPED
Status string of stopped simulation.
@ TXT_STATUS_NOT_INITIALIZED
Status string of non-initialized simulation (program not loaded).
@ TXT_STOPREASON_TIMEOUT
Stop reason: timeout
@ TXT_INTERP_SIMULATION_NOT_INITIALIZED
Text to be printed when simulation is not initialized and it should be.
@ TXT_ILLEGAL_PROGRAM_UNKNOWN_MOVE_TERMINAL_TYPE
Text of the exception thrown when the terminal type of a move is not regocnized.
@ TXT_INTERP_HELP_WATCH
Help text for command "watch" of the CLI.
@ TXT_INTERP_HELP_COMMANDS_AVAILABLE
Description of the execution trace setting.
@ TXT_INTERP_HELP_UNTIL
Help text for command "stepi" of the CLI.
@ TXT_INTERP_HELP_INFO
Help text for command "info" of the CLI.
@ TXT_INTERP_SETTING_FU_CONFLICT_DETECTION
@ TXT_STARTUP_SETTINGS_CHANGED_WARNING
@ TXT_INTERP_HELP_TBREAK
Help text for command "tbp" of the CLI.
@ TXT_INTERP_SETTING_PROCEDURE_TRANSFER_TRACKING
@ TXT_INTERP_HELP_PROG
Help text for command "prog" of the CLI.
@ TXT_INTERP_HELP_LOADDATA
Help text for command "load_data" of the CLI.
@ TXT_STOPREASON_STEPPING
Stop reason: stepping.
@ TXT_STOPREASON_USERREQUEST
Stop reason: user requested.
@ TXT_INTERP_SETTING_NEXT_INSTRUCTION_PRINTING
@ TXT_ILLEGAL_PROGRAM_PORT_STATE_NOT_FOUND
Text of the exception thrown when FUPortState could not be found and there is instruction referring t...
@ TXT_SIMULATION_TIMEOUT
Simulation timeout in seconds.
@ TXT_INTERP_HELP_RUN
Help text for command "run" of the CLI.
@ TXT_INTERP_HELP_KILL
Help text for command "kill" of the CLI.
@ TXT_INTERP_HELP_MACH
Help text for command "mach" of the CLI.
@ TXT_INTERP_HELP_DISABLEBP
Help text for command "disablebp" of the CLI.
@ TXT_INTERP_HELP_IGNORE
Help text for command "ignore" of the CLI.
@ TXT_INTERP_ENTER_CONDITION_PROMPT
@ TXT_INTERP_ENTER_EXPRESSION_PROMPT
@ TXT_INTERP_HELP_COMMANDS
Help text for command "commands" of the CLI.
@ TXT_STOPREASON_RUNTIME_ERROR
Stop reason: user requested.
@ TXT_STOPREASON_DELETED_BREAKPOINT
Stop reason: temporary breakpoint.
@ TXT_NOT_RUNNING_PARALLEL_SIMULATION
@ TXT_INTERP_SIMULATION_NOT_ENDED
Text to be printed when simulation has not ended and it should be.
@ TXT_INTERP_SIMULATION_NOT_RUNNING
Text to be printed when simulation is not running and it should be.
@ TXT_INTERP_SETTING_UTILIZATION_SAVING
@ TXT_ILLEGAL_PROGRAM_RF_STATE_NOT_FOUND
Text of the exception thrown when RegisterFileState could not be found and there is instruction refer...
@ TXT_STOPREASON_UNTIL
Stop reason: until.
@ TXT_INTERP_SETTING_HISTORY_FILENAME
@ TXT_INTERP_HELP_CONDITION
Help text for command "condition" of the CLI.
@ TXT_INTERP_HELP_STEPI
Help text for command "stepi" of the CLI.
@ TXT_INTERP_SIMULATION_ALREDY_RUNNING
Text to be printed when simulation is already running and it should not be.
@ TXT_INTERP_HELP_BREAK
Help text for command "bp" of the CLI.
@ TXT_INTERP_HELP_QUIT
Help text for command "quit" of the CLI.
@ TXT_STOPREASON_BREAKPOINT
Stop reason: breakpoint.
@ TXT_INTERP_HELP_X
Help text for command "x" of the CLI.
@ TXT_STATUS_FINISHED
Status string of a finished simulation.
@ TXT_INTERP_SETTING_PARSE_ERROR
In case user tried to set a setting with illegal parameter.