OpenASIP  2.0
MemoryGridTable.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file MemoryGridTable.hh
26  *
27  * Declaration of MemoryGridTable class.
28  *
29  * @author Veli-Pekka Jääskeläinen 2005 (vjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_MEMORY_GRID_TABLE_HH
34 #define TTA_MEMORY_GRID_TABLE_HH
35 
36 #include <string>
37 #include <wx/wx.h>
38 #include <wx/grid.h>
39 #include "BaseType.hh"
40 
41 class Memory;
42 
43 /**
44  * Grid table class which allows wxGrid to access TargetMemory contents
45  * without copying the memory contents to separate table.
46  */
47 class MemoryGridTable : public wxGridTableBase {
48 public:
49  MemoryGridTable(Memory& memory);
50  virtual ~MemoryGridTable();
51  virtual int GetNumberRows();
52  virtual int GetNumberCols();
53  virtual bool IsEmptyCell(int row, int col);
54  virtual wxString GetValue(int row, int col);
55  virtual wxString GetRowLabelValue(int row);
56  virtual wxString GetColLabelValue(int col);
57  virtual void SetValue(int row, int col, const wxString& value);
58 
59  void writeValue(int row, int column, UIntWord memoryValue);
60  void writeValue(int row, int column, DoubleWord memoryValue);
61  void findAddress(Word addr, int& row, int& col);
62  void setNumberOfColumns(unsigned columns);
63 
64  enum SizeMode {
69  };
70 
71  enum DataMode {
78  };
79 
82  unsigned sizeOfCell() const;
83 
84 
85 private:
86  Word cellAddress(int row, int column) const;
87  wxString memoryContents(ULongWord addr);
88 
89  /// Memory to access.
91  /// Start address of the memory range to display.
92  Word start_;
93  /// End address of the memory range to display.
94  Word end_;
95 
96  /// String that is displayed in a cell that is not in the current AS.
97  static const std::string NOT_AVAILABLE;
98  static const int COLUMNS;
99  /// Maximum number of rows to display in the window.
100  static const Word MAX_ROWS;
101  /// Current data mode of the window (hex/binary/int...).
103  /// Current size mode of the window (1/2/4... MAUs per cell).
105  /// Size of MAU in bits.
106  int mauSize_;
107  /// Current number of columns in the grid.
109 };
110 
111 #endif
UIntWord
Word UIntWord
Definition: BaseType.hh:144
MemoryGridTable::memory_
Memory & memory_
Memory to access.
Definition: MemoryGridTable.hh:90
MemoryGridTable::sizeMode_
SizeMode sizeMode_
Current size mode of the window (1/2/4... MAUs per cell).
Definition: MemoryGridTable.hh:104
BaseType.hh
mode
mode
Definition: tceopgen.cc:45
MemoryGridTable::setDataMode
void setDataMode(DataMode mode)
Definition: MemoryGridTable.cc:286
MemoryGridTable::SetValue
virtual void SetValue(int row, int col, const wxString &value)
Definition: MemoryGridTable.cc:185
MemoryGridTable::GetNumberRows
virtual int GetNumberRows()
Definition: MemoryGridTable.cc:82
MemoryGridTable::memoryContents
wxString memoryContents(ULongWord addr)
Definition: MemoryGridTable.cc:199
MemoryGridTable::GetNumberCols
virtual int GetNumberCols()
Definition: MemoryGridTable.cc:102
MemoryGridTable::IsEmptyCell
virtual bool IsEmptyCell(int row, int col)
Definition: MemoryGridTable.cc:115
MemoryGridTable::SIZE_MAU
@ SIZE_MAU
Definition: MemoryGridTable.hh:65
MemoryGridTable::DATA_SIGNED_INT
@ DATA_SIGNED_INT
Definition: MemoryGridTable.hh:74
MemoryGridTable
Definition: MemoryGridTable.hh:47
MemoryGridTable::SizeMode
SizeMode
Definition: MemoryGridTable.hh:64
MemoryGridTable::DATA_UNSIGNED_INT
@ DATA_UNSIGNED_INT
Definition: MemoryGridTable.hh:75
MemoryGridTable::numberOfColumns_
unsigned numberOfColumns_
Current number of columns in the grid.
Definition: MemoryGridTable.hh:108
MemoryGridTable::DATA_HEX
@ DATA_HEX
Definition: MemoryGridTable.hh:73
MemoryGridTable::DataMode
DataMode
Definition: MemoryGridTable.hh:71
MemoryGridTable::DATA_FLOAT
@ DATA_FLOAT
Definition: MemoryGridTable.hh:77
MemoryGridTable::SIZE_EIGHT_MAUS
@ SIZE_EIGHT_MAUS
Definition: MemoryGridTable.hh:68
MemoryGridTable::start_
Word start_
Start address of the memory range to display.
Definition: MemoryGridTable.hh:92
MemoryGridTable::GetValue
virtual wxString GetValue(int row, int col)
Definition: MemoryGridTable.cc:132
MemoryGridTable::GetRowLabelValue
virtual wxString GetRowLabelValue(int row)
Definition: MemoryGridTable.cc:156
MemoryGridTable::dataMode_
DataMode dataMode_
Current data mode of the window (hex/binary/int...).
Definition: MemoryGridTable.hh:102
DoubleWord
double DoubleWord
Definition: BaseType.hh:166
MemoryGridTable::findAddress
void findAddress(Word addr, int &row, int &col)
Definition: MemoryGridTable.cc:364
MemoryGridTable::GetColLabelValue
virtual wxString GetColLabelValue(int col)
Definition: MemoryGridTable.cc:175
MemoryGridTable::mauSize_
int mauSize_
Size of MAU in bits.
Definition: MemoryGridTable.hh:106
MemoryGridTable::COLUMNS
static const int COLUMNS
Definition: MemoryGridTable.hh:98
MemoryGridTable::writeValue
void writeValue(int row, int column, UIntWord memoryValue)
Definition: MemoryGridTable.cc:310
MemoryGridTable::DATA_DOUBLE
@ DATA_DOUBLE
Definition: MemoryGridTable.hh:76
MemoryGridTable::setNumberOfColumns
void setNumberOfColumns(unsigned columns)
Definition: MemoryGridTable.cc:275
MemoryGridTable::MAX_ROWS
static const Word MAX_ROWS
Maximum number of rows to display in the window.
Definition: MemoryGridTable.hh:100
MemoryGridTable::setSizeMode
void setSizeMode(SizeMode mode)
Definition: MemoryGridTable.cc:297
MemoryGridTable::MemoryGridTable
MemoryGridTable(Memory &memory)
Definition: MemoryGridTable.cc:49
MemoryGridTable::end_
Word end_
End address of the memory range to display.
Definition: MemoryGridTable.hh:94
ULongWord
unsigned long ULongWord
Definition: BaseType.hh:51
MemoryGridTable::SIZE_FOUR_MAUS
@ SIZE_FOUR_MAUS
Definition: MemoryGridTable.hh:67
MemoryGridTable::cellAddress
Word cellAddress(int row, int column) const
Definition: MemoryGridTable.cc:347
MemoryGridTable::sizeOfCell
unsigned sizeOfCell() const
Definition: MemoryGridTable.cc:377
MemoryGridTable::DATA_BIN
@ DATA_BIN
Definition: MemoryGridTable.hh:72
MemoryGridTable::SIZE_TWO_MAUS
@ SIZE_TWO_MAUS
Definition: MemoryGridTable.hh:66
Memory
Definition: Memory.hh:74
MemoryGridTable::NOT_AVAILABLE
static const std::string NOT_AVAILABLE
String that is displayed in a cell that is not in the current AS.
Definition: MemoryGridTable.hh:97
MemoryGridTable::~MemoryGridTable
virtual ~MemoryGridTable()
Definition: MemoryGridTable.cc:70