2 /* ###--------------------------------------------------------------### */
3 /* file : beh_chkbefig.c */
4 /* date : Oct 30 1995 */
6 /* authors : Pirouz BAZARGAN SABET */
7 /* description : high level function */
8 /* ###--------------------------------------------------------------### */
13 /* ###--------------------------------------------------------------### */
14 /* function : beh_chkbefig */
15 /* description : check the consistency of a behavioural description */
16 /* called func. : none */
17 /* ###--------------------------------------------------------------### */
19 int beh_chkbefig (befig_list
*pt_befig
, unsigned int mode
)
22 struct beout
*pt_beout
;
23 struct beaux
*pt_beaux
;
24 struct bebus
*pt_bebus
;
25 struct bebux
*pt_bebux
;
26 struct bereg
*pt_bereg
;
29 /* ###------------------------------------------------------### */
30 /* check that the description is not empty */
31 /* ###------------------------------------------------------### */
38 /* ###------------------------------------------------------### */
39 /* check that each output has at least one driver. Outputs */
40 /* are simple output ports, bussed output ports, simple */
41 /* internal signals, delayed internal signals, bussed internal */
42 /* signals, and internal registers. */
43 /* ###------------------------------------------------------### */
45 if ((mode
& BEH_CHK_DRIVERS
) != 0)
47 /* ###------------------------------------------------------### */
48 /* simple output ports */
49 /* ###------------------------------------------------------### */
51 pt_beout
= pt_befig
->BEOUT
;
52 while (pt_beout
!= NULL
)
54 if (pt_beout
->ABL
== NULL
)
55 err_flg
+= beh_error (40, pt_beout
->NAME
);
56 pt_beout
= pt_beout
->NEXT
;
59 /* ###------------------------------------------------------### */
60 /* simple internal signals */
61 /* ###------------------------------------------------------### */
63 pt_beaux
= pt_befig
->BEAUX
;
64 while (pt_beaux
!= NULL
)
66 if (pt_beaux
->ABL
== NULL
)
67 err_flg
+= beh_error (40, pt_beaux
->NAME
);
68 pt_beaux
= pt_beaux
->NEXT
;
71 /* ###------------------------------------------------------### */
72 /* delayed internal signals */
73 /* ###------------------------------------------------------### */
75 pt_beaux
= pt_befig
->BEDLY
;
76 while (pt_beaux
!= NULL
)
78 if (pt_beaux
->ABL
== NULL
)
79 err_flg
+= beh_error (40, pt_beaux
->NAME
);
80 pt_beaux
= pt_beaux
->NEXT
;
83 /* ###------------------------------------------------------### */
84 /* bussed output ports */
85 /* ###------------------------------------------------------### */
87 pt_bebus
= pt_befig
->BEBUS
;
88 while (pt_bebus
!= NULL
)
90 if (pt_bebus
->BIABL
== NULL
)
91 err_flg
+= beh_error (40, pt_bebus
->NAME
);
92 pt_bebus
= pt_bebus
->NEXT
;
95 /* ###------------------------------------------------------### */
96 /* bussed internal signals */
97 /* ###------------------------------------------------------### */
99 pt_bebux
= pt_befig
->BEBUX
;
100 while (pt_bebux
!= NULL
)
102 if (pt_bebux
->BIABL
== NULL
)
103 err_flg
+= beh_error (40, pt_bebux
->NAME
);
104 pt_bebux
= pt_bebux
->NEXT
;
107 /* ###------------------------------------------------------### */
108 /* internal registers */
109 /* ###------------------------------------------------------### */
111 pt_bereg
= pt_befig
->BEREG
;
112 while (pt_bereg
!= NULL
)
114 if (pt_bereg
->BIABL
== NULL
)
115 err_flg
+= beh_error (40, pt_bereg
->NAME
);
116 pt_bereg
= pt_bereg
->NEXT
;
121 /* ###------------------------------------------------------### */
122 /* check that the descriptiona has an empty architecture. */
123 /* that means, no internal signal is declared and output ports */
124 /* have no dreivers. */
125 /* ###------------------------------------------------------### */
127 if ((mode
& BEH_CHK_EMPTY
) != 0)
129 /* ###------------------------------------------------------### */
130 /* check that simple output ports have no drivers */
131 /* ###------------------------------------------------------### */
133 pt_beout
= pt_befig
->BEOUT
;
134 while (pt_beout
!= NULL
)
136 if (pt_beout
->ABL
!= NULL
)
138 pt_beout
= pt_beout
->NEXT
;
141 /* ###------------------------------------------------------### */
142 /* check that bussed output ports have no drivers */
143 /* ###------------------------------------------------------### */
145 pt_bebus
= pt_befig
->BEBUS
;
146 while (pt_bebus
!= NULL
)
148 if (pt_bebus
->BIABL
!= NULL
)
150 pt_bebus
= pt_bebus
->NEXT
;
153 /* ###------------------------------------------------------### */
154 /* check that the architecture is empty */
155 /* ###------------------------------------------------------### */
157 if ((pt_befig
->BEAUX
!= NULL
) || (pt_befig
->BEBUX
!= NULL
) ||
158 (pt_befig
->BEDLY
!= NULL
) || (pt_befig
->BEREG
!= NULL
) ||
159 (pt_befig
->BEMSG
!= NULL
) || (pt_beout
!= NULL
) ||
161 err_flg
+= beh_error (41, pt_befig
->NAME
);
165 pt_befig
->ERRFLG
= err_flg
;