Add xlibrary celltable.
This commit is contained in:
parent
47060bfedd
commit
6495d0bd5d
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: d-virtex2.c,v 1.6 2003/03/31 01:34:19 steve Exp $"
|
||||
#ident "$Id: d-virtex2.c,v 1.7 2003/04/04 04:59:03 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "device.h"
|
||||
|
|
@ -59,7 +59,6 @@ static edif_cell_t cell_opad = 0;
|
|||
|
||||
static edif_cell_t cell_buf = 0;
|
||||
static edif_cell_t cell_inv = 0;
|
||||
static edif_cell_t cell_bufg = 0;
|
||||
static edif_cell_t cell_ibuf = 0;
|
||||
static edif_cell_t cell_obuf = 0;
|
||||
const unsigned BUF_O = 0;
|
||||
|
|
@ -86,7 +85,6 @@ const unsigned XORCY_O = 0;
|
|||
const unsigned XORCY_CI = 1;
|
||||
const unsigned XORCY_LI = 2;
|
||||
|
||||
static edif_cell_t cell_mult_and = 0;
|
||||
const unsigned MULT_AND_LO = 0;
|
||||
const unsigned MULT_AND_I0 = 1;
|
||||
const unsigned MULT_AND_I1 = 2;
|
||||
|
|
@ -237,17 +235,30 @@ static void check_cell_xorcy(void)
|
|||
edif_cell_portconfig(cell_xorcy, XORCY_LI, "LI", IVL_SIP_INPUT);
|
||||
}
|
||||
|
||||
static void check_cell_mult_and(void)
|
||||
{
|
||||
if (cell_mult_and != 0)
|
||||
return;
|
||||
|
||||
cell_mult_and = edif_xcell_create(xlib, "MULT_AND", 3);
|
||||
edif_cell_portconfig(cell_mult_and, MULT_AND_LO, "LO", IVL_SIP_OUTPUT);
|
||||
edif_cell_portconfig(cell_mult_and, MULT_AND_I0, "I0", IVL_SIP_INPUT);
|
||||
edif_cell_portconfig(cell_mult_and, MULT_AND_I1, "I1", IVL_SIP_INPUT);
|
||||
static edif_cell_t celltable_mult_and(edif_xlibrary_t xlib)
|
||||
{
|
||||
edif_cell_t cell = edif_xcell_create(xlib, "MULT_AND", 3);
|
||||
edif_cell_portconfig(cell, MULT_AND_LO, "LO", IVL_SIP_OUTPUT);
|
||||
edif_cell_portconfig(cell, MULT_AND_I0, "I0", IVL_SIP_INPUT);
|
||||
edif_cell_portconfig(cell, MULT_AND_I1, "I1", IVL_SIP_INPUT);
|
||||
return cell;
|
||||
}
|
||||
|
||||
static edif_cell_t celltable_bufg(edif_xlibrary_t xlib)
|
||||
{
|
||||
edif_cell_t cell = edif_xcell_create(xlib, "BUFG", 2);
|
||||
edif_cell_portconfig(cell, BUF_O, "O", IVL_SIP_OUTPUT);
|
||||
edif_cell_portconfig(cell, BUF_I, "I", IVL_SIP_INPUT);
|
||||
return cell;
|
||||
}
|
||||
|
||||
const static struct edif_xlib_celltable virtex2_celltable[] = {
|
||||
{ "BUFG", celltable_bufg },
|
||||
{ "MULT_AND", celltable_mult_and },
|
||||
{ 0, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
* The show_header function is called before any of the devices of the
|
||||
* netlist are scanned.
|
||||
|
|
@ -321,6 +332,8 @@ static void virtex2_show_header(ivl_design_t des)
|
|||
assert(pidx == nports);
|
||||
|
||||
xlib = edif_xlibrary_create(edf, "VIRTEX2");
|
||||
edif_xlibrary_set_celltable(xlib, virtex2_celltable);
|
||||
|
||||
|
||||
if ( (part_str = ivl_design_flag(des, "part")) && (part_str[0] != 0) ) {
|
||||
edif_pstring(edf, "PART", part_str);
|
||||
|
|
@ -332,9 +345,6 @@ static void virtex2_show_header(ivl_design_t des)
|
|||
cell_1 = edif_xcell_create(xlib, "VCC", 1);
|
||||
edif_cell_portconfig(cell_1, 0, "VCC", IVL_SIP_OUTPUT);
|
||||
|
||||
cell_bufg = edif_xcell_create(xlib, "BUFG", 2);
|
||||
edif_cell_portconfig(cell_bufg, BUF_O, "O", IVL_SIP_OUTPUT);
|
||||
edif_cell_portconfig(cell_bufg, BUF_I, "I", IVL_SIP_INPUT);
|
||||
}
|
||||
|
||||
static void virtex2_show_footer(ivl_design_t des)
|
||||
|
|
@ -1142,6 +1152,9 @@ const struct device_s d_virtex2_edif = {
|
|||
|
||||
/*
|
||||
* $Log: d-virtex2.c,v $
|
||||
* Revision 1.7 2003/04/04 04:59:03 steve
|
||||
* Add xlibrary celltable.
|
||||
*
|
||||
* Revision 1.6 2003/03/31 01:34:19 steve
|
||||
* Wide shift of MUX was wrong.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: edif.c,v 1.3 2003/03/30 03:43:44 steve Exp $"
|
||||
#ident "$Id: edif.c,v 1.4 2003/04/04 04:59:03 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "edif.h"
|
||||
|
|
@ -54,7 +54,8 @@ struct edif_xlibrary_s {
|
|||
const char*name;
|
||||
/* The cells that are contained in this library. */
|
||||
struct edif_cell_s*cells;
|
||||
|
||||
/* point to the optional celltable. */
|
||||
const struct edif_xlib_celltable*celltable;
|
||||
/* used to list libraries in an edif_t. */
|
||||
struct edif_xlibrary_s*next;
|
||||
};
|
||||
|
|
@ -160,23 +161,41 @@ edif_xlibrary_t edif_xlibrary_create(edif_t edf, const char*name)
|
|||
{
|
||||
edif_xlibrary_t xlib = malloc(sizeof(struct edif_xlibrary_s));
|
||||
|
||||
xlib->name = name;
|
||||
xlib->cells= 0;
|
||||
xlib->name = name;
|
||||
xlib->cells = 0;
|
||||
xlib->celltable = 0;
|
||||
xlib->next = edf->xlibs;
|
||||
edf->xlibs = xlib;
|
||||
|
||||
return xlib;
|
||||
}
|
||||
|
||||
void edif_xlibrary_set_celltable(edif_xlibrary_t xlib,
|
||||
const struct edif_xlib_celltable*tab)
|
||||
{
|
||||
assert(xlib->celltable == 0);
|
||||
xlib->celltable = tab;
|
||||
}
|
||||
|
||||
edif_cell_t edif_xlibrary_findcell(edif_xlibrary_t xlib,
|
||||
const char*cell_name)
|
||||
{
|
||||
const struct edif_xlib_celltable*tcur;
|
||||
edif_cell_t cur;
|
||||
|
||||
for (cur = xlib->cells ; cur ; cur = cur->next) {
|
||||
if (strcmp(cell_name, cur->name) == 0)
|
||||
return cur;
|
||||
}
|
||||
|
||||
if (xlib->celltable == 0)
|
||||
return 0;
|
||||
|
||||
for (tcur = xlib->celltable ; tcur->cell_name ; tcur += 1)
|
||||
if (strcmp(cell_name, tcur->cell_name) == 0) {
|
||||
return (tcur->cell_func)(xlib);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -472,6 +491,9 @@ void edif_print(FILE*fd, edif_t edf)
|
|||
|
||||
/*
|
||||
* $Log: edif.c,v $
|
||||
* Revision 1.4 2003/04/04 04:59:03 steve
|
||||
* Add xlibrary celltable.
|
||||
*
|
||||
* Revision 1.3 2003/03/30 03:43:44 steve
|
||||
* Handle wide ports of macros.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: edif.h,v 1.2 2003/03/24 02:29:04 steve Exp $"
|
||||
#ident "$Id: edif.h,v 1.3 2003/04/04 04:59:03 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <stdio.h>
|
||||
|
|
@ -102,6 +102,16 @@ typedef struct edif_cellref_s* edif_cellref_t;
|
|||
object, of stand along. */
|
||||
typedef struct edif_joint_s* edif_joint_t;
|
||||
|
||||
/* This structure defines a table that can be attached to an xlibrary
|
||||
to incorporate black-box cells to the library. The cell_name is the
|
||||
name that may be passed to the edif_xlibrary_findcell function, and
|
||||
the function pointer points to a function that creates the cell and
|
||||
defines ports for it. A real celltable is terminated by an entry
|
||||
with a null pointer for the cell_name. */
|
||||
struct edif_xlib_celltable {
|
||||
const char*cell_name;
|
||||
edif_cell_t (*cell_func)(edif_xlibrary_t xlib);
|
||||
};
|
||||
|
||||
/* FUNCTIONS */
|
||||
|
||||
|
|
@ -130,6 +140,10 @@ extern void edif_pstring(edif_t edf, const char*name, const char*value);
|
|||
by the design. */
|
||||
extern edif_xlibrary_t edif_xlibrary_create(edif_t edf, const char*name);
|
||||
|
||||
extern void edif_xlibrary_set_celltable(edif_xlibrary_t lib,
|
||||
const struct edif_xlib_celltable*table);
|
||||
|
||||
|
||||
/* External libraries can be searched for existing cells, given a
|
||||
string name. This function searches for the cell by name, and
|
||||
returns it. */
|
||||
|
|
@ -197,6 +211,9 @@ extern void edif_print(FILE*fd, edif_t design);
|
|||
|
||||
/*
|
||||
* $Log: edif.h,v $
|
||||
* Revision 1.3 2003/04/04 04:59:03 steve
|
||||
* Add xlibrary celltable.
|
||||
*
|
||||
* Revision 1.2 2003/03/24 02:29:04 steve
|
||||
* Give proper basenames to PAD signals.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue