/* Filename : NPDetector.cvl Author : XXX Created : 2024-12-31 Modified : 2025-01-17 Implementation of NPDetector.cvh. Detects non-progress cycles. some Lab some division some institution */ #pragma CIVL ACSL #include "NPDetector.cvh" #include static int nthread; // number of threads static int nnonterm; // number of non-terminated threads static int * state; //@ depends_on(\nothing); $atomic_f void npd_initialize(int _nthread) { $assert(_nthread >= 1); nnonterm = nthread = _nthread; state = malloc(nthread*sizeof(int)); for (int i=0; i0 && s%3!=2) s=s/3; if (s>0) sum++; } return sum==nnonterm; } void npd_print(void) { $print("nnonterm=", nnonterm, " state={ "); for (int i=0; i