OpenASIP
2.0
|
#include <MemoryGridTable.hh>
Public Types | |
enum | SizeMode { SIZE_MAU, SIZE_TWO_MAUS, SIZE_FOUR_MAUS, SIZE_EIGHT_MAUS } |
enum | DataMode { DATA_BIN, DATA_HEX, DATA_SIGNED_INT, DATA_UNSIGNED_INT, DATA_DOUBLE, DATA_FLOAT } |
Public Member Functions | |
MemoryGridTable (Memory &memory) | |
virtual | ~MemoryGridTable () |
virtual int | GetNumberRows () |
virtual int | GetNumberCols () |
virtual bool | IsEmptyCell (int row, int col) |
virtual wxString | GetValue (int row, int col) |
virtual wxString | GetRowLabelValue (int row) |
virtual wxString | GetColLabelValue (int col) |
virtual void | SetValue (int row, int col, const wxString &value) |
void | writeValue (int row, int column, UIntWord memoryValue) |
void | writeValue (int row, int column, DoubleWord memoryValue) |
void | findAddress (Word addr, int &row, int &col) |
void | setNumberOfColumns (unsigned columns) |
void | setSizeMode (SizeMode mode) |
void | setDataMode (DataMode mode) |
unsigned | sizeOfCell () const |
Private Member Functions | |
Word | cellAddress (int row, int column) const |
wxString | memoryContents (ULongWord addr) |
Private Attributes | |
Memory & | memory_ |
Memory to access. More... | |
Word | start_ |
Start address of the memory range to display. More... | |
Word | end_ |
End address of the memory range to display. More... | |
DataMode | dataMode_ |
Current data mode of the window (hex/binary/int...). More... | |
SizeMode | sizeMode_ |
Current size mode of the window (1/2/4... MAUs per cell). More... | |
int | mauSize_ |
Size of MAU in bits. More... | |
unsigned | numberOfColumns_ |
Current number of columns in the grid. More... | |
Static Private Attributes | |
static const std::string | NOT_AVAILABLE = "N/A" |
String that is displayed in a cell that is not in the current AS. More... | |
static const int | COLUMNS |
static const Word | MAX_ROWS = 600000000 |
Maximum number of rows to display in the window. More... | |
Grid table class which allows wxGrid to access TargetMemory contents without copying the memory contents to separate table.
Definition at line 47 of file MemoryGridTable.hh.
Enumerator | |
---|---|
DATA_BIN | |
DATA_HEX | |
DATA_SIGNED_INT | |
DATA_UNSIGNED_INT | |
DATA_DOUBLE | |
DATA_FLOAT |
Definition at line 71 of file MemoryGridTable.hh.
Enumerator | |
---|---|
SIZE_MAU | |
SIZE_TWO_MAUS | |
SIZE_FOUR_MAUS | |
SIZE_EIGHT_MAUS |
Definition at line 64 of file MemoryGridTable.hh.
MemoryGridTable::MemoryGridTable | ( | Memory & | memory | ) |
The Constructor.
memory | Memory to display in the grid. |
Definition at line 49 of file MemoryGridTable.cc.
References Memory::end(), end_, Memory::MAUSize(), mauSize_, Memory::start(), and start_.
|
virtual |
|
private |
Calculates the address of given cell.
row | The selected row. |
colummn | The selected column. |
Definition at line 347 of file MemoryGridTable.cc.
References numberOfColumns_, and sizeOfCell().
Referenced by writeValue().
void MemoryGridTable::findAddress | ( | Word | addr, |
int & | row, | ||
int & | col | ||
) |
Returns row and column nubmer of the address in the table.
address | Memory address to find. |
row | Variable to set the row to. |
col | Variable to set the column to. |
Definition at line 364 of file MemoryGridTable.cc.
References numberOfColumns_, and sizeOfCell().
Referenced by MemoryControl::onGoTo().
|
virtual |
Returns column label of a grid column.
The label is the offset of the column compared to the first cell in the row.
col | Column number. |
Definition at line 175 of file MemoryGridTable.cc.
References sizeOfCell(), Conversion::toHexString(), and WxConversion::toWxString().
|
virtual |
Returns column count of the grid.
Definition at line 102 of file MemoryGridTable.cc.
References numberOfColumns_.
Referenced by MemoryControl::clearHighlights(), and MemoryControl::highlight().
|
virtual |
Returns row count of the grid.
The row count is limited to MAX_ROWS due to limtiations of wxGrid.
Definition at line 82 of file MemoryGridTable.cc.
References end_, MAX_ROWS, numberOfColumns_, sizeOfCell(), and start_.
|
virtual |
Returns row label of a grid row.
The label is the memory address of the first cell in the row.
row | Row number. |
Definition at line 156 of file MemoryGridTable.cc.
References numberOfColumns_, sizeOfCell(), start_, Conversion::toHexString(), and WxConversion::toWxString().
|
virtual |
Returns cell value as a wxString.
Returns memory contents corresponding to the cell coordinates. The memory value is formatted to the string depending on the size and type modes set.
row | Row of the cell. |
col | Column of the cell. |
Definition at line 132 of file MemoryGridTable.cc.
References end_, memoryContents(), NOT_AVAILABLE, numberOfColumns_, sizeOfCell(), start_, and WxConversion::toWxString().
|
virtual |
Returns true, if the given cell is empty, false otherwise.
row | Row of the cell. |
col | Column of the cell. |
Definition at line 115 of file MemoryGridTable.cc.
|
private |
Returns contents of the given memory contents as a wxString.
The string formatting depends on the current sizeMode_ and dataMode_ set.
addr | Memory address to return. |
Definition at line 199 of file MemoryGridTable.cc.
References BYTE_BITWIDTH, DATA_BIN, DATA_DOUBLE, DATA_FLOAT, DATA_HEX, DATA_SIGNED_INT, DATA_UNSIGNED_INT, dataMode_, end_, mauSize_, memory_, NOT_AVAILABLE, Memory::read(), sizeOfCell(), Conversion::toBinary(), Conversion::toHexString(), Conversion::toString(), and WxConversion::toWxString().
Referenced by GetValue().
void MemoryGridTable::setDataMode | ( | DataMode | mode | ) |
Sets the data display mode of the table.
mode | Data display mode to set. |
Definition at line 286 of file MemoryGridTable.cc.
References dataMode_.
Referenced by MemoryControl::onDataModeChanged().
void MemoryGridTable::setNumberOfColumns | ( | unsigned | columns | ) |
Sets the number of columns to display.
columns | New table width. |
Definition at line 275 of file MemoryGridTable.cc.
References numberOfColumns_.
Referenced by MemoryControl::onWidthChanged().
void MemoryGridTable::setSizeMode | ( | SizeMode | mode | ) |
Sets the memory size per cell.
mode | Size mode to set. |
Definition at line 297 of file MemoryGridTable.cc.
References sizeMode_.
Referenced by MemoryControl::onSizeModeChanged().
|
virtual |
Not implemented, use setCellValue() instead.
Definition at line 185 of file MemoryGridTable.cc.
unsigned MemoryGridTable::sizeOfCell | ( | ) | const |
Returns size of memory displayed in a single cell.
Definition at line 377 of file MemoryGridTable.cc.
References assert, SIZE_EIGHT_MAUS, SIZE_FOUR_MAUS, SIZE_MAU, SIZE_TWO_MAUS, and sizeMode_.
Referenced by cellAddress(), findAddress(), GetColLabelValue(), GetNumberRows(), GetRowLabelValue(), GetValue(), memoryContents(), MemoryControl::onWriteMemory(), MemoryControl::updateView(), and writeValue().
void MemoryGridTable::writeValue | ( | int | row, |
int | column, | ||
DoubleWord | memoryValue | ||
) |
Sets the memory value correspoding to a cell.
row | Row of the cell. |
column | Column of the cell. |
memoryValue | Value to set. |
Definition at line 329 of file MemoryGridTable.cc.
References Memory::advanceClock(), cellAddress(), end_, memory_, start_, and Memory::write().
void MemoryGridTable::writeValue | ( | int | row, |
int | column, | ||
UIntWord | memoryValue | ||
) |
Sets the memory value correspoding to a cell.
row | Row of the cell. |
column | Column of the cell. |
memoryValue | Value to set. |
Definition at line 310 of file MemoryGridTable.cc.
References Memory::advanceClock(), cellAddress(), end_, memory_, sizeOfCell(), start_, and Memory::write().
Referenced by MemoryControl::clearMemory(), and MemoryControl::onWriteMemory().
|
staticprivate |
Definition at line 98 of file MemoryGridTable.hh.
|
private |
Current data mode of the window (hex/binary/int...).
Definition at line 102 of file MemoryGridTable.hh.
Referenced by memoryContents(), and setDataMode().
|
private |
End address of the memory range to display.
Definition at line 94 of file MemoryGridTable.hh.
Referenced by GetNumberRows(), GetValue(), memoryContents(), MemoryGridTable(), and writeValue().
|
private |
Size of MAU in bits.
Definition at line 106 of file MemoryGridTable.hh.
Referenced by memoryContents(), and MemoryGridTable().
|
staticprivate |
Maximum number of rows to display in the window.
Definition at line 100 of file MemoryGridTable.hh.
Referenced by GetNumberRows().
|
private |
Memory to access.
Definition at line 90 of file MemoryGridTable.hh.
Referenced by memoryContents(), and writeValue().
|
staticprivate |
String that is displayed in a cell that is not in the current AS.
Definition at line 97 of file MemoryGridTable.hh.
Referenced by GetValue(), and memoryContents().
|
private |
Current number of columns in the grid.
Definition at line 108 of file MemoryGridTable.hh.
Referenced by cellAddress(), findAddress(), GetNumberCols(), GetNumberRows(), GetRowLabelValue(), GetValue(), and setNumberOfColumns().
|
private |
Current size mode of the window (1/2/4... MAUs per cell).
Definition at line 104 of file MemoryGridTable.hh.
Referenced by setSizeMode(), and sizeOfCell().
|
private |
Start address of the memory range to display.
Definition at line 92 of file MemoryGridTable.hh.
Referenced by GetNumberRows(), GetRowLabelValue(), GetValue(), MemoryGridTable(), and writeValue().