OpenASIP  2.0
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.

50  :
51  ProximDisasmAttrProvider(), simulator_(simulator) {
52 }

◆ ~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 }

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:
DisasmExecPercentageAttrProvider::simulator_
const TracedSimulatorFrontend & simulator_
Definition: DisasmExecPercentageAttrProvider.hh:52
TTAProgram::Program
Definition: Program.hh:63
ExecutableInstruction
Definition: ExecutableInstruction.hh:49
SimulatorFrontend::program
const TTAProgram::Program & program() const
Definition: SimulatorFrontend.cc:276
TTAProgram::Instruction::move
Move & move(int i) const
Definition: Instruction.cc:193
TTAProgram::Instruction
Definition: Instruction.hh:57
TTAMachine::Bus
Definition: Bus.hh:53
TTAProgram::Move::bus
const TTAMachine::Bus & bus() const
Definition: Move.cc:373
TTAMachine::Machine::Navigator::count
int count() const
assert
#define assert(condition)
Definition: Application.hh:86
ProximDisasmAttrProvider::ProximDisasmAttrProvider
ProximDisasmAttrProvider()
Definition: ProximDisasmAttrProvider.cc:39
SimulatorFrontend::executableInstructionAt
const ExecutableInstruction & executableInstructionAt(InstructionAddress address) const
Definition: SimulatorFrontend.cc:2208
SimulatorFrontend::isProgramLoaded
bool isProgramLoaded() const
Definition: SimulatorFrontend.cc:1240
SimulatorFrontend::cycleCount
ClockCycleCount cycleCount() const
Definition: SimulatorFrontend.cc:1194
ClockCycleCount
CycleCount ClockCycleCount
Alias for ClockCycleCount.
Definition: SimulatorConstants.hh:57
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
program
find Finds info of the inner loops in the program
Definition: InnerLoopFinder.cc:80
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
TTAProgram::Instruction::moveCount
int moveCount() const
Definition: Instruction.cc:176
ExecutableInstruction::moveExecutionCount
ClockCycleCount moveExecutionCount(std::size_t moveIndex) const
Definition: ExecutableInstruction.cc:110