@@ -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,31 @@ 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: " << err_desc << " \n RTL entry is:\n " ;
268+ rtl_entry_.print (" " , std::cerr);
269+ std::cerr << " ISS entry is:\n " ;
270+ iss_entry_.print (" " , std::cerr);
271+ } else {
272+ std::cerr << " ERROR: Mismatch between RTL and ISS trace entries: "
273+ << err_desc << " \n RTL entry is:\n " ;
274+ rtl_entry_.print (" " , std::cerr);
275+ std::cerr << " ISS entry is:\n " ;
276+ iss_entry_.print (" " , std::cerr);
277+ seen_err_ = true ;
278+ return false ;
279+ if (rtl_entry_.trace_type () == OtbnTraceEntry::WipeComplete) {
280+ no_sec_wipe_data_chk_ = false ;
281+ }
268282 }
269283 }
284+ // We tolerate a mismatch only for one comparison.
285+ if (tolerate_result_mismatch_) {
286+ std::cerr << " INFO: No longer tolerating RTL/ISS mismatches.\n " ;
287+ }
288+ tolerate_result_mismatch_ = false ;
289+
270290 // We've got a matching pair of entries. Move the ISS data out of the (now
271291 // defunct) iss_entry_ and into last_data_.
272292 if (rtl_entry_.trace_type () == OtbnTraceEntry::Exec) {
0 commit comments