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

#include <BusDialog.hh>

Inheritance diagram for BusDialog:
Inheritance graph
Collaboration diagram for BusDialog:
Collaboration graph

Public Member Functions

 BusDialog (wxWindow *parent, TTAMachine::Bus *bus)
 
virtual ~BusDialog ()
 

Private Types

enum  {
  ID_BUS_NAME = 10000 , ID_BUS_WIDTH , ID_SI_WIDTH , ID_SI_EXTENSION ,
  ID_TRUE_GUARD , ID_FALSE_GUARD , ID_SEGMENT_LIST , ID_SEGMENT_NAME ,
  ID_SEGMENT_UP , ID_SEGMENT_DOWN , ID_ADD_SEGMENT , ID_DELETE_SEGMENT ,
  ID_RF_GUARD_LIST , ID_ADD_RF_GUARD , ID_EDIT_RF_GUARD , ID_DELETE_RF_GUARD ,
  ID_FU_GUARD_LIST , ID_ADD_FU_GUARD , ID_EDIT_FU_GUARD , ID_DELETE_FU_GUARD ,
  ID_HELP , ID_LABEL_BUS_NAME , ID_LABEL_BUS_WIDTH , ID_LABEL_WIDTH ,
  ID_LABEL_SI_WIDTH , ID_LABEL_SEGMENT_NAME
}
 enumerated IDs for dialog controls More...
 

Private Member Functions

virtual bool TransferDataToWindow ()
 
void onOK (wxCommandEvent &)
 
void onHelp (wxCommandEvent &event)
 
void onBusName (wxCommandEvent &)
 
void onAddSegment (wxCommandEvent &)
 
void onSegmentName (wxCommandEvent &)
 
void onSegmentSelection (wxListEvent &)
 
void onSegmentRightClick (wxListEvent &event)
 
void onDeleteSegment (wxCommandEvent &)
 
void onSegmentUp (wxCommandEvent &)
 
void onSegmentDown (wxCommandEvent &)
 
void setTexts ()
 
void onRFGuardSelection (wxListEvent &)
 
void onAddRFGuard (wxCommandEvent &)
 
void onDeleteRFGuard (wxCommandEvent &)
 
void onEditRFGuard (wxCommandEvent &)
 
void onFUGuardSelection (wxListEvent &)
 
void onAddFUGuard (wxCommandEvent &)
 
void onDeleteFUGuard (wxCommandEvent &)
 
void onEditFUGuard (wxCommandEvent &)
 
void onUnconditionalGuard (wxCommandEvent &)
 
void onWidth (wxSpinEvent &)
 
void updateSegmentList ()
 
void updateGuardLists ()
 
void onRFGuardRightClick (wxListEvent &event)
 
void onActivateRFGuard (wxListEvent &event)
 
void onFUGuardRightClick (wxListEvent &event)
 
void onActivateFUGuard (wxListEvent &event)
 
TTAMachine::SegmentselectedSegment () const
 
TTAMachine::RegisterGuardselectedRFGuard () const
 
TTAMachine::PortGuardselectedFUGuard () const
 
wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 

Private Attributes

TTAMachine::Busbus_
 Transport Bus to edit.
 
wxString name_
 Name of the bus.
 
int width_
 Width of the bus.
 
int immWidth_
 Short immediate width.
 
wxString newSegName_
 Name for a new segment.
 
wxListCtrl * segList_
 List widget for the segment list.
 
wxCheckBox * alwaysTrueGuard_
 Check box for always true unconditional guard.
 
wxCheckBox * alwaysFalseGuard_
 Check box for always false unconditional guard.
 
wxRadioBox * immediateExtensionBox_
 Radio box for immediate extension.
 
wxListCtrl * rfGuardList_
 Register file guard list control.
 
wxListCtrl * fuGuardList_
 Function unit port guard list control.
 
wxStaticBoxSizer * busSizer_
 Static boxsizer for the bus properties.
 
wxStaticBoxSizer * siSizer_
 Static boxsizer for the short immediate properties.
 
wxStaticBoxSizer * registerGuardSizer_
 Static boxsizer for the register guard properties.
 
wxStaticBoxSizer * portGuardSizer_
 Static boxsizer for the port guard properties.
 
wxStaticBoxSizer * segmentSizer_
 Static boxsizer for the segment properties.
 
vector< TTAMachine::RegisterGuard * > registerGuards_
 list of register guards
 
vector< TTAMachine::PortGuard * > portGuards_
 list of port guards
 

Detailed Description

Dialog for querying transport bus parameters from the user.

Definition at line 54 of file BusDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

enumerated IDs for dialog controls

Enumerator
ID_BUS_NAME 
ID_BUS_WIDTH 
ID_SI_WIDTH 
ID_SI_EXTENSION 
ID_TRUE_GUARD 
ID_FALSE_GUARD 
ID_SEGMENT_LIST 
ID_SEGMENT_NAME 
ID_SEGMENT_UP 
ID_SEGMENT_DOWN 
ID_ADD_SEGMENT 
ID_DELETE_SEGMENT 
ID_RF_GUARD_LIST 
ID_ADD_RF_GUARD 
ID_EDIT_RF_GUARD 
ID_DELETE_RF_GUARD 
ID_FU_GUARD_LIST 
ID_ADD_FU_GUARD 
ID_EDIT_FU_GUARD 
ID_DELETE_FU_GUARD 
ID_HELP 
ID_LABEL_BUS_NAME 
ID_LABEL_BUS_WIDTH 
ID_LABEL_WIDTH 
ID_LABEL_SI_WIDTH 
ID_LABEL_SEGMENT_NAME 

Definition at line 138 of file BusDialog.hh.

138 {
139 ID_BUS_NAME = 10000,
159 ID_HELP,
165 };
@ ID_EDIT_RF_GUARD
Definition BusDialog.hh:153
@ ID_EDIT_FU_GUARD
Definition BusDialog.hh:157
@ ID_SEGMENT_NAME
Definition BusDialog.hh:146
@ ID_RF_GUARD_LIST
Definition BusDialog.hh:151
@ ID_DELETE_SEGMENT
Definition BusDialog.hh:150
@ ID_LABEL_SEGMENT_NAME
Definition BusDialog.hh:164
@ ID_DELETE_RF_GUARD
Definition BusDialog.hh:154
@ ID_ADD_FU_GUARD
Definition BusDialog.hh:156
@ ID_SEGMENT_LIST
Definition BusDialog.hh:145
@ ID_SI_EXTENSION
Definition BusDialog.hh:142
@ ID_LABEL_BUS_WIDTH
Definition BusDialog.hh:161
@ ID_ADD_RF_GUARD
Definition BusDialog.hh:152
@ ID_SEGMENT_DOWN
Definition BusDialog.hh:148
@ ID_DELETE_FU_GUARD
Definition BusDialog.hh:158
@ ID_LABEL_SI_WIDTH
Definition BusDialog.hh:163
@ ID_FU_GUARD_LIST
Definition BusDialog.hh:155
@ ID_LABEL_BUS_NAME
Definition BusDialog.hh:160

Constructor & Destructor Documentation

◆ BusDialog()

BusDialog::BusDialog ( wxWindow *  parent,
TTAMachine::Bus bus 
)

The Constructor.

Parameters
parentParent window of the dialog.
busTransport bus to be modified with the dialog.

Definition at line 122 of file BusDialog.cc.

