Add API to support user defined function.
This commit is contained in:
parent
f5049c2f14
commit
828ca0ef9d
2
ivl.def
2
ivl.def
|
|
@ -57,6 +57,8 @@ ivl_lpm_clk
|
||||||
ivl_lpm_data
|
ivl_lpm_data
|
||||||
ivl_lpm_datab
|
ivl_lpm_datab
|
||||||
ivl_lpm_data2
|
ivl_lpm_data2
|
||||||
|
ivl_lpm_data2_width
|
||||||
|
ivl_lpm_define
|
||||||
ivl_lpm_enable
|
ivl_lpm_enable
|
||||||
ivl_lpm_memory
|
ivl_lpm_memory
|
||||||
ivl_lpm_name
|
ivl_lpm_name
|
||||||
|
|
|
||||||
11
ivl_target.h
11
ivl_target.h
|
|
@ -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
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: ivl_target.h,v 1.93 2002/03/09 02:10:22 steve Exp $"
|
#ident "$Id: ivl_target.h,v 1.94 2002/03/17 19:30:20 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
@ -563,14 +563,18 @@ extern unsigned ivl_lpm_width(ivl_lpm_t net);
|
||||||
|
|
||||||
/* IVL_LPM_FF IVL_LPM_RAM */
|
/* IVL_LPM_FF IVL_LPM_RAM */
|
||||||
extern ivl_nexus_t ivl_lpm_clk(ivl_lpm_t net);
|
extern ivl_nexus_t ivl_lpm_clk(ivl_lpm_t net);
|
||||||
|
/* IVL_LPM_UFUNC */
|
||||||
|
extern ivl_scope_t ivl_lpm_define(ivl_lpm_t net);
|
||||||
/* IVL_LPM_FF IVL_LPM_RAM */
|
/* IVL_LPM_FF IVL_LPM_RAM */
|
||||||
extern ivl_nexus_t ivl_lpm_enable(ivl_lpm_t net);
|
extern ivl_nexus_t ivl_lpm_enable(ivl_lpm_t net);
|
||||||
/* IVL_LPM_ADD IVL_LPM_FF IVL_LPM_MULT IVL_LPM_RAM IVL_LPM_SUB */
|
/* IVL_LPM_ADD IVL_LPM_FF IVL_LPM_MULT IVL_LPM_RAM IVL_LPM_SUB */
|
||||||
extern ivl_nexus_t ivl_lpm_data(ivl_lpm_t net, unsigned idx);
|
extern ivl_nexus_t ivl_lpm_data(ivl_lpm_t net, unsigned idx);
|
||||||
/* IVL_LPM_ADD IVL_LPM_MULT IVL_LPM_SUB */
|
/* IVL_LPM_ADD IVL_LPM_MULT IVL_LPM_SUB */
|
||||||
|
/* IVL_LPM_MUX IVL_LPM_UFUNC */
|
||||||
extern ivl_nexus_t ivl_lpm_datab(ivl_lpm_t net, unsigned idx);
|
extern ivl_nexus_t ivl_lpm_datab(ivl_lpm_t net, unsigned idx);
|
||||||
/* IVL_LPM_MUX */
|
|
||||||
extern ivl_nexus_t ivl_lpm_data2(ivl_lpm_t net, unsigned sdx, unsigned idx);
|
extern ivl_nexus_t ivl_lpm_data2(ivl_lpm_t net, unsigned sdx, unsigned idx);
|
||||||
|
/* IVL_LPM_UFUNC */
|
||||||
|
extern unsigned ivl_lpm_data2_width(ivl_lpm_t net, unsigned sdx);
|
||||||
/* IVL_LPM_ADD IVL_LPM_FF IVL_LPM_MULT IVL_LPM_RAM IVL_LPM_SUB
|
/* IVL_LPM_ADD IVL_LPM_FF IVL_LPM_MULT IVL_LPM_RAM IVL_LPM_SUB
|
||||||
IVL_LPM_UFUNC */
|
IVL_LPM_UFUNC */
|
||||||
extern ivl_nexus_t ivl_lpm_q(ivl_lpm_t net, unsigned idx);
|
extern ivl_nexus_t ivl_lpm_q(ivl_lpm_t net, unsigned idx);
|
||||||
|
|
@ -1002,6 +1006,9 @@ _END_DECL
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: ivl_target.h,v $
|
* $Log: ivl_target.h,v $
|
||||||
|
* Revision 1.94 2002/03/17 19:30:20 steve
|
||||||
|
* Add API to support user defined function.
|
||||||
|
*
|
||||||
* Revision 1.93 2002/03/09 02:10:22 steve
|
* Revision 1.93 2002/03/09 02:10:22 steve
|
||||||
* Add the NetUserFunc netlist node.
|
* Add the NetUserFunc netlist node.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
Icarus Verilog LOADABLE TARGET API (ivl_target)
|
Icarus Verilog LOADABLE TARGET API (ivl_target)
|
||||||
|
|
||||||
Copyright 2002 Stephen Williams <steve@icarus.com>
|
Copyright 2002 Stephen Williams <steve@icarus.com>
|
||||||
$Id: ivl_target.txt,v 1.1 2002/03/09 02:10:22 steve Exp $
|
$Id: ivl_target.txt,v 1.2 2002/03/17 19:31:17 steve Exp $
|
||||||
|
|
||||||
|
|
||||||
The ivl_target API is the interface available to modules that the
|
The ivl_target API is the interface available to modules that the
|
||||||
|
|
@ -19,21 +19,30 @@ the API are used to access and interpret the netlist of the design.
|
||||||
LPM DEVICES
|
LPM DEVICES
|
||||||
|
|
||||||
All LPM devices support a small set of common LPM functions, as
|
All LPM devices support a small set of common LPM functions, as
|
||||||
described in the ivl_target header file.
|
described in the ivl_target header file. The ivl_lpm_t object has a
|
||||||
|
type enumerated by ivl_lpm_type_t, and that type is accessible via the
|
||||||
|
ivl_lpm_type function.
|
||||||
|
|
||||||
|
The following are type specific aspects of LPM devices.
|
||||||
|
|
||||||
* IVL_LPM_UFUNC
|
* IVL_LPM_UFUNC
|
||||||
|
|
||||||
This LPM represents a user defined function. It is a way to connect
|
This LPM represents a user defined function. It is a way to connect
|
||||||
behavioral code into a structural network. The UFUNC device has a
|
behavioral code into a structural network. The UFUNC device has a
|
||||||
vector output and a set of inputs.
|
vector output and a set of inputs. The ivl_lpm_define function returns
|
||||||
|
the definition as an ivl_scope_t object.
|
||||||
|
|
||||||
The output vector is accessible through the ivl_lpm_q, and the output
|
The output vector is accessible through the ivl_lpm_q, and the output
|
||||||
has the width defined by ivl_lpm_width. This similar to most every
|
has the width defined by ivl_lpm_width. This similar to most every
|
||||||
other LPM device with outputs.
|
other LPM device with outputs.
|
||||||
|
|
||||||
|
There are ivl_lpm_size() input ports, each with the width
|
||||||
|
ivl_lpm_data2_width(). The actual nexus is indexed by ivl_lpm_data2().
|
||||||
|
|
||||||
$Log: ivl_target.txt,v $
|
$Log: ivl_target.txt,v $
|
||||||
|
Revision 1.2 2002/03/17 19:31:17 steve
|
||||||
|
Add API to support user defined function.
|
||||||
|
|
||||||
Revision 1.1 2002/03/09 02:10:22 steve
|
Revision 1.1 2002/03/09 02:10:22 steve
|
||||||
Add the NetUserFunc netlist node.
|
Add the NetUserFunc netlist node.
|
||||||
|
|
||||||
|
|
|
||||||
42
t-dll-api.cc
42
t-dll-api.cc
|
|
@ -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
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT) && !defined(macintosh)
|
#if !defined(WINNT) && !defined(macintosh)
|
||||||
#ident "$Id: t-dll-api.cc,v 1.76 2002/03/09 02:10:22 steve Exp $"
|
#ident "$Id: t-dll-api.cc,v 1.77 2002/03/17 19:30:47 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
@ -543,6 +543,18 @@ extern "C" ivl_nexus_t ivl_lpm_clk(ivl_lpm_t net)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" ivl_scope_t ivl_lpm_define(ivl_lpm_t net)
|
||||||
|
{
|
||||||
|
assert(net);
|
||||||
|
switch (net->type) {
|
||||||
|
case IVL_LPM_UFUNC:
|
||||||
|
return net->u_.ufunc.def;
|
||||||
|
default:
|
||||||
|
assert(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" ivl_nexus_t ivl_lpm_enable(ivl_lpm_t net)
|
extern "C" ivl_nexus_t ivl_lpm_enable(ivl_lpm_t net)
|
||||||
{
|
{
|
||||||
assert(net);
|
assert(net);
|
||||||
|
|
@ -623,12 +635,35 @@ extern "C" ivl_nexus_t ivl_lpm_data2(ivl_lpm_t net, unsigned sdx, unsigned idx)
|
||||||
assert(idx < net->u_.mux.width);
|
assert(idx < net->u_.mux.width);
|
||||||
return net->u_.mux.d[sdx*net->u_.mux.width + idx];
|
return net->u_.mux.d[sdx*net->u_.mux.width + idx];
|
||||||
|
|
||||||
|
case IVL_LPM_UFUNC: {
|
||||||
|
sdx += 1; /* skip the output port. */
|
||||||
|
assert(sdx < net->u_.ufunc.ports);
|
||||||
|
assert(idx < net->u_.ufunc.port_wid[sdx]);
|
||||||
|
unsigned base = 0;
|
||||||
|
for (unsigned i = 0 ; i < sdx ; i += 1)
|
||||||
|
base += net->u_.ufunc.port_wid[i];
|
||||||
|
return net->u_.ufunc.pins[base+idx];
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" unsigned ivl_lpm_data2_width(ivl_lpm_t net, unsigned sdx)
|
||||||
|
{
|
||||||
|
assert(net);
|
||||||
|
switch (net->type) {
|
||||||
|
case IVL_LPM_UFUNC:
|
||||||
|
sdx += 1; /* skip the output port. */
|
||||||
|
assert(sdx < net->u_.ufunc.ports);
|
||||||
|
return net->u_.ufunc.port_wid[sdx];
|
||||||
|
default:
|
||||||
|
assert(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
extern "C" const char* ivl_lpm_name(ivl_lpm_t net)
|
extern "C" const char* ivl_lpm_name(ivl_lpm_t net)
|
||||||
{
|
{
|
||||||
return net->name;
|
return net->name;
|
||||||
|
|
@ -739,6 +774,8 @@ extern "C" unsigned ivl_lpm_size(ivl_lpm_t net)
|
||||||
switch (net->type) {
|
switch (net->type) {
|
||||||
case IVL_LPM_MUX:
|
case IVL_LPM_MUX:
|
||||||
return net->u_.mux.size;
|
return net->u_.mux.size;
|
||||||
|
case IVL_LPM_UFUNC:
|
||||||
|
return net->u_.ufunc.ports - 1;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1458,6 +1495,9 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: t-dll-api.cc,v $
|
* $Log: t-dll-api.cc,v $
|
||||||
|
* Revision 1.77 2002/03/17 19:30:47 steve
|
||||||
|
* Add API to support user defined function.
|
||||||
|
*
|
||||||
* Revision 1.76 2002/03/09 02:10:22 steve
|
* Revision 1.76 2002/03/09 02:10:22 steve
|
||||||
* Add the NetUserFunc netlist node.
|
* Add the NetUserFunc netlist node.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue