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

#include <ProximRegisterWindow.hh>

Inheritance diagram for ProximRegisterWindow:
Inheritance graph
Collaboration diagram for ProximRegisterWindow:
Collaboration graph

Public Member Functions

 ProximRegisterWindow (ProximMainFrame *parent, int id)
 
virtual ~ProximRegisterWindow ()
 
void showRegisterFile (const std::string &name)
 
void showImmediateUnit (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

void loadRegisterFile (const TTAMachine::RegisterFile &rf)
 
void loadImmediateUnit (const TTAMachine::ImmediateUnit &iu)
 
virtual void reinitialize ()
 
virtual void update ()
 

Static Private Attributes

static const std::string RF_PREFIX = "RF: "
 Prefix for register files in the unit choicer.
 
static const std::string IMM_PREFIX = "IMM: "
 Prefix for immediate units in the unit choicer.
 

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 .
 
wxChoice * unitChoice_
 Unit choicer widget.
 
wxChoice * modeChoice_
 Value display mode choicer widget.
 
wxListCtrl * valueList_
 List widget for the values.
 
- Static Protected Attributes inherited from ProximUnitWindow
static const wxString MODE_INT = _T("Int")
 String for the mode choicer integer mode.
 
static const wxString MODE_UNSIGNED = _T("Unsigned")
 String for the mode choicer unsigned integer mode.
 
static const wxString MODE_HEX = _T("Hex")
 String for the mode choicer hexadecimal mode.
 
static const wxString MODE_BIN = _T("Binary")
 String for the mode choicer binary mode.
 

Detailed Description

Proxim subwindow which displays register values.

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

Definition at line 54 of file ProximRegisterWindow.hh.

Constructor & Destructor Documentation

◆ ProximRegisterWindow()

ProximRegisterWindow::ProximRegisterWindow ( ProximMainFrame parent,
int  id 
)

Constructor.

Parameters
parentParent window of the window.
idWindow identifier.

Definition at line 73 of file ProximRegisterWindow.cc.

74 :
75 ProximUnitWindow(parent, id) {
76
77 valueList_->InsertColumn(0, _T("Register"), wxLIST_FORMAT_LEFT, 100);
78 valueList_->InsertColumn(1, _T("Value"), wxLIST_FORMAT_RIGHT, 120);
79
80 modeChoice_->Disable();
81
85
87 }
88}
wxListCtrl * valueList_
List widget for the values.
wxChoice * modeChoice_
Value display mode choicer widget.
SimulatorFrontend * simulator_
Simulator instance .
bool hasSimulationEnded() const
bool isSimulationInitialized() const
bool isSimulationStopped() const

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

Here is the call graph for this function:

◆ ~ProximRegisterWindow()

ProximRegisterWindow::~ProximRegisterWindow ( )
virtual

Destructor.

Definition at line 93 of file ProximRegisterWindow.cc.

93 {
94}

Member Function Documentation

◆ loadImmediateUnit()

void ProximRegisterWindow::loadImmediateUnit ( const TTAMachine::ImmediateUnit iu)
private

Loads register file registers to the register list.

Parameters
immImmediate Unit to display.

Definition at line 205 of file ProximRegisterWindow.cc.

205 {
206
207 valueList_->DeleteAllItems();
208
209 LongImmediateUnitState& immState =
211
212 // Append all registers to the register list.
213 int row = 0;
214 for (int i = 0; i < immState.immediateRegisterCount(); i++) {
215 wxString value;
216
217 const LongImmediateRegisterState& state =
218 immState.immediateRegister(i);
219
220 wxString mode = modeChoice_->GetStringSelection();
221
222 if (mode == MODE_UNSIGNED) {
224 } else if (mode == MODE_INT) {
225 int intValue = state.value().intValue();
226 value = WxConversion::toWxString(intValue);
227 } else if (mode == MODE_HEX) {
230 } else if (mode == MODE_BIN) {
231 int intValue = static_cast<int>(state.value().unsignedValue());
233 Conversion::toBinString(intValue));
234 }
235
236 DisassemblyRegister r(imm.name(), i);
237 valueList_->InsertItem(
238 row, WxConversion::toWxString(r.toString()));
239
240 valueList_->SetItem(row, 1, value);
241 row++;
242 }
243}
static std::string toBinString(int source)
Definition Conversion.cc:81
static std::string toHexString(T source, std::size_t digits=0, bool include0x=true)
virtual const SimValue & value() const
virtual LongImmediateRegisterState & immediateRegister(int i)
virtual int immediateRegisterCount() const
LongImmediateUnitState & longImmediateUnitState(const std::string &name)
static const wxString MODE_HEX
String for the mode choicer hexadecimal mode.
static const wxString MODE_INT
String for the mode choicer integer mode.
static const wxString MODE_BIN
String for the mode choicer binary mode.
static const wxString MODE_UNSIGNED
String for the mode choicer unsigned integer mode.
int intValue() const
Definition SimValue.cc:895
unsigned int unsignedValue() const
Definition SimValue.cc:919
MachineState & machineState(int core=-1)
static wxString toWxString(const std::string &source)
mode
Definition tceopgen.cc:45

