parent
8f74988416
commit
e2b8259142
|
@ -66,10 +66,16 @@ static int is_input_used(char* input, chain_list* abl)
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* seek if all inputs are used in abl */
|
/* seek if all inputs are used in abl */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
static int used_inputs(befig_list* befig, chain_list* abl, biabl_list* biabl)
|
static int used_inputs(befig_list* befig)
|
||||||
{
|
{
|
||||||
bepor_list* bepor;
|
bepor_list* bepor;
|
||||||
biabl_list* biabl_aux;
|
bereg_list *bereg;
|
||||||
|
beaux_list *beaux;
|
||||||
|
bebus_list *bebus;
|
||||||
|
bebux_list *bebux;
|
||||||
|
beout_list *beout;
|
||||||
|
biabl_list *biabl;
|
||||||
|
|
||||||
|
|
||||||
/*all inputs should be used*/
|
/*all inputs should be used*/
|
||||||
for (bepor=befig->BEPOR; bepor; bepor=bepor->NEXT) {
|
for (bepor=befig->BEPOR; bepor; bepor=bepor->NEXT) {
|
||||||
|
@ -77,15 +83,55 @@ static int used_inputs(befig_list* befig, chain_list* abl, biabl_list* biabl)
|
||||||
if (bepor->DIRECTION!=IN && bepor->DIRECTION!=INOUT
|
if (bepor->DIRECTION!=IN && bepor->DIRECTION!=INOUT
|
||||||
&& bepor->DIRECTION!=TRANSCV) continue;
|
&& bepor->DIRECTION!=TRANSCV) continue;
|
||||||
if (!isvdd(bepor->NAME) && !isvss(bepor->NAME)) {
|
if (!isvdd(bepor->NAME) && !isvss(bepor->NAME)) {
|
||||||
if (!is_input_used(bepor->NAME,abl)) {
|
|
||||||
for (biabl_aux=biabl; biabl_aux; biabl_aux=biabl_aux->NEXT) {
|
for ( beout = befig->BEOUT; beout; beout = beout->NEXT )
|
||||||
if (is_input_used(bepor->NAME,biabl_aux->VALABL)
|
{
|
||||||
|| is_input_used(bepor->NAME,biabl_aux->CNDABL)) break;
|
if ( is_input_used(bepor->NAME, beout->ABL) ) break;
|
||||||
}
|
}
|
||||||
if (biabl_aux) continue;
|
if ( beout ) continue;
|
||||||
|
|
||||||
|
for ( beaux = befig->BEAUX; beaux; beaux = beaux->NEXT )
|
||||||
|
{
|
||||||
|
if ( is_input_used(bepor->NAME, beaux->ABL) ) break;
|
||||||
|
}
|
||||||
|
if ( beaux ) continue;
|
||||||
|
|
||||||
|
for ( bebux = befig->BEBUX; bebux; bebux = bebux->NEXT )
|
||||||
|
{
|
||||||
|
for ( biabl = bebux->BIABL; biabl; biabl = biabl->NEXT )
|
||||||
|
{
|
||||||
|
if ( is_input_used(bepor->NAME, biabl->CNDABL) ) break;
|
||||||
|
if ( is_input_used(bepor->NAME, biabl->VALABL) ) break;
|
||||||
|
}
|
||||||
|
if ( biabl ) break;
|
||||||
|
}
|
||||||
|
if ( bebux ) continue;
|
||||||
|
|
||||||
|
for ( bereg = befig->BEREG; bereg; bereg = bereg->NEXT )
|
||||||
|
{
|
||||||
|
for ( biabl = bereg->BIABL; biabl; biabl = biabl->NEXT )
|
||||||
|
{
|
||||||
|
if ( is_input_used(bepor->NAME, biabl->CNDABL) ) break;
|
||||||
|
if ( is_input_used(bepor->NAME, biabl->VALABL) ) break;
|
||||||
|
}
|
||||||
|
if ( biabl ) break;
|
||||||
|
}
|
||||||
|
if ( bereg ) continue;
|
||||||
|
|
||||||
|
for ( bebus = befig->BEBUS; bebus; bebus = bebus->NEXT )
|
||||||
|
{
|
||||||
|
for ( biabl = bebus->BIABL; biabl; biabl = biabl->NEXT )
|
||||||
|
{
|
||||||
|
if ( is_input_used(bepor->NAME, biabl->CNDABL) ) break;
|
||||||
|
if ( is_input_used(bepor->NAME, biabl->VALABL) ) break;
|
||||||
|
}
|
||||||
|
if ( biabl ) break;
|
||||||
|
}
|
||||||
|
if ( bebus ) continue;
|
||||||
|
|
||||||
fprintf(stderr,"BEH: %s input unused\n",bepor->NAME);
|
fprintf(stderr,"BEH: %s input unused\n",bepor->NAME);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,13 +165,27 @@ static void format_subst_befig( befig_list *befig, beaux_list *BeauxSubst )
|
||||||
bereg_list *bereg;
|
bereg_list *bereg;
|
||||||
beaux_list *beaux;
|
beaux_list *beaux;
|
||||||
bebus_list *bebus;
|
bebus_list *bebus;
|
||||||
|
bebux_list *bebux;
|
||||||
|
beout_list *beout;
|
||||||
biabl_list *biabl;
|
biabl_list *biabl;
|
||||||
|
|
||||||
|
for ( beout = befig->BEOUT; beout; beout = beout->NEXT )
|
||||||
|
{
|
||||||
|
beout->ABL = format_subst_abl( beout->ABL, BeauxSubst );
|
||||||
|
}
|
||||||
for ( beaux = befig->BEAUX; beaux; beaux = beaux->NEXT )
|
for ( beaux = befig->BEAUX; beaux; beaux = beaux->NEXT )
|
||||||
{
|
{
|
||||||
if ( beaux == BeauxSubst ) continue;
|
if ( beaux == BeauxSubst ) continue;
|
||||||
beaux->ABL = format_subst_abl( beaux->ABL, BeauxSubst );
|
beaux->ABL = format_subst_abl( beaux->ABL, BeauxSubst );
|
||||||
}
|
}
|
||||||
|
for ( bebux = befig->BEBUX; bebux; bebux = bebux->NEXT )
|
||||||
|
{
|
||||||
|
for ( biabl = bebux->BIABL; biabl; biabl = biabl->NEXT )
|
||||||
|
{
|
||||||
|
biabl->CNDABL = format_subst_abl( biabl->CNDABL, BeauxSubst );
|
||||||
|
biabl->VALABL = format_subst_abl( biabl->VALABL, BeauxSubst );
|
||||||
|
}
|
||||||
|
}
|
||||||
for ( bereg = befig->BEREG; bereg; bereg = bereg->NEXT )
|
for ( bereg = befig->BEREG; bereg; bereg = bereg->NEXT )
|
||||||
{
|
{
|
||||||
for ( biabl = bereg->BIABL; biabl; biabl = biabl->NEXT )
|
for ( biabl = bereg->BIABL; biabl; biabl = biabl->NEXT )
|
||||||
|
@ -181,9 +241,6 @@ extern int format_cell(befig_list* befig)
|
||||||
biabl->VALABL=simpablexpr(createablnotexpr(biabl->VALABL));
|
biabl->VALABL=simpablexpr(createablnotexpr(biabl->VALABL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return used_inputs(befig,NULL,
|
|
||||||
befig->BEREG->BIABL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (befig->BEBUS) {
|
if (befig->BEBUS) {
|
||||||
|
@ -191,8 +248,6 @@ extern int format_cell(befig_list* befig)
|
||||||
if (befig->BEBUS->NEXT || befig->BEREG || befig->BEBUX) return 0;
|
if (befig->BEBUS->NEXT || befig->BEREG || befig->BEBUX) return 0;
|
||||||
/*one ouput: bebus*/
|
/*one ouput: bebus*/
|
||||||
if (befig->BEOUT) return 0;
|
if (befig->BEOUT) return 0;
|
||||||
return used_inputs(befig,NULL,
|
|
||||||
befig->BEBUS->BIABL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (befig->BEBUX) {
|
if (befig->BEBUX) {
|
||||||
|
@ -223,17 +278,15 @@ extern int format_cell(befig_list* befig)
|
||||||
beh_frebeout(befig->BEOUT);
|
beh_frebeout(befig->BEOUT);
|
||||||
befig->BEBUX=NULL;
|
befig->BEBUX=NULL;
|
||||||
befig->BEOUT=NULL;
|
befig->BEOUT=NULL;
|
||||||
|
|
||||||
return used_inputs(befig,NULL,
|
|
||||||
befig->BEBUS->BIABL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (befig->BEOUT) {
|
if (befig->BEOUT) {
|
||||||
/*one ouput: beout*/
|
/*one ouput: beout*/
|
||||||
if (befig->BEOUT->NEXT || befig->BEBUS) return 0;
|
if (befig->BEOUT->NEXT || befig->BEBUS) return 0;
|
||||||
return used_inputs(befig,befig->BEOUT->ABL,NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return used_inputs(befig);
|
||||||
|
|
||||||
/*illegal befig*/
|
/*illegal befig*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue