Emit constants for LPM device.

This commit is contained in:
steve 2003-10-27 02:18:27 +00:00
parent a503e2d91f
commit 1b8034818c
3 changed files with 83 additions and 4 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: d-lpm.c,v 1.8 2003/09/03 23:34:09 steve Exp $" #ident "$Id: d-lpm.c,v 1.9 2003/10/27 02:18:27 steve Exp $"
#endif #endif
/* /*
@ -785,6 +785,58 @@ static void lpm_show_mult(ivl_lpm_t net)
} }
static void lpm_show_constant(ivl_net_const_t net)
{
edif_cell_t cell0 = edif_xlibrary_findcell(xlib, "cell0");
edif_cell_t cell1 = edif_xlibrary_findcell(xlib, "cell1");
edif_cellref_t ref0 = 0, ref1 = 0;
const char*bits;
unsigned idx;
if (cell0 == 0) {
cell0 = edif_xcell_create(xlib, "cell0", 1);
edif_cell_portconfig(cell0, 0, "Result0", IVL_SIP_OUTPUT);
edif_cell_pstring(cell0, "LPM_Type", "LPM_CONSTANT");
edif_cell_pinteger(cell0, "LPM_Width", 1);
edif_cell_pinteger(cell0, "LPM_CValue", 0);
}
if (cell1 == 0) {
cell1 = edif_xcell_create(xlib, "cell1", 1);
edif_cell_portconfig(cell1, 0, "Result0", IVL_SIP_OUTPUT);
edif_cell_pstring(cell1, "LPM_Type", "LPM_CONSTANT");
edif_cell_pinteger(cell1, "LPM_Width", 1);
edif_cell_pinteger(cell1, "LPM_CValue", 1);
}
bits = ivl_const_bits(net);
for (idx = 0 ; idx < ivl_const_pins(net) ; idx += 1) {
if (bits[idx] == '1') {
if (ref1 == 0)
ref1 = edif_cellref_create(edf, cell1);
} else {
if (ref0 == 0)
ref0 = edif_cellref_create(edf, cell0);
}
}
for (idx = 0 ; idx < ivl_const_pins(net) ; idx += 1) {
edif_joint_t jnt;
jnt = edif_joint_of_nexus(edf, ivl_const_pin(net,idx));
if (bits[idx] == '1')
edif_add_to_joint(jnt, ref1, 0);
else
edif_add_to_joint(jnt, ref0, 0);
}
}
const struct device_s d_lpm_edif = { const struct device_s d_lpm_edif = {
lpm_show_header, lpm_show_header,
lpm_show_footer, lpm_show_footer,
@ -800,11 +852,15 @@ const struct device_s d_lpm_edif = {
lpm_show_add, /* show_sub */ lpm_show_add, /* show_sub */
0, /* show_shiftl */ 0, /* show_shiftl */
0, /* show_shiftr */ 0, /* show_shiftr */
lpm_show_mult /* show_mult */ lpm_show_mult, /* show_mult */
lpm_show_constant /* show_constant */
}; };
/* /*
* $Log: d-lpm.c,v $ * $Log: d-lpm.c,v $
* Revision 1.9 2003/10/27 02:18:27 steve
* Emit constants for LPM device.
*
* Revision 1.8 2003/09/03 23:34:09 steve * Revision 1.8 2003/09/03 23:34:09 steve
* Support synchronous set of LPM_FF devices. * Support synchronous set of LPM_FF devices.
* *

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: device.h,v 1.12 2003/08/09 03:23:03 steve Exp $" #ident "$Id: device.h,v 1.13 2003/10/27 02:18:27 steve Exp $"
#endif #endif
# include <ivl_target.h> # include <ivl_target.h>
@ -63,6 +63,8 @@ struct device_s {
void (*show_shiftr)(ivl_lpm_t net); void (*show_shiftr)(ivl_lpm_t net);
/* Multipliers */ /* Multipliers */
void (*show_mult)(ivl_lpm_t net); void (*show_mult)(ivl_lpm_t net);
/* Constants */
void (*show_constant)(ivl_net_const_t net);
}; };
/* /*
@ -77,6 +79,9 @@ extern device_t device_from_arch(const char*arch);
/* /*
* $Log: device.h,v $ * $Log: device.h,v $
* Revision 1.13 2003/10/27 02:18:27 steve
* Emit constants for LPM device.
*
* Revision 1.12 2003/08/09 03:23:03 steve * Revision 1.12 2003/08/09 03:23:03 steve
* Add support for IVL_LPM_MULT device. * Add support for IVL_LPM_MULT device.
* *

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: fpga.c,v 1.9 2003/08/07 04:04:01 steve Exp $" #ident "$Id: fpga.c,v 1.10 2003/10/27 02:18:28 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -88,6 +88,19 @@ static void show_pads(ivl_scope_t scope)
} }
} }
static void show_constants(ivl_design_t des)
{
unsigned idx;
if (device->show_constant == 0)
return;
for (idx = 0 ; idx < ivl_design_consts(des) ; idx += 1) {
ivl_net_const_t con = ivl_design_const(des, idx);
device->show_constant(con);
}
}
/* /*
* This is the main entry point that ivl uses to invoke me, the code * This is the main entry point that ivl uses to invoke me, the code
* generator. * generator.
@ -135,6 +148,8 @@ int target_design(ivl_design_t des)
netlist. */ netlist. */
show_scope_gates(root, 0); show_scope_gates(root, 0);
show_constants(des);
/* Call the device driver to close out the file. */ /* Call the device driver to close out the file. */
device->show_footer(des); device->show_footer(des);
@ -145,6 +160,9 @@ int target_design(ivl_design_t des)
/* /*
* $Log: fpga.c,v $ * $Log: fpga.c,v $
* Revision 1.10 2003/10/27 02:18:28 steve
* Emit constants for LPM device.
*
* Revision 1.9 2003/08/07 04:04:01 steve * Revision 1.9 2003/08/07 04:04:01 steve
* Add an LPM device type. * Add an LPM device type.
* *