124 :
125 wxDialog(parent, -1, _T(""), wxDefaultPosition, wxSize(300, 300)),
126 bus_(bus),
127 name_(_T("")),
130 newSegName_(_T("")),
131 alwaysTrueGuard_(NULL),
132 alwaysFalseGuard_(NULL),
134 rfGuardList_(NULL),
135 fuGuardList_(NULL) {
136
137 createContents(this, true, true);
138
139 FindWindow(wxID_OK)->Disable();
140 FindWindow(ID_ADD_SEGMENT)->Disable();
141 FindWindow(ID_DELETE_SEGMENT)->Disable();
142 FindWindow(ID_SEGMENT_UP)->Disable();
143 FindWindow(ID_SEGMENT_DOWN)->Disable();
144 FindWindow(ID_EDIT_RF_GUARD)->Disable();
145 FindWindow(ID_DELETE_RF_GUARD)->Disable();
146 FindWindow(ID_EDIT_FU_GUARD)->Disable();
147 FindWindow(ID_DELETE_FU_GUARD)->Disable();
148
149 rfGuardList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_RF_GUARD_LIST));
150 fuGuardList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_FU_GUARD_LIST));
151 segList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_SEGMENT_LIST));
152
154 dynamic_cast<wxRadioBox*>(FindWindow(ID_SI_EXTENSION));
156 dynamic_cast<wxCheckBox*>(FindWindow(ID_TRUE_GUARD));
158 dynamic_cast<wxCheckBox*>(FindWindow(ID_FALSE_GUARD));
159
160 FindWindow(ID_BUS_NAME)->SetValidator(
161 wxTextValidator(wxFILTER_ASCII, &name_));
162 FindWindow(ID_SEGMENT_NAME)->SetValidator(
163 wxTextValidator(wxFILTER_ASCII, &newSegName_));
164 FindWindow(ID_BUS_WIDTH)->SetValidator(wxGenericValidator(&width_));
165 FindWindow(ID_SI_WIDTH)->SetValidator(wxGenericValidator(&immWidth_));
166
167 // set widget texts
168 setTexts();
169
171
172 FindWindow(ID_BUS_NAME)->SetFocus();
173
174 // Editing segments is unsupported feature => hide segment ui
175 segmentSizer_->Show(false);
176 GetSizer()->SetSizeHints(this);
177}
wxString newSegName_
Name for a new segment.
Definition BusDialog.hh:105
wxListCtrl * rfGuardList_
Register file guard list control.
Definition BusDialog.hh:116
wxListCtrl * fuGuardList_
Function unit port guard list control.
Definition BusDialog.hh:118
wxCheckBox * alwaysFalseGuard_
Check box for always false unconditional guard.
Definition BusDialog.hh:112
wxRadioBox * immediateExtensionBox_
Radio box for immediate extension.
Definition BusDialog.hh:114
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
void setTexts()
Definition BusDialog.cc:192
wxListCtrl * segList_
List widget for the segment list.
Definition BusDialog.hh:108
virtual bool TransferDataToWindow()
Definition BusDialog.cc:337
int width_
Width of the bus.
Definition BusDialog.hh:101
wxString name_
Name of the bus.
Definition BusDialog.hh:99
int immWidth_
Short immediate width.
Definition BusDialog.hh:103
wxCheckBox * alwaysTrueGuard_
Check box for always true unconditional guard.
Definition BusDialog.hh:110
wxStaticBoxSizer * segmentSizer_
Static boxsizer for the segment properties.
Definition BusDialog.hh:129
TTAMachine::Bus * bus_
Transport Bus to edit.
Definition BusDialog.hh:97
static const int DEFAULT_WIDTH
Default bit width.

◆ ~BusDialog()

BusDialog::~BusDialog ( )
virtual

The Destructor.

Definition at line 184 of file BusDialog.cc.

184 {
185}

Member Function Documentation

◆ createContents()

wxSizer * BusDialog::createContents ( wxWindow *  parent,
bool  call_fit,
bool  set_sizer 
)
private

Creates the dialog window contents.

This method was generated with wxDesigner. Don't modify manually, all chnages will be lost if the code is regenerated.

Returns
Main sizer of the created contents.
Parameters
parentThe dialog window.
call_fitIf true, fits the contents inside the dialog.
set_sizerIf true, sets the main sizer as dialog contents.

Definition at line 1178 of file BusDialog.cc.

