OpenASIP 2.2
Loading...
Searching...
No Matches
BEMSerializer.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file BEMSerializer.cc
26 *
27 * Implementation of BEMSerializer class.
28 *
29 * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#include <string>
34#include <vector>
35
36#include "BEMSerializer.hh"
37#include "BinaryEncoding.hh"
38#include "SocketCodeTable.hh"
39#include "FUPortCode.hh"
40#include "RFPortCode.hh"
41#include "IUPortCode.hh"
43#include "MoveSlot.hh"
45#include "ImmediateSlotField.hh"
46#include "GuardField.hh"
47#include "SourceField.hh"
48#include "DestinationField.hh"
49#include "GPRGuardEncoding.hh"
50#include "FUGuardEncoding.hh"
52#include "SocketEncoding.hh"
53#include "BridgeEncoding.hh"
54#include "ImmediateEncoding.hh"
55#include "NOPEncoding.hh"
56#include "Application.hh"
57#include "Environment.hh"
58#include "ObjectState.hh"
59#include "InstructionFormat.hh"
60
61using std::string;
62using std::vector;
63
64const string TRUE = "true";
65const string FALSE = "false";
66
67const string ADF_ENCODING = "adf-encoding";
68const string BEM_VERSION_STR = "version";
69const string REQUIRED_VERSION = "required-version";
70
71const string SOCKET_CODE_TABLE = "map-ports";
72const string SC_TABLE_NAME = "name";
73const string SC_TABLE_EXTRA_BITS = "extra-bits";
74const string FU_PORT_CODE = "fu-port-code";
75const string FU_PORT_CODE_PORT = "name";
76const string FU_PORT_CODE_FU = "fu";
77const string FU_PORT_CODE_OPERATION = "operation";
78const string FU_PORT_CODE_ENCODING = "encoding";
79const string FU_PORT_CODE_EXTRA_BITS = "extra-bits";
80const string RF_PORT_CODE = "rf-port-code";
81const string RF_PORT_CODE_RF = "rf";
82const string RF_PORT_CODE_INDEX_WIDTH = "index-width";
83const string RF_PORT_CODE_MAX_INDEX = "max-index";
84const string RF_PORT_CODE_ENCODING = "encoding";
85const string RF_PORT_CODE_EXTRA_BITS = "extra-bits";
86const string IU_PORT_CODE = "iu-port-code";
87const string IU_PORT_CODE_IU = "iu";
88
89const string LONG_IMMEDIATE_TAG = "long-immediate-tag";
90const string LIMM_TAG_POSITION = "pos";
91const string LIMM_TAG_EXTRA_BITS = "extra-bits";
92const string LIMM_TAG_MAP = "map";
93const string LIMM_TAG_MAP_NAME = "name";
94
95const string IMM_REG_FIELD = "immediate-register-field";
96const string IMM_REG_FIELD_POS = "pos";
97const string IMM_REG_FIELD_WIDTH = "width";
98const string IMM_REG_FIELD_ITEMP = "instruction-template";
99const string IMM_REG_FIELD_ITEMP_NAME = "name";
100const string IMM_REG_FIELD_ITEMP_REG_INDEX = "reg-index-of";
101
102const string SLOT = "slot";
103const string SLOT_NAME = "name";
104const string SLOT_POSITION = "pos";
105const string SLOT_EXTRA_BITS = "extra-bits";
106const string SLOT_GUARD = "guard";
107const string SLOT_GUARD_POSITION = "pos";
108const string SLOT_GUARD_EXTRA_BITS = "extra-bits";
109const string REG_GUARD_CODE = "reg-guard-code";
110const string REG_GUARD_CODE_RF = "rf";
111const string REG_GUARD_CODE_INDEX = "index";
112const string REG_GUARD_CODE_INVERTED = "inv";
113const string PORT_GUARD_CODE = "port-guard-code";
114const string PORT_GUARD_CODE_FU = "fu";
115const string PORT_GUARD_CODE_PORT = "port";
116const string PORT_GUARD_CODE_INVERTED = "inv";
117const string ALWAYS_TRUE_GUARD_CODE = "always-true-guard-code";
118const string ALWAYS_FALSE_GUARD_CODE = "always-false-guard-code";
119
120const string SLOT_SOURCE = "source";
121const string SLOT_DESTINATION = "destination";
122
123const string SRC_DST_POSITION = "pos";
124const string SRC_DST_EXTRA_BITS = "extra-bits";
125const string SRC_DST_ID_POS = "id-pos";
126const string ID_POS_LEFT = "left";
127const string ID_POS_RIGHT = "right";
128
129const string SOCKET = "socket";
130const string SOCKET_NAME = "name";
131const string SOCKET_MAP = "map";
132const string SOCKET_MAP_EXTRA_BITS = "extra-bits";
133const string SOCKET_MAP_CODES = "codes";
134
135const string SOURCE_IMMEDIATE = "immediate";
136const string SOURCE_IMMEDIATE_WIDTH = "width";
137const string SOURCE_IMMEDIATE_MAP = "map";
138const string SOURCE_IMMEDIATE_MAP_EXTRA_BITS = "extra-bits";
139const string SOURCE_BRIDGE = "bridge";
140const string SOURCE_BRIDGE_NAME = "name";
141const string SOURCE_BRIDGE_MAP = "map";
142const string SOURCE_BRIDGE_MAP_EXTRA_BITS = "extra-bits";
143
144const string SRC_DST_NO_OPERATION = "no-operation";
145const string SRC_DST_NO_OPERATION_MAP = "map";
146const string SRC_DST_NO_OPERATION_MAP_EXTRA_BITS = "extra-bits";
147
148const string INSTRUCTION_FORMAT = "ota-format";
149const string INSTRUCTION_FORMAT_NAME = "name";
150
151const string IMMEDIATE_SLOT = "immediate-slot";
152const string IMMEDIATE_SLOT_NAME = "name";
153const string IMMEDIATE_SLOT_WIDTH = "width";
154const string IMMEDIATE_SLOT_POS = "pos";
155
156const string EXTRA_BITS = "extra-bits";
157const string MAP = "map";
158
159const string BEM_SCHEMA_FILE = "bem/BEM_Schema.xsd";
160
161/**
162 * The constructor.
163 */
168
169
170/**
171 * The destructor.
172 */
175
176
177/**
178 * Reads the BEM file and returns an ObjectState tree that can be loaded by
179 * BinaryEncoding.
180 *
181 * @return An ObjectState tree that can be loaded by BinaryEncoding.
182 * @exception SerializerException If an error occurs while reading the BEM
183 * file.
184 */
188
189 double version = fileState->doubleAttribute(BEM_VERSION_STR);
190 if (fileState->hasAttribute(REQUIRED_VERSION)) {
191 double requiredVersion = fileState->doubleAttribute(REQUIRED_VERSION);
192 if (requiredVersion > 1.5) {
195 "Cannot parse the file. "
196 "The file requests parser version of " +
198 ". "
199 "The version of the parser is 1.5.");
200 }
201 }
202 if (version < 1.2) {
203 convertZeroEncExtraBits(fileState);
204 }
205 ObjectState* omState = convertToOMFormat(fileState);
206 delete fileState;
207 return omState;
208}
209
210/**
211 * Recursively convert all encodings with zero encodings to have
212 * one more extra bit.
213 */
215 if (os->name() == MAP) {
216 if (os->intValue() == 0 && os->hasAttribute(EXTRA_BITS)) {
217 int extraBits = os->intAttribute(EXTRA_BITS);
218 os->setAttribute(EXTRA_BITS, extraBits + 1);
219 }
220 }
221 if (os->name() == FU_PORT_CODE &&
222 os->hasChild(EXTRA_BITS) &&
224 if (os->childByName(FU_PORT_CODE_ENCODING)->intValue() == 0) {
226 eb ->setValue(eb->intValue()+1);
227 }
228 }
229 // call recursively for children
230 for (int i = 0; i < os->childCount(); i++) {
231 ObjectState* child = os->child(i);
233 }
234}
235
236
237/**
238 * Writes the given ObjectState tree that represents a BEM object model to a
239 * BEM file.
240 *
241 * @param state ObjectState tree obtained by calling
242 * BinaryEncoding::saveState().
243 * @exception SerializerException If the destination file cannot be written.
244 */
245void
247 ObjectState* fileState = convertToFileFormat(state);
248 XMLSerializer::writeState(fileState);
249 delete fileState;
250}
251
252/**
253 * Reads the BEM file and creates a BinaryEncoding instance from it.
254 *
255 * @return The newly created BinaryEncoding instance.
256 */
259 ObjectState* omState = readState();
260 BinaryEncoding* bem = new BinaryEncoding(omState);
261 delete omState;
262 return bem;
263}
264
265/**
266 * Writes the given binary encoding to a BEM file.
267 *
268 * @param bem The binary encoding.
269 * @exception SerializerException If the destination file cannot be written.
270 */
271void
273 ObjectState* omState = bem.saveState();
274 writeState(omState);
275 delete omState;
276}
277
278/**
279 * Converts the given ObjectState tree that represents a BEM file to an
280 * ObjectState tree that can be loaded by BinaryEncoding.
281 *
282 * @param fileState ObjectState tree that represents a BEM file.
283 * @return A newly created ObjectState tree that can be loaded by
284 * BinaryEncoding.
285 */
288
290
291 for (int i = 0; i < fileState->childCount(); i++) {
292 ObjectState* child = fileState->child(i);
293 if (child->name() == SOCKET_CODE_TABLE) {
294 bem->addChild(socketCodeTableToOM(child));
295 } else if (child->name() == SLOT) {
296 bem->addChild(moveSlotToOM(child));
297 } else if (child->name() == IMMEDIATE_SLOT) {
298 bem->addChild(immediateSlotToOM(child));
299 } else if (child->name() == LONG_IMMEDIATE_TAG) {
300 bem->addChild(longImmTagToOM(child));
301 } else if (child->name() == IMM_REG_FIELD) {
302 bem->addChild(longImmDstRegFieldToOM(child));
303 } else if (child->name() == INSTRUCTION_FORMAT) {
304 ObjectState* newChild = new ObjectState(*child);
305 bem->addChild(newChild);
306 } else if (
308 bem->addChild(new ObjectState(*child));
309 } else {
310 assert(false);
311 }
312 }
313
314 return bem;
315}
316
317
318/**
319 * Converts the ObjectState tree that represent the BEM object model to an
320 * ObjectState tree that represents the BEM file format.
321 *
322 * @param omState ObjectState tree that represents BEM object model (returned
323 * by BinaryEncoding::saveState()).
324 * @return ObjectState tree representing BEM file.
325 */
328
329 ObjectState* fileState = new ObjectState(ADF_ENCODING);
330 const string version = "1.5";
331 const string requiredVersion = "1.5";
332 fileState->setAttribute(BEM_VERSION_STR, version);
333 fileState->setAttribute(REQUIRED_VERSION, requiredVersion);
334
335 // create socket code tables
336 for (int i = 0; i < state->childCount(); i++) {
337 ObjectState* child = state->child(i);
339 fileState->addChild(socketCodeTableToFile(child));
340 }
341 }
342
343 // create long immediate tag
344 for (int i = 0; i < state->childCount(); i++) {
345 ObjectState* child = state->child(i);
346 if (child->name() ==
348 fileState->addChild(longImmTagToFile(child));
349 }
350 }
351
352 // create long immediate destination register fields
353 for (int i = 0; i < state->childCount(); i++) {
354 ObjectState* child = state->child(i);
355 if (child->name() ==
357 fileState->addChild(longImmDstRegisterFieldToFile(child));
358 }
359 }
360
361 // create move slots
362 for (int i = 0; i < state->childCount(); i++) {
363 ObjectState* child = state->child(i);
364 if (child->name() == MoveSlot::OSNAME_MOVE_SLOT) {
365 fileState->addChild(moveSlotToFile(child));
366 }
367 }
368
369 // create immediate slots
370 for (int i = 0; i < state->childCount(); i++) {
371 ObjectState* child = state->child(i);
372 if (child->name() ==
374 fileState->addChild(immediateSlotToFile(child));
375 }
376 }
377
378 for (int i = 0; i < state->childCount(); i++) {
379 ObjectState* child = state->child(i);
381 ObjectState* newChild = new ObjectState(*child);
382 fileState->addChild(newChild);
383 }
384 }
385
386 // template extra bits: copy OS tree
387 for (int i = 0; i < state->childCount(); i++) {
388 ObjectState* child = state->child(i);
390 fileState->addChild(new ObjectState(*child));
391 }
392 }
393 return fileState;
394}
395
396
397/**
398 * Converts the given ObjectState tree that represents a socket code table in
399 * the object model format to BEM file format.
400 *
401 * @return The newly created ObjectState tree.
402 */
405
407 scTable->setAttribute(
410
411 // create extra-bits element
413 scTable->addChild(extraBits);
414 extraBits->setValue(
416
417 // create fu-port-code elements
418 for (int i = 0; i < omTable->childCount(); i++) {
419 ObjectState* portCode = omTable->child(i);
420 if (portCode->name() == FUPortCode::OSNAME_FU_PORT_CODE) {
421 ObjectState* fuPortCode = new ObjectState(FU_PORT_CODE);
422 scTable->addChild(fuPortCode);
423 fuPortCode->setAttribute(
426 fuPortCode->setAttribute(
430 fuPortCode->setAttribute(
432 portCode->stringAttribute(
434 }
436 fuPortCode->addChild(encoding);
437 encoding->setValue(
440 fuPortCode->addChild(extraBits);
441 extraBits->setValue(
443 }
444 }
445
446 // create rf-port-code elements
447 for (int i = 0; i < omTable->childCount(); i++) {
448 ObjectState* portCode = omTable->child(i);
449 if (portCode->name() == RFPortCode::OSNAME_RF_PORT_CODE) {
450 ObjectState* rfPortCode = new ObjectState(RF_PORT_CODE);
451 scTable->addChild(rfPortCode);
452 rfPortCode->setAttribute(
455 rfPortCode->setAttribute(
458
460 rfPortCode->setAttribute(
463
465 ObjectState* encoding = new ObjectState(
467 rfPortCode->addChild(encoding);
468 encoding->setValue(
470 ObjectState* extraBits = new ObjectState(
472 rfPortCode->addChild(extraBits);
473 extraBits->setValue(
475 }
476 }
477 }
478
479 // create iu-port-code elements
480 for (int i = 0; i < omTable->childCount(); i++) {
481 ObjectState* portCode = omTable->child(i);
482 if (portCode->name() == IUPortCode::OSNAME_IU_PORT_CODE) {
483 ObjectState* iuPortCode = new ObjectState(IU_PORT_CODE);
484 scTable->addChild(iuPortCode);
485 iuPortCode->setAttribute(
488 iuPortCode->setAttribute(
491
493 iuPortCode->setAttribute(
496
498 ObjectState* encoding = new ObjectState(
500 iuPortCode->addChild(encoding);
501 encoding->setValue(
503 ObjectState* extraBits = new ObjectState(
505 iuPortCode->addChild(extraBits);
506 extraBits->setValue(
508 }
509 }
510 }
511
512 return scTable;
513}
514
515
516/**
517 * Converts the given ObjectState tree that represents immediate control field
518 * in object model format to BEM file file format.
519 *
520 * @param immTag The ObjectState tree.
521 * @return The newly created ObjectState tree.
522 */
525
528 fileTag->addChild(position);
529 position->setValue(
532 fileTag->addChild(extraBits);
533 extraBits->setValue(
535
536 // create map elements
537 for (int i = 0; i < immTag->childCount(); i++) {
538 ObjectState* child = immTag->child(i);
541 fileTag->addChild(map);
542 map->setAttribute(
544 child->stringAttribute(
546 map->setValue(
548 }
549
550 return fileTag;
551}
552
553
554/**
555 * Converts the given ObjectState tree that represents a move slot in object
556 * model format to BEM file format.
557 *
558 * @param slotState The ObjectState tree.
559 * @return The newly created ObjectState tree.
560 */
563
564 ObjectState* slot = new ObjectState(SLOT);
565 slot->setAttribute(
567
568 ObjectState* position = new ObjectState(SLOT_POSITION);
569 slot->addChild(position);
571 ObjectState* extraBits = new ObjectState(SLOT_EXTRA_BITS);
572 slot->addChild(extraBits);
573 extraBits->setValue(
575
576 // add guard field
578 ObjectState* guardField = slotState->childByName(
580 slot->addChild(guardFieldToFile(guardField));
581 }
582
583 // add source field
585 ObjectState* sourceField = slotState->childByName(
587 slot->addChild(sourceFieldToFile(sourceField));
588 }
589
590 // add destination field
592 ObjectState* destinationField = slotState->childByName(
594 slot->addChild(destinationFieldToFile(destinationField));
595 }
596 return slot;
597}
598
599
600/**
601 * Converts the given ObjectState tree that represents a guard field
602 * in object model to BEM file format.
603 *
604 * @param gFieldState The ObjectState tree.
605 * @return The newly created ObjectState tree.
606 */
609
610 ObjectState* guard = new ObjectState(SLOT_GUARD);
612 guard->addChild(position);
613 position->setValue(
616 guard->addChild(extraBits);
617 extraBits->setValue(
619
620 // add register guard encodings
621 for (int i = 0; i < gFieldState->childCount(); i++) {
622 ObjectState* child = gFieldState->child(i);
624 ObjectState* regGuard = new ObjectState(REG_GUARD_CODE);
625 guard->addChild(regGuard);
626 regGuard->setAttribute(
629 regGuard->setAttribute(
631 child->stringAttribute(
633 string inverted = child->boolAttribute(
635 regGuard->setAttribute(REG_GUARD_CODE_INVERTED, inverted);
636 regGuard->setValue(
638 }
639 }
640
641 // add port guard encodings
642 for (int i = 0; i < gFieldState->childCount(); i++) {
643 ObjectState* child = gFieldState->child(i);
646 guard->addChild(fuGuard);
647 fuGuard->setAttribute(
650 fuGuard->setAttribute(
653 string inverted = child->boolAttribute(
655 fuGuard->setAttribute(PORT_GUARD_CODE_INVERTED, inverted);
656 fuGuard->setValue(
658 }
659 }
660
661 // add unconditional always-true-guard encoding
662 for (int i = 0; i < gFieldState->childCount(); i++) {
663 ObjectState* child = gFieldState->child(i);
664 if (child->name() ==
666 OSNAME_UNCONDITIONAL_GUARD_ENCODING &&
667 !child->boolAttribute(
670 guard->addChild(ucGuard);
671 ucGuard->setValue(
672 child->stringAttribute(
674 }
675 }
676
677 // add always-false-guard encoding
678 for (int i = 0; i < gFieldState->childCount(); i++) {
679 ObjectState* child = gFieldState->child(i);
680 if (child->name() ==
682 && child->boolAttribute(
685 guard->addChild(ucGuard);
686 ucGuard->setValue(
687 child->stringAttribute(
689 }
690 }
691
692 return guard;
693}
694
695
696/**
697 * Converts the given ObjectState tree that represents a source field in
698 * object model to BEM file format.
699 *
700 * @param sFieldState The ObjectState tree.
701 * @return The newly created ObjectState tree.
702 */
705
706 ObjectState* source = slotFieldToFile(sFieldState);
707 source->setName(SLOT_SOURCE);
708
709 // add immediate element in front of socket elements, it has to be done
710 // by removing the socket elements
712 std::vector<ObjectState*> socketElems;
713 for (int i = 0; i < source->childCount();) {
714 ObjectState* child = source->child(i);
715 if (child->name() == SOCKET) {
716 socketElems.push_back(child);
717 source->removeChild(child);
718 } else {
719 i++;
720 }
721 }
722 ObjectState* immediate = new ObjectState(SOURCE_IMMEDIATE);
723 source->addChild(immediate);
724 ObjectState* encodingState = sFieldState->childByName(
726 immediate->setAttribute(
728 encodingState->stringAttribute(
731 immediate->addChild(map);
733 encodingState->stringAttribute(
735 map->setValue(
736 encodingState->stringAttribute(
738
739 // add the socket elements
740 for (vector<ObjectState*>::const_iterator iter = socketElems.begin();
741 iter != socketElems.end(); iter++) {
742 source->addChild(*iter);
743 }
744 }
745
746 // add bridge elements
747 for (int i = 0; i < sFieldState->childCount(); i++) {
748 ObjectState* child = sFieldState->child(i);
751 source->addChild(bridge);
752 bridge->setAttribute(
756 bridge->addChild(map);
757 map->setAttribute(
760 map->setValue(
762 }
763 }
764
765 // move the no-operation element to the end
766 if (source->hasChild(SRC_DST_NO_OPERATION)) {
768 source->removeChild(nop);
769 source->addChild(nop);
770 }
771
772 return source;
773}
774
775
776/**
777 * Converts the given ObjectState tree that represents a destination field in
778 * object model to BEM file format.
779 *
780 * @param dFieldState The ObjectState tree.
781 * @return The newly created ObjectState tree.
782 */
785 ObjectState* destination = slotFieldToFile(dFieldState);
786 destination->setName(SLOT_DESTINATION);
787 return destination;
788}
789
790/**
791 * Converts the given ObjectState tree that represents either source or
792 * destination in BEM object model to BEM file format.
793 *
794 * @param sFieldState The ObjectState tree.
795 * @return The newly created ObjectState tree.
796 */
799
800 ObjectState* srcOrDst = new ObjectState(SLOT_SOURCE);
802 srcOrDst->addChild(position);
803 position->setValue(
806 srcOrDst->addChild(extraBits);
807 extraBits->setValue(
809 ObjectState* encodingPos = new ObjectState(SRC_DST_ID_POS);
810 srcOrDst->addChild(encodingPos);
813 encodingPos->setValue(ID_POS_LEFT);
814 } else {
815 encodingPos->setValue(ID_POS_RIGHT);
816 }
817
818 // add socket elements
819 for (int i = 0; i < sFieldState->childCount(); i++) {
820 ObjectState* child = sFieldState->child(i);
822 ObjectState* socket = new ObjectState(SOCKET);
823 srcOrDst->addChild(socket);
824 socket->setAttribute(
828 socket->addChild(map);
829 map->setAttribute(
833 map->setAttribute(
836 }
837 map->setValue(
839 }
840 }
841
842 // add move no-operation element
843 if (sFieldState->hasChild(NOPEncoding::OSNAME_NOP_ENCODING)) {
844 ObjectState* nopEncoding = sFieldState->childByName(
846 ObjectState* noOperation = new ObjectState(SRC_DST_NO_OPERATION);
847 srcOrDst->addChild(noOperation);
849 noOperation->addChild(map);
850 map->setAttribute(
853 map->setValue(
855 }
856
857 return srcOrDst;
858}
859
860
861/**
862 * Converts the given ObjectState instance that represents an
863 * ImmediateSlotField instance to BEM file format.
864 *
865 * @param slotState The ObjectState instance that represents an
866 * ImmediateSlotField instance.
867 * @return The newly created ObjectState tree.
868 */
871 ObjectState* immSlot = new ObjectState(IMMEDIATE_SLOT);
872 immSlot->setAttribute(
876 immSlot->addChild(pos);
877 pos->setValue(
880 immSlot->addChild(width);
881 width->setValue(
883 return immSlot;
884}
885
886
887/**
888 * Converts the given ObjectState tree that represent a long immediate
889 * destination register field in BEM object model to BEM file format.
890 *
891 * @param omState The ObjectState tree.
892 * @return The newly create ObjectState tree.
893 */
896
897 ObjectState* fileState = new ObjectState(IMM_REG_FIELD);
899 fileState->addChild(posElem);
900 posElem->setValue(
903 fileState->addChild(widthElem);
904 widthElem->setValue(
906
907 for (int i = 0; i < omState->childCount(); i++) {
908 ObjectState* child = omState->child(i);
911 fileState->addChild(iTempElem);
912 iTempElem->setAttribute(
915 ObjectState* regIndexElem = new ObjectState(
917 iTempElem->addChild(regIndexElem);
918 regIndexElem->setValue(
920 }
921
922 return fileState;
923}
924
925/**
926 * Converts the given ObjectState tree that represents a socket code table
927 * in BEM file to an ObjectState tree that can be loaded by SocketCodeTable.
928 *
929 * @param scTable The ObjectState tree.
930 * @return The newly created ObjectState tree that can be loaded by
931 * SocketCodeTable.
932 */
935
936 ObjectState* omTable = new ObjectState(
938 string name = scTable->stringAttribute(SC_TABLE_NAME);
940 int extraBits = scTable->childByName(SC_TABLE_EXTRA_BITS)->intValue();
941 omTable->setAttribute(
943
944 // add port codes
945 for (int i = 0; i < scTable->childCount(); i++) {
946 ObjectState* child = scTable->child(i);
947 if (child->name() == FU_PORT_CODE) {
948 ObjectState* fuPortCode = new ObjectState(
950 omTable->addChild(fuPortCode);
951 string portName = child->stringAttribute(FU_PORT_CODE_PORT);
952 string fuName = child->stringAttribute(FU_PORT_CODE_FU);
953 fuPortCode->setAttribute(FUPortCode::OSKEY_UNIT_NAME, fuName);
954 fuPortCode->setAttribute(FUPortCode::OSKEY_PORT_NAME, portName);
956 string opName = child->stringAttribute(
958 fuPortCode->setAttribute(
960 }
961
962 fuPortCode->setAttribute(
965 fuPortCode->setAttribute(
968 } else if (child->name() == RF_PORT_CODE) {
969 ObjectState* rfPortCode = new ObjectState(
971 omTable->addChild(rfPortCode);
972 readRegisterFilePortCode(child, rfPortCode);
973 } else if (child->name() == IU_PORT_CODE) {
974 ObjectState* iuPortCode = new ObjectState(
976 omTable->addChild(iuPortCode);
977 readRegisterFilePortCode(child, iuPortCode);
978 }
979 }
980
981 return omTable;
982}
983
984
985/**
986 * Converts the given ObjectState tree that represents a long-immediate-tag
987 * element of BEM file to ObjectState tree that can be loaded by
988 * ImmediateControlField.
989 *
990 * @param fileTag An ObjectState tree that represents a long-immediate-tag
991 * element.
992 * @return The newly created ObjectState tree.
993 */
996 ObjectState* immControlField =
999 immControlField->setAttribute(
1001 ObjectState* extraBits = immTag->childByName(LIMM_TAG_EXTRA_BITS);
1002 immControlField->setAttribute(
1004
1005 // add template mappings
1006 for (int i = 0; i < immTag->childCount(); i++) {
1007 ObjectState* child = immTag->child(i);
1008 if (child->name() == LIMM_TAG_MAP) {
1009 ObjectState* mapping = new ObjectState(
1011 immControlField->addChild(mapping);
1012 mapping->setAttribute(
1015 mapping->setAttribute(
1017 }
1018 }
1019
1020 return immControlField;
1021}
1022
1023
1024/**
1025 * Converts the given ObjectState tree that represents a slot element of
1026 * BEM file to ObjectState tree that can be loaded by MoveSlot.
1027 *
1028 * @param fileSlot The ObjectState tree that represents a slot element.
1029 * @return The newly created ObjectState tree.
1030 */
1033
1035 string busName = fileSlot->stringAttribute(SLOT_NAME);
1036 moveSlot->setAttribute(MoveSlot::OSKEY_BUS_NAME, busName);
1037
1038 ObjectState* pos = fileSlot->childByName(SLOT_POSITION);
1040
1041 ObjectState* extraBits = fileSlot->childByName(SLOT_EXTRA_BITS);
1042 moveSlot->setAttribute(
1044
1045 // add guard field
1046 if (fileSlot->hasChild(SLOT_GUARD)) {
1047 ObjectState* guard = fileSlot->childByName(SLOT_GUARD);
1048 moveSlot->addChild(guardFieldToOM(guard));
1049 }
1050
1051 // add source field
1052 if (fileSlot->hasChild(SLOT_SOURCE)) {
1053 ObjectState* source = fileSlot->childByName(SLOT_SOURCE);
1054 moveSlot->addChild(sourceFieldToOM(source));
1055 }
1056
1057 // add destination field
1058 if (fileSlot->hasChild(SLOT_DESTINATION)) {
1059 ObjectState* destination = fileSlot->childByName(SLOT_DESTINATION);
1060 moveSlot->addChild(destinationFieldToOM(destination));
1061 }
1062
1063 return moveSlot;
1064}
1065
1066
1067/**
1068 * Converts the given ObjectState tree that represents a guard element of
1069 * BEM file to a new ObjectState tree that can be loaded by GuardField.
1070 *
1071 * @param fileGuard An ObjectState tree that represents a guard element of
1072 * BEM file.
1073 * @return The newly created ObjectState tree.
1074 */
1077
1078 ObjectState* guardField = new ObjectState(
1080 ObjectState* pos = fileGuard->childByName(SLOT_GUARD_POSITION);
1082 ObjectState* extraBits = fileGuard->childByName(SLOT_GUARD_EXTRA_BITS);
1083 guardField->setAttribute(
1085
1086 // add guard encodings
1087 for (int i = 0; i < fileGuard->childCount(); i++) {
1088 ObjectState* child = fileGuard->child(i);
1089 if (child->name() == REG_GUARD_CODE) {
1090 ObjectState* guardCode = new ObjectState(
1092 guardField->addChild(guardCode);
1093 string regFile = child->stringAttribute(REG_GUARD_CODE_RF);
1094 guardCode->setAttribute(
1096 int regIndex = child->intAttribute(REG_GUARD_CODE_INDEX);
1097 guardCode->setAttribute(
1099 string inverted = child->stringAttribute(
1101 if (inverted == TRUE) {
1102 guardCode->setAttribute(
1104 } else if (inverted == FALSE) {
1105 guardCode->setAttribute(
1107 } else {
1108 assert(false);
1109 }
1110 guardCode->setAttribute(
1112
1113 } else if (child->name() == PORT_GUARD_CODE) {
1114 ObjectState* guardCode = new ObjectState(
1116 guardField->addChild(guardCode);
1117 string fu = child->stringAttribute(PORT_GUARD_CODE_FU);
1119 string port = child->stringAttribute(PORT_GUARD_CODE_PORT);
1121 string inverted = child->stringAttribute(
1123 if (inverted == TRUE) {
1124 guardCode->setAttribute(
1126 } else if (inverted == FALSE) {
1127 guardCode->setAttribute(
1129 } else {
1130 assert(false);
1131 }
1132 guardCode->setAttribute(
1134
1135 } else if (child->name() == ALWAYS_TRUE_GUARD_CODE ||
1136 child->name() == ALWAYS_FALSE_GUARD_CODE) {
1137 ObjectState* guardCode = new ObjectState(
1139 OSNAME_UNCONDITIONAL_GUARD_ENCODING);
1140 guardField->addChild(guardCode);
1141 guardCode->setAttribute(
1143 child->stringValue());
1144 if (child->name() == ALWAYS_TRUE_GUARD_CODE) {
1145 guardCode->setAttribute(
1147 } else {
1148 guardCode->setAttribute(
1150 }
1151 }
1152 }
1153
1154 return guardField;
1155}
1156
1157
1158/**
1159 * Converts the given ObjectState tree that represents a source element in
1160 * BEM file to an ObjectState tree that can be loaded by SourceField.
1161 *
1162 * @param fileSource An ObjectState tree that represents a source element
1163 * in a BEM file.
1164 * @return The newly created ObjectState tree.
1165 */
1168
1169 ObjectState* sourceField = slotFieldToOM(fileSource);
1171
1172 // add immediate encoding
1173 if (fileSource->hasChild(SOURCE_IMMEDIATE)) {
1174 ObjectState* immEncoding = new ObjectState(
1176 sourceField->addChild(immEncoding);
1177 immEncoding->setAttribute(
1181 ObjectState* map = fileSource->childByName(SOURCE_IMMEDIATE)->
1182 child(0);
1183 immEncoding->setAttribute(
1185 immEncoding->setAttribute(
1188 }
1189
1190 // add bridge encodings
1191 for (int i = 0; i < fileSource->childCount(); i++) {
1192 ObjectState* child = fileSource->child(i);
1193 if (child->name() == SOURCE_BRIDGE) {
1194 ObjectState* bridgeEncoding = new ObjectState(
1196 sourceField->addChild(bridgeEncoding);
1197 bridgeEncoding->setAttribute(
1201 bridgeEncoding->setAttribute(
1204 bridgeEncoding->setAttribute(
1206 }
1207 }
1208
1209 return sourceField;
1210}
1211
1212
1213/**
1214 * Converts the given ObjectState tree that represents a destination element
1215 * in BEM file to an ObjectState tree that can be loaded by DestinationField.
1216 *
1217 * @param fileDestination An ObjectState tree that represents a destination
1218 * element in a BEM file.
1219 * @return The newly created ObjectState tree.
1220 */
1223 ObjectState* destinationField = slotFieldToOM(fileDestination);
1225 return destinationField;
1226}
1227
1228
1229/**
1230 * Converts the given ObjectState tree that represents either source or
1231 * destination element of BEM file to an ObjectState tree that can be loaded
1232 * by SlotField.
1233 *
1234 * @param fileSlot An ObjectState tree representing source or destination
1235 * field.
1236 * @return The newly created ObjectState tree.
1237 */
1240
1242 ObjectState* pos = fileSlot->childByName(SRC_DST_POSITION);
1243 slotField->setAttribute(
1245 ObjectState* extraBits = fileSlot->childByName(SRC_DST_EXTRA_BITS);
1246 slotField->setAttribute(
1248 if (fileSlot->childByName(SRC_DST_ID_POS)->stringValue() ==
1249 ID_POS_RIGHT) {
1250 slotField->setAttribute(
1252 } else {
1253 assert(
1254 fileSlot->childByName(SRC_DST_ID_POS)->stringValue() ==
1255 ID_POS_LEFT);
1256 slotField->setAttribute(
1258 }
1259
1260 // read socket elements
1261 for (int i = 0; i < fileSlot->childCount(); i++) {
1262 ObjectState* child = fileSlot->child(i);
1263 if (child->name() == SOCKET) {
1264 ObjectState* socketEncoding = new ObjectState(
1266 slotField->addChild(socketEncoding);
1267 socketEncoding->setAttribute(
1270 ObjectState* map = child->childByName(SOCKET_MAP);
1271 socketEncoding->setAttribute(
1273 socketEncoding->setAttribute(
1276 if (map->hasAttribute(SOCKET_MAP_CODES)) {
1277 socketEncoding->setAttribute(
1280 }
1281 }
1282 }
1283
1284 // read NOP encoding
1285 if (fileSlot->hasChild(SRC_DST_NO_OPERATION)) {
1286 ObjectState* nopEncoding = new ObjectState(
1288 slotField->addChild(nopEncoding);
1289 ObjectState* map = fileSlot->childByName(SRC_DST_NO_OPERATION)->
1290 child(0);
1291 nopEncoding->setAttribute(
1293 nopEncoding->setAttribute(
1296 }
1297
1298 return slotField;
1299}
1300
1301
1302/**
1303 * Converts the given ObjectState tree that represents immediate-slot element
1304 * of BEM file to an ObjectState instance that can be loaded by
1305 * ImmediateSlotField instance.
1306 *
1307 * @param fileSlot ObjectState tree that represents immediate-slot element
1308 * of BEM file.
1309 * @return The newly created ObjectState instance.
1310 */
1313 ObjectState* immSlotField = new ObjectState(
1315 string name = fileSlot->stringAttribute(IMMEDIATE_SLOT_NAME);
1316 immSlotField->setAttribute(ImmediateSlotField::OSKEY_NAME, name);
1317 string width = fileSlot->childByName(IMMEDIATE_SLOT_WIDTH)->
1318 stringValue();
1319 immSlotField->setAttribute(ImmediateSlotField::OSKEY_WIDTH, width);
1320 string pos = fileSlot->childByName(IMMEDIATE_SLOT_POS)->stringValue();
1323 return immSlotField;
1324}
1325
1326
1327/**
1328 * Converts the given ObjectState tree that represents a long immediate
1329 * destination register field in BEM file to an ObjectState tree that can
1330 * be loaded by LImmDstRegisterField instance.
1331 *
1332 * @param fileField The ObjectState tree that represents long immediate
1333 * destination register field in BEM file.
1334 * @return The newly created ObjectState tree.
1335 */
1338
1339 ObjectState* omState = new ObjectState(
1342 omState->setAttribute(
1345 omState->setAttribute(
1348
1349 for (int i = 0; i < fileField->childCount(); i++) {
1350 ObjectState* child = fileField->child(i);
1351 if (child->name() == IMM_REG_FIELD_ITEMP) {
1352 ObjectState* iuDst = new ObjectState(
1354 omState->addChild(iuDst);
1355 iuDst->setAttribute(
1358 iuDst->setAttribute(
1360 child->child(0)->stringValue());
1361 }
1362 }
1363
1364 return omState;
1365}
1366
1367/**
1368 * Reads rf-port-code or iu-port-code element from an ObjectState tree that
1369 * represents BEM file and adds the data to the given ObjectState instance
1370 * to make it loadable by RFPortCode or IUPortCode.
1371 *
1372 * @param filePortCode ObjectState tree representing rf-port-code or
1373 * iu-port-code element of BEM file.
1374 * @param omPortCode The ObjectState instance to which the data is added.
1375 */
1376void
1378 const ObjectState* filePortCode,
1379 ObjectState* omPortCode) {
1380
1381 string unit;
1382 if (filePortCode->name() == RF_PORT_CODE) {
1383 unit = filePortCode->stringAttribute(RF_PORT_CODE_RF);
1384 } else if (filePortCode->name() == IU_PORT_CODE) {
1385 unit = filePortCode->stringAttribute(IU_PORT_CODE_IU);
1386 } else {
1387 assert(false);
1388 }
1389
1390 omPortCode->setAttribute(PortCode::OSKEY_UNIT_NAME, unit);
1391 omPortCode->setAttribute(
1394
1395 if (filePortCode->hasChild(RF_PORT_CODE_ENCODING)) {
1396 ObjectState* encoding = filePortCode->childByName(
1398 omPortCode->setAttribute(
1400 ObjectState* extraBits = filePortCode->childByName(
1402 omPortCode->setAttribute(
1404 }
1405
1406}
#define assert(condition)
const string SC_TABLE_NAME
const string IU_PORT_CODE_IU
const string BEM_VERSION_STR
const string REG_GUARD_CODE
const string ID_POS_RIGHT
const string RF_PORT_CODE_INDEX_WIDTH
const string ALWAYS_TRUE_GUARD_CODE
const string SLOT_SOURCE
const string SRC_DST_ID_POS
const string SLOT_GUARD_EXTRA_BITS
const string FU_PORT_CODE_PORT
const string REG_GUARD_CODE_INDEX
const string INSTRUCTION_FORMAT_NAME
const string SOCKET_MAP_CODES
const string IU_PORT_CODE
const string PORT_GUARD_CODE_PORT
const string PORT_GUARD_CODE_INVERTED
const string BEM_SCHEMA_FILE
const string SLOT_GUARD_POSITION
const string IMM_REG_FIELD_ITEMP_NAME
const string MAP
const string REQUIRED_VERSION
const string SOURCE_BRIDGE
const string RF_PORT_CODE
const string SOURCE_BRIDGE_NAME
const string SOCKET
const string SOCKET_CODE_TABLE
const string SRC_DST_NO_OPERATION_MAP
const string LONG_IMMEDIATE_TAG
const string FALSE
const string IMM_REG_FIELD_ITEMP_REG_INDEX
const string REG_GUARD_CODE_RF
const string FU_PORT_CODE_FU
const string TRUE
const string SLOT_DESTINATION
const string SLOT
const string SLOT_EXTRA_BITS
const string SOCKET_NAME
const string SOURCE_IMMEDIATE_WIDTH
const string SOURCE_IMMEDIATE_MAP_EXTRA_BITS
const string RF_PORT_CODE_ENCODING
const string ID_POS_LEFT
const string IMMEDIATE_SLOT_WIDTH
const string SLOT_POSITION
const string LIMM_TAG_MAP_NAME
const string SRC_DST_NO_OPERATION_MAP_EXTRA_BITS
const string FU_PORT_CODE_EXTRA_BITS
const string INSTRUCTION_FORMAT
const string IMM_REG_FIELD_WIDTH
const string IMM_REG_FIELD_POS
const string FU_PORT_CODE_OPERATION
const string ADF_ENCODING
const string SOURCE_BRIDGE_MAP_EXTRA_BITS
const string IMM_REG_FIELD_ITEMP
const string SLOT_NAME
const string FU_PORT_CODE_ENCODING
const string LIMM_TAG_POSITION
const string REG_GUARD_CODE_INVERTED
const string SRC_DST_EXTRA_BITS
const string PORT_GUARD_CODE_FU
const string SOURCE_IMMEDIATE_MAP
const string SRC_DST_POSITION
const string RF_PORT_CODE_EXTRA_BITS
const string SOCKET_MAP_EXTRA_BITS
const string ALWAYS_FALSE_GUARD_CODE
const string IMM_REG_FIELD
const string SOURCE_IMMEDIATE
const string EXTRA_BITS
const string LIMM_TAG_EXTRA_BITS
const string SRC_DST_NO_OPERATION
const string FU_PORT_CODE
const string SC_TABLE_EXTRA_BITS
const string IMMEDIATE_SLOT
const string PORT_GUARD_CODE
const string SLOT_GUARD
const string RF_PORT_CODE_RF
const string IMMEDIATE_SLOT_NAME
const string IMMEDIATE_SLOT_POS
const string LIMM_TAG_MAP
const string RF_PORT_CODE_MAX_INDEX
const string SOURCE_BRIDGE_MAP
const string SOCKET_MAP
#define THROW_EXCEPTION(exceptionType, message)
Exception wrapper macro that automatically includes file name, line number and function name where th...
Definition Exception.hh:39
const string FALSE
Value used for false in attribute and element values.
const string TRUE
Value used for true in attribute and element values.
const string SLOT_POSITION
Name of the attribute of the slot element.
static ObjectState * longImmDstRegisterFieldToFile(const ObjectState *omState)
static ObjectState * destinationFieldToFile(const ObjectState *dFieldState)
static ObjectState * longImmDstRegFieldToOM(const ObjectState *fileField)
static ObjectState * socketCodeTableToOM(const ObjectState *scTable)
static ObjectState * convertToOMFormat(const ObjectState *fileState)
static void readRegisterFilePortCode(const ObjectState *filePortCode, ObjectState *omPortCode)
BinaryEncoding * readBinaryEncoding()
static void convertZeroEncExtraBits(ObjectState *os)
static ObjectState * longImmTagToOM(const ObjectState *fileTag)
static ObjectState * longImmTagToFile(const ObjectState *immTag)
void writeBinaryEncoding(const BinaryEncoding &bem)
static ObjectState * socketCodeTableToFile(const ObjectState *scTable)
virtual void writeState(const ObjectState *state)
static ObjectState * sourceFieldToFile(const ObjectState *sFieldState)
static ObjectState * immediateSlotToOM(const ObjectState *fileSlot)
static ObjectState * slotFieldToOM(const ObjectState *fileSlot)
static ObjectState * sourceFieldToOM(const ObjectState *fileSource)
static ObjectState * convertToFileFormat(const ObjectState *omState)
static ObjectState * destinationFieldToOM(const ObjectState *fileDestination)
static ObjectState * moveSlotToFile(const ObjectState *slotState)
static ObjectState * guardFieldToFile(const ObjectState *gFieldState)
static ObjectState * slotFieldToFile(const ObjectState *sFieldState)
virtual ObjectState * readState()
static ObjectState * immediateSlotToFile(const ObjectState *slotState)
virtual ~BEMSerializer()
static ObjectState * moveSlotToOM(const ObjectState *fileSlot)
static ObjectState * guardFieldToOM(const ObjectState *fileGuard)
static const std::string OSNAME_BEM
ObjectState name for binary encoding.
virtual ObjectState * saveState() const
static const std::string OSNAME_TEMPLATE_EXTRA_BITS
static const std::string OSNAME_BRIDGE_ENCODING
ObjectState name for bridge encoding.
static const std::string OSKEY_BRIDGE_NAME
ObjectState attribute key for the name of the bridge.
static const std::string OSNAME_DESTINATION_FIELD
ObjectState name for destination field.
static const std::string OSKEY_EXTRA_BITS
ObjectState attribute key for the number of extra bits.
Definition Encoding.hh:68
static const std::string OSKEY_ENCODING
ObjectState attribute key for the encoding.
Definition Encoding.hh:66
static std::string schemaDirPath(const std::string &prog)
static const std::string OSKEY_PORT_NAME
ObjectState attribute key for the name of the port.
static const std::string OSNAME_FU_GUARD_ENCODING
ObjectState name for FU guard encoding.
static const std::string OSKEY_FU_NAME
ObjectState attribute key for the name of the function unit.
static const std::string OSNAME_FU_PORT_CODE
ObjectState name for FU port code.
Definition FUPortCode.hh:66
static const std::string OSKEY_OPERATION_NAME
ObjectState attribute key for the name of the operation.
Definition FUPortCode.hh:70
static const std::string OSKEY_PORT_NAME
ObjectState attribute key for the name of the port.
Definition FUPortCode.hh:68
static const std::string OSNAME_GPR_GUARD_ENCODING
ObjectState name for GPR guard encoding.
static const std::string OSKEY_RF_NAME
ObjectState attribute key for the name of the register file.
static const std::string OSKEY_REGISTER_INDEX
ObjectState attribute key for register index.
static const std::string OSKEY_INVERTED
ObjectState attribute key for invert flag.
static const std::string OSKEY_ENCODING
ObjectState attribute key for encoding.
static const std::string OSNAME_GUARD_FIELD
ObjectState name for guard field.
Definition GuardField.hh:99
static const std::string OSNAME_IU_PORT_CODE
ObjectState name for RF port code.
Definition IUPortCode.hh:55
static const std::string OSKEY_TEMPLATE_NAME
ObjectState attribute key for the name of the instruction template.
static const std::string OSNAME_TEMPLATE_MAP
ObjectState name for a template mapping.
static const std::string OSNAME_IMM_CONTROL_FIELD
ObjectState name for immediate control field.
static const std::string OSKEY_ENCODING
ObjectState attribute key for the encoding of the instruction template.
static const std::string OSNAME_IMM_ENCODING
ObjectState name for immediate encoding.
static const std::string OSKEY_IMM_WIDTH
ObjectState attribute key for the immediate width.
static const std::string OSNAME_IMMEDIATE_SLOT_FIELD
ObjectState name for immediate slot field.
static const std::string OSKEY_NAME
ObjectState attribute key for the name of the immediate slot.
static const std::string OSKEY_WIDTH
ObjectState attribute key for the width of the field.
static const std::string OSKEY_POSITION
ObjectState attribute key for the relative position of the field.
static const std::string OSKEY_EXTRA_BITS
ObjectState attribute key for the number of extra bits.
static const std::string OSNAME_INSTRUCTION_FORMAT
static const std::string OSKEY_ITEMP
ObjectState attribute key for the name of the instruction template.
static const std::string OSKEY_DST_IU
ObjectState attribute key for the name of the immediate unit.
static const std::string OSNAME_LIMM_DST_REGISTER_FIELD
ObjectState name for long immediate destination register field.
static const std::string OSKEY_WIDTH
ObjectState attribute key for the width of the field.
static const std::string OSNAME_IU_DESTINATION
ObjectState name for a immediate unit destination.
static const std::string OSKEY_BUS_NAME
ObjectState attribute key for the name of the bus.
Definition MoveSlot.hh:98
static const std::string OSNAME_MOVE_SLOT
ObjectState name for move slot.
Definition MoveSlot.hh:96
static const std::string OSNAME_NOP_ENCODING
ObjectState name for NOP encoding.
bool hasAttribute(const std::string &name) const
ObjectState * childByName(const std::string &name) const
double doubleAttribute(const std::string &name) const
void setName(const std::string &name)
void setAttribute(const std::string &name, const std::string &value)
void setValue(const std::string &value)
void removeChild(ObjectState *child)
bool hasChild(const std::string &name) const
ObjectState * child(int index) const
void addChild(ObjectState *child)
int intValue() const
std::string stringAttribute(const std::string &name) const
bool boolAttribute(const std::string &name) const
int intAttribute(const std::string &name) const
std::string stringValue() const
std::string name() const
int childCount() const
static const std::string OSKEY_INDEX_WIDTH
ObjectState attribute key for the widht of register index.
Definition PortCode.hh:75
static const std::string OSKEY_EXTRA_BITS
ObjectState attribute key for the number of extra bits.
Definition PortCode.hh:73
static const std::string OSKEY_ENCODING
ObjectState attribute key for the encoding.
Definition PortCode.hh:71
static const std::string OSKEY_UNIT_NAME
ObjectState attribute key for the name of the unit.
Definition PortCode.hh:69
static const std::string OSKEY_MAX_INDEX
ObjectState attribute key for the max-index attribute.
Definition PortCode.hh:77
static const std::string OSNAME_RF_PORT_CODE
ObjectState name for RF port code.
Definition RFPortCode.hh:57
static const std::string OSNAME_SLOT_FIELD
ObjectState name for slot field.
Definition SlotField.hh:89
static const std::string OSKEY_COMPONENT_ID_POSITION
ObjectState attribute key for component ID position.
Definition SlotField.hh:91
static const std::string OSKEY_EXTRA_BITS
ObjectState attribute key for the number of extra bits.
static const std::string OSKEY_NAME
ObjectState attribute key for name of the table.
static const std::string OSNAME_SOCKET_CODE_TABLE
ObjectState name for socket code table.
static const std::string OSNAME_SOCKET_ENCODING
ObjectState name for socket encoding.
static const std::string OSKEY_SOCKET_NAME
ObjectState attribute key for the name of the socket.
static const std::string OSKEY_SC_TABLE
ObjectState attribute key for the name of the socket code table.
static const std::string OSNAME_SOURCE_FIELD
ObjectState name for source field.
static const std::string OSNAME_UNCONDITIONAL_GUARD_ENCODING
ObjectState name for unconditional guard encoding.
void setUseSchema(bool useSchema)
void setSchemaFile(const std::string &fileName)
virtual void writeState(const ObjectState *rootState)
virtual ObjectState * readState()