Exemplo n.º 1
0
static void
init_model(char *file)
{
    Warning(info, "opening %s", file);
    model = GBcreateBase();
    GBsetChunkMap (model, HREgreyboxTableFactory());

    HREbarrier(HREglobal());
    GBloadFile(model, file, &model);

    HREbarrier(HREglobal());

    if (HREme(HREglobal())==0 && !PINS_USE_GUARDS && no_soundness_check) {
        Abort("Option --no-soundness-check is incompatible with --pins-guards=false");
    }

    if (HREme(HREglobal())==0 && log_active(infoLong) && !no_matrix) {
        fprintf(stderr, "Dependency Matrix:\n");
        GBprintDependencyMatrixCombined(stderr, model);
    }

    ltstype = GBgetLTStype(model);
    N = lts_type_get_state_length(ltstype);
    eLbls = lts_type_get_edge_label_count(ltstype);
    sLbls = GBgetStateLabelInfo(model) == NULL ? 0 : dm_nrows(GBgetStateLabelInfo(model));
    nGrps = dm_nrows(GBgetDMInfo(model));
    max_sat_levels = (N / sat_granularity) + 1;
    if (PINS_USE_GUARDS) {
        nGuards = GBgetStateLabelGroupInfo(model, GB_SL_GUARDS)->count;
        if (HREme(HREglobal())==0) {
            Warning(info, "state vector length is %d; there are %d groups and %d guards", N, nGrps, nGuards);
        }
    } else {
        if (HREme(HREglobal())==0) {
            Warning(info, "state vector length is %d; there are %d groups", N, nGrps);
        }
    }

    int id=GBgetMatrixID(model,"inhibit");
    if (id>=0){
        inhibit_matrix=GBgetMatrix(model,id);
        if (HREme(HREglobal())==0) {
            Warning(infoLong,"inhibit matrix is:");
            if (log_active(infoLong)) dm_print(stderr,inhibit_matrix);
        }
    }
    id = GBgetMatrixID(model,LTSMIN_EDGE_TYPE_ACTION_CLASS);
    if (id>=0){
        class_matrix=GBgetMatrix(model,id);
        if (HREme(HREglobal())==0) {
            Warning(infoLong,"inhibit class matrix is:");
            if (log_active(infoLong)) dm_print(stderr,class_matrix);
        }
    }

    HREbarrier(HREglobal());
}
Exemplo n.º 2
0
value_table_t HREcreateTable(hre_context_t ctx,const char* name){
    if (HREpeers(ctx)==1) return chunk_table_create(ctx,(char*)name);
    value_table_t vt=VTcreateBase((char*)name,sizeof(struct value_table_s));
    VTdestroySet(vt,destroy);
    VTputChunkSet(vt,put_chunk);
    VTputAtChunkSet(vt,put_at_chunk);
    VTgetChunkSet(vt,get_chunk);
    VTgetCountSet(vt,get_count);
    vt->index=SIcreate();
    vt->ctx=ctx;
    vt->msg_pending=0;
    uint32_t request_tag=HREactionCreate(ctx,1,CHUNK_BUFFER_SIZE,request_action,vt);
    uint32_t answer_tag=HREactionCreate(ctx,0,CHUNK_BUFFER_SIZE,answer_action,vt);
    vt->msg=HREnewMessage(ctx,CHUNK_BUFFER_SIZE);
    if (HREme(ctx)==0){
        vt->msg->tag=answer_tag;
        vt->msg->comm=0;
    } else {
        vt->msg->tag=request_tag;
        vt->msg->comm=1;
    }
    vt->msg->source=HREme(ctx);
    vt->msg->target=0;
    vt->msg->ready=hre_ready_decr;
    vt->msg->ready_ctx=&vt->msg_pending;
    HREbarrier(ctx);
    return vt;
}
Exemplo n.º 3
0
void
timed_run (run_t *run, wctx_t *ctx)
{
    transition_info_t       ti = GB_NO_TRANSITION;

    if ( Strat_PBFS & strategy[0] ) {
        ta_queue_state = pbfs_queue_state;
    }

    if (0 == ctx->id) { // only w1 receives load, as it is propagated later
        if ( Strat_PBFS & strategy[0] ) {
            if (ctx->local->lts != NULL) {
                state_data_t    initial = state_info_state(ctx->initial);
                int             src_owner = ref_hash(ctx->initial->ref) % W;
                lts_write_init (ctx->local->lts, src_owner, initial);
            }
        }
        ta_handle (ctx, ctx->initial, &ti, 0);
        ctx->counters->trans = 0; //reset trans count
    }

    HREbarrier (HREglobal());

    switch (get_strategy(run->alg)) {
        case Strat_TA_PBFS:
            ta_pbfs (ctx);
            break;
        case Strat_TA_SBFS:
            ta_sbfs (ctx);
            break;
        case Strat_TA_BFS:
            ta_bfs (ctx);
            break;
        case Strat_TA_DFS:
            ta_dfs (ctx);
            break;
        default: Abort ("Missing case in timed_run");
    }
}