Exemplo n.º 1
0
static void explore_state_index(void*context,int idx,int*src){
	model_t model=(model_t)context;
	int labels[state_labels];
	if (state_labels){
		GBgetStateLabelsAll(model,src,labels);
	}
	if(write_lts){
		if(write_state){
			enum_vec(output_handle,src,labels);
		} else {
			enum_seg(output_handle,0,idx,labels);
		}
	}
	switch(call_mode){
	case UseBlackBox:
		GBgetTransitionsAll(model,src,index_next,&idx);
		break;
	case UseGreyBox:
		for(int i=0;i<K;i++){
			GBgetTransitionsLong(model,i,src,index_next,&idx);
		}
		break;
	}
	explored++;
	if (explored%1000==0 && RTverbosity>=2) 
	  Warning(info,"explored %d visited %d trans %d",explored,visited,trans);
}
Exemplo n.º 2
0
int
permute_next (permute_t *perm, state_info_t *state, int group, perm_cb_f cb, void *ctx)
{
    perm->permutation   = Perm_None;
    perm->call_ctx      = ctx;
    perm->real_cb       = cb;
    perm->state         = state;
    perm->nstored       = perm->start_group_index = 0;
    int                 count;
    state_data_t        data = state_info_pins_state (state);
    count = GBgetTransitionsLong (((wctx_t *)ctx)->model, group, data, permute_one, perm);
    return count;
}
Exemplo n.º 3
0
static int
check_long (model_t model, int g, int *src, TransitionCB cb, void *context)
{
    check_ctx_t    *ctx = GBgetContext (model);
    int             count;
    int             found;

    // collect
    ctx->src = src;
    ctx->group = g;
    ctx->user_cb = cb;
    ctx->user_ctx = context;
    ci_clear (ctx->check_must);
    isba_discard_int (ctx->stack, isba_size_int(ctx->stack));
    HREassert (!ctx->reentrent, "INTERFACE ERROR: GBgetTransitions* is not re-entrant");
    ctx->reentrent = 1;
    count = GBgetTransitionsLong (ctx->parent, g, src, collect, ctx);
    ctx->reentrent = 0;
    found = isba_size_int(ctx->stack);
    abort_if (count != found, "Wrong count returned by GBnextLong(collect): %d (Found: %d).",
              count, found);

    // compare
    ctx->src2 = copy_vec (ctx, g, src);
    ctx->comparison_failed = false;
    ctx->call_idx = 0;
    count = GBgetTransitionsLong (ctx->parent, g, ctx->src2, compare, ctx);
    abort_if (count != ctx->call_idx , "Wrong count returned by GBnextLong(compare): %d (Found: %d).",
              count, ctx->call_idx );

    if (ctx->call_idx != found || ctx->comparison_failed) {
        find_culprit_slot (ctx, g);
    }

    return count;
}
Exemplo n.º 4
0
static void
find_culprit_slot (check_ctx_t *ctx, int g)
{
    int             count;

    for (int i = 0; i < ctx->N; i++) {
        while (ctx->src2[i] == ctx->src[i]) {
            i++;
            abort_if (i >= ctx->N, "No-deterministic GBnextLong for group %d", g);
        }
        ctx->src2[i] = ctx->src[i]; // fill

        // retry with src2 more similar to src:
        ctx->idx = i;
        ctx->call_idx = 0;
        ctx->comparison_failed = false;
        count = GBgetTransitionsLong (ctx->parent, g, ctx->src2, find, ctx);
        abort_if (count != ctx->call_idx , "Wrong count returned by GBnextLong(compare): %d (Found: %d).",
                  count, ctx->call_idx);
    }
    HREassert (false);
}