Emit constants for LPM device.
This commit is contained in:
parent
a503e2d91f
commit
1b8034818c
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#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
|
||||
|
||||
/*
|
||||
|
|
@ -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 = {
|
||||
lpm_show_header,
|
||||
lpm_show_footer,
|
||||
|
|
@ -800,11 +852,15 @@ const struct device_s d_lpm_edif = {
|
|||
lpm_show_add, /* show_sub */
|
||||
0, /* show_shiftl */
|
||||
0, /* show_shiftr */
|
||||
lpm_show_mult /* show_mult */
|
||||
lpm_show_mult, /* show_mult */
|
||||
lpm_show_constant /* show_constant */
|
||||
};
|
||||
|
||||
/*
|
||||
* $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
|
||||
* Support synchronous set of LPM_FF devices.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#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
|
||||
|
||||
# include <ivl_target.h>
|
||||
|
|
@ -63,6 +63,8 @@ struct device_s {
|
|||
void (*show_shiftr)(ivl_lpm_t net);
|
||||
/* Multipliers */
|
||||
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 $
|
||||
* 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
|
||||
* Add support for IVL_LPM_MULT device.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#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
|
||||
|
||||
# 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
|
||||
* generator.
|
||||
|
|
@ -135,6 +148,8 @@ int target_design(ivl_design_t des)
|
|||
netlist. */
|
||||
show_scope_gates(root, 0);
|
||||
|
||||
show_constants(des);
|
||||
|
||||
/* Call the device driver to close out the file. */
|
||||
device->show_footer(des);
|
||||
|
||||
|
|
@ -145,6 +160,9 @@ int target_design(ivl_design_t des)
|
|||
|
||||
/*
|
||||
* $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
|
||||
* Add an LPM device type.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue