OpenASIP 2.2
Loading...
Searching...
No Matches
BinaryEncoding.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2014 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 BinaryEncoding.cc
26 *
27 * Implementation of BinaryEncoding class.
28 *
29 * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30 * @author Pekka Jääskeläinen 2014
31 * @note rating: red
32 */
33
34#include <string>
35#include <algorithm>
36
37#include "BinaryEncoding.hh"
38#include "MoveSlot.hh"
39#include "ImmediateSlotField.hh"
43#include "SocketCodeTable.hh"
45#include "ContainerTools.hh"
46#include "SequenceTools.hh"
47#include "Application.hh"
48#include "ObjectState.hh"
49#include "InstructionFormat.hh"
50
51using std::string;
52
53const std::string BinaryEncoding::OSNAME_BEM = "bem";
55 "template-extra-bits";
57 "bit-count";
58const std::string BinaryEncoding::OSNAME_TEMPLATE_NAME = "template";
59
60/**
61 * The constructor.
62 *
63 * Creates an empty BEM.
64 */
66 InstructionField(NULL), immediateField_(NULL) {
67}
68
69
70/**
71 * The constructor.
72 *
73 * Loads the state of the object from the given ObjectState tree.
74 *
75 * @exception ObjectStateLoadingException If an error occurs while loading
76 * the state.
77 */
79 : InstructionField(NULL), immediateField_(NULL) {
80 loadState(state);
81}
82
83/**
84 * The destructor.
85 */
96
97
98/**
99 * Returns the number of move slots in the instruction.
100 *
101 * @return The number of move slots.
102 */
103int
105 return moveSlots_.size();
106}
107
108
109/**
110 * Returns the move slot at given index.
111 *
112 * The index does not have to reflect the actual order within the TTA
113 * instruction word.
114 *
115 * @param index The index.
116 * @return The move slot at given index.
117 * @exception OutOfRange If the index is negative or is not smaller than the
118 * number of move slots of the TTA instruction word.
119 */
121BinaryEncoding::moveSlot(int index) const {
122 if (index < 0 || index >= moveSlotCount()) {
123 const string procName = "BinaryEncoding::moveSlot";
124 throw OutOfRange(__FILE__, __LINE__, procName);
125 }
126
127 return *moveSlots_[index];
128}
129
130/**
131 * Tells whether the encoding map contains a move slot with the given (bus)
132 * name.
133 *
134 * @param name The bus name.
135 * @return True if there is a move slot with the given name, otherwise false.
136 */
137bool
138BinaryEncoding::hasMoveSlot(const std::string& name) const {
139 for (MoveSlotContainer::const_iterator iter = moveSlots_.begin();
140 iter != moveSlots_.end(); iter++) {
141 MoveSlot* slot = *iter;
142 if (slot->name() == name) {
143 return true;
144 }
145 }
146
147 return false;
148}
149
150
151/**
152 * Returns the move slot that programs the bus identified by the given name.
153 *
154 * @param The bus name.
155 * @return The move slot.
156 * @exception InstanceNotFound If the encoding map does not contain a move
157 * slot with the given name.
158 */
160BinaryEncoding::moveSlot(const std::string& name) const {
161 for (MoveSlotContainer::const_iterator iter = moveSlots_.begin();
162 iter != moveSlots_.end(); iter++) {
163 MoveSlot* slot = *iter;
164 if (slot->name() == name) {
165 return *slot;
166 }
167 }
168
169 const string procName = "BinaryEncoding::moveSlot";
170 throw InstanceNotFound(__FILE__, __LINE__, procName);
171}
172
173/**
174 * Adds the given move slot to the encoding map.
175 *
176 * This method is to be called from the constructor of MoveSlot.
177 *
178 * @param slot The move slot to be added.
179 * @exception ObjectAlreadyExists If the encoding map contains a slot with
180 * the same name already.
181 */
182void
184 // verify that this is called from MoveSlot constructor
185 assert(slot.parent() == NULL);
186
187 if (hasMoveSlot(slot.name())) {
188 const string procName = "BinaryEncoding::addMoveSlot";
189 throw ObjectAlreadyExists(__FILE__, __LINE__, procName);
190 }
191
192 moveSlots_.push_back(&slot);
193}
194
195/**
196 * Removes the given move slot from the encoding map.
197 *
198 * This method is to be called from the destructor of MoveSlot.
199 *
200 * @param slot The move slot to be removed.
201 */
202void
204 // verify that this is called from MoveSlot destructor.
205 assert(slot.parent() == NULL);
207}
208
209
210/**
211 * Returns the number of immediate slots in the instruction.
212 *
213 * @return The number of immediate slots.
214 */
215int
217 return immediateSlots_.size();
218}
219
220
221/**
222 * Returns the immediate slot at given index.
223 *
224 * The index does not have to reflect the actual order within the TTA
225 * instruction word.
226 *
227 * @param index The index.
228 * @return The immediate slot at given index.
229 * @exception OutOfRange If the index is negative or is not smaller than the
230 * number of immediate slots in the TTA instruction
231 * word.
232 */
235 if (index < 0 || index >= immediateSlotCount()) {
236 const string procName = "BinaryEncoding::immediateSlot";
237 throw OutOfRange(__FILE__, __LINE__, procName);
238 }
239
240 return *immediateSlots_[index];
241}
242
243/**
244 * Tells whether the encoding map contains an immediate slot with the given
245 * name.
246 *
247 * @param name The name of the immediate slot.
248 * @return True if there is an immediate slot with the given name, otherwise
249 * false.
250 */
251bool
252BinaryEncoding::hasImmediateSlot(const std::string& name) const {
253
254 for (ImmediateSlotContainer::const_iterator iter =
255 immediateSlots_.begin(); iter != immediateSlots_.end();
256 iter++) {
257 ImmediateSlotField* slot = *iter;
258 if (slot->name() == name) {
259 return true;
260 }
261 }
262
263 return false;
264}
265
266
267/**
268 * Returns the immediate slot of the given name.
269 *
270 * @param name The name of the immediate slot.
271 * @return The immediate slot.
272 * @exception InstanceNotFound If the encoding map does not contain an
273 * immediate slot with the given name.
274 */
276BinaryEncoding::immediateSlot(const std::string& name) const {
277 for (ImmediateSlotContainer::const_iterator iter =
278 immediateSlots_.begin(); iter != immediateSlots_.end();
279 iter++) {
280 ImmediateSlotField* slot = *iter;
281 if (slot->name() == name) {
282 return *slot;
283 }
284 }
285
286 const string procName = "BinaryEncoding::immediateSlot";
287 throw InstanceNotFound(__FILE__, __LINE__, procName);
288}
289
290/**
291 * Adds the given immediate slot to the encoding map.
292 *
293 * This method is to be called from the constructor of ImmediateSlotField.
294 *
295 * @param slot The immediate slot to be added.
296 * @exception ObjectAlreadyExists If the encoding map contains an immediate
297 * slot with the same name already.
298 */
299void
301 // verify that this is called from MoveSlot constructor
302 assert(slot.parent() == NULL);
303
304 if (hasImmediateSlot(slot.name())) {
305 const string procName = "BinaryEncoding::addImmediateSlot";
306 throw ObjectAlreadyExists(__FILE__, __LINE__, procName);
307 }
308
309 immediateSlots_.push_back(&slot);
310}
311
312/**
313 * Removes the given immediate slot from the encoding map.
314 *
315 * This method is to be called from the destructor of ImmediateSlotField.
316 *
317 * @param slot The immediate slot to be removed.
318 */
319void
321 // verify that this is called from ImmediateSlotField destructor.
322 assert(slot.parent() == NULL);
324}
325
326
327/**
328 * Tells whether the instruction word has an immediate control field.
329 *
330 * @return True if the instruction word has an immediate control field,
331 * otherwise false.
332 */
333bool
337
338
339/**
340 * Returns the immediate control field of the instruction word, if one exists.
341 *
342 * Returns a NullImmediateControlField instance otherwise (a single-template
343 * instruction).
344 *
345 * @return The immediate control field.
346 */
350 return *immediateField_;
351 } else {
353 }
354}
355
356
357/**
358 * Adds the given immediate control field to the instruction word.
359 *
360 * This method is to be called from the constructor of ImmediateControlField.
361 *
362 * @param field The immediate control field to be added.
363 * @exception ObjectAlreadyExists If the instruction word already has an
364 * immediate control field.
365 */
366void
368 // verify that this is called from ImmediateControlField constructor
369 assert(field.parent() == NULL);
370
372 const string procName = "BinaryEncoding::setImmediateControlField";
373 throw ObjectAlreadyExists(__FILE__, __LINE__, procName);
374 }
375
376 immediateField_ = &field;
377}
378
379/**
380 * Removes the immediate control field.
381 *
382 * This method is to be called from the destructor of ImmediateControlField.
383 */
384void
386 // verify that this is called from ImmediateControlField destructor
389 immediateField_ = NULL;
390}
391
392
393/**
394 * Returns the number of long immediate destination register fields in the
395 * instruction.
396 *
397 * @return The number of fields.
398 */
399int
403
404
405/**
406 * Returns a long immediate destination register field by the given index.
407 *
408 * @param index The index.
409 * @return The field.
410 * @exception OutOfRange If the index is negative or not smaller than the
411 * number of long immediate destination register
412 * fields.
413 */
416 if (index < 0 || index >= longImmDstRegisterFieldCount()) {
417 throw OutOfRange(__FILE__, __LINE__, __func__);
418 }
419
420 return *longImmDstRegFields_[index];
421}
422
423/**
424 * Returns the long immediate destination register field that gives the
425 * destination register of the given immediate unit in the given instruction
426 * template.
427 *
428 * @param iTemp Name of the instruction template.
429 * @param dstUnit Name of the immediate unit.
430 * @return The long immediate destination register field.
431 * @exception InstanceNotFound If there is no such field.
432 */
435 const std::string& iTemp, const std::string& dstUnit) const {
436 int fields = longImmDstRegisterFieldCount();
437 for (int i = 0; i < fields; i++) {
439 if (field.usedByInstructionTemplate(iTemp)) {
440 if (field.immediateUnit(iTemp) == dstUnit) {
441 return field;
442 }
443 }
444 }
445
446 throw InstanceNotFound(__FILE__, __LINE__, __func__);
447}
448
449/**
450 * Adds the given long immediate destination register field to the
451 * instruction format.
452 *
453 * This method is to be called from the constructor of LImmDstRegisterField
454 * only!
455 *
456 * @param field The field to add.
457 */
458void
463
464
465/**
466 * Removes the given long immediate destination register field from the
467 * instruction format.
468 *
469 * This method is to be called from the destructor of LImmDstRegisterField
470 * only!
471 *
472 * @param field The field to remove.
473 */
474void
480
481/**
482 * Returns the number of instruction formats in the in binary encoding.
483 *
484 * @return The number of instruction formats.
485 */
486
487int
491
492/**
493 * Tells whether the binary encoding has an instruction format with the given
494 * name.
495 *
496 * @param name The name.
497 * @return True if the ecoding map contains an instruction format with the
498 * given name, otherwise false.
499 */
500
501bool
502BinaryEncoding::hasInstructionFormat(const std::string& name) const {
503 return std::find_if(
505 [name](const InstructionFormat* it) {
506 return it->name() == name;
507 }) != instructionFormats_.end();
508}
509
510/**
511 * Returns the instruction format with the given index.
512 *
513 * @param index The index.
514 * @return The instruction format
515 * @exception OutOfRange If the given index is negative or not smaller than
516 * the number of instruction formats in the encoding
517 * map.
518 */
519
522 if (index < 0 || index >= instructionFormatCount()) {
523 throw OutOfRange(__FILE__, __LINE__, __func__);
524 }
525 return *instructionFormats_[index];
526}
527
528/**
529 * Returns the instruction format with the given name.
530 *
531 * @param name The name of the format.
532 * @return The instruction format, null if not found
533 */
534
536BinaryEncoding::instructionFormat(const std::string& name) const {
537 InstructionFormat* format = NULL;
538 for (int f = 0; f < instructionFormatCount(); f++) {
539 if (instructionFormat(f).name() == name) {
540 format = &instructionFormat(f);
541 break;
542 }
543 }
544 return format;
545}
546
547/**
548 * Adds the given instruction format to the encoding map.
549 *
550 * @param format The instruction format to be added.
551 * @exception ObjectAlreadyExists If the encoding map already contains a
552 * a socket code table with the same name as
553 * the given table.
554 */
555
556void
558 // verify that this is called from InstructionFormat constructor
559 assert(format.parent() == NULL);
560
561 if (hasInstructionFormat(format.name())) {
562 const string procName = "BinaryEncoding::addInstructionFormat";
563 throw ObjectAlreadyExists(__FILE__, __LINE__, procName);
564 }
565
566 instructionFormats_.push_back(&format);
567}
568
569/**
570 * Removes the given instruction format from the encoding map.
571 * This method is to be called from the destructor Instruction Format.
572 *
573 * @param format The instruction format to be removed.
574 */
575
576void
581
582/**
583 * Returns the number of socket code tables contained by the encoding map.
584 *
585 * @return The number of socket code tables.
586 */
587int
589 return socketCodes_.size();
590}
591
592
593/**
594 * Returns the socket code table at the given index.
595 *
596 * @param index The index.
597 * @exception OutOfRange If the given index is negative or not smaller than
598 * the number of socket code tables in the encoding
599 * map.
600 */
603 if (index < 0 || index >= socketCodeTableCount()) {
604 const string procName = "BinaryEncoding::socketCodeTable";
605 throw OutOfRange(__FILE__, __LINE__, procName);
606 }
607
608 return *socketCodes_[index];
609}
610
611/**
612 * Returns the socket code table which has the given name.
613 *
614 * Returns a NullSocketCodeTable instance if there is no such table.
615 *
616 * @param name Name of the table.
617 * @return The socket code table.
618 */
620BinaryEncoding::socketCodeTable(const std::string& name) const {
621
622 for (int i = 0; i < socketCodeTableCount(); i++) {
624 if (table.name() == name) {
625 return table;
626 }
627 }
628
630}
631
632
633/**
634 * Adds the given socket code table to the encoding map.
635 *
636 * This method is to be called from the constructor of SocketCodeTable.
637 *
638 * @param table The socket code table to be added.
639 * @exception ObjectAlreadyExists If the encoding map already contains a
640 * socket code table with the same name as
641 * the given table.
642 */
643void
645 // verify that this is called from SocketCodeTable constructor
646 assert(table.parent() == NULL);
647
648 if (hasSocketCodeTable(table.name())) {
649 const string procName = "BinaryEncoding::addSocketCodeTable";
650 throw ObjectAlreadyExists(__FILE__, __LINE__, procName);
651 }
652
653 socketCodes_.push_back(&table);
654}
655
656/**
657 * Removes the given socket code table from the encoding map.
658 *
659 * This method is to be called from the destructor of SocketCodeTable.
660 *
661 * @param table The socket code table to be removed.
662 */
663void
668
669/**
670 * Returns the extra template bit amount in the largest template in the
671 * machine. Needed for instructionField's bitPosition-method.
672 *
673 * @return The extra padding bits in the longest instruction template.
674 */
675int
677 if (immediateField_ == NULL) return 0;
678
679 TCEString longestTemplate = "";
680 int maxWidth = 0;
681
682 for (int i = 0; i < immediateField_->templateCount(); ++i) {
684 int w = width(iTemplate);
685 if (w > maxWidth) {
686 maxWidth = w;
687 longestTemplate = iTemplate;
688 }
689 }
690 return templateExtraBits(longestTemplate);
691}
692
693/**
694 * Returns the number of immediate child fields
695 * (move slots + immediate slots + immediate control field).
696 *
697 * @return The number of child fields.
698 */
699int
701 int count = moveSlotCount() + immediateSlotCount() +
704 count++;
705 }
706 return count;
707}
708
709
710/**
711 * Returns the child instruction field at the given relative position.
712 *
713 * Returns a NullInstructionField instance if there is no child field at
714 * the given position. This is, however, not possible if the object model is
715 * in consistent state.
716 *
717 * @param position The relative position.
718 * @return The instruction field at the given relative position.
719 * @exception OutOfRange If the given position is negative or not smaller
720 * than the number of child fields.
721 */
723BinaryEncoding::childField(int position) const {
724 if (position < 0 || position >= childFieldCount()) {
725 const string procName = "BinaryEncoding::childField";
726 throw OutOfRange(__FILE__, __LINE__, procName);
727 }
728
730 immediateControlField().relativePosition() == position) {
731 return immediateControlField();
732 }
733
734 int moveSlots = moveSlotCount();
735 for (int i = 0; i < moveSlots; i++) {
736 MoveSlot& slot = moveSlot(i);
737 if (slot.relativePosition() == position) {
738 return slot;
739 }
740 }
741
742 int immediateSlots = immediateSlotCount();
743 for (int i = 0; i < immediateSlots; i++) {
745 if (slot.relativePosition() == position) {
746 return slot;
747 }
748 }
749
750 int limmDstRegFields = longImmDstRegisterFieldCount();
751 for (int i = 0; i < limmDstRegFields; i++) {
753 if (field.relativePosition() == position) {
754 return field;
755 }
756 }
757
759}
760
761/**
762 * Returns the bit width of the maximum width instruction word defined by this
763 * encoding map.
764 *
765 * @param If set, returns the instruction width of the given instruction
766 * template, otherwise the maximum.
767 * @return The bit width of the instruction word.
768 */
769int
771 if (immediateField_ == NULL) return width("");
772
773 int maxWidth = 0;
774 for (int i = 0; i < immediateField_->templateCount(); ++i) {
776 int w = width(iTemplate);
777 if (w > maxWidth) maxWidth = w;
778 }
779 return maxWidth;
780}
781
782/**
783 * Returns the bit width of the instruction word defined by an instruction
784 * template in this encoding map.
785 */
786int
787BinaryEncoding::width(const TCEString& templateName) const {
788 int moveSlots = moveSlotCount();
789 int immediateSlots = immediateSlotCount();
790 int limmDstRegFields = longImmDstRegisterFieldCount();
791 int width = 0;
792
793 for (int i = 0; i < moveSlots; i++) {
794 MoveSlot& slot = moveSlot(i);
795 width += slot.width();
796 }
797
798 for (int i = 0; i < immediateSlots; i++) {
800 width += slot.width();
801 }
802
803 for (int i = 0; i < limmDstRegFields; i++) {
805 width += field.width();
806 }
807
810 }
811
812 width += templateExtraBits(templateName);
813 width += extraBits();
814 return width;
815}
816
817/**
818 * Loads the state of the binary encoding map from the given ObjectState
819 * tree.
820 *
821 * @param state The ObjectState tree.
822 * @exception ObjectStateLoadingException If an error occurs while loading
823 * the state.
824 */
825void
827 if (state->name() != OSNAME_BEM) {
828 const string procName = "BinaryEncoding::loadState";
829 throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
830 }
831
832 // create socket code tables at first
833 for (int i = 0; i < state->childCount(); i++) {
834 ObjectState* child = state->child(i);
836 new SocketCodeTable(child, *this);
837 }
838 }
839
840 // create subfields in the correct order
841 ObjectState* newState = new ObjectState(*state);
842 reorderSubfields(newState);
843
844 for (int i = 0; i < newState->childCount(); i++) {
845 ObjectState* child = newState->child(i);
846 if (child->name() == MoveSlot::OSNAME_MOVE_SLOT) {
847 new MoveSlot(child, *this);
848 } else if (child->name() ==
850 new ImmediateSlotField(child, *this);
851 } else if (child->name() ==
853 new ImmediateControlField(child, *this);
854 } else if (child->name() ==
856 new LImmDstRegisterField(child, *this);
857 } else if (
861 ->stringValue(),
862 child
863 ->childByName(
865 ->intValue());
866 }
867 }
868 delete newState;
869}
870
871/**
872 * Saves the state of the binary encoding map to an ObjectState tree.
873 *
874 * @return The newly created ObjectState tree.
875 */
878
880
881 // add move slots
882 int moveSlots = moveSlotCount();
883 for (int i = 0; i < moveSlots; i++) {
884 MoveSlot& slot = moveSlot(i);
885 bem->addChild(slot.saveState());
886 }
887
888 // add immediate slots
889 int immediateSlots = immediateSlotCount();
890 for (int i = 0; i < immediateSlots; i++) {
892 bem->addChild(slot.saveState());
893 }
894
895 // add long immediate destination register fields
896 int limmDstRegFields = longImmDstRegisterFieldCount();
897 for (int i = 0; i < limmDstRegFields; i++) {
899 bem->addChild(field.saveState());
900 }
901
902 // add socket code tables
903 int tableCount = socketCodeTableCount();
904 for (int i = 0; i < tableCount; i++) {
906 bem->addChild(table.saveState());
907 }
908
909 // add immediate control field
912 }
913
914 for (TemplateExtraBitCountMap::const_iterator
915 i = extraTemplateBits_.begin(),
916 e = extraTemplateBits_.end();
917 i != e; ++i) {
918 TCEString templateName = (*i).first;
919 int bitCount = (*i).second;
920 ObjectState* root =
922
923 ObjectState* templateNameObj =
925 templateNameObj->setValue(templateName);
926
927 ObjectState* bitCountObj =
929 bitCountObj->setValue(bitCount);
930
931 root->addChild(templateNameObj);
932 root->addChild(bitCountObj);
933
934 bem->addChild(root);
935 }
936
937 for (int i = 0; i < instructionFormatCount(); i++) {
938 bem->addChild(instructionFormats_.at(i)->saveState());
939 }
940
941 return bem;
942}
943
944
945/**
946 * Tells whether the encoding map contains a socket code table with the given
947 * name.
948 *
949 * @param name The name.
950 * @return True if the encoding map contains a socket code table with the
951 * given name, otherwise false.
952 */
953bool
954BinaryEncoding::hasSocketCodeTable(const std::string& name) const {
955 for (SocketCodeTableContainer::const_iterator iter = socketCodes_.begin();
956 iter != socketCodes_.end(); iter++) {
957 SocketCodeTable* table = *iter;
958 if (table->name() == name) {
959 return true;
960 }
961 }
962
963 return false;
964}
965
966
967/**
968 * Deletes all the move slots contained by the encoding map.
969 */
970void
974
975
976/**
977 * Deletes all the immediate slots contained by the encoding map.
978 */
979void
983
984
985/**
986 * Deletes all the long immediate destination register fields contained
987 * by the encoding map.
988 */
989void
993
994
995/**
996 * Deletes all the socket code tables contained by the encoding map.
997 */
998void
1002
1003/**
1004 * Deletes all the instruction formats contained by the encoding map.
1005 */
1006void
1010/**
1011 * Sets the extra padding bit count for an instruction template
1012 */
1013void
1015 const TCEString& templateName, int bitCount) {
1016 extraTemplateBits_[templateName] = bitCount;
1017}
1018
1019int
1021 TemplateExtraBitCountMap::const_iterator pos =
1022 extraTemplateBits_.find(templateName);
1023
1024 if (pos == extraTemplateBits_.end()) return 0;
1025 return (*pos).second;
1026}
#define __func__
#define assert(condition)
int instructionFormatCount() const
void addInstructionFormat(InstructionFormat &format)
ImmediateControlField & immediateControlField() const
static const std::string OSNAME_TEMPLATE_NAME
int socketCodeTableCount() const
LImmDstRegisterField & longImmDstRegisterField(int index) const
static const std::string OSNAME_BEM
ObjectState name for binary encoding.
int moveSlotCount() const
bool hasSocketCodeTable(const std::string &name) const
void addLongImmDstRegisterField(LImmDstRegisterField &field)
void addSocketCodeTable(SocketCodeTable &table)
virtual int width() const
bool hasInstructionFormat(const std::string &name) const
int longestTemplateExtraBits() const
void removeMoveSlot(MoveSlot &slot)
virtual ObjectState * saveState() const
ImmediateSlotContainer immediateSlots_
A container for immediate slots.
virtual int childFieldCount() const
void deleteInstructionFormats()
int templateExtraBits(const TCEString &templateName) const
int immediateSlotCount() const
static const std::string OSNAME_TEMPLATE_EXTRA_BIT_COUNT
MoveSlot & moveSlot(int index) const
InstructionFormatContainer instructionFormats_
A container for instruction formats.
int longImmDstRegisterFieldCount() const
MoveSlotContainer moveSlots_
A container for move slots.
void removeLongImmDstRegisterField(LImmDstRegisterField &field)
LImmDstRegisterFieldContainer longImmDstRegFields_
A container for long immediate register fields.
void addMoveSlot(MoveSlot &slot)
virtual void loadState(const ObjectState *state)
bool hasImmediateSlot(const std::string &name) const
void unsetImmediateControlField()
void addImmediateSlot(ImmediateSlotField &slot)
TemplateExtraBitCountMap extraTemplateBits_
Extra (padding) bits per instruction template.
void removeInstructionFormat(InstructionFormat &format)
void removeSocketCodeTable(SocketCodeTable &table)
void removeImmediateSlot(ImmediateSlotField &slot)
void deleteLongImmDstRegisterFields()
ImmediateSlotField & immediateSlot(int index) const
void setImmediateControlField(ImmediateControlField &field)
SocketCodeTableContainer socketCodes_
A container for socket code tables.
bool hasMoveSlot(const std::string &name) const
SocketCodeTable & socketCodeTable(int index) const
virtual ~BinaryEncoding()
bool hasImmediateControlField() const
static const std::string OSNAME_TEMPLATE_EXTRA_BITS
ImmediateControlField * immediateField_
The immediate control field.
virtual InstructionField & childField(int position) const
void deleteImmediateSlots()
InstructionFormat & instructionFormat(int index) const
void setTemplateExtraBits(const TCEString &templateName, int bitCount)
static bool removeValueIfExists(ContainerType &aContainer, const ElementType &aKey)
static const std::string OSNAME_IMM_CONTROL_FIELD
ObjectState name for immediate control field.
std::string instructionTemplate(int index) const
BinaryEncoding * parent() const
virtual ObjectState * saveState() const
virtual int width() const
std::string name() const
static const std::string OSNAME_IMMEDIATE_SLOT_FIELD
ObjectState name for immediate slot field.
BinaryEncoding * parent() const
InstructionField * parent() const
static void reorderSubfields(ObjectState *state)
int relativePosition() const
std::string name() const
InstructionField * parent() const
BinaryEncoding * parent() const
bool usedByInstructionTemplate(const std::string &instructionTemplate) const
virtual int width() const
static const std::string OSNAME_LIMM_DST_REGISTER_FIELD
ObjectState name for long immediate destination register field.
virtual ObjectState * saveState() const
std::string immediateUnit(const std::string &instructionTemplate) const
BinaryEncoding * parent() const
Definition MoveSlot.cc:118
virtual ObjectState * saveState() const
Definition MoveSlot.cc:469
virtual int width() const
Definition MoveSlot.cc:406
std::string name() const
Definition MoveSlot.cc:136
static const std::string OSNAME_MOVE_SLOT
ObjectState name for move slot.
Definition MoveSlot.hh:96
static NullImmediateControlField & instance()
static NullInstructionField & instance()
static NullSocketCodeTable & instance()
ObjectState * childByName(const std::string &name) const
void setValue(const std::string &value)
ObjectState * child(int index) const
void addChild(ObjectState *child)
int intValue() const
std::string stringValue() const
std::string name() const
int childCount() const
static void deleteAllItems(SequenceType &aSequence)
std::string name() const
static const std::string OSNAME_SOCKET_CODE_TABLE
ObjectState name for socket code table.
virtual ObjectState * saveState() const
BinaryEncoding * parent() const