2 * This file is part of the Alliance CAD System
3 * Copyright (C) Laboratoire LIP6 - Département ASIM
4 * Universite Pierre et Marie Curie
6 * Home page : http://www-asim.lip6.fr/alliance/
7 * E-mail support : mailto:alliance-support@asim.lip6.fr
9 * This library is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Library General Public License as published
11 * by the Free Software Foundation; either version 2 of the License, or (at
12 * your option) any later version.
14 * Alliance VLSI CAD System is distributed in the hope that it will be
15 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
17 * Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with the GNU C Library; see the file COPYING. If not, write to the Free
21 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 /* ###--------------------------------------------------------------### */
26 /* file : mvl_sspec.yac */
27 /* date : Jan 29 1992 */
28 /* author : P. BAZARGAN */
32 /* content : these functions are used to build up MBK's structures */
34 /* ###--------------------------------------------------------------### */
39 #include "mvl_stype.h"
40 #include "mvl_sspec.h"
41 #include "mvl_stdef.h"
43 /* ###--------------------------------------------------------------### */
44 /* function : mvl_addlosig */
45 /* description : create one or more losig structures (for an array a */
46 /* losig is created for each bit) */
47 /* called func. : addlosig, addchain */
48 /* ###--------------------------------------------------------------### */
50 struct losig
*mvl_addlosig (ptfig
, index
, type
, ptype
, name
, left
, right
)
52 lofig_list
*ptfig
; /* pointer on LOFIG structure */
53 int index
; /* index of the first signal */
54 char type
; /* signal's type */
55 char ptype
; /* signal's resolution function */
56 char *name
; /* signal's name */
57 short left
; /* array's left bound (= -1 if scalar) */
58 short right
; /* array's right bound (= -1 if scalar) */
64 struct chain
*pt_chlst
;
67 if ((left
==-1) && (right
==-1))
69 pt_chlst
= addchain (NULL
, name
);
70 ptsig
= addlosig (ptfig
, index
, pt_chlst
, type
);
73 ptsig
->USER
= addptype (ptsig
->USER
, ptype
, NULL
);
77 if (left
>= right
) /* array */
80 for (i
=left
; i
!=(right
+inc
) ; i
+=inc
)
82 sprintf (extname
, "%s %d", name
, i
);
83 pt_chlst
= addchain (NULL
, extname
);
84 ptsig
= addlosig (ptfig
, index
, pt_chlst
, type
);
87 ptsig
->USER
= addptype (ptsig
->USER
, ptype
, NULL
);
95 /* ###--------------------------------------------------------------### */
96 /* function : mvl_addlocon */
97 /* description : create one or more locon structures (for an array a */
98 /* locon is created for each bit) */
99 /* called func. : addlocon, addchain */
100 /* ###--------------------------------------------------------------### */
102 struct locon
*mvl_addlocon (ptfig
, ptsig
, dir
, name
, left
, right
)
104 struct lofig
*ptfig
; /* BEFIG structure's pointer */
105 struct losig
*ptsig
; /* external signal's pointer */
106 char dir
; /* port's mode */
107 char *name
; /* port's name */
108 short left
; /* array left bound (= -1 if scalar) */
109 short right
; /* array right bound (= -1 if scalar) */
115 struct locon
*ptcon
;
116 struct locon
*ptcontmp
;
118 if ((left
==-1) && (right
==-1))
120 ptcon
= addlocon (ptfig
, name
, ptsig
, dir
);
127 for (i
=left
; i
!=(right
+inc
) ; i
+=inc
)
129 sprintf (extname
, "%s %d", name
, i
);
130 ptcon
= addlocon (ptfig
, extname
, NULL
, dir
);
136 for (i
=left
; i
!=(right
+inc
) ; i
+=inc
)
138 ptcontmp
->SIG
= ptsig
;
139 ptcontmp
= ptcontmp
->NEXT
;