References LongImmediateUnitState::immediateRegister(), LongImmediateUnitState::immediateRegisterCount(), SimValue::intValue(), MachineState::longImmediateUnitState(), SimulatorFrontend::machineState(), ProximUnitWindow::MODE_BIN, ProximUnitWindow::MODE_HEX, ProximUnitWindow::MODE_INT, ProximUnitWindow::MODE_UNSIGNED, ProximUnitWindow::modeChoice_, TTAMachine::Component::name(), ProximUnitWindow::simulator_, Conversion::toBinString(), Conversion::toHexString(), DisassemblyRegister::toString(), WxConversion::toWxString(), SimValue::unsignedValue(), LongImmediateRegisterState::value(), and ProximUnitWindow::valueList_.

Referenced by update().

Here is the call graph for this function:

◆ loadRegisterFile()

void ProximRegisterWindow::loadRegisterFile ( const TTAMachine::RegisterFile rf)
private

Loads register file registers to the register list.

Parameters
rfRegister file to display.

Definition at line 161 of file ProximRegisterWindow.cc.

161 {
162
163 valueList_->DeleteAllItems();
164
165 RegisterFileState& rfState =
167
168 // Append all registers to the register list.
169 int row = 0;
170 for (unsigned i = 0; i < rfState.registerCount(); i++) {
171 wxString value;
172 const RegisterState& state = rfState.registerState(i);
173
174 wxString mode = modeChoice_->GetStringSelection();
175
176 if (mode == MODE_UNSIGNED) {
178 } else if (mode == MODE_INT) {
179 int intValue = state.value().intValue();
180 value = WxConversion::toWxString(intValue);
181 } else if (mode == MODE_HEX) {
184 } else if (mode == MODE_BIN) {
185 int intValue = state.value().intValue();
187 Conversion::toBinString(intValue));
188 }
189
190 DisassemblyRegister r(rf.name(), i);
191 valueList_->InsertItem(
192 row, WxConversion::toWxString(r.toString()));
193
194 valueList_->SetItem(row, 1, value);
195 row++;
196 }
197}
RegisterFileState & registerFileState(const std::string &name)
virtual RegisterState & registerState(int index)
virtual std::size_t registerCount() const
virtual const SimValue & value() const
virtual TCEString name() const

References SimValue::intValue(), SimulatorFrontend::machineState(), ProximUnitWindow::MODE_BIN, ProximUnitWindow::MODE_HEX, ProximUnitWindow::MODE_INT, ProximUnitWindow::MODE_UNSIGNED, ProximUnitWindow::modeChoice_, TTAMachine::Component::name(), RegisterFileState::registerCount(), MachineState::registerFileState(), RegisterFileState::registerState(), ProximUnitWindow::simulator_, Conversion::toBinString(), Conversion::toHexString(), DisassemblyRegister::toString(), WxConversion::toWxString(), SimValue::unsignedValue(), RegisterState::value(), and ProximUnitWindow::valueList_.

Referenced by update().

Here is the call graph for this function:

◆ reinitialize()

void ProximRegisterWindow::reinitialize ( )
privatevirtual

Sets the available register file selections in the register file choice.

Reimplemented from ProximUnitWindow.

Definition at line 101 of file ProximRegisterWindow.cc.

