OpenASIP  2.0
Public Member Functions | Private Member Functions | List of all members
ProximPortWindow Class Reference

#include <ProximPortWindow.hh>

Inheritance diagram for ProximPortWindow:
Inheritance graph
Collaboration diagram for ProximPortWindow:
Collaboration graph

Public Member Functions

 ProximPortWindow (ProximMainFrame *parent, int id)
 
virtual ~ProximPortWindow ()
 
void showFunctionUnit (const std::string &name)
 
- Public Member Functions inherited from ProximUnitWindow
 ProximUnitWindow (ProximMainFrame *parent, int id)
 
virtual ~ProximUnitWindow ()
 
- Public Member Functions inherited from ProximSimulatorWindow
virtual void reset ()
 

Private Member Functions

virtual void reinitialize ()
 
virtual void update ()
 

Additional Inherited Members

- Protected Member Functions inherited from ProximSimulatorWindow
 ProximSimulatorWindow (ProximMainFrame *mainFrame, wxWindowID id=-1, wxPoint pos=wxDefaultPosition, wxSize size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
 
virtual ~ProximSimulatorWindow ()
 
- Protected Attributes inherited from ProximUnitWindow
SimulatorFrontendsimulator_
 Simulator instance . More...
 
wxChoice * unitChoice_
 Unit choicer widget. More...
 
wxChoice * modeChoice_
 Value display mode choicer widget. More...
 
wxListCtrl * valueList_
 List widget for the values. More...
 
- Static Protected Attributes inherited from ProximUnitWindow
static const wxString MODE_INT = _T("Int")
 String for the mode choicer integer mode. More...
 
static const wxString MODE_UNSIGNED = _T("Unsigned")
 String for the mode choicer unsigned integer mode. More...
 
static const wxString MODE_HEX = _T("Hex")
 String for the mode choicer hexadecimal mode. More...
 
static const wxString MODE_BIN = _T("Binary")
 String for the mode choicer binary mode. More...
 

Detailed Description

Proxim subwindow which displays function unit port values.

This window listens to SimulatorEvents and updates the window contents automatically.

Definition at line 47 of file ProximPortWindow.hh.

Constructor & Destructor Documentation

◆ ProximPortWindow()

ProximPortWindow::ProximPortWindow ( ProximMainFrame parent,
int  id 
)

Constructor.

Parameters
parentParent window of the window.
idWindow identifier.

Definition at line 64 of file ProximPortWindow.cc.

65  :
66  ProximUnitWindow(parent, id) {
67 
68  valueList_->InsertColumn(0, _T("Port"), wxLIST_FORMAT_LEFT, 100);
69  valueList_->InsertColumn(1, _T("Value"), wxLIST_FORMAT_RIGHT, 120);
70 
74 
75  reinitialize();
76  }
77 }

References SimulatorFrontend::hasSimulationEnded(), SimulatorFrontend::isSimulationInitialized(), SimulatorFrontend::isSimulationStopped(), reinitialize(), ProximUnitWindow::simulator_, and ProximUnitWindow::valueList_.

Here is the call graph for this function:

◆ ~ProximPortWindow()

ProximPortWindow::~ProximPortWindow ( )
virtual

Destructor.

Definition at line 83 of file ProximPortWindow.cc.

83  {
84 }

Member Function Documentation

◆ reinitialize()

void ProximPortWindow::reinitialize ( )
privatevirtual

Sets the available function unit selections in the function unit choice.

Reimplemented from ProximUnitWindow.

Definition at line 91 of file ProximPortWindow.cc.

91  {
92 
93  unitChoice_->Clear();
94 
95  string gcuName = simulator_->machine().controlUnit()->name();
96  unitChoice_->Append(WxConversion::toWxString(gcuName));
97 
100 
101  for (int i = 0; i < navigator.count(); i++) {
102  string fuName = navigator.item(i)->name();
103  unitChoice_->Append(WxConversion::toWxString(fuName));
104  }
105 
106  unitChoice_->SetSelection(0);
107 
108  update();
109 }

References TTAMachine::Machine::controlUnit(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), SimulatorFrontend::machine(), TTAMachine::Component::name(), ProximUnitWindow::simulator_, WxConversion::toWxString(), ProximUnitWindow::unitChoice_, and update().

Referenced by ProximPortWindow().

Here is the call graph for this function:

◆ showFunctionUnit()

void ProximPortWindow::showFunctionUnit ( const std::string &  name)

Changes unit selection to function unit with given name.

Parameters
nameName of the function unit to select.

Definition at line 117 of file ProximPortWindow.cc.

117  {
118  unitChoice_->SetStringSelection(WxConversion::toWxString(name));
119  update();
120 }

References WxConversion::toWxString(), ProximUnitWindow::unitChoice_, and update().

Referenced by ProximShowPortsCmd::Do().

Here is the call graph for this function:

◆ update()

void ProximPortWindow::update ( )
privatevirtual

Updates the value list with port values of the selected function unit.

Reimplemented from ProximUnitWindow.

Definition at line 126 of file ProximPortWindow.cc.

