OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
DisasmExecPercentageAttrProvider Class Reference

#include <DisasmExecPercentageAttrProvider.hh>

Inheritance diagram for DisasmExecPercentageAttrProvider:
Inheritance graph
Collaboration diagram for DisasmExecPercentageAttrProvider:
Collaboration graph

Public Member Functions

 DisasmExecPercentageAttrProvider (const TracedSimulatorFrontend &simulator)
 
virtual ~DisasmExecPercentageAttrProvider ()
 
virtual wxGridCellAttr * moveCellAttr (InstructionAddress address, int move)
 
- Public Member Functions inherited from ProximDisasmAttrProvider
 ProximDisasmAttrProvider ()
 
virtual ~ProximDisasmAttrProvider ()
 
virtual void update ()
 

Private Attributes

const TracedSimulatorFrontendsimulator_
 

Detailed Description

Proxim disassembly attribute provider, which highlights moves based on execution count ratio to the simulated cycle count.

Definition at line 44 of file DisasmExecPercentageAttrProvider.hh.

Constructor & Destructor Documentation

◆ DisasmExecPercentageAttrProvider()

DisasmExecPercentageAttrProvider::DisasmExecPercentageAttrProvider ( const TracedSimulatorFrontend simulator)

The Constructor.

Parameters
simulatorSimulator frontend for accessing instructions and execution counts.

Definition at line 49 of file DisasmExecPercentageAttrProvider.cc.

◆ ~DisasmExecPercentageAttrProvider()

DisasmExecPercentageAttrProvider::~DisasmExecPercentageAttrProvider ( )
virtual

The Destructor.

Definition at line 58 of file DisasmExecPercentageAttrProvider.cc.

58 {
59}

Member Function Documentation

◆ moveCellAttr()

wxGridCellAttr * DisasmExecPercentageAttrProvider::moveCellAttr ( InstructionAddress  address,
int  move 
)
virtual

Returns grid cell attributes for cell with given move.

Parameters
addressAddress of the cell's instruction.

Implements ProximDisasmAttrProvider.

Definition at line 68 of file DisasmExecPercentageAttrProvider.cc.

69 {
70
72
73 wxGridCellAttr* attr = new wxGridCellAttr();
74
75 const ExecutableInstruction& ins =
77
79
81 program.targetProcessor().busNavigator();
82
83 assert(move >= 0);
84
85 if (move >= nav.count()) {
86 // No highlight for immediate slots.
87 return attr;
88 }
89
90 const TTAMachine::Bus* moveBus = nav.item(move);
91 const TTAProgram::Instruction& instruction =
92 program.instructionAt(address);
93
94 // Search for the correct move index in the instruction.
95 // TTAProgram::Instruction doesn't contain nops and the move indexing
96 // differs from the busNavigator and disassembly grid indexing.
97 int index = 0;
98 for (; index < instruction.moveCount(); index++) {
99 if (moveBus == &instruction.move(index).bus()) {
100 break;
101 }
102 }
103
104 ClockCycleCount executions = 0;
105 if (index < instruction.moveCount()) {
106 executions = ins.moveExecutionCount(index);
107 }
108
109 if (executions > 0) {
111 int colour = static_cast<int>(
112 5 * 255 * sin((executions / cycles) * 0.5 * 3.1415926));
113 if (colour > 255) colour = 255;
114 attr->SetBackgroundColour(
115 wxColour(255, 255 - colour, 255 - colour));
116 } else {
117 // Gray background colour for moves that are not executed at all.
118 attr->SetBackgroundColour(wxColour(220, 220, 220));
119 }
120 return attr;
121}
#define assert(condition)
find Finds info of the inner loops in the program
CycleCount ClockCycleCount
Alias for ClockCycleCount.
ClockCycleCount moveExecutionCount(std::size_t moveIndex) const
ClockCycleCount cycleCount() const
const TTAProgram::Program & program() const
const ExecutableInstruction & executableInstructionAt(InstructionAddress address) const
ComponentType * item(int index) const
Move & move(int i) const
const TTAMachine::Bus & bus() const
Definition Move.cc:373

References assert, TTAProgram::Move::bus(), TTAMachine::Machine::Navigator< ComponentType >::count(), SimulatorFrontend::cycleCount(), SimulatorFrontend::executableInstructionAt(), SimulatorFrontend::isProgramLoaded(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAProgram::Instruction::move(), TTAProgram::Instruction::moveCount(), ExecutableInstruction::moveExecutionCount(), program, SimulatorFrontend::program(), and simulator_.

Here is the call graph for this function:

Member Data Documentation

◆ simulator_

const TracedSimulatorFrontend& DisasmExecPercentageAttrProvider::simulator_
private

Definition at line 52 of file DisasmExecPercentageAttrProvider.hh.

Referenced by moveCellAttr().


The documentation for this class was generated from the following files: