2 * Copyright (C) 2013 Freescale Semiconductor, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
27 #include "FullAddressVisitor.h"
28 #include "NxMessage.h"
30 using std::ostringstream
;
37 // implement the specific visit
38 void FullAddressVisitor::visit(NxProgramTraceSync
*m
)
40 last_key_
= m
->sourceIdString();
41 mismatch_addr_
= source_addr_
[last_key_
];
42 data_mismatch_
= (m
->address() != mismatch_addr_
);
43 source_addr_
[last_key_
] = m
->address();
47 // implement the specific visit
48 void FullAddressVisitor::visit(NxProgramTraceIndirectBranch
*m
)
50 last_key_
= m
->sourceIdString();
51 source_addr_
[last_key_
] ^= m
->address();
55 // implement the specific visit
56 void FullAddressVisitor::visit(NxProgramTraceIndirectBranchSync
*m
)
58 last_key_
= m
->sourceIdString();
59 mismatch_addr_
= source_addr_
[last_key_
];
60 data_mismatch_
= (m
->address() != mismatch_addr_
);
61 source_addr_
[last_key_
] = m
->address();
64 // implement the specific visit
65 void FullAddressVisitor::visit(NxDAMInCircuitTraceMessage
*m
)
67 // source_addr_[m->sourceIdString()] = m->address();
68 // useful_visit_ = true;
71 // implement the specific visit
72 void FullAddressVisitor::visit(NxCDMInCircuitTraceMessage
*m
)
74 // source_addr_[m->sourceIdString()] = m->address();
75 // useful_visit_ = true;
78 // implement the specific visit
79 void FullAddressVisitor::visit(NxCAMInCircuitTraceMessage
*m
)
81 // source_addr_[m->sourceIdString()] = m->address();
82 // useful_visit_ = true;
85 // output message information as a string
86 string
FullAddressVisitor::asString() const
91 map
<string
, SizedAddress
>::const_iterator i
=
92 source_addr_
.find(last_key_
);
93 os
<< "-----------UNCOMPRESSED ADDRESS-----------" << endl
;
94 if (i
!= source_addr_
.end()) {
95 os
<< "SRC : " << last_key_
<< endl
;
96 os
<< "F-ADDR : " << i
->second
.asString() << endl
;
98 os
<< "Warning: Sync Address differs from calculated Address" << endl
;
99 os
<< "CALC ADDR : " << mismatch_addr_
.asString() << endl
;
100 data_mismatch_
= false;
103 os
<< "ERROR resolving address source" << endl
;