101 {
102
103 unitChoice_->Clear();
104
105 // parallel simulation
106 const Machine::RegisterFileNavigator& rfNavigator =
108
109 for (int i = 0; i < rfNavigator.count(); i++) {
110 string rfName = RF_PREFIX + rfNavigator.item(i)->name();
111 unitChoice_->Append(WxConversion::toWxString(rfName));
112 }
113
114 const Machine::ImmediateUnitNavigator& immNavigator =
116 for (int i = 0; i < immNavigator.count(); i++) {
117 string rfName = IMM_PREFIX + immNavigator.item(i)->name();
118 unitChoice_->Append(WxConversion::toWxString(rfName));
119 }
120
121 unitChoice_->SetSelection(0);
122 update();
123}
static const std::string IMM_PREFIX
Prefix for immediate units in the unit choicer.
static const std::string RF_PREFIX
Prefix for register files in the unit choicer.
wxChoice * unitChoice_
Unit choicer widget.
const TTAMachine::Machine & machine() const
ComponentType * item(int index) const
virtual RegisterFileNavigator registerFileNavigator() const
Definition Machine.cc:450
virtual ImmediateUnitNavigator immediateUnitNavigator() const
Definition Machine.cc:416

References TTAMachine::Machine::Navigator< ComponentType >::count(), IMM_PREFIX, TTAMachine::Machine::immediateUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), SimulatorFrontend::machine(), TTAMachine::Machine::registerFileNavigator(), RF_PREFIX, ProximUnitWindow::simulator_, WxConversion::toWxString(), ProximUnitWindow::unitChoice_, and update().

Referenced by ProximRegisterWindow().

Here is the call graph for this function:

◆ showImmediateUnit()

void ProximRegisterWindow::showImmediateUnit ( const std::string &  name)

Sets the immediate unit dipslayed in the window.

Parameters
nameName of the immediate unit.

Definition at line 265 of file ProximRegisterWindow.cc.

265 {
266
267 unitChoice_->SetStringSelection(
269 update();
270}

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

Here is the call graph for this function:

◆ showRegisterFile()

void ProximRegisterWindow::showRegisterFile ( const std::string &  name)

Sets the registerfile displayed in the window.

Parameters
nameName of the register file.

Definition at line 252 of file ProximRegisterWindow.cc.

252 {
253
254 unitChoice_->SetStringSelection(
256 update();
257}

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

Referenced by ProximShowRegistersCmd::Do().

Here is the call graph for this function:

◆ update()

void ProximRegisterWindow::update ( )
privatevirtual

Event handler for the register file choicer.

When the choice selection changes, corresponding register file registers are loaded in the register list.

Reimplemented from ProximUnitWindow.

Definition at line 133 of file ProximRegisterWindow.cc.

133 {
134
135 int rfIndex = unitChoice_->GetSelection();
136
137 modeChoice_->Disable();
138 modeChoice_->Enable();
139
140 // Machine is not a universal machine.
141 const Machine::RegisterFileNavigator& rfNavigator =
143
144 if (rfIndex < rfNavigator.count()) {
145 loadRegisterFile(*rfNavigator.item(rfIndex));
146 } else {
147 const Machine::ImmediateUnitNavigator& immNavigator =
149
150 rfIndex = rfIndex - rfNavigator.count();
151 loadImmediateUnit(*immNavigator.item(rfIndex));
152 }
153}
void loadRegisterFile(const TTAMachine::RegisterFile &rf)
void loadImmediateUnit(const TTAMachine::ImmediateUnit &iu)

References TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::immediateUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), loadImmediateUnit(), loadRegisterFile(), SimulatorFrontend::machine(), ProximUnitWindow::modeChoice_, TTAMachine::Machine::registerFileNavigator(), ProximUnitWindow::simulator_, and ProximUnitWindow::unitChoice_.

Referenced by reinitialize(), showImmediateUnit(), and showRegisterFile().

Here is the call graph for this function:

Member Data Documentation

◆ IMM_PREFIX

const std::string ProximRegisterWindow::IMM_PREFIX = "IMM: "
staticprivate

Prefix for immediate units in the unit choicer.

Definition at line 70 of file ProximRegisterWindow.hh.

Referenced by reinitialize(), and showImmediateUnit().

◆ RF_PREFIX

const std::string ProximRegisterWindow::RF_PREFIX = "RF: "
staticprivate

Prefix for register files in the unit choicer.

Definition at line 68 of file ProximRegisterWindow.hh.

Referenced by reinitialize(), and showRegisterFile().


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