126  {
127 
128  valueList_->DeleteAllItems();
129 
130  MachineState& machState = simulator_->machineState();
133 
134  int fuIndex = unitChoice_->GetSelection();
135  FunctionUnit* fu = NULL;
136 
137  // FU Choice item with index 0 is the control unit.
138  if (fuIndex == 0) {
139  fu = simulator_->machine().controlUnit();
140  } else {
141  fu = navigator.item(fuIndex - 1);
142  }
143 
144  // Append all ports of the function unit to the port list.
145  for (int i = 0; i < fu->portCount(); i++) {
146 
147  string portName = fu->port(i)->name();
148  const PortState& state = machState.portState(portName, fu->name());
149 
150  wxString value;
151 
152  wxString mode = modeChoice_->GetStringSelection();
153 
154  if (mode == MODE_UNSIGNED) {
155  value = WxConversion::toWxString(state.value().unsignedValue());
156  } else if (mode == MODE_INT) {
157  int intValue = state.value().intValue();
158  value = WxConversion::toWxString(intValue);
159  } else if (mode == MODE_HEX) {
160  value = WxConversion::toWxString(
162  } else if (mode == MODE_BIN) {
163  int intValue = state.value().unsignedValue();
164  value = WxConversion::toWxString(
165  Conversion::toBinString(intValue));
166  }
167 
168  valueList_->InsertItem(i, WxConversion::toWxString(portName));
169  valueList_->SetItem(i, 1, value);
170  }
171 }

References TTAMachine::Machine::controlUnit(), TTAMachine::Machine::functionUnitNavigator(), SimValue::intValue(), TTAMachine::Machine::Navigator< ComponentType >::item(), SimulatorFrontend::machine(), SimulatorFrontend::machineState(), ProximUnitWindow::MODE_BIN, ProximUnitWindow::MODE_HEX, ProximUnitWindow::MODE_INT, ProximUnitWindow::MODE_UNSIGNED, ProximUnitWindow::modeChoice_, TTAMachine::Port::name(), TTAMachine::Component::name(), TTAMachine::FunctionUnit::port(), TTAMachine::Unit::portCount(), MachineState::portState(), ProximUnitWindow::simulator_, Conversion::toBinString(), Conversion::toHexString(), WxConversion::toWxString(), ProximUnitWindow::unitChoice_, SimValue::unsignedValue(), RegisterState::value(), and ProximUnitWindow::valueList_.

Referenced by reinitialize(), and showFunctionUnit().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
ProximUnitWindow::ProximUnitWindow
ProximUnitWindow(ProximMainFrame *parent, int id)
Definition: ProximUnitWindow.cc:67
SimValue::intValue
int intValue() const
Definition: SimValue.cc:895
WxConversion::toWxString
static wxString toWxString(const std::string &source)
mode
mode
Definition: tceopgen.cc:45
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
MachineState::portState
PortState & portState(const std::string &portName, const std::string &fuName)
Definition: MachineState.cc:175
SimulatorFrontend::machine
const TTAMachine::Machine & machine() const
Definition: SimulatorFrontend.cc:263
ProximUnitWindow::modeChoice_
wxChoice * modeChoice_
Value display mode choicer widget.
Definition: ProximUnitWindow.hh:62
SimulatorFrontend::isSimulationStopped
bool isSimulationStopped() const
Definition: SimulatorFrontend.cc:1271
TTAMachine::FunctionUnit::port
virtual BaseFUPort * port(const std::string &name) const
Definition: FunctionUnit.cc:145
TTAMachine::Machine::Navigator::count
int count() const
ProximPortWindow::reinitialize
virtual void reinitialize()
Definition: ProximPortWindow.cc:91
ProximUnitWindow::MODE_UNSIGNED
static const wxString MODE_UNSIGNED
String for the mode choicer unsigned integer mode.
Definition: ProximUnitWindow.hh:69
ProximUnitWindow::unitChoice_
wxChoice * unitChoice_
Unit choicer widget.
Definition: ProximUnitWindow.hh:60
ProximPortWindow::update
virtual void update()
Definition: ProximPortWindow.cc:126
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
RegisterState::value
virtual const SimValue & value() const
Definition: RegisterState.cc:92
TTAMachine::Machine::controlUnit
virtual ControlUnit * controlUnit() const
Definition: Machine.cc:345
MachineState
Definition: MachineState.hh:61
ProximUnitWindow::valueList_
wxListCtrl * valueList_
List widget for the values.
Definition: ProximUnitWindow.hh:64
ProximUnitWindow::MODE_INT
static const wxString MODE_INT
String for the mode choicer integer mode.
Definition: ProximUnitWindow.hh:67
TTAMachine::Machine::functionUnitNavigator
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition: Machine.cc:380
ProximUnitWindow::simulator_
SimulatorFrontend * simulator_
Simulator instance .
Definition: ProximUnitWindow.hh:58
PortState
Definition: PortState.hh:51
TTAMachine::Unit::portCount
virtual int portCount() const
Definition: Unit.cc:135
Conversion::toHexString
static std::string toHexString(T source, std::size_t digits=0, bool include0x=true)
SimValue::unsignedValue
unsigned int unsignedValue() const
Definition: SimValue.cc:919
SimulatorFrontend::machineState
MachineState & machineState(int core=-1)
Definition: SimulatorFrontend.cc:2138
TTAMachine::Port::name
virtual std::string name() const
Definition: Port.cc:141
Conversion::toBinString
static std::string toBinString(int source)
Definition: Conversion.cc:81
ProximUnitWindow::MODE_HEX
static const wxString MODE_HEX
String for the mode choicer hexadecimal mode.
Definition: ProximUnitWindow.hh:71
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
SimulatorFrontend::hasSimulationEnded
bool hasSimulationEnded() const
Definition: SimulatorFrontend.cc:1283
ProximUnitWindow::MODE_BIN
static const wxString MODE_BIN
String for the mode choicer binary mode.
Definition: ProximUnitWindow.hh:73
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
SimulatorFrontend::isSimulationInitialized
bool isSimulationInitialized() const
Definition: SimulatorFrontend.cc:1228