1178 {
1179
1180 wxFlexGridSizer *item0 = new wxFlexGridSizer( 2, 0, 0 );
1181
1182 wxBoxSizer *item1 = new wxBoxSizer( wxVERTICAL );
1183
1184 wxStaticBox *item3 = new wxStaticBox( parent, -1, wxT("Bus:") );
1185 wxStaticBoxSizer *item2 = new wxStaticBoxSizer( item3, wxVERTICAL );
1186 busSizer_ = item2;
1187
1188 wxBoxSizer *item4 = new wxBoxSizer( wxHORIZONTAL );
1189
1190 wxStaticText *item5 = new wxStaticText( parent, ID_LABEL_BUS_NAME, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
1191 item4->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
1192
1193 wxTextCtrl *item6 = new wxTextCtrl( parent, ID_BUS_NAME, wxT(""), wxDefaultPosition, wxSize(200,-1), 0 );
1194 item4->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
1195
1196 item2->Add( item4, 0, wxGROW|wxALL, 5 );
1197
1198 wxBoxSizer *item7 = new wxBoxSizer( wxHORIZONTAL );
1199
1200 wxStaticText *item8 = new wxStaticText( parent, ID_LABEL_BUS_WIDTH, wxT("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
1201 item7->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
1202
1203 wxSpinCtrl *item9 = new wxSpinCtrl( parent, ID_BUS_WIDTH, wxT("1"), wxDefaultPosition, wxSize(-1,-1), 0, 1, 1024, 1 );
1204 item7->Add( item9, 0, wxALIGN_CENTER|wxALL, 5 );
1205
1206 item2->Add( item7, 0, wxGROW|wxALL, 5 );
1207
1208 item0->Add( item2, 0, wxGROW|wxALL, 5 );
1209 //item1->Add( item2, 0, wxGROW|wxALL, 5 );
1210
1211 wxStaticBox *item11 = new wxStaticBox( parent, -1, wxT("Short Immediate:") );
1212 wxStaticBoxSizer *item10 = new wxStaticBoxSizer( item11, wxVERTICAL );
1213 siSizer_ = item10;
1214
1215 wxBoxSizer *item12 = new wxBoxSizer( wxHORIZONTAL );
1216
1217 wxStaticText *item13 = new wxStaticText( parent, ID_LABEL_SI_WIDTH, wxT("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
1218 item12->Add( item13, 0, wxALIGN_CENTER|wxALL, 5 );
1219
1220 wxSpinCtrl *item14 = new wxSpinCtrl( parent, ID_SI_WIDTH, wxT("0"), wxDefaultPosition, wxSize(-1,-1), 0, 0, 1000, 0 );
1221 item12->Add( item14, 0, wxALIGN_CENTER|wxALL, 5 );
1222
1223 item10->Add( item12, 0, wxGROW|wxALL, 5 );
1224
1225 wxString strs15[] =
1226 {
1227 wxT("Zero"),
1228 wxT("Sign")
1229 };
1230 wxRadioBox *item15 = new wxRadioBox( parent, ID_SI_EXTENSION, wxT("Extension"), wxDefaultPosition, wxDefaultSize, 2, strs15, 1, wxRA_SPECIFY_ROWS );
1231 item10->Add( item15, 0, wxALL, 5 );
1232
1233 item0->Add( item10, 0, wxGROW|wxALL, 5 );
1234 //item1->Add( item10, 0, wxGROW|wxALL, 5 );
1235
1236 wxCheckBox *item16 = new wxCheckBox( parent, ID_TRUE_GUARD, wxT("Always true guard"), wxDefaultPosition, wxDefaultSize, 0 );
1237 item1->Add( item16, 0, wxALL, 5 );
1238
1239 wxCheckBox *item17 = new wxCheckBox( parent, ID_FALSE_GUARD, wxT("Always false guard"), wxDefaultPosition, wxDefaultSize, 0 );
1240 item1->Add( item17, 0, wxALL, 5 );
1241
1242 item0->Add( item1, 0, wxGROW|wxALL, 5 );
1243
1244 wxStaticBox *item19 = new wxStaticBox( parent, -1, wxT("Segements:") );
1245 wxStaticBoxSizer *item18 = new wxStaticBoxSizer( item19, wxVERTICAL );
1246 segmentSizer_ = item18;
1247
1248 wxListCtrl *item20 = new wxListCtrl( parent, ID_SEGMENT_LIST, wxDefaultPosition, wxSize(300,160), wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER );
1249 item18->Add( item20, 0, wxALIGN_CENTER|wxALL, 5 );
1250
1251 wxBoxSizer *item21 = new wxBoxSizer( wxHORIZONTAL );
1252
1253 wxStaticText *item22 = new wxStaticText( parent, ID_LABEL_SEGMENT_NAME, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
1254 item21->Add( item22, 0, wxALIGN_CENTER|wxALL, 5 );
1255
1256 wxTextCtrl *item23 = new wxTextCtrl( parent, ID_SEGMENT_NAME, wxT(""), wxDefaultPosition, wxSize(100,-1), 0 );
1257 item21->Add( item23, 0, wxALIGN_CENTER|wxALL, 5 );
1258
1259 wxBoxSizer *item24 = new wxBoxSizer( wxHORIZONTAL );
1260
1261 wxButton *item25 = new wxButton( parent, ID_SEGMENT_UP, wxT("Up"), wxDefaultPosition, wxSize(40,-1), 0 );
1262 item24->Add( item25, 0, wxALIGN_CENTER|wxALL, 5 );
1263
1264 wxButton *item26 = new wxButton( parent, ID_SEGMENT_DOWN, wxT("Down"), wxDefaultPosition, wxSize(50,-1), 0 );
1265 item24->Add( item26, 0, wxALIGN_CENTER|wxALL, 5 );
1266
1267 item21->Add( item24, 0, wxALL, 5 );
1268
1269 item18->Add( item21, 0, wxGROW|wxALL, 5 );
1270
1271 wxBoxSizer *item27 = new wxBoxSizer( wxHORIZONTAL );
1272
1273 wxButton *item28 = new wxButton( parent, ID_ADD_SEGMENT, wxT("Add"), wxDefaultPosition, wxDefaultSize, 0 );
1274 item27->Add( item28, 0, wxALIGN_CENTER|wxALL, 5 );
1275
1276 item27->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
1277
1278 wxButton *item29 = new wxButton( parent, ID_DELETE_SEGMENT, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
1279 item27->Add( item29, 0, wxALIGN_CENTER|wxALL, 5 );
1280
1281 item18->Add( item27, 0, wxALIGN_CENTER|wxALL, 5 );
1282
1283 item0->Add( item18, 0, wxALL, 5 );
1284
1285 wxStaticBox *item31 = new wxStaticBox( parent, -1, wxT("Register File Guards:") );
1286 wxStaticBoxSizer *item30 = new wxStaticBoxSizer( item31, wxVERTICAL );
1287 registerGuardSizer_ = item30;
1288
1289 wxListCtrl *item32 = new wxListCtrl( parent, ID_RF_GUARD_LIST, wxDefaultPosition, wxSize(300,120), wxLC_REPORT|wxSUNKEN_BORDER );
1290 item30->Add( item32, 0, wxALIGN_CENTER|wxALL, 5 );
1291
1292 wxBoxSizer *item33 = new wxBoxSizer( wxHORIZONTAL );
1293
1294 wxButton *item34 = new wxButton( parent, ID_ADD_RF_GUARD, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0 );
1295 item33->Add( item34, 0, wxALIGN_CENTER|wxALL, 5 );
1296
1297 wxButton *item35 = new wxButton( parent, ID_EDIT_RF_GUARD, wxT("Edit..."), wxDefaultPosition, wxDefaultSize, 0 );
1298 item35->Enable( false );
1299 item33->Add( item35, 0, wxALIGN_CENTER|wxALL, 5 );
1300
1301 wxButton *item36 = new wxButton( parent, ID_DELETE_RF_GUARD, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
1302 item36->Enable( false );
1303 item33->Add( item36, 0, wxALIGN_CENTER|wxALL, 5 );
1304
1305 item30->Add( item33, 0, wxALIGN_CENTER|wxALL, 5 );
1306
1307 item0->Add( item30, 0, wxGROW|wxALL, 5 );
1308
1309 wxStaticBox *item38 = new wxStaticBox( parent, -1, wxT("Function Unit Guards") );
1310 wxStaticBoxSizer *item37 = new wxStaticBoxSizer( item38, wxVERTICAL );
1311 portGuardSizer_ = item37;
1312
1313 wxListCtrl *item39 = new wxListCtrl( parent, ID_FU_GUARD_LIST, wxDefaultPosition, wxSize(300,120), wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER );
1314 item37->Add( item39, 0, wxALIGN_CENTER|wxALL, 5 );
1315
1316 wxBoxSizer *item40 = new wxBoxSizer( wxHORIZONTAL );
1317
1318 wxButton *item41 = new wxButton( parent, ID_ADD_FU_GUARD, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0 );
1319 item40->Add( item41, 0, wxALIGN_CENTER|wxALL, 5 );
1320
1321 wxButton *item42 = new wxButton( parent, ID_EDIT_FU_GUARD, wxT("Edit..."), wxDefaultPosition, wxDefaultSize, 0 );
1322 item42->Enable( false );
1323 item40->Add( item42, 0, wxALIGN_CENTER|wxALL, 5 );
1324
1325 wxButton *item43 = new wxButton( parent, ID_DELETE_FU_GUARD, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
1326 item43->Enable( false );
1327 item40->Add( item43, 0, wxALIGN_CENTER|wxALL, 5 );
1328
1329 item37->Add( item40, 0, wxALIGN_CENTER|wxALL, 5 );
1330
1331 item0->Add( item37, 0, wxGROW|wxALL, 5 );
1332
1333 wxButton *item44 = new wxButton( parent, ID_HELP, wxT("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
1334 item0->Add( item44, 0, wxALL, 5 );
1335
1336 wxBoxSizer *item45 = new wxBoxSizer( wxHORIZONTAL );
1337
1338 wxButton *item46 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
1339 item45->Add( item46, 0, wxALIGN_CENTER|wxALL, 5 );
1340
1341 wxButton *item47 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
1342 item45->Add( item47, 0, wxALIGN_CENTER|wxALL, 5 );
1343
1344 item0->Add( item45, 0, wxALL, 5 );
1345
1346 if (set_sizer)
1347 {
1348 parent->SetSizer( item0 );
1349 if (call_fit)
1350 item0->SetSizeHints( parent );
1351 }
1352
1353 return item0;
1354}
wxStaticBoxSizer * registerGuardSizer_
Static boxsizer for the register guard properties.
Definition BusDialog.hh:125
wxStaticBoxSizer * siSizer_
Static boxsizer for the short immediate properties.
Definition BusDialog.hh:123
wxStaticBoxSizer * busSizer_
Static boxsizer for the bus properties.
Definition BusDialog.hh:121
wxStaticBoxSizer * portGuardSizer_
Static boxsizer for the port guard properties.
Definition BusDialog.hh:127

References busSizer_, ID_ADD_FU_GUARD, ID_ADD_RF_GUARD, ID_ADD_SEGMENT, ID_BUS_NAME, ID_BUS_WIDTH, ID_DELETE_FU_GUARD, ID_DELETE_RF_GUARD, ID_DELETE_SEGMENT, ID_EDIT_FU_GUARD, ID_EDIT_RF_GUARD, ID_FALSE_GUARD, ID_FU_GUARD_LIST, ID_HELP, ID_LABEL_BUS_NAME, ID_LABEL_BUS_WIDTH, ID_LABEL_SEGMENT_NAME, ID_LABEL_SI_WIDTH, ID_RF_GUARD_LIST, ID_SEGMENT_DOWN, ID_SEGMENT_LIST, ID_SEGMENT_NAME, ID_SEGMENT_UP, ID_SI_EXTENSION, ID_SI_WIDTH, ID_TRUE_GUARD, portGuardSizer_, registerGuardSizer_, segmentSizer_, and siSizer_.

◆ onActivateFUGuard()

void BusDialog::onActivateFUGuard ( wxListEvent &  event)
private

Handles left mouse button double clicks on the FUGuard list.

Definition at line 1160 of file BusDialog.cc.

1160 {
1161 wxCommandEvent dummy;
1163}
SimValue dummy(32)
a dummy simvalue which is given for operands that are not bound
void onEditFUGuard(wxCommandEvent &)

References dummy, and onEditFUGuard().

Here is the call graph for this function:

◆ onActivateRFGuard()

void BusDialog::onActivateRFGuard ( wxListEvent &  event)
private

Handles left mouse button double clicks on the RFGuard list.

Definition at line 1123 of file BusDialog.cc.

1123 {
1124 wxCommandEvent dummy;
1126}
void onEditRFGuard(wxCommandEvent &)
Definition BusDialog.cc:958

References dummy, and onEditRFGuard().

Here is the call graph for this function:

◆ onAddFUGuard()

void BusDialog::onAddFUGuard ( wxCommandEvent &  )
private

Creates and shows an empty function unit port guard dialog for adding function unit port guards.

Definition at line 998 of file BusDialog.cc.

998 {
1001
1002 bool portExists = false;
1003 for (int i = 0; i < navigator.count(); i++) {
1004 if (navigator.item(i)->portCount() > 0) {
1005 portExists = true;
1006 break;
1007 }
1008 }
1009
1010 if (!portExists) {
1012 format message =
1014 InformationDialog dialog(
1015 this, WxConversion::toWxString(message.str()));
1016 dialog.ShowModal();
1017 return;
1018 }
1019
1020 FUGuardDialog dialog(this, bus_);
1021 dialog.ShowModal();
1023}
void updateGuardLists()
Definition BusDialog.cc:412
static ProDeTextGenerator * instance()
@ MSG_ERROR_CANNOT_FU_GUARD
Error: Function unit port guard.
virtual Machine * machine() const
ComponentType * item(int index) const
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition Machine.cc:380
virtual boost::format text(int textId)
static wxString toWxString(const std::string &source)

References bus_, TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::functionUnitNavigator(), ProDeTextGenerator::instance(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::machine(), ProDeTextGenerator::MSG_ERROR_CANNOT_FU_GUARD, Texts::TextGenerator::text(), WxConversion::toWxString(), and updateGuardLists().

Here is the call graph for this function:

◆ onAddRFGuard()

void BusDialog::onAddRFGuard ( wxCommandEvent &  )
private

Creates and shows a register file guard dialog for adding register file guards.

Definition at line 898 of file BusDialog.cc.

898 {
901
902 if (navigator.count() < 1) {
904 format message =
906 InformationDialog dialog(this, WxConversion::toWxString(message.str()));
907 dialog.ShowModal();
908 return;
909 }
910
911 RFGuardDialog dialog(this, bus_);
912 dialog.ShowModal();
914}
@ MSG_ERROR_CANNOT_RF_GUARD
Error: Register file guard.
virtual RegisterFileNavigator registerFileNavigator() const
Definition Machine.cc:450

References bus_, TTAMachine::Machine::Navigator< ComponentType >::count(), ProDeTextGenerator::instance(), TTAMachine::Component::machine(), ProDeTextGenerator::MSG_ERROR_CANNOT_RF_GUARD, TTAMachine::Machine::registerFileNavigator(), Texts::TextGenerator::text(), WxConversion::toWxString(), and updateGuardLists().

Here is the call graph for this function:

◆ onAddSegment()

void BusDialog::onAddSegment ( wxCommandEvent &  )
private

Adds a new segment to the segment list.

Definition at line 567 of file BusDialog.cc.

567 {
568
569 if (!TransferDataFromWindow()) {
570 return;
571 }
572 assert(newSegName_ != _T(""));
573
574 string trimmedName =
575 WxConversion::toString(newSegName_.Trim(false).Trim(true));
576
577 // Check the name validity.
578 if (!MachineTester::isValidComponentName(trimmedName)) {
580 format message =
582 InformationDialog warning(
583 this, WxConversion::toWxString(message.str()));
584 warning.ShowModal();
585 return;
586 }
587
588 // Check that the new segment's name is unique among the segments of
589 // the bus.
590 if (bus_->hasSegment(trimmedName)) {
592 format message =
594 format component =
596 format bus = prodeTexts->text(ProDeTextGenerator::COMP_BUS);
597 message % trimmedName % component.str() % bus.str();
598 component = prodeTexts->text(ProDeTextGenerator::COMP_SEGMENT);
599 message % component.str();
600 WarningDialog dialog(this, WxConversion::toWxString(message.str()));
601 dialog.ShowModal();
602 return;
603 }
604 new Segment(trimmedName, *bus_);
606
607 // clear the segment name control
608 dynamic_cast<wxTextCtrl*>(
609 FindWindow(ID_SEGMENT_NAME))->SetValue(_T(""));
610}
#define assert(condition)
void updateSegmentList()
Definition BusDialog.cc:486
static bool isValidComponentName(const std::string &name)
@ MSG_ERROR_SAME_NAME
Error: Same name exists.
@ MSG_ERROR_ILLEGAL_NAME
Error: Illegal component name.
@ COMP_BUS
Name for bus component.
@ COMP_A_SEGMENT
Name for a segment component.
@ COMP_SEGMENT
Name for segment component.
virtual bool hasSegment(const std::string &name) const
Definition Bus.cc:284
static std::string toString(const wxString &source)

References assert, bus_, ProDeTextGenerator::COMP_A_SEGMENT, ProDeTextGenerator::COMP_BUS, ProDeTextGenerator::COMP_SEGMENT, TTAMachine::Bus::hasSegment(), ID_SEGMENT_NAME, ProDeTextGenerator::instance(), MachineTester::isValidComponentName(), ProDeTextGenerator::MSG_ERROR_ILLEGAL_NAME, ProDeTextGenerator::MSG_ERROR_SAME_NAME, newSegName_, Texts::TextGenerator::text(), WxConversion::toString(), WxConversion::toWxString(), and updateSegmentList().

Here is the call graph for this function:

◆ onBusName()

void BusDialog::onBusName ( wxCommandEvent &  )
private

Enables and disables OK button based on input in the bus name widget.

Definition at line 617 of file BusDialog.cc.

617 {
618 if (!TransferDataFromWindow()) {
619 assert(false);
620 }
621 wxString trimmedName = name_.Trim(false).Trim(true);
622 if (trimmedName == _T("")) {
623 FindWindow(wxID_OK)->Disable();
624 } else {
625 FindWindow(wxID_OK)->Enable();
626 }
627}

References assert, and name_.

◆ onDeleteFUGuard()

void BusDialog::onDeleteFUGuard ( wxCommandEvent &  )
private

Deletes selected function unit port guards from the function unit port guards list.

Definition at line 1032 of file BusDialog.cc.

1032 {
1033 delete selectedFUGuard();
1035 wxListEvent dummy;
1037}
TTAMachine::PortGuard * selectedFUGuard() const
Definition BusDialog.cc:522
void onFUGuardSelection(wxListEvent &)

References dummy, onFUGuardSelection(), selectedFUGuard(), and updateGuardLists().

Here is the call graph for this function:

◆ onDeleteRFGuard()

void BusDialog::onDeleteRFGuard ( wxCommandEvent &  )
private

Deletes selected register file guards from the register file guards list.

Definition at line 922 of file BusDialog.cc.

922 {
923 long item = -1;
924
925 // loop selected guards and delete them
926 for (int i = 0; i < rfGuardList_->GetSelectedItemCount(); ++i) {
927 item = rfGuardList_->GetNextItem(
928 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
929
930 assert (item < static_cast<int>(registerGuards_.size()));
931
932 // retrieve item data (guard pointer) that is bound with the item
933 if (item >= 0) {
934 long itemData = rfGuardList_->GetItemData(item);
935 RegisterGuard* rfGuard = (RegisterGuard*)itemData;
936 if (rfGuard != NULL) {
937 delete rfGuard;
938 rfGuard = NULL;
939 }
940 }
941 }
942
944 wxListEvent dummy;
946
947 return;
948}
void onRFGuardSelection(wxListEvent &)
Definition BusDialog.cc:978
vector< TTAMachine::RegisterGuard * > registerGuards_
list of register guards
Definition BusDialog.hh:133

References assert, dummy, onRFGuardSelection(), registerGuards_, rfGuardList_, and updateGuardLists().

Here is the call graph for this function:

◆ onDeleteSegment()

void BusDialog::onDeleteSegment ( wxCommandEvent &  )
private

Deletes the selected segment from the bus.

The Segments before and after the deleted segments are connected to each other.

Definition at line 735 of file BusDialog.cc.

735 {
736
737 Segment* selected = selectedSegment();
738 assert(selected != NULL);
739
740 delete selected;
742
743 wxListEvent dummy;
745}
TTAMachine::Segment * selectedSegment() const
Definition BusDialog.cc:501
void onSegmentSelection(wxListEvent &)
Definition BusDialog.cc:693

References assert, dummy, onSegmentSelection(), selectedSegment(), and updateSegmentList().

Here is the call graph for this function:

◆ onEditFUGuard()

void BusDialog::onEditFUGuard ( wxCommandEvent &  )
private

Handles the 'Edit FUGuard' button event.

Opens a FUGuardDialog with the selected guard's attributes set.

Definition at line 1047 of file BusDialog.cc.

1047 {
1048 PortGuard* guard = selectedFUGuard();
1049 if (guard == NULL) {
1050 // No guard selected.
1051 return;
1052 }
1053 FUGuardDialog dialog(this, bus_, guard);
1054 dialog.ShowModal();
1056}

References bus_, selectedFUGuard(), and updateGuardLists().

Referenced by onActivateFUGuard().

Here is the call graph for this function:

◆ onEditRFGuard()

void BusDialog::onEditRFGuard ( wxCommandEvent &  )
private

Handles the 'Edit RFGuard' button event.

Opens a RFGuardDialog with the selected guard's attributes set.

Definition at line 958 of file BusDialog.cc.

958 {
960 if (guard == NULL) {
961 // No guard selected.
962 return;
963 }
964 RFGuardDialog dialog(this, bus_, guard);
965 dialog.ShowModal();
967}
TTAMachine::RegisterGuard * selectedRFGuard() const
Definition BusDialog.cc:543

References bus_, selectedRFGuard(), and updateGuardLists().

Referenced by onActivateRFGuard().

Here is the call graph for this function:

◆ onFUGuardRightClick()

void BusDialog::onFUGuardRightClick ( wxListEvent &  event)
private

Opens a pop-up menu when right mouse button was pressed on the FU guard list.

Parameters
eventInformation about right mouse click event.

Definition at line 1136 of file BusDialog.cc.

1136 {
1137
1138 fuGuardList_->SetItemState(event.GetIndex(), wxLIST_STATE_SELECTED,
1139 wxLIST_STATE_SELECTED);
1140
1141 wxMenu* contextMenu = new wxMenu();
1142
1144 format button = prodeTexts->text(
1146 contextMenu->Append(
1148 button = prodeTexts->text(
1150 contextMenu->Append(
1152 fuGuardList_->PopupMenu(contextMenu, event.GetPoint());
1153}
@ TXT_LABEL_BUTTON_EDIT
Label for &Edit... button.
@ TXT_LABEL_BUTTON_DELETE
Label for &Delete button.

References fuGuardList_, ID_DELETE_FU_GUARD, ID_EDIT_FU_GUARD, ProDeTextGenerator::instance(), Texts::TextGenerator::text(), WxConversion::toWxString(), ProDeTextGenerator::TXT_LABEL_BUTTON_DELETE, and ProDeTextGenerator::TXT_LABEL_BUTTON_EDIT.

Here is the call graph for this function:

◆ onFUGuardSelection()

void BusDialog::onFUGuardSelection ( wxListEvent &  )
private

Disables and enables Edit and Delete buttons under the register file guard list.

If a guard is selected, buttons are enabled. If no guard is selected the buttons will be disabled.

Definition at line 1081 of file BusDialog.cc.

1081 {
1082 if (fuGuardList_->GetSelectedItemCount() != 1) {
1083 FindWindow(ID_DELETE_FU_GUARD)->Disable();
1084 FindWindow(ID_EDIT_FU_GUARD)->Disable();
1085 return;
1086 }
1087 FindWindow(ID_DELETE_FU_GUARD)->Enable();
1088 FindWindow(ID_EDIT_FU_GUARD)->Enable();
1089}

References fuGuardList_, ID_DELETE_FU_GUARD, and ID_EDIT_FU_GUARD.

Referenced by onDeleteFUGuard().

◆ onHelp()

void BusDialog::onHelp ( wxCommandEvent &  event)
private

◆ onOK()

void BusDialog::onOK ( wxCommandEvent &  )
private

Validates input in the controls, and updates the Bus object.

Definition at line 797 of file BusDialog.cc.

797 {
798
799 if (!Validate()) {
800 return;
801 }
802
803 if (!TransferDataFromWindow()) {
804 return;
805 }
806
807 // Check that the machine doesn't contain instruction templates with
808 // slots that are wider than the new bus width.
811 for (int i = 0; i < navigator.count(); i++) {
812 int slotWidth = navigator.item(i)->supportedWidth(bus_->name());
813 if (slotWidth != 0 && slotWidth > width_) {
814 ProDeTextGenerator* generator =
816 format message = generator->text(
818 message % navigator.item(i)->name();
819 message % slotWidth;
820 InformationDialog dialog(
821 this, WxConversion::toWxString(message.str()));
822 dialog.ShowModal();
823 return;
824 }
825 }
826
827 // Check the name validity.
828 string trimmedName =
829 WxConversion::toString(name_.Trim(false).Trim(true));
830 if (!MachineTester::isValidComponentName(trimmedName)) {
832 format message =
834 InformationDialog warning(
835 this, WxConversion::toWxString(message.str()));
836 warning.ShowModal();
837 return;
838 }
839
840 // Check that the new name is not reserved.
841 if (trimmedName != bus_->name()) {
842 const Machine::BusNavigator busNavigator =
844 if (busNavigator.hasItem(trimmedName)) {
846 format message =
848 message % trimmedName;
849 message % prodeTexts->text(ProDeTextGenerator::COMP_A_BUS).str();
850 message % prodeTexts->text(ProDeTextGenerator::COMP_MACHINE).str();
851 message % prodeTexts->text(ProDeTextGenerator::COMP_BUS).str();
852 WarningDialog warning(
853 this, WxConversion::toWxString(message.str()));
854 warning.ShowModal();
855 return;
856 }
857 // Immediate slots share namespace with busses, check that an immediate
858 // slot with the same name does not exist.
859 const Machine::ImmediateSlotNavigator immSlotNavigator =
861 if (immSlotNavigator.hasItem(trimmedName)) {
863 format message =
865 message % trimmedName;
866 message % prodeTexts->text(
868 message % prodeTexts->text(ProDeTextGenerator::COMP_MACHINE).str();
869 message % prodeTexts->text(ProDeTextGenerator::COMP_BUS).str();
870 WarningDialog warning(
871 this, WxConversion::toWxString(message.str()));
872 warning.ShowModal();
873 return;
874 }
875 }
876
879 bus_->setName(trimmedName);
880
881 if (immediateExtensionBox_->GetStringSelection().IsSameAs(
883
885 } else {
887 }
888
889 EndModal(wxID_OK);
890}
static const wxString EXTENSION_ZERO
String for the zero extension.
@ COMP_MACHINE
Text for machine description.
@ COMP_AN_IMM_SLOT
Name for imm. slot (w/ article).
@ MSG_ERROR_BUS_IT_SLOT_WIDTH
Error: Slot width > bus width.
@ COMP_A_BUS
Name for a bus component.
virtual void setName(const std::string &name)
Definition Bus.cc:196
virtual void setImmediateWidth(int width)
Definition Bus.cc:241
virtual void setSignExtends()
Definition Bus.cc:262
virtual void setZeroExtends()
Definition Bus.cc:253
virtual void setWidth(int width)
Definition Bus.cc:223
virtual TCEString name() const
bool hasItem(const std::string &name) const
virtual ImmediateSlotNavigator immediateSlotNavigator() const
Definition Machine.cc:462
virtual InstructionTemplateNavigator instructionTemplateNavigator() const
Definition Machine.cc:428
virtual BusNavigator busNavigator() const
Definition Machine.cc:356

References bus_, TTAMachine::Machine::busNavigator(), ProDeTextGenerator::COMP_A_BUS, ProDeTextGenerator::COMP_AN_IMM_SLOT, ProDeTextGenerator::COMP_BUS, ProDeTextGenerator::COMP_MACHINE, TTAMachine::Machine::Navigator< ComponentType >::count(), ProDeConstants::EXTENSION_ZERO, TTAMachine::Machine::Navigator< ComponentType >::hasItem(), immediateExtensionBox_, TTAMachine::Machine::immediateSlotNavigator(), immWidth_, ProDeTextGenerator::instance(), TTAMachine::Machine::instructionTemplateNavigator(), MachineTester::isValidComponentName(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::machine(), ProDeTextGenerator::MSG_ERROR_BUS_IT_SLOT_WIDTH, ProDeTextGenerator::MSG_ERROR_ILLEGAL_NAME, ProDeTextGenerator::MSG_ERROR_SAME_NAME, TTAMachine::Component::name(), name_, TTAMachine::Bus::setImmediateWidth(), TTAMachine::Bus::setName(), TTAMachine::Bus::setSignExtends(), TTAMachine::Bus::setWidth(), TTAMachine::Bus::setZeroExtends(), Texts::TextGenerator::text(), WxConversion::toString(), WxConversion::toWxString(), and width_.

Here is the call graph for this function:

◆ onRFGuardRightClick()

void BusDialog::onRFGuardRightClick ( wxListEvent &  event)
private

Opens a pop-up menu when right mouse button was pressed on the register file guard list.

Parameters
eventInformation about right mouse click event.

Definition at line 1099 of file BusDialog.cc.

1099 {
1100
1101 rfGuardList_->SetItemState(event.GetIndex(), wxLIST_STATE_SELECTED,
1102 wxLIST_STATE_SELECTED);
1103
1104 wxMenu* contextMenu = new wxMenu();
1105
1107 format button = prodeTexts->text(
1109 contextMenu->Append(
1111 button = prodeTexts->text(
1113 contextMenu->Append(
1115 rfGuardList_->PopupMenu(contextMenu, event.GetPoint());
1116}

References ID_DELETE_RF_GUARD, ID_EDIT_RF_GUARD, ProDeTextGenerator::instance(), rfGuardList_, Texts::TextGenerator::text(), WxConversion::toWxString(), ProDeTextGenerator::TXT_LABEL_BUTTON_DELETE, and ProDeTextGenerator::TXT_LABEL_BUTTON_EDIT.

Here is the call graph for this function:

◆ onRFGuardSelection()

void BusDialog::onRFGuardSelection ( wxListEvent &  )
private

Disables and enables Edit and Delete buttons under the register file guard list.

If a guard is selected, buttons are enabled. If no guard is selected the buttons will be disabled.

Definition at line 978 of file BusDialog.cc.

978 {
979 if (rfGuardList_->GetSelectedItemCount() != 1) {
980 FindWindow(ID_EDIT_RF_GUARD)->Disable();
981 } else {
982 FindWindow(ID_EDIT_RF_GUARD)->Enable();
983 }
984
985 if (rfGuardList_->GetSelectedItemCount() < 1) {
986 FindWindow(ID_DELETE_RF_GUARD)->Disable();
987 } else {
989 }
990}

References ID_DELETE_RF_GUARD, ID_EDIT_RF_GUARD, and rfGuardList_.

Referenced by onDeleteRFGuard().

◆ onSegmentDown()

void BusDialog::onSegmentDown ( wxCommandEvent &  )
private

Moves selected segment one position down in the segment chain.

Definition at line 775 of file BusDialog.cc.

775 {
776 Segment* selected = selectedSegment();
777 assert (selected != NULL);
778
779 if (!selected->hasDestinationSegment()) {
780 // Selected segment was first in the chain, do nothing.
781 return;
782 }
783
784 selected->moveAfter(*(selected->destinationSegment()));
786
787 // set the moved segment as selected
788 long i = segList_->FindItem(0, WxConversion::toWxString(selected->name()));
789 segList_->SetItemState(i,wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
790}
Segment * destinationSegment() const
void moveAfter(Segment &segment)
Definition Segment.cc:357
bool hasDestinationSegment() const
Definition Segment.cc:399
std::string name() const

References assert, TTAMachine::Segment::destinationSegment(), TTAMachine::Segment::hasDestinationSegment(), TTAMachine::Segment::moveAfter(), TTAMachine::Segment::name(), segList_, selectedSegment(), WxConversion::toWxString(), and updateSegmentList().

Here is the call graph for this function:

◆ onSegmentName()

void BusDialog::onSegmentName ( wxCommandEvent &  )
private

Enables and disables add segment button based on input in the segment name widget.

Definition at line 676 of file BusDialog.cc.

676 {
677 if (!TransferDataFromWindow()) {
678 assert(false);
679 }
680 wxString trimmedName = newSegName_.Trim(false).Trim(true);
681 if (trimmedName == _T("")) {
682 FindWindow(ID_ADD_SEGMENT)->Disable();
683 } else {
684 FindWindow(ID_ADD_SEGMENT)->Enable();
685 }
686}

References assert, ID_ADD_SEGMENT, and newSegName_.

◆ onSegmentRightClick()

void BusDialog::onSegmentRightClick ( wxListEvent &  event)
private

Opens a pop-up menu when right mouse button was pressed.

Parameters
eventInformation about right mouse click event.

Definition at line 712 of file BusDialog.cc.

712 {
713
714 segList_->SetItemState(event.GetIndex(), wxLIST_STATE_SELECTED,
715 wxLIST_STATE_SELECTED);
716
717 wxMenu* contextMenu = new wxMenu();
718
720 format button = prodeTexts->text(
722 contextMenu->Append(
724 segList_->PopupMenu(contextMenu, event.GetPoint());
725}

References ID_DELETE_SEGMENT, ProDeTextGenerator::instance(), segList_, Texts::TextGenerator::text(), WxConversion::toWxString(), and ProDeTextGenerator::TXT_LABEL_BUTTON_DELETE.

Here is the call graph for this function:

◆ onSegmentSelection()

void BusDialog::onSegmentSelection ( wxListEvent &  )
private

Disables segment deletion and move buttons if no segment is selected.

Definition at line 693 of file BusDialog.cc.

693 {
694 if (segList_->GetSelectedItemCount() != 1) {
695 FindWindow(ID_DELETE_SEGMENT)->Disable();
696 FindWindow(ID_SEGMENT_UP)->Disable();
697 FindWindow(ID_SEGMENT_DOWN)->Disable();
698 return;
699 }
700 FindWindow(ID_DELETE_SEGMENT)->Enable();
701 FindWindow(ID_SEGMENT_UP)->Enable();
702 FindWindow(ID_SEGMENT_DOWN)->Enable();
703}

References ID_DELETE_SEGMENT, ID_SEGMENT_DOWN, ID_SEGMENT_UP, and segList_.

Referenced by onDeleteSegment().

◆ onSegmentUp()

void BusDialog::onSegmentUp ( wxCommandEvent &  )
private

Moves selected segment one position up in the segment chain.

Definition at line 752 of file BusDialog.cc.

752 {
753 Segment* selected = selectedSegment();
754 assert (selected != NULL);
755
756 if (!selected->hasSourceSegment()) {
757 // Selected segment was first in the chain, do nothing.
758 return;
759 }
760
761 selected->moveBefore(*(selected->sourceSegment()));
763
764 // set the moved segment as selected
765 long i = segList_->FindItem(0, WxConversion::toWxString(selected->name()));
766 segList_->SetItemState(i,wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
767}
void moveBefore(Segment &segment)
Definition Segment.cc:320
bool hasSourceSegment() const
Definition Segment.cc:388
Segment * sourceSegment() const

References assert, TTAMachine::Segment::hasSourceSegment(), TTAMachine::Segment::moveBefore(), TTAMachine::Segment::name(), segList_, selectedSegment(), TTAMachine::Segment::sourceSegment(), WxConversion::toWxString(), and updateSegmentList().

Here is the call graph for this function:

◆ onUnconditionalGuard()

void BusDialog::onUnconditionalGuard ( wxCommandEvent &  event)
private

Handles the unconditional guard deletion/creation when true/false guard checkbox values are toggled.

Definition at line 635 of file BusDialog.cc.

635 {
636
637 bool inverted = false;
638 wxCheckBox* checkbox = alwaysTrueGuard_;
639
640 if (event.GetId() == ID_FALSE_GUARD) {
641 inverted = true;
642 checkbox = alwaysFalseGuard_;
643 }
644
645 if (!checkbox->GetValue()) {
646 for (int i = 0; i < bus_->guardCount(); i++) {
647 Guard* guard = bus_->guard(i);
648 UnconditionalGuard* unCondGuard =
649 dynamic_cast<UnconditionalGuard*>(guard);
650 if (unCondGuard != NULL &&
651 unCondGuard->isInverted() == inverted) {
652
653 delete unCondGuard;
654 }
655 }
656 } else {
657 try {
658 new UnconditionalGuard(inverted, *bus_);
659 } catch (Exception& e) {
661 format text = prodeTexts->text(ProDeTextGenerator::MSG_ERROR);
662 wxString message = WxConversion::toWxString(text.str());
663 message.Append(WxConversion::toWxString(e.errorMessage()));
664 ErrorDialog dialog(this, message);
665 dialog.ShowModal();
666 return;
667 }
668 }
669}
std::string errorMessage() const
Definition Exception.cc:123
@ MSG_ERROR
Text 'Error' and new line.
Guard * guard(int index) const
Definition Bus.cc:456
int guardCount() const
Definition Bus.cc:441
virtual bool isInverted() const

References alwaysFalseGuard_, alwaysTrueGuard_, bus_, Exception::errorMessage(), TTAMachine::Bus::guard(), TTAMachine::Bus::guardCount(), ID_FALSE_GUARD, ProDeTextGenerator::instance(), TTAMachine::Guard::isInverted(), ProDeTextGenerator::MSG_ERROR, Texts::TextGenerator::text(), and WxConversion::toWxString().

Here is the call graph for this function:

◆ onWidth()

void BusDialog::onWidth ( wxSpinEvent &  )
private

Sets the immediate width range when the bus width is modified.

Definition at line 1063 of file BusDialog.cc.

1063 {
1064 wxSpinCtrl* width = dynamic_cast<wxSpinCtrl*>(FindWindow(ID_BUS_WIDTH));
1065 wxSpinCtrl* siWidth = dynamic_cast<wxSpinCtrl*>(FindWindow(ID_SI_WIDTH));
1066 if (siWidth->GetValue() > width->GetValue()) {
1067 siWidth->SetValue(width->GetValue());
1068 }
1069 siWidth->SetRange(0, width->GetValue());
1070}

References ID_BUS_WIDTH, and ID_SI_WIDTH.

Referenced by TransferDataToWindow().

◆ selectedFUGuard()

PortGuard * BusDialog::selectedFUGuard ( ) const
private

Returns pointer to the selected fu port guard.

Returns
NULL if no port guard is selected.

Definition at line 522 of file BusDialog.cc.

522 {
523 long item = -1;
524 item = fuGuardList_->GetNextItem(
525 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
526
527 if (item == -1) {
528 return NULL;
529 }
530
531 assert (item < int(portGuards_.size()));
532
533 return portGuards_[item];
534}
vector< TTAMachine::PortGuard * > portGuards_
list of port guards
Definition BusDialog.hh:135

References assert, fuGuardList_, and portGuards_.

Referenced by onDeleteFUGuard(), and onEditFUGuard().

◆ selectedRFGuard()

RegisterGuard * BusDialog::selectedRFGuard ( ) const
private

Returns pointer to the selected register file guard.

Returns
NULL if no register guard is selected.

Definition at line 543 of file BusDialog.cc.

543 {
544 long item = -1;
545 item = rfGuardList_->GetNextItem(
546 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
547
548 if (item == -1) {
549 return NULL;
550 }
551
552 assert (item < int(registerGuards_.size()));
553
554 long itemData = rfGuardList_->GetItemData(item);
555 RegisterGuard* rfGuard = (RegisterGuard*)itemData;
556 assert (rfGuard != NULL);
557 return rfGuard;
558}

References assert, registerGuards_, and rfGuardList_.

Referenced by onEditRFGuard().

◆ selectedSegment()

Segment * BusDialog::selectedSegment ( ) const
private

Returns pointer to the selected segment.

Returns NULL if no segment is selected.

Definition at line 501 of file BusDialog.cc.

501 {
502
503 // search the selected segment in the segment list widget
504 Segment* selected = NULL;
505 for (int i = 0; i < segList_->GetItemCount(); i++) {
506 // search selected list item
507 if (segList_->GetItemState(i, wxLIST_STATE_SELECTED) != 0) {
508 string name = WxConversion::toString(segList_->GetItemText(i));
509 selected = bus_->segment(name);
510 }
511 }
512 return selected;
513}
virtual Segment * segment(int index) const
Definition Bus.cc:329

References bus_, segList_, TTAMachine::Bus::segment(), and WxConversion::toString().

Referenced by onDeleteSegment(), onSegmentDown(), and onSegmentUp().

Here is the call graph for this function:

◆ setTexts()

void BusDialog::setTexts ( )
private

Definition at line 192 of file BusDialog.cc.

192 {
195
196 // Dialog title
197 format fmt = prodeTexts->text(ProDeTextGenerator::TXT_BUS_DIALOG_TITLE);
198
199 string title = fmt.str();
200 SetTitle(WxConversion::toWxString(title));
201
202 // buttons
203 WidgetTools::setLabel(generator, FindWindow(wxID_OK),
205
206 WidgetTools::setLabel(generator, FindWindow(wxID_CANCEL),
208
211
214
217
220
223
226
229
232
235
238
241
242 // widget labels
245
248
251
254
257
260
263
264 // Radio button labels
266 immediateExtensionBox_->SetString(0, WxConversion::toWxString(fmt.str()));
268 immediateExtensionBox_->SetString(1, WxConversion::toWxString(fmt.str()));
269
270 // box sizer labels
271 fmt = prodeTexts->text(ProDeTextGenerator::TXT_BUS_BUS_BOX);
272 string label = fmt.str();
274
276 label = fmt.str();
278
279 fmt = prodeTexts->text(ProDeTextGenerator::TXT_BUS_SI_BOX);
280 label = fmt.str();
282
283 fmt = prodeTexts->
285 label = fmt.str();
287
289 label = fmt.str();
291
292 // Create segment list columns.
293 wxListCtrl* segmentList =
294 dynamic_cast<wxListCtrl*>(FindWindow(ID_SEGMENT_LIST));
295 wxListCtrl* rfGuardList =
296 dynamic_cast<wxListCtrl*>(FindWindow(ID_RF_GUARD_LIST));
297 wxListCtrl* fuGuardList =
298 dynamic_cast<wxListCtrl*>(FindWindow(ID_FU_GUARD_LIST));
299
301 string invLabel = fmt.str();
302
303 fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_NAME);
304 string nameLabel = fmt.str();
305
307 string indexLabel = fmt.str();
308
309 fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_PORT);
310 string portLabel = fmt.str();
311
312 segmentList->InsertColumn(0, WxConversion::toWxString(nameLabel),
313 wxLIST_FORMAT_LEFT, 280);
314
315 rfGuardList->InsertColumn(0, WxConversion::toWxString(nameLabel),
316 wxLIST_FORMAT_LEFT, 170);
317 rfGuardList->InsertColumn(1, WxConversion::toWxString(indexLabel),
318 wxLIST_FORMAT_LEFT, 70);
319 rfGuardList->InsertColumn(2, WxConversion::toWxString(invLabel),
320 wxLIST_FORMAT_LEFT, 40);
321
322 fuGuardList->InsertColumn(0, WxConversion::toWxString(invLabel),
323 wxLIST_FORMAT_LEFT, 40);
324 fuGuardList->InsertColumn(1, WxConversion::toWxString(nameLabel),
325 wxLIST_FORMAT_LEFT, 170);
326 fuGuardList->InsertColumn(2, WxConversion::toWxString(portLabel),
327 wxLIST_FORMAT_LEFT, 70);
328}
@ TXT_BUTTON_EDIT_DIALOG
Label for edit button (with trailing ...).
@ TXT_BUTTON_ADD_DIALOG
Label for add button (with trailing ...).
@ TXT_BUTTON_HELP
Label for help button.
@ TXT_BUTTON_DELETE
Label for delete button.
@ TXT_BUTTON_CANCEL
Label for cancel button.
@ TXT_BUTTON_OK
Label for OK button.
@ TXT_BUTTON_ADD
Label for an add button.
static GUITextGenerator * instance()
@ TXT_LABEL_FALSE_GUARD
Label for 'always false guard'.
@ TXT_BUS_REGISTER_GUARD_BOX
Register file guards box title.
@ TXT_LABEL_NAME
Label for component name widget.
@ TXT_LABEL_EXTENSION
Label for 'extension' radiobox.
@ TXT_RADIO_EXTENSION_ZERO
Label for 'zero' radio button.
@ TXT_BUS_SEGMENTS_BOX
Segments box title.
@ TXT_LABEL_WIDTH
Label for bit width widget.
@ TXT_BUS_SI_BOX
Short immediate box title.
@ TXT_BUTTON_UP
Label for up button.
@ TXT_BUS_BUS_BOX
Bus Dialog bus box title.
@ TXT_BUTTON_DOWN
Label for down button.
@ TXT_RADIO_EXTENSION_SIGN
Label for 'sign' radio button.
@ TXT_LABEL_TRUE_GUARD
Label for 'always true guard'.
@ TXT_COLUMN_PORT
Label for port column in a list.
@ TXT_BUS_PORT_GUARD_BOX
Function unit guards box title.
@ TXT_COLUMN_INDEX
Label for index column in a list.
@ TXT_COLUMN_INVERTED
Label for inv column in a list.
@ TXT_COLUMN_NAME
Label for name column in a list.
@ TXT_BUS_DIALOG_TITLE
Bus Dialog title.
static void setWidgetLabel(wxWindow *widget, std::string text)
static void setLabel(Texts::TextGenerator *generator, wxWindow *widget, int textID)

References busSizer_, ID_ADD_FU_GUARD, ID_ADD_RF_GUARD, ID_ADD_SEGMENT, ID_DELETE_FU_GUARD, ID_DELETE_RF_GUARD, ID_DELETE_SEGMENT, ID_EDIT_FU_GUARD, ID_EDIT_RF_GUARD, ID_FALSE_GUARD, ID_FU_GUARD_LIST, ID_HELP, ID_LABEL_BUS_NAME, ID_LABEL_BUS_WIDTH, ID_LABEL_SEGMENT_NAME, ID_LABEL_SI_WIDTH, ID_RF_GUARD_LIST, ID_SEGMENT_DOWN, ID_SEGMENT_LIST, ID_SEGMENT_UP, ID_SI_EXTENSION, ID_TRUE_GUARD, immediateExtensionBox_, GUITextGenerator::instance(), ProDeTextGenerator::instance(), portGuardSizer_, registerGuardSizer_, segmentSizer_, WidgetTools::setLabel(), WidgetTools::setWidgetLabel(), siSizer_, Texts::TextGenerator::text(), WxConversion::toWxString(), ProDeTextGenerator::TXT_BUS_BUS_BOX, ProDeTextGenerator::TXT_BUS_DIALOG_TITLE, ProDeTextGenerator::TXT_BUS_PORT_GUARD_BOX, ProDeTextGenerator::TXT_BUS_REGISTER_GUARD_BOX, ProDeTextGenerator::TXT_BUS_SEGMENTS_BOX, ProDeTextGenerator::TXT_BUS_SI_BOX, GUITextGenerator::TXT_BUTTON_ADD, GUITextGenerator::TXT_BUTTON_ADD_DIALOG, GUITextGenerator::TXT_BUTTON_CANCEL, GUITextGenerator::TXT_BUTTON_DELETE, ProDeTextGenerator::TXT_BUTTON_DOWN, GUITextGenerator::TXT_BUTTON_EDIT_DIALOG, GUITextGenerator::TXT_BUTTON_HELP, GUITextGenerator::TXT_BUTTON_OK, ProDeTextGenerator::TXT_BUTTON_UP, ProDeTextGenerator::TXT_COLUMN_INDEX, ProDeTextGenerator::TXT_COLUMN_INVERTED, ProDeTextGenerator::TXT_COLUMN_NAME, ProDeTextGenerator::TXT_COLUMN_PORT, ProDeTextGenerator::TXT_LABEL_EXTENSION, ProDeTextGenerator::TXT_LABEL_FALSE_GUARD, ProDeTextGenerator::TXT_LABEL_NAME, ProDeTextGenerator::TXT_LABEL_TRUE_GUARD, ProDeTextGenerator::TXT_LABEL_WIDTH, ProDeTextGenerator::TXT_RADIO_EXTENSION_SIGN, and ProDeTextGenerator::TXT_RADIO_EXTENSION_ZERO.

Here is the call graph for this function:

◆ TransferDataToWindow()

bool BusDialog::TransferDataToWindow ( )
privatevirtual

Transfers the data from the bus model to the dialog controls.

Returns
false, if an error occured in the transfer.

Definition at line 337 of file BusDialog.cc.

337 {
338
340 width_ = bus_->width();
342
343
344 // set extension
345 if (bus_->signExtends()) {
346 immediateExtensionBox_->SetStringSelection(
348 } else {
349 immediateExtensionBox_->SetStringSelection(
351 }
352
355
356 // wxWidgets GTK1 version seems to bug with spincontrol validators.
357 // The widget value has to be set manually.
358 dynamic_cast<wxSpinCtrl*>(FindWindow(ID_BUS_WIDTH))->SetValue(width_);
359 dynamic_cast<wxSpinCtrl*>(FindWindow(ID_SI_WIDTH))->SetValue(immWidth_);
360
361 wxSpinEvent dummy;
362 onWidth(dummy);
363
364 return wxWindow::TransferDataToWindow();
365}
void onWidth(wxSpinEvent &)
static const wxString EXTENSION_SIGN
String for the sign extension.
int width() const
Definition Bus.cc:149
int immediateWidth() const
Definition Bus.cc:160
bool signExtends() const
Definition Bus.cc:171

References bus_, dummy, ProDeConstants::EXTENSION_SIGN, ProDeConstants::EXTENSION_ZERO, ID_BUS_WIDTH, ID_SI_WIDTH, immediateExtensionBox_, TTAMachine::Bus::immediateWidth(), immWidth_, TTAMachine::Component::name(), name_, onWidth(), TTAMachine::Bus::signExtends(), WxConversion::toWxString(), updateGuardLists(), updateSegmentList(), TTAMachine::Bus::width(), and width_.

Here is the call graph for this function:

◆ updateGuardLists()

void BusDialog::updateGuardLists ( )
private

Updates the guard lists.

Definition at line 412 of file BusDialog.cc.

412 {
413
414 assert (rfGuardList_ != NULL);
415 assert (fuGuardList_ != NULL);
416 rfGuardList_->DeleteAllItems();
417 fuGuardList_->DeleteAllItems();
418
419 registerGuards_.clear();
420 portGuards_.clear();
421
422 alwaysTrueGuard_->SetValue(false);
423 alwaysFalseGuard_->SetValue(false);
424
425 // add guards
426 for (int i = 0; i < bus_->guardCount(); i++) {
427
428 Guard* guard = bus_->guard(i);
429
430 UnconditionalGuard* unCondGuard =
431 dynamic_cast<UnconditionalGuard*>(guard);
432
433 RegisterGuard* rfGuard = dynamic_cast<RegisterGuard*>(guard);
434 PortGuard* fuGuard = dynamic_cast<PortGuard*>(guard);
435
436 if (unCondGuard != NULL) {
437 // unconditional guard
438 if (unCondGuard->isInverted()) {
439 alwaysFalseGuard_->SetValue(true);
440 } else {
441 alwaysTrueGuard_->SetValue(true);
442 }
443 } else if(rfGuard != NULL) {
444 // register guard
445 int index = registerGuards_.size();
446 registerGuards_.push_back(rfGuard);
447
448 string name = rfGuard->registerFile()->name();
449 int rfIndex = rfGuard->registerIndex();
450 rfGuardList_->InsertItem(index, WxConversion::toWxString(name));
451 rfGuardList_->SetItem(index, 1, WxConversion::toWxString(rfIndex));
452 if (rfGuard->isInverted()) {
453 rfGuardList_->SetItem(index, 2, _T("*"));
454 } else {
455 rfGuardList_->SetItem(index, 2, _T(" "));
456 }
457
458 // bind pointer to the guard as item data for future reference
459 rfGuardList_->SetItemData(index, (long)rfGuard);
460 } else if(fuGuard != NULL) {
461 // port guard
462 int index = portGuards_.size();
463 portGuards_.push_back(fuGuard);
464
465 if (fuGuard->isInverted()) {
466 fuGuardList_->InsertItem(index, _T("*"));
467 } else {
468 fuGuardList_->InsertItem(index, _T(" "));
469 }
470
471 string name = fuGuard->port()->parentUnit()->name();
472 fuGuardList_->SetItem(index, 1, WxConversion::toWxString(name));
473 name = fuGuard->port()->name();
474 fuGuardList_->SetItem(index, 2, WxConversion::toWxString(name));
475 }
476 }
477
478 // sort guard list with given function, data parameter is not needed
479 rfGuardList_->SortItems(ListCompareFunction, static_cast<long>(0));
480}
int wxCALLBACK ListCompareFunction(long item1, long item2, long WXUNUSED(sortData))
Definition BusDialog.cc:375
FunctionUnit * parentUnit() const
Definition BaseFUPort.cc:96
FUPort * port() const
virtual std::string name() const
Definition Port.cc:141
const RegisterFile * registerFile() const

References alwaysFalseGuard_, alwaysTrueGuard_, assert, bus_, fuGuardList_, TTAMachine::Bus::guard(), TTAMachine::Bus::guardCount(), TTAMachine::Guard::isInverted(), ListCompareFunction(), TTAMachine::Component::name(), TTAMachine::Port::name(), TTAMachine::BaseFUPort::parentUnit(), TTAMachine::PortGuard::port(), portGuards_, TTAMachine::RegisterGuard::registerFile(), registerGuards_, TTAMachine::RegisterGuard::registerIndex(), rfGuardList_, and WxConversion::toWxString().

Referenced by onAddFUGuard(), onAddRFGuard(), onDeleteFUGuard(), onDeleteRFGuard(), onEditFUGuard(), onEditRFGuard(), and TransferDataToWindow().

Here is the call graph for this function:

◆ updateSegmentList()

void BusDialog::updateSegmentList ( )
private

Updates the segment list control.

Definition at line 486 of file BusDialog.cc.

486 {
487 segList_->DeleteAllItems();
488
489 for (int i = bus_->segmentCount()-1;i > -1;i--) {
490 string segmentName = bus_->segment(i)->name();
491 segList_->InsertItem(0, WxConversion::toWxString(segmentName));
492 }
493}
virtual int segmentCount() const
Definition Bus.cc:385

References bus_, TTAMachine::Segment::name(), segList_, TTAMachine::Bus::segment(), TTAMachine::Bus::segmentCount(), and WxConversion::toWxString().

Referenced by onAddSegment(), onDeleteSegment(), onSegmentDown(), onSegmentUp(), and TransferDataToWindow().

Here is the call graph for this function:

Member Data Documentation

◆ alwaysFalseGuard_

wxCheckBox* BusDialog::alwaysFalseGuard_
private

Check box for always false unconditional guard.

Definition at line 112 of file BusDialog.hh.

Referenced by onUnconditionalGuard(), and updateGuardLists().

◆ alwaysTrueGuard_

wxCheckBox* BusDialog::alwaysTrueGuard_
private

Check box for always true unconditional guard.

Definition at line 110 of file BusDialog.hh.

Referenced by onUnconditionalGuard(), and updateGuardLists().

◆ bus_

TTAMachine::Bus* BusDialog::bus_
private

◆ busSizer_

wxStaticBoxSizer* BusDialog::busSizer_
private

Static boxsizer for the bus properties.

Definition at line 121 of file BusDialog.hh.

Referenced by createContents(), and setTexts().

◆ fuGuardList_

wxListCtrl* BusDialog::fuGuardList_
private

Function unit port guard list control.

Definition at line 118 of file BusDialog.hh.

Referenced by onFUGuardRightClick(), onFUGuardSelection(), selectedFUGuard(), and updateGuardLists().

◆ immediateExtensionBox_

wxRadioBox* BusDialog::immediateExtensionBox_
private

Radio box for immediate extension.

Definition at line 114 of file BusDialog.hh.

Referenced by onOK(), setTexts(), and TransferDataToWindow().

◆ immWidth_

int BusDialog::immWidth_
private

Short immediate width.

Definition at line 103 of file BusDialog.hh.

Referenced by onOK(), and TransferDataToWindow().

◆ name_

wxString BusDialog::name_
private

Name of the bus.

Definition at line 99 of file BusDialog.hh.

Referenced by onBusName(), onOK(), and TransferDataToWindow().

◆ newSegName_

wxString BusDialog::newSegName_
private

Name for a new segment.

Definition at line 105 of file BusDialog.hh.

Referenced by onAddSegment(), and onSegmentName().

◆ portGuards_

vector<TTAMachine::PortGuard*> BusDialog::portGuards_
private

list of port guards

Definition at line 135 of file BusDialog.hh.

Referenced by selectedFUGuard(), and updateGuardLists().

◆ portGuardSizer_

wxStaticBoxSizer* BusDialog::portGuardSizer_
private

Static boxsizer for the port guard properties.

Definition at line 127 of file BusDialog.hh.

Referenced by createContents(), and setTexts().

◆ registerGuards_

vector<TTAMachine::RegisterGuard*> BusDialog::registerGuards_
private

list of register guards

Definition at line 133 of file BusDialog.hh.

Referenced by onDeleteRFGuard(), selectedRFGuard(), and updateGuardLists().

◆ registerGuardSizer_

wxStaticBoxSizer* BusDialog::registerGuardSizer_
private

Static boxsizer for the register guard properties.

Definition at line 125 of file BusDialog.hh.

Referenced by createContents(), and setTexts().

◆ rfGuardList_

wxListCtrl* BusDialog::rfGuardList_
private

Register file guard list control.

Definition at line 116 of file BusDialog.hh.

Referenced by onDeleteRFGuard(), onRFGuardRightClick(), onRFGuardSelection(), selectedRFGuard(), and updateGuardLists().

◆ segList_

wxListCtrl* BusDialog::segList_
private

List widget for the segment list.

Definition at line 108 of file BusDialog.hh.

Referenced by onSegmentDown(), onSegmentRightClick(), onSegmentSelection(), onSegmentUp(), selectedSegment(), and updateSegmentList().

◆ segmentSizer_

wxStaticBoxSizer* BusDialog::segmentSizer_
private

Static boxsizer for the segment properties.

Definition at line 129 of file BusDialog.hh.

Referenced by createContents(), and setTexts().

◆ siSizer_

wxStaticBoxSizer* BusDialog::siSizer_
private

Static boxsizer for the short immediate properties.

Definition at line 123 of file BusDialog.hh.

Referenced by createContents(), and setTexts().

◆ width_

int BusDialog::width_
private

Width of the bus.

Definition at line 101 of file BusDialog.hh.

Referenced by onOK(), and TransferDataToWindow().


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