OpenASIP 2.2
Loading...
Searching...
No Matches
MemoryControl.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 MemoryControl.hh
26 *
27 * Declaration of MemoryControl class.
28 *
29 * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30 * @author Veli-Pekka Jääskeläinen 2005 (vjaaskel-no.spam-cs.tut.fi)
31 * @note rating: red
32 */
33
34#ifndef TTA_MEMORY_CONTROL_HH
35#define TTA_MEMORY_CONTROL_HH
36
37#include <wx/wx.h>
38#include <wx/grid.h>
39#include <vector>
40
41#include "BaseType.hh"
42#include "Exception.hh"
43
44class MemoryGridTable;
45class Memory;
46
47/**
48 * Widget for showing the contents of the memory.
49 *
50 * The contents of the memory is shown in bytes, half words, words, or
51 * double words, and either in binary, hexa, float, decimal, or double format.
52 */
53class MemoryControl : public wxPanel {
54public:
56 wxWindow* parent,
57 Memory* memory,
58 wxWindowID id = -1,
59 const wxPoint& pos = wxDefaultPosition,
60 const wxSize& size = wxDefaultSize,
61 const wxString& name = _T("MemoryControl"));
62
63 virtual ~MemoryControl();
64 void updateView();
65 void setMemory(Memory* memory);
66
67 void clearHighlights();
68 void highlight(Word address, unsigned count, const wxColour& colour);
69
70private:
71 /// Copying not allowed.
73 /// Assignment not allowed.
75
76 /// Size label for byte size.
77 static const std::string SIZE_MAU;
78 /// Size label for half word size.
79 static const std::string SIZE_TWO_MAUS;
80 /// Size label for word size.
81 static const std::string SIZE_FOUR_MAUS;
82 /// Size label for word size.
83 static const std::string SIZE_EIGHT_MAUS;
84
85 /// Data label for binary format.
86 static const std::string DATA_BIN;
87 /// Data label for hexa format.
88 static const std::string DATA_HEX;
89 /// Data label for signed int format.
90 static const std::string DATA_SIGNED_INT;
91 /// Data label for unsigned int format.
92 static const std::string DATA_UNSIGNED_INT;
93 /// Data label for float format.
94 static const std::string DATA_FLOAT;
95 /// Data label for double format.
96 static const std::string DATA_DOUBLE;
97
98 /// Table width label for 8 column mode
99 static const wxString WIDTH_8;
100 /// Table width label for 16 column mode
101 static const wxString WIDTH_16;
102 /// Table width label for 32 column mode
103 static const wxString WIDTH_32;
104
105 void createContents();
106 void onGoTo(wxCommandEvent& event);
107 void onSizeModeChanged(wxCommandEvent&);
108 void onDataModeChanged(wxCommandEvent&);
109 void onWidthChanged(wxCommandEvent&);
110 void onSize(wxSizeEvent&);
111 void onWriteMemory(wxGridEvent& event);
112 void onChar(wxKeyEvent& event);
113 void clearMemory();
114 void copySelection();
115
116 /// Used for access to memory contents.
118 /// Size of the minimum addressable unit.
120 /// Start point of memory.
121 Word start_;
122 /// End point of memory.
123 Word end_;
124 /// Grid in which the contents of the memory is written.
125 wxGrid* grid_;
126 /// Mode of the data in the cells.
127 wxChoice* dataMode_;
128 /// Mode of the data size.
129 wxChoice* sizeMode_;
130 /// Grid width choicer.
131 wxChoice* widthMode_;
132 /// Go to address.
133 wxString goToAddress_;
134 /// Grid contents.
136 /// Top level sizer of the window.
137 wxBoxSizer* sizer_;
138 /// Number of maus displayed in a cell.
139 unsigned mausPerCell_;
140
141 std::vector<unsigned> highlights_;
142 /**
143 * Widget ids.
144 */
145 enum {
153 };
154
155 DECLARE_EVENT_TABLE()
156};
157
158#endif
MemoryGridTable * table_
Grid contents.
void highlight(Word address, unsigned count, const wxColour &colour)
static const std::string DATA_SIGNED_INT
Data label for signed int format.
void onGoTo(wxCommandEvent &event)
static const wxString WIDTH_16
Table width label for 16 column mode.
wxString goToAddress_
Go to address.
Word end_
End point of memory.
static const std::string DATA_UNSIGNED_INT
Data label for unsigned int format.
MemoryControl(const MemoryControl &)
Copying not allowed.
Word start_
Start point of memory.
void setMemory(Memory *memory)
MemoryControl & operator=(const MemoryControl &)
Assignment not allowed.
static const std::string SIZE_MAU
Size label for byte size.
static const std::string DATA_DOUBLE
Data label for double format.
Memory * memory_
Used for access to memory contents.
void onChar(wxKeyEvent &event)
static const wxString WIDTH_32
Table width label for 32 column mode.
static const wxString WIDTH_8
Table width label for 8 column mode.
virtual ~MemoryControl()
void onSizeModeChanged(wxCommandEvent &)
static const std::string DATA_BIN
Data label for binary format.
static const std::string SIZE_EIGHT_MAUS
Size label for word size.
wxGrid * grid_
Grid in which the contents of the memory is written.
wxBoxSizer * sizer_
Top level sizer of the window.
void onSize(wxSizeEvent &)
static const std::string DATA_FLOAT
Data label for float format.
void onWriteMemory(wxGridEvent &event)
static const std::string SIZE_FOUR_MAUS
Size label for word size.
wxChoice * sizeMode_
Mode of the data size.
std::vector< unsigned > highlights_
int MAUSize_
Size of the minimum addressable unit.
wxChoice * widthMode_
Grid width choicer.
wxChoice * dataMode_
Mode of the data in the cells.
static const std::string DATA_HEX
Data label for hexa format.
void onWidthChanged(wxCommandEvent &)
static const std::string SIZE_TWO_MAUS
Size label for half word size.
void onDataModeChanged(wxCommandEvent &)
unsigned mausPerCell_
Number of maus displayed in a cell.