73 createNewConfig_(
false),
75 removeInsTemplateName_(
""),
76 addInsTemplateName_(
""),
77 modInsTemplateName_(
""),
88 addParameter(removeInsTemplateNamePN_,
STRING,
false, removeInsTemplateName_);
89 addParameter(addInsTemplateNamePN_,
STRING,
false, addInsTemplateName_);
90 addParameter(modInsTemplateNamePN_,
STRING,
false, modInsTemplateName_);
94 addParameter(dstImmUnitNamePN_,
STRING,
false, dstImmUnitName_);
119 virtual std::vector<RowID>
124 std::vector<RowID> result;
141 std::ostringstream msg(std::ostringstream::out);
147 if (!removeInsTemplateName_.empty()) {
148 removeInsTemplate(*mach, removeInsTemplateName_);
151 if (!addInsTemplateName_.empty()) {
153 addSplitInsTemplate(*mach, addInsTemplateName_);
155 addInsTemplate(*mach, addInsTemplateName_);
161 printImmediateTemplates(*mach);
164 if (createNewConfig_) {
186 result.push_back(confID);
190 std::ostringstream msg(std::ostringstream::out);
191 msg <<
"Error while using ImmediateGenerator:" << endl
236 readCompulsoryParameter(printPN_, print_);
237 readCompulsoryParameter(removeInsTemplateNamePN_, removeInsTemplateName_);
238 readCompulsoryParameter(addInsTemplateNamePN_, addInsTemplateName_);
239 readCompulsoryParameter(modInsTemplateNamePN_, modInsTemplateName_);
240 readCompulsoryParameter(widthPN_, width_);
241 readCompulsoryParameter(widthPartPN_, widthPart_);
242 readCompulsoryParameter(splitPN_, split_);
243 readCompulsoryParameter(dstImmUnitNamePN_, dstImmUnitName_);
256 std::ostringstream msg(std::ostringstream::out);
257 msg <<
"====== Instruction templates: =======" << endl;
261 for (
int it = 0; it < ITNav.
count(); it++) {
262 insTemplate = ITNav.
item(it);
264 msg <<
"Instruction template: " << insTemplate->
name() << endl;
266 msg <<
"\tEmpty instruction template." << endl;
270 msg <<
"\tSlot count: " << insTemplate->
slotCount() << endl;
271 for (
int sc = 0; sc < insTemplate->
slotCount(); sc++) {
272 tempSlot = insTemplate->
slot(sc);
273 msg <<
"\t\tSlot name: " << tempSlot->
slot() << endl;
274 msg <<
"\t\tSlot width: " << tempSlot->
width() << endl;
275 msg <<
"\t\tSlot destination: "
279 msg <<
"\tSupported Width: " << insTemplate->
supportedWidth() << endl;
280 msg <<
"\tNumber of Destinations: "
297 for (
int it = 0; it < ITNav.
count(); it++) {
298 insTemplate = ITNav.
item(it);
299 if (insTemplate->
name() == name) {
301 createNewConfig_ =
true;
305 if (!createNewConfig_) {
306 std::ostringstream msg(std::ostringstream::out);
307 msg <<
"Error while using ImmediateGenerator:" << endl
308 <<
"Instruction template with name \"" << name
309 <<
"\" was not found." << endl;
326 std::ostringstream msg(std::ostringstream::out);
327 msg <<
"Error while using ImmediateGenerator:" << endl
333 std::ostringstream msg(std::ostringstream::out);
334 msg <<
"Error while using ImmediateGenerator:" << endl
340 createNewConfig_ =
true;
359 if (dstImmUnitName_.empty()) {
361 if (IUNav.
count() > 0) {
362 dstImmUnit = IUNav.
item(0);
364 std::ostringstream msg(std::ostringstream::out);
365 msg <<
"Error while using ImmediateGenerator:" << endl
366 <<
"No immediate units." << endl;
371 for (
int iu = 0; iu < IUNav.
count(); iu++) {
372 immUnit = IUNav.
item(iu);
373 if (immUnit->
name() == dstImmUnitName_) {
374 dstImmUnit = immUnit;
377 if (dstImmUnit == NULL) {
378 std::ostringstream msg(std::ostringstream::out);
379 msg <<
"Error while using ImmediateGenerator:" << endl
380 <<
"Given destination immediate unit \""
381 << dstImmUnitName_ <<
"\" was not found." << endl;
391 std::ostringstream msg(std::ostringstream::out);
392 msg <<
"Error while using ImmediateGenerator:" << endl
399 std::ostringstream msg(std::ostringstream::out);
400 msg <<
"Error while using ImmediateGenerator:" << endl
411 int slotCount = (width_/widthPart_);
414 if (busNav.
count() < slotCount) {
415 slotCount = busNav.
count();
418 int overSpill = width_ - (slotCount * widthPart_);
421 for (
int bus = 0; bus < slotCount; bus++) {
422 busP = busNav.
item(bus);
425 if (overSpill <
static_cast<int>(
426 busP->
width() - widthPart_)) {
427 widthAdd = overSpill;
430 widthAdd = busP->
width() - widthPart_;
431 overSpill = overSpill - widthAdd;
438 insTemplate->
addSlot(busP->
name(), widthPart_ + widthAdd,
441 std::ostringstream msg(std::ostringstream::out);
442 msg <<
"Error while using ImmediateGenerator:" << endl
453 std::ostringstream msg(std::ostringstream::out);
454 msg <<
"Error while using ImmediateGenerator:" << endl
455 <<
"Immediate template generation failed, width=\"" << width_
456 <<
"\" too great by: \"" << overSpill <<
"\"" << endl;
463 createNewConfig_ =
true;