@@ -20,6 +20,7 @@ OtbnTraceChecker::OtbnTraceChecker()
2020 iss_started_(false ),
2121 iss_pending_(false ),
2222 done_(true ),
23+ tolerate_result_mismatch_(false ),
2324 seen_err_(false ),
2425 last_data_vld_(false ) {
2526 OtbnTraceSource::get ().AddListener (this );
@@ -245,6 +246,11 @@ const OtbnIssTraceEntry::IssData *OtbnTraceChecker::PopIssData() {
245246
246247void OtbnTraceChecker::set_no_sec_wipe_chk () { no_sec_wipe_data_chk_ = true ; }
247248
249+ void OtbnTraceChecker::TolerateResultMismatch () {
250+ tolerate_result_mismatch_ = true ;
251+ std::cerr << " INFO: Next RTL/ISS trace entry mismatch will be tolerated.\n " ;
252+ }
253+
248254bool OtbnTraceChecker::MatchPair () {
249255 if (!(rtl_pending_ && iss_pending_)) {
250256 return true ;
@@ -256,17 +262,32 @@ bool OtbnTraceChecker::MatchPair() {
256262 std::string err_desc;
257263 if (!(rtl_entry_.compare_rtl_iss_entries (iss_entry_, no_sec_wipe_data_chk_,
258264 &err_desc))) {
259- std::cerr << " ERROR: Mismatch between RTL and ISS trace entries: "
260- << err_desc << " \n RTL entry is:\n " ;
261- rtl_entry_.print (" " , std::cerr);
262- std::cerr << " ISS entry is:\n " ;
263- iss_entry_.print (" " , std::cerr);
264- seen_err_ = true ;
265- return false ;
266- if (rtl_entry_.trace_type () == OtbnTraceEntry::WipeComplete) {
267- no_sec_wipe_data_chk_ = false ;
265+ if (tolerate_result_mismatch_) {
266+ std::cerr << " INFO: Mismatch between RTL and ISS trace entries "
267+ << " but tolerated: "
268+ << err_desc << " \n RTL entry is:\n " ;
269+ rtl_entry_.print (" " , std::cerr);
270+ std::cerr << " ISS entry is:\n " ;
271+ iss_entry_.print (" " , std::cerr);
272+ } else {
273+ std::cerr << " ERROR: Mismatch between RTL and ISS trace entries: "
274+ << err_desc << " \n RTL entry is:\n " ;
275+ rtl_entry_.print (" " , std::cerr);
276+ std::cerr << " ISS entry is:\n " ;
277+ iss_entry_.print (" " , std::cerr);
278+ seen_err_ = true ;
279+ return false ;
280+ if (rtl_entry_.trace_type () == OtbnTraceEntry::WipeComplete) {
281+ no_sec_wipe_data_chk_ = false ;
282+ }
268283 }
269284 }
285+ // We tolerate a mismatch only for one comparison.
286+ if (tolerate_result_mismatch_) {
287+ std::cerr << " INFO: No longer tolerating RTL/ISS mismatches.\n " ;
288+ }
289+ tolerate_result_mismatch_ = false ;
290+
270291 // We've got a matching pair of entries. Move the ISS data out of the (now
271292 // defunct) iss_entry_ and into last_data_.
272293 if (rtl_entry_.trace_type () == OtbnTraceEntry::Exec) {
0 commit comments