Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add ivl_target support for logic gates, and

 make the interface more accessible.
  • Loading branch information...
commit d0fc6d515d8c3e8f14561f0ebb593324e3ad787a 1 parent 3cb666d
steve authored
View
10 Makefile.in
@@ -18,12 +18,12 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
-#ident "$Id: Makefile.in,v 1.62 2000/08/12 16:34:37 steve Exp $"
+#ident "$Id: Makefile.in,v 1.63 2000/08/20 04:13:56 steve Exp $"
#
#
SHELL = /bin/sh
-VERSION = 0.3PRE
+VERSION = 0.3
prefix = @prefix@
exec_prefix = @exec_prefix@
@@ -135,7 +135,7 @@ lexor_keyword.cc: lexor_keyword.gperf
gperf -o -i 7 -C -k 1-3,$$ -L ANSI-C -H keyword_hash -N check_identifier -t lexor_keyword.gperf > lexor_keyword.cc || (rm -f lexor_keyword.cc ; false)
-install: all installdirs $(bindir)/iverilog $(libdir)/ivl/ivl $(mandir)/man1/iverilog.1
+install: all installdirs $(bindir)/iverilog $(libdir)/ivl/ivl $(includedir)/ivl_target.h $(mandir)/man1/iverilog.1
cd vpi ; $(MAKE) install
cd vvm ; $(MAKE) install
cd ivlpp ; $(MAKE) install
@@ -148,6 +148,9 @@ $(libdir)/ivl/ivl: ./ivl
$(INSTALL_PROGRAM) ./ivl $(libdir)/ivl/ivl
$(STRIP) $(libdir)/ivl/ivl
+$(includedir)/ivl_target.h: $(srcdir)/ivl_target.h
+ $(INSTALL_DATA) $(srcdir)/ivl_target.h $(includedir)/ivl_target.h
+
$(mandir)/man1/iverilog.1: $(srcdir)/iverilog.man
$(INSTALL_DATA) $(srcdir)/iverilog.man $(mandir)/man1/iverilog.1
@@ -159,6 +162,7 @@ uninstall:
rm -f $(bindir)/verilog
rm -f $(bindir)/gverilog
rm -f $(bindir)/iverilog
+ rm -r $(includedir)/ivl_target.h
rm -f $(mandir)/man1/verilog.1
rm -f $(mandir)/man1/iverilog.1
cd vpi ; $(MAKE) uninstall
View
25 compiler.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: compiler.h,v 1.3 2000/03/17 21:50:25 steve Exp $"
+#ident "$Id: compiler.h,v 1.4 2000/08/20 04:13:56 steve Exp $"
#endif
/*
@@ -34,6 +34,25 @@
#endif
/*
+ * When doing dynamic linking, we need a uniform way to identify the
+ * symbol. Some compilers put leading _, some trailing _. The
+ * configure script figures out which is the local convention and
+ * defines NEED_LU and NEED_TU as required.
+ */
+#ifdef NEED_LU
+#define LU "_"
+#else
+#define LU ""
+#endif
+
+#ifdef NEED_TU
+#define TU "_"
+#else
+#define TU ""
+#endif
+
+
+/*
* These are flags to enable various sorts of warnings. By default all
* the warnings are of, the -W<list> parameter arranges for each to be
* enabled.
@@ -44,6 +63,10 @@ extern bool warn_implicit;
/*
* $Log: compiler.h,v $
+ * Revision 1.4 2000/08/20 04:13:56 steve
+ * Add ivl_target support for logic gates, and
+ * make the interface more accessible.
+ *
* Revision 1.3 2000/03/17 21:50:25 steve
* Switch to control warnings.
*
View
42 ivl_target.h
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: ivl_target.h,v 1.3 2000/08/19 18:12:42 steve Exp $"
+#ident "$Id: ivl_target.h,v 1.4 2000/08/20 04:13:57 steve Exp $"
#endif
#ifdef __cplusplus
@@ -38,11 +38,25 @@ _BEGIN_DECL
* module. The main program can load these modules and access the
* functions within the loaded module to implement the backend
* behavior.
+ *
+ * The interface is divided into two parts: the entry points within
+ * the core that are called by the module, and then entry points in
+ * the module that are called by the core. It is the latter that
+ * causes the module to be invoked in the first place, but most of the
+ * interesting information about the design is accessed through the
+ * various access functions that the modules calls into the core.
*/
-/* This is the opaque type of an entire design. This type is used when
- requesting an operation that affects the entire netlist. */
+/*
+ * In order to grab onto data in the design, the core passes cookies
+ * to the various functions of the module. These cookies can in turn
+ * be passed to access functions in the core to get more detailed
+ * information.
+ *
+ * The following typedefs list the various cookies that may be passed
+ * around.
+ */
typedef struct ivl_design_s *ivl_design_t;
typedef struct ivl_net_bufz_s *ivl_net_bufz_t;
@@ -67,7 +81,23 @@ typedef struct ivl_scope_s *ivl_scope_t;
extern const char* ivl_get_flag(ivl_design_t, const char*key);
- /* TARGET MODULE ENTRY POINTS */
+/* Given an ivl_net_logic_t cookie, get the type of the gate. */
+typedef enum ivl_logic_e { IVL_AND, IVL_BUF, IVL_BUFIF0, IVL_BUFIF1,
+ IVL_NAND, IVL_NOR, IVL_NOT, IVL_NOTIF0,
+ IVL_NOTIF1, IVL_OR, IVL_XNOR, IVL_XOR } ivl_logic_t;
+
+extern ivl_logic_t ivl_get_logic_type(ivl_net_logic_t net);
+
+
+/* TARGET MODULE ENTRY POINTS
+ *
+ * The module entry points generally take a cookie and possibly a name
+ * as parameters. They use the cookie to get the required detailed
+ * information, and they do their job. The functions return an integer
+ * value which usually should be 0 for success, or less then 0 for any
+ * errors. How the error is interpreted depends on the function
+ * returning the error.
+ */
/* target_start_design (required)
@@ -150,6 +180,10 @@ _END_DECL
/*
* $Log: ivl_target.h,v $
+ * Revision 1.4 2000/08/20 04:13:57 steve
+ * Add ivl_target support for logic gates, and
+ * make the interface more accessible.
+ *
* Revision 1.3 2000/08/19 18:12:42 steve
* Add target calls for scope, events and logic.
*
View
42 t-dll.cc
@@ -17,11 +17,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: t-dll.cc,v 1.3 2000/08/19 18:12:42 steve Exp $"
+#ident "$Id: t-dll.cc,v 1.4 2000/08/20 04:13:57 steve Exp $"
#endif
# include "target.h"
# include "ivl_target.h"
+# include "compiler.h"
# include <dlfcn.h>
struct ivl_design_s {
@@ -32,6 +33,10 @@ struct ivl_net_const_s {
const NetConst*con_;
};
+struct ivl_net_logic_s {
+ const NetLogic*dev_;
+};
+
struct ivl_process_s {
const NetProcTop*top_;
};
@@ -95,13 +100,13 @@ bool dll_target::start_design(const Design*des)
start_design_ = (start_design_f)dlsym(dll_, "target_start_design");
end_design_ = (end_design_f) dlsym(dll_, "target_end_design");
- net_bufz_ = (net_bufz_f) dlsym(dll_, "target_net_bufz");
- net_const_ = (net_const_f) dlsym(dll_, "target_net_const");
- net_event_ = (net_event_f) dlsym(dll_, "target_net_event");
- net_logic_ = (net_logic_f) dlsym(dll_, "target_net_logic");
- net_probe_ = (net_probe_f) dlsym(dll_, "target_net_probe");
- process_ = (process_f) dlsym(dll_, "target_process");
- scope_ = (scope_f) dlsym(dll_, "target_scope");
+ net_bufz_ = (net_bufz_f) dlsym(dll_, LU "target_net_bufz" TU);
+ net_const_ = (net_const_f) dlsym(dll_, LU "target_net_const" TU);
+ net_event_ = (net_event_f) dlsym(dll_, LU "target_net_event" TU);
+ net_logic_ = (net_logic_f) dlsym(dll_, LU "target_net_logic" TU);
+ net_probe_ = (net_probe_f) dlsym(dll_, LU "target_net_probe" TU);
+ process_ = (process_f) dlsym(dll_, LU "target_process" TU);
+ scope_ = (scope_f) dlsym(dll_, LU "target_scope" TU);
(start_design_)(&ivl_des);
return true;
@@ -143,8 +148,11 @@ void dll_target::event(const NetEvent*net)
void dll_target::logic(const NetLogic*net)
{
+ struct ivl_net_logic_s obj;
+ obj.dev_ = net;
+
if (net_logic_) {
- (net_logic_)(net->name().c_str(), 0);
+ (net_logic_)(net->name().c_str(), &obj);
} else {
cerr << dll_path_ << ": internal error: target DLL lacks "
@@ -227,8 +235,24 @@ extern "C" const char*ivl_get_flag(ivl_design_t des, const char*key)
return des->des_->get_flag(key).c_str();
}
+extern "C" ivl_logic_t ivl_get_logic_type(ivl_net_logic_t net)
+{
+ switch (net->dev_->type()) {
+ case NetLogic::AND:
+ return IVL_AND;
+ case NetLogic::OR:
+ return IVL_OR;
+ }
+ assert(0);
+ return IVL_AND;
+}
+
/*
* $Log: t-dll.cc,v $
+ * Revision 1.4 2000/08/20 04:13:57 steve
+ * Add ivl_target support for logic gates, and
+ * make the interface more accessible.
+ *
* Revision 1.3 2000/08/19 18:12:42 steve
* Add target calls for scope, events and logic.
*
View
4 tgt-stub/Makefile.in
@@ -16,7 +16,7 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
-#ident "$Id: Makefile.in,v 1.1 2000/08/12 16:34:37 steve Exp $"
+#ident "$Id: Makefile.in,v 1.2 2000/08/20 04:13:57 steve Exp $"
#
#
SHELL = /bin/sh
@@ -47,7 +47,7 @@ all: stub.tgt
%.o dep/%.d: %.c
@[ -d dep ] || mkdir dep
- $(CC) -Wall $(CPPFLAGS) -I$(srcdir) -MD -c $< -o $*.o
+ $(CC) -Wall $(CPPFLAGS) -I$(srcdir)/.. -MD -c $< -o $*.o
mv $*.d dep
O = stub.o
View
26 tgt-stub/stub.c
@@ -17,9 +17,16 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
-#ident "$Id: stub.c,v 1.3 2000/08/19 18:12:42 steve Exp $"
+#ident "$Id: stub.c,v 1.4 2000/08/20 04:13:57 steve Exp $"
#endif
+/*
+ * This is a sample target module. All this does is write to the
+ * output file some information about each object handle when each of
+ * the various object functions is called. This can be used to
+ * understand the behavior of the core as it uses a target module.
+ */
+
# include <ivl_target.h>
# include <stdio.h>
@@ -68,7 +75,18 @@ int target_net_event(const char*name, ivl_net_event_t net)
int target_net_logic(const char*name, ivl_net_logic_t net)
{
- fprintf(out, "STUB: %s: logic gate\n", name);
+ switch (ivl_get_logic_type(net)) {
+ case IVL_AND:
+ fprintf(out, "STUB: %s: AND gate\n", name);
+ break;
+ case IVL_OR:
+ fprintf(out, "STUB: %s: OR gate\n", name);
+ break;
+ default:
+ fprintf(out, "STUB: %s: unsupported gate\n", name);
+ return -1;
+ }
+
return 0;
}
@@ -85,6 +103,10 @@ int target_process(ivl_process_t net)
/*
* $Log: stub.c,v $
+ * Revision 1.4 2000/08/20 04:13:57 steve
+ * Add ivl_target support for logic gates, and
+ * make the interface more accessible.
+ *
* Revision 1.3 2000/08/19 18:12:42 steve
* Add target calls for scope, events and logic.
*
View
9 verilog.spec
@@ -1,10 +1,10 @@
Summary: Icarus Verilog
Name: verilog
-Version: 0.3
-Release: 2
+Version: 0.4
+Release: x
Copyright: GPL
Group: Applications/Engineering
-Source: ftp://icarus.com/pub/eda/verilog/v0.3/verilog-0.3.tar.gz
+Source: ftp://icarus.com/pub/eda/verilog/v0.4/verilog-0.4.tar.gz
URL: http://www.icarus.com/eda/verilog/index.html
Packager: Stephen Williams <steve@icarus.com>
@@ -20,7 +20,7 @@ engineering formats, including a C++ simulation. It strives to be
true to the IEEE-1364 standard.
%prep
-%setup -n verilog-0.3
+%setup -n verilog-0.4
%build
./configure --prefix=/usr
@@ -39,6 +39,7 @@ make prefix=$RPM_BUILD_ROOT/usr install
%attr(-,root,root) /usr/lib/ivl/ivlpp
%attr(-,root,root) /usr/lib/ivl/system.vpi
%attr(-,root,root) /usr/lib/libvvm.a
+%attr(-,root,root) /usr/include/ivl_target.h
%attr(-,root,root) /usr/include/vpi_priv.h
%attr(-,root,root) /usr/include/vpi_user.h
%attr(-,root,root) /usr/include/vvm.h
Please sign in to comment.
Something went wrong with that request. Please try again.