Add target calls for scope, events and logic.
This commit is contained in:
parent
a59bbdeb4f
commit
3cb666dd2f
62
ivl_target.h
62
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.2 2000/08/14 04:39:56 steve Exp $"
|
||||
#ident "$Id: ivl_target.h,v 1.3 2000/08/19 18:12:42 steve Exp $"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
@ -47,11 +47,23 @@ typedef struct ivl_design_s *ivl_design_t;
|
|||
|
||||
typedef struct ivl_net_bufz_s *ivl_net_bufz_t;
|
||||
typedef struct ivl_net_const_s*ivl_net_const_t;
|
||||
typedef struct ivl_net_event_s*ivl_net_event_t;
|
||||
typedef struct ivl_net_logic_s*ivl_net_logic_t;
|
||||
typedef struct ivl_net_probe_s*ivl_net_probe_t;
|
||||
typedef struct ivl_process_s *ivl_process_t;
|
||||
typedef struct ivl_scope_s *ivl_scope_t;
|
||||
|
||||
|
||||
/* This function returns the string value of the named flag. The key
|
||||
is used to select the flag. If the key does not exist or the flag
|
||||
does not have a value, this function returns 0. */
|
||||
does not have a value, this function returns 0.
|
||||
|
||||
Flags come from the "-fkey=value" options to the iverilog command
|
||||
line.
|
||||
|
||||
The key "-o" is special and is the argument to the -o flag of the
|
||||
iverilog command. This is generally how the target learns the name
|
||||
of the output file. */
|
||||
extern const char* ivl_get_flag(ivl_design_t, const char*key);
|
||||
|
||||
|
||||
|
|
@ -79,16 +91,40 @@ typedef void (*end_design_f)(ivl_design_t des);
|
|||
in the netlist. */
|
||||
typedef int (*net_bufz_f)(const char*name, ivl_net_bufz_t net);
|
||||
|
||||
|
||||
/* target_net_const
|
||||
|
||||
The "target_net_const" function is called for structural constant
|
||||
values that appear in the design. the DLL is expected to return 0
|
||||
for success, or <0 for some sort of error. If this function is not
|
||||
implemented by the DLL, ivl will generate an error when a constant
|
||||
is detected in the design. */
|
||||
values that appear in the design. */
|
||||
typedef int (*net_const_f)(const char*name, ivl_net_const_t net);
|
||||
|
||||
|
||||
/* target_net_event
|
||||
|
||||
Verilog code such as @event and @(posedge foo) create event
|
||||
objects. These named objects can be triggered by structural probes
|
||||
or behavioral triggers. The target_net_event function is called
|
||||
once for each event in the netlist. The event function is
|
||||
guaranteed to be called before probe or trigger functions. */
|
||||
typedef int (*net_event_f)(const char*name, ivl_net_event_t net);
|
||||
|
||||
|
||||
/* target_net_logic
|
||||
|
||||
This function is called for each logic gate in the design. The name
|
||||
parameter is the name of the gate in the design. If the gate is
|
||||
part of an array of gates, the name includes its index. */
|
||||
typedef int (*net_logic_f)(const char*name, ivl_net_logic_t net);
|
||||
|
||||
|
||||
/* target_net_probe
|
||||
|
||||
This is the probe, or structural trigger, of an event. The
|
||||
net_event_f is guaranteed to be called for the associated event
|
||||
before this probe is called. */
|
||||
typedef int (*net_probe_f)(const char*name, ivl_net_probe_t net);
|
||||
|
||||
|
||||
/* target_process
|
||||
|
||||
The "target_process" function is called for each always and initial
|
||||
|
|
@ -99,10 +135,24 @@ typedef int (*net_const_f)(const char*name, ivl_net_const_t net);
|
|||
process statements, or if I will do that myself. Hmm... */
|
||||
typedef int (*process_f)(ivl_process_t net);
|
||||
|
||||
|
||||
/* target_scope (optional)
|
||||
|
||||
If the "target_scope" function is implemented in the module, it is
|
||||
called to introduce a new scope in the design. If scopes are
|
||||
nested, this method is always called for the containing scope
|
||||
before the contained scope. Also, this is guaranteed to be called
|
||||
before functions for any objects contained in this scope. */
|
||||
typedef void (*scope_f)(ivl_scope_t net);
|
||||
|
||||
|
||||
_END_DECL
|
||||
|
||||
/*
|
||||
* $Log: ivl_target.h,v $
|
||||
* Revision 1.3 2000/08/19 18:12:42 steve
|
||||
* Add target calls for scope, events and logic.
|
||||
*
|
||||
* Revision 1.2 2000/08/14 04:39:56 steve
|
||||
* add th t-dll functions for net_const, net_bufz and processes.
|
||||
*
|
||||
|
|
|
|||
85
t-dll.cc
85
t-dll.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: t-dll.cc,v 1.2 2000/08/14 04:39:57 steve Exp $"
|
||||
#ident "$Id: t-dll.cc,v 1.3 2000/08/19 18:12:42 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "target.h"
|
||||
|
|
@ -36,6 +36,10 @@ struct ivl_process_s {
|
|||
const NetProcTop*top_;
|
||||
};
|
||||
|
||||
struct ivl_scope_s {
|
||||
const NetScope*scope_;
|
||||
};
|
||||
|
||||
/*
|
||||
* The DLL target type loads a named object file to handle the process
|
||||
* of scanning the netlist. When it is time to start the design, I
|
||||
|
|
@ -49,9 +53,13 @@ struct dll_target : public target_t {
|
|||
void end_design(const Design*);
|
||||
|
||||
bool bufz(const NetBUFZ*);
|
||||
void event(const NetEvent*);
|
||||
void logic(const NetLogic*);
|
||||
bool net_const(const NetConst*);
|
||||
void net_probe(const NetEvProbe*);
|
||||
|
||||
bool process(const NetProcTop*);
|
||||
void scope(const NetScope*);
|
||||
|
||||
void*dll_;
|
||||
string dll_path_;
|
||||
|
|
@ -61,10 +69,14 @@ struct dll_target : public target_t {
|
|||
start_design_f start_design_;
|
||||
end_design_f end_design_;
|
||||
|
||||
net_bufz_f net_bufz_;
|
||||
net_const_f net_const_;
|
||||
net_bufz_f net_bufz_;
|
||||
net_const_f net_const_;
|
||||
net_event_f net_event_;
|
||||
net_logic_f net_logic_;
|
||||
net_probe_f net_probe_;
|
||||
|
||||
process_f process_;
|
||||
process_f process_;
|
||||
scope_f scope_;
|
||||
|
||||
} dll_target_obj;
|
||||
|
||||
|
|
@ -82,9 +94,14 @@ 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");
|
||||
process_ = (process_f) dlsym(dll_, "target_process");
|
||||
|
||||
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");
|
||||
|
||||
(start_design_)(&ivl_des);
|
||||
return true;
|
||||
|
|
@ -111,6 +128,32 @@ bool dll_target::bufz(const NetBUFZ*net)
|
|||
return false;
|
||||
}
|
||||
|
||||
void dll_target::event(const NetEvent*net)
|
||||
{
|
||||
if (net_event_) {
|
||||
(net_event_)(net->full_name().c_str(), 0);
|
||||
|
||||
} else {
|
||||
cerr << dll_path_ << ": internal error: target DLL lacks "
|
||||
<< "target_net_event function." << endl;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void dll_target::logic(const NetLogic*net)
|
||||
{
|
||||
if (net_logic_) {
|
||||
(net_logic_)(net->name().c_str(), 0);
|
||||
|
||||
} else {
|
||||
cerr << dll_path_ << ": internal error: target DLL lacks "
|
||||
<< "target_net_logic function." << endl;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool dll_target::net_const(const NetConst*net)
|
||||
{
|
||||
struct ivl_net_const_s obj;
|
||||
|
|
@ -130,6 +173,21 @@ bool dll_target::net_const(const NetConst*net)
|
|||
return false;
|
||||
}
|
||||
|
||||
void dll_target::net_probe(const NetEvProbe*net)
|
||||
{
|
||||
if (net_probe_) {
|
||||
int rc = (net_probe_)(net->name().c_str(), 0);
|
||||
return;
|
||||
|
||||
} else {
|
||||
cerr << dll_path_ << ": internal error: target DLL lacks "
|
||||
<< "target_net_probe function." << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool dll_target::process(const NetProcTop*net)
|
||||
{
|
||||
struct ivl_process_s obj;
|
||||
|
|
@ -149,6 +207,16 @@ bool dll_target::process(const NetProcTop*net)
|
|||
return false;
|
||||
}
|
||||
|
||||
void dll_target::scope(const NetScope*net)
|
||||
{
|
||||
struct ivl_scope_s obj;
|
||||
|
||||
obj.scope_ = net;
|
||||
|
||||
if (scope_)
|
||||
(scope_)(&obj);
|
||||
}
|
||||
|
||||
extern const struct target tgt_dll = { "dll", &dll_target_obj };
|
||||
|
||||
|
||||
|
|
@ -161,6 +229,9 @@ extern "C" const char*ivl_get_flag(ivl_design_t des, const char*key)
|
|||
|
||||
/*
|
||||
* $Log: t-dll.cc,v $
|
||||
* Revision 1.3 2000/08/19 18:12:42 steve
|
||||
* Add target calls for scope, events and logic.
|
||||
*
|
||||
* Revision 1.2 2000/08/14 04:39:57 steve
|
||||
* add th t-dll functions for net_const, net_bufz and processes.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT) && !defined(macintosh)
|
||||
#ident "$Id: stub.c,v 1.2 2000/08/14 04:39:57 steve Exp $"
|
||||
#ident "$Id: stub.c,v 1.3 2000/08/19 18:12:42 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <ivl_target.h>
|
||||
|
|
@ -60,6 +60,23 @@ int target_net_const(const char*name, ivl_net_const_t net)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int target_net_event(const char*name, ivl_net_event_t net)
|
||||
{
|
||||
fprintf(out, "STUB: %s: event\n", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int target_net_logic(const char*name, ivl_net_logic_t net)
|
||||
{
|
||||
fprintf(out, "STUB: %s: logic gate\n", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int target_net_probe(const char*name, ivl_net_probe_t net)
|
||||
{
|
||||
fprintf(out, "STUB: %s: probe\n", name);
|
||||
return 0;
|
||||
}
|
||||
int target_process(ivl_process_t net)
|
||||
{
|
||||
fprintf(out, "STUB: process\n");
|
||||
|
|
@ -68,6 +85,9 @@ int target_process(ivl_process_t net)
|
|||
|
||||
/*
|
||||
* $Log: stub.c,v $
|
||||
* Revision 1.3 2000/08/19 18:12:42 steve
|
||||
* Add target calls for scope, events and logic.
|
||||
*
|
||||
* Revision 1.2 2000/08/14 04:39:57 steve
|
||||
* add th t-dll functions for net_const, net_bufz and processes.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue