2000-09-18 03:24:32 +02:00
|
|
|
#ifndef __t_dll_H
|
|
|
|
|
#define __t_dll_H
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2000 Stephen Williams (steve@icarus.com)
|
|
|
|
|
*
|
|
|
|
|
* This source code is free software; you can redistribute it
|
|
|
|
|
* and/or modify it in source code form under the terms of the GNU
|
|
|
|
|
* General Public License as published by the Free Software
|
|
|
|
|
* Foundation; either version 2 of the License, or (at your option)
|
|
|
|
|
* any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
|
|
|
*/
|
|
|
|
|
#if !defined(WINNT) && !defined(macintosh)
|
2000-10-21 18:49:45 +02:00
|
|
|
#ident "$Id: t-dll.h,v 1.15 2000/10/21 16:49:45 steve Exp $"
|
2000-09-18 03:24:32 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
# include "target.h"
|
|
|
|
|
# include "ivl_target.h"
|
|
|
|
|
|
2000-09-30 04:18:15 +02:00
|
|
|
struct ivl_design_s {
|
2000-10-08 06:01:54 +02:00
|
|
|
|
2000-09-30 04:18:15 +02:00
|
|
|
ivl_scope_t root_;
|
2000-10-08 06:01:54 +02:00
|
|
|
|
|
|
|
|
ivl_process_t threads_;
|
|
|
|
|
|
2000-09-30 04:18:15 +02:00
|
|
|
const Design*self;
|
|
|
|
|
};
|
|
|
|
|
|
2000-09-18 03:24:32 +02:00
|
|
|
/*
|
|
|
|
|
* 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
|
|
|
|
|
* locate and link in the desired DLL, then start calling methods. The
|
|
|
|
|
* DLL will call me back to get information out of the netlist in
|
|
|
|
|
* particular.
|
|
|
|
|
*/
|
2000-09-23 07:15:07 +02:00
|
|
|
struct dll_target : public target_t, public expr_scan_t {
|
2000-09-18 03:24:32 +02:00
|
|
|
|
|
|
|
|
bool start_design(const Design*);
|
|
|
|
|
void end_design(const Design*);
|
|
|
|
|
|
|
|
|
|
bool bufz(const NetBUFZ*);
|
|
|
|
|
void event(const NetEvent*);
|
|
|
|
|
void logic(const NetLogic*);
|
2000-10-21 18:49:45 +02:00
|
|
|
void net_assign(const NetAssign_*);
|
2000-09-18 03:24:32 +02:00
|
|
|
bool net_const(const NetConst*);
|
|
|
|
|
void net_probe(const NetEvProbe*);
|
|
|
|
|
|
|
|
|
|
bool process(const NetProcTop*);
|
|
|
|
|
void scope(const NetScope*);
|
|
|
|
|
void signal(const NetNet*);
|
|
|
|
|
|
|
|
|
|
void*dll_;
|
|
|
|
|
string dll_path_;
|
|
|
|
|
|
2000-09-30 04:18:15 +02:00
|
|
|
ivl_design_s des_;
|
2000-09-18 03:24:32 +02:00
|
|
|
|
2000-10-21 18:49:45 +02:00
|
|
|
target_design_f target_;
|
2000-09-18 03:24:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/* These methods and members are used for forming the
|
|
|
|
|
statements of a thread. */
|
|
|
|
|
struct ivl_statement_s*stmt_cur_;
|
|
|
|
|
void proc_assign(const NetAssign*);
|
|
|
|
|
bool proc_block(const NetBlock*);
|
|
|
|
|
void proc_condit(const NetCondit*);
|
|
|
|
|
bool proc_delay(const NetPDelay*);
|
2000-09-19 06:15:27 +02:00
|
|
|
void proc_stask(const NetSTask*);
|
2000-09-26 02:30:07 +02:00
|
|
|
bool proc_trigger(const NetEvTrig*);
|
2000-09-18 03:24:32 +02:00
|
|
|
bool proc_wait(const NetEvWait*);
|
|
|
|
|
void proc_while(const NetWhile*);
|
|
|
|
|
|
2000-09-23 07:15:07 +02:00
|
|
|
struct ivl_expr_s*expr_;
|
2000-09-30 04:18:15 +02:00
|
|
|
void expr_binary(const NetEBinary*);
|
2000-09-24 04:21:53 +02:00
|
|
|
void expr_const(const NetEConst*);
|
2000-10-05 07:03:01 +02:00
|
|
|
void expr_sfunc(const NetESFunc*);
|
2000-09-24 04:21:53 +02:00
|
|
|
void expr_signal(const NetESignal*);
|
2000-09-23 07:15:07 +02:00
|
|
|
};
|
2000-09-18 03:24:32 +02:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* These are various private declarations used by the t-dll target.
|
|
|
|
|
*/
|
|
|
|
|
|
2000-09-24 04:21:53 +02:00
|
|
|
/*
|
|
|
|
|
* The ivl_expr_t is an opaque reference to one of these
|
|
|
|
|
* structures. This structure holds all the information we need about
|
|
|
|
|
* an expression node, including its type, the expression width, and
|
|
|
|
|
* type specific properties.
|
|
|
|
|
*/
|
2000-09-23 07:15:07 +02:00
|
|
|
struct ivl_expr_s {
|
|
|
|
|
ivl_expr_type_t type_;
|
2000-09-26 02:30:07 +02:00
|
|
|
|
|
|
|
|
unsigned width_ :24;
|
|
|
|
|
unsigned signed_ : 1;
|
2000-09-23 07:15:07 +02:00
|
|
|
|
|
|
|
|
union {
|
2000-09-30 04:18:15 +02:00
|
|
|
struct {
|
|
|
|
|
char op_;
|
|
|
|
|
ivl_expr_t lef_;
|
|
|
|
|
ivl_expr_t rig_;
|
|
|
|
|
} binary_;
|
|
|
|
|
|
2000-09-26 02:30:07 +02:00
|
|
|
struct {
|
|
|
|
|
char*bits_;
|
|
|
|
|
} number_;
|
|
|
|
|
|
2000-10-05 07:03:01 +02:00
|
|
|
struct {
|
|
|
|
|
char*name_;
|
|
|
|
|
} sfunc_;
|
|
|
|
|
|
2000-09-23 07:15:07 +02:00
|
|
|
struct {
|
|
|
|
|
char*value_;
|
|
|
|
|
} string_;
|
2000-09-24 04:21:53 +02:00
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
char*name_;
|
|
|
|
|
ivl_expr_t msb_;
|
|
|
|
|
ivl_expr_t lsb_;
|
|
|
|
|
} subsig_;
|
2000-09-23 07:15:07 +02:00
|
|
|
} u_;
|
|
|
|
|
};
|
2000-09-18 03:24:32 +02:00
|
|
|
|
2000-10-18 22:04:39 +02:00
|
|
|
/*
|
|
|
|
|
* This object contains references to ivl_nexus_t objects that in turn
|
|
|
|
|
* are reg nets. This is used by the assignment to represent the
|
|
|
|
|
* l-value expressions.
|
|
|
|
|
*/
|
|
|
|
|
struct ivl_lval_s {
|
|
|
|
|
unsigned width_ :24;
|
|
|
|
|
ivl_expr_t mux;
|
|
|
|
|
union {
|
|
|
|
|
ivl_nexus_t*pins_;
|
|
|
|
|
ivl_nexus_t pin_;
|
|
|
|
|
} n;
|
|
|
|
|
};
|
|
|
|
|
|
2000-10-07 01:46:50 +02:00
|
|
|
/*
|
|
|
|
|
* This object represents a vector constant, possibly signed, in a
|
|
|
|
|
* structural context.
|
|
|
|
|
*/
|
2000-09-18 03:24:32 +02:00
|
|
|
struct ivl_net_const_s {
|
2000-10-05 07:03:01 +02:00
|
|
|
unsigned width_ :24;
|
|
|
|
|
unsigned signed_ : 1;
|
2000-10-07 01:46:50 +02:00
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
char bit_[sizeof(char*)];
|
|
|
|
|
char *bits_;
|
|
|
|
|
} b;
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
ivl_nexus_t pin_;
|
|
|
|
|
ivl_nexus_t*pins_;
|
|
|
|
|
} n;
|
2000-09-18 03:24:32 +02:00
|
|
|
};
|
|
|
|
|
|
2000-10-07 01:46:50 +02:00
|
|
|
/*
|
|
|
|
|
* Logic gates (just about everything that has a single output) are
|
|
|
|
|
* represented structurally by instances of this object.
|
|
|
|
|
*/
|
2000-09-18 03:24:32 +02:00
|
|
|
struct ivl_net_logic_s {
|
2000-10-07 01:46:50 +02:00
|
|
|
ivl_logic_t type_;
|
2000-10-15 06:46:23 +02:00
|
|
|
|
|
|
|
|
char* name_;
|
|
|
|
|
ivl_scope_t scope_;
|
|
|
|
|
|
2000-10-07 01:46:50 +02:00
|
|
|
unsigned npins_;
|
|
|
|
|
ivl_nexus_t*pins_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2000-10-08 06:01:54 +02:00
|
|
|
/*
|
|
|
|
|
* The ivl_nexus_t is a single-bit link of some number of pins of
|
|
|
|
|
* devices. the __nexus_ptr structure is a helper that actually does
|
|
|
|
|
* the pointing.
|
|
|
|
|
*/
|
2000-10-15 06:46:23 +02:00
|
|
|
struct ivl_nexus_ptr_s {
|
2000-10-08 06:01:54 +02:00
|
|
|
unsigned pin_ :24;
|
|
|
|
|
unsigned type_ : 8;
|
|
|
|
|
union {
|
|
|
|
|
ivl_signal_t sig; /* type 0 */
|
|
|
|
|
ivl_net_logic_t log; /* type 1 */
|
2000-10-13 05:39:27 +02:00
|
|
|
ivl_net_const_t con; /* type 2 */
|
2000-10-08 06:01:54 +02:00
|
|
|
} l;
|
|
|
|
|
};
|
|
|
|
|
# define __NEXUS_PTR_SIG 0
|
|
|
|
|
# define __NEXUS_PTR_LOG 1
|
2000-10-13 05:39:27 +02:00
|
|
|
# define __NEXUS_PTR_CON 2
|
2000-10-08 06:01:54 +02:00
|
|
|
|
2000-10-07 01:46:50 +02:00
|
|
|
struct ivl_nexus_s {
|
2000-10-08 06:01:54 +02:00
|
|
|
unsigned nptr_;
|
2000-10-15 06:46:23 +02:00
|
|
|
struct ivl_nexus_ptr_s*ptrs_;
|
2000-10-08 06:01:54 +02:00
|
|
|
char*name_;
|
2000-09-18 03:24:32 +02:00
|
|
|
};
|
|
|
|
|
|
2000-10-07 01:46:50 +02:00
|
|
|
/*
|
|
|
|
|
* All we know about a process it its type (initial or always) and the
|
|
|
|
|
* single statement that is it.
|
|
|
|
|
*/
|
2000-09-18 03:24:32 +02:00
|
|
|
struct ivl_process_s {
|
|
|
|
|
ivl_process_type_t type_;
|
|
|
|
|
ivl_statement_t stmt_;
|
2000-10-08 06:01:54 +02:00
|
|
|
|
|
|
|
|
ivl_process_t next_;
|
2000-09-18 03:24:32 +02:00
|
|
|
};
|
|
|
|
|
|
2000-10-07 01:46:50 +02:00
|
|
|
/*
|
|
|
|
|
* Scopes are kept in a tree. Each scope points to its first child,
|
|
|
|
|
* and also to any siblings. Thus a parent can scan all its children
|
|
|
|
|
* by following its child pointer then following sibling pointers from
|
|
|
|
|
* there.
|
|
|
|
|
*/
|
2000-09-30 04:18:15 +02:00
|
|
|
struct ivl_scope_s {
|
|
|
|
|
ivl_scope_t child_, sibling_;
|
|
|
|
|
|
2000-10-08 06:01:54 +02:00
|
|
|
char* name_;
|
2000-10-07 01:46:50 +02:00
|
|
|
|
|
|
|
|
unsigned nsigs_;
|
|
|
|
|
ivl_signal_t*sigs_;
|
2000-10-07 21:45:42 +02:00
|
|
|
|
|
|
|
|
unsigned nlog_;
|
|
|
|
|
ivl_net_logic_t*log_;
|
2000-10-07 01:46:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* A signal is a think like a wire, a reg, or whatever. It has a type,
|
|
|
|
|
* and if it is a port is also has a directory. Signals are collected
|
|
|
|
|
* into scopes (which also point back to me) and have pins that
|
|
|
|
|
* connect to the rest of the netlist.
|
|
|
|
|
*/
|
|
|
|
|
struct ivl_signal_s {
|
|
|
|
|
ivl_signal_type_t type_;
|
|
|
|
|
ivl_signal_port_t port_;
|
|
|
|
|
|
|
|
|
|
unsigned width_ :24;
|
|
|
|
|
unsigned signed_ : 1;
|
|
|
|
|
|
2000-10-08 06:01:54 +02:00
|
|
|
char*name_;
|
2000-10-07 01:46:50 +02:00
|
|
|
ivl_scope_t scope_;
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
ivl_nexus_t pin_;
|
|
|
|
|
ivl_nexus_t*pins_;
|
|
|
|
|
} n;
|
2000-09-30 04:18:15 +02:00
|
|
|
};
|
|
|
|
|
|
2000-09-18 03:24:32 +02:00
|
|
|
/*
|
|
|
|
|
* The ivl_statement_t represents any statement. The type of statement
|
|
|
|
|
* is defined by the ivl_statement_type_t enumeration. Given the type,
|
|
|
|
|
* certain information about the statement may be available.
|
|
|
|
|
*/
|
|
|
|
|
struct ivl_statement_s {
|
|
|
|
|
enum ivl_statement_type_e type_;
|
|
|
|
|
union {
|
2000-10-07 01:46:50 +02:00
|
|
|
struct { /* IVL_ST_ASSIGN */
|
2000-10-18 22:04:39 +02:00
|
|
|
unsigned lvals_;
|
|
|
|
|
struct ivl_lval_s*lval_;
|
2000-10-07 01:46:50 +02:00
|
|
|
ivl_expr_t rval_;
|
|
|
|
|
} assign_;
|
|
|
|
|
|
2000-09-18 03:24:32 +02:00
|
|
|
struct { /* IVL_ST_BLOCK */
|
|
|
|
|
struct ivl_statement_s*stmt_;
|
|
|
|
|
unsigned nstmt_;
|
|
|
|
|
} block_;
|
|
|
|
|
|
|
|
|
|
struct { /* IVL_ST_CONDIT */
|
2000-09-30 04:18:15 +02:00
|
|
|
/* This is the condition expression */
|
|
|
|
|
ivl_expr_t cond_;
|
|
|
|
|
/* This is two statements, the true and false. */
|
2000-09-18 03:24:32 +02:00
|
|
|
struct ivl_statement_s*stmt_;
|
|
|
|
|
} condit_;
|
|
|
|
|
|
|
|
|
|
struct { /* IVL_ST_DELAY */
|
|
|
|
|
unsigned long delay_;
|
|
|
|
|
ivl_statement_t stmt_;
|
|
|
|
|
} delay_;
|
|
|
|
|
|
|
|
|
|
struct { /* IVL_ST_DELAYX */
|
|
|
|
|
int expr_; /* XXXX */
|
|
|
|
|
ivl_statement_t stmt_;
|
|
|
|
|
} delayx_;
|
|
|
|
|
|
2000-09-22 05:58:30 +02:00
|
|
|
struct { /* IVL_ST_STASK */
|
|
|
|
|
char* name_;
|
2000-09-23 07:15:07 +02:00
|
|
|
unsigned nparm_;
|
|
|
|
|
ivl_expr_t*parms_;
|
2000-09-22 05:58:30 +02:00
|
|
|
} stask_;
|
|
|
|
|
|
2000-09-26 02:30:07 +02:00
|
|
|
struct { /* IVL_ST_TRIGGER */
|
|
|
|
|
ivl_net_event_t event_;
|
|
|
|
|
} trig_;
|
|
|
|
|
|
2000-09-18 03:24:32 +02:00
|
|
|
struct { /* IVL_ST_WAIT */
|
|
|
|
|
int cond_; /* XXXX */
|
|
|
|
|
ivl_statement_t stmt_;
|
|
|
|
|
} wait_;
|
|
|
|
|
|
|
|
|
|
struct { /* IVL_ST_WHILE */
|
|
|
|
|
int cond_; /* XXXX */
|
|
|
|
|
ivl_statement_t stmt_;
|
|
|
|
|
} while_;
|
|
|
|
|
} u_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* $Log: t-dll.h,v $
|
2000-10-21 18:49:45 +02:00
|
|
|
* Revision 1.15 2000/10/21 16:49:45 steve
|
|
|
|
|
* Reduce the target entry points to the target_design.
|
|
|
|
|
*
|
2000-10-18 22:04:39 +02:00
|
|
|
* Revision 1.14 2000/10/18 20:04:39 steve
|
|
|
|
|
* Add ivl_lval_t and support for assignment l-values.
|
|
|
|
|
*
|
2000-10-15 06:46:23 +02:00
|
|
|
* Revision 1.13 2000/10/15 04:46:23 steve
|
|
|
|
|
* Scopes and processes are accessible randomly from
|
|
|
|
|
* the design, and signals and logic are accessible
|
|
|
|
|
* from scopes. Remove the target calls that are no
|
|
|
|
|
* longer needed.
|
|
|
|
|
*
|
|
|
|
|
* Add the ivl_nexus_ptr_t and the means to get at
|
|
|
|
|
* them from nexus objects.
|
|
|
|
|
*
|
|
|
|
|
* Give names to methods that manipulate the ivl_design_t
|
|
|
|
|
* type more consistent names.
|
|
|
|
|
*
|
2000-10-13 05:39:27 +02:00
|
|
|
* Revision 1.12 2000/10/13 03:39:27 steve
|
|
|
|
|
* Include constants in nexus targets.
|
|
|
|
|
*
|
2000-10-08 06:01:54 +02:00
|
|
|
* Revision 1.11 2000/10/08 04:01:55 steve
|
|
|
|
|
* Back pointers in the nexus objects into the devices
|
|
|
|
|
* that point to it.
|
|
|
|
|
*
|
|
|
|
|
* Collect threads into a list in the design.
|
|
|
|
|
*
|
2000-10-07 21:45:42 +02:00
|
|
|
* Revision 1.10 2000/10/07 19:45:43 steve
|
|
|
|
|
* Put logic devices into scopes.
|
|
|
|
|
*
|
2000-10-07 01:46:50 +02:00
|
|
|
* Revision 1.9 2000/10/06 23:46:51 steve
|
|
|
|
|
* ivl_target updates, including more complete
|
|
|
|
|
* handling of ivl_nexus_t objects. Much reduced
|
|
|
|
|
* dependencies on pointers to netlist objects.
|
|
|
|
|
*
|
2000-10-05 07:03:01 +02:00
|
|
|
* Revision 1.8 2000/10/05 05:03:01 steve
|
|
|
|
|
* xor and constant devices.
|
|
|
|
|
*
|
2000-09-30 04:18:15 +02:00
|
|
|
* Revision 1.7 2000/09/30 02:18:15 steve
|
|
|
|
|
* ivl_expr_t support for binary operators,
|
|
|
|
|
* Create a proper ivl_scope_t object.
|
|
|
|
|
*
|
2000-09-26 02:30:07 +02:00
|
|
|
* Revision 1.6 2000/09/26 00:30:07 steve
|
|
|
|
|
* Add EX_NUMBER and ST_TRIGGER to dll-api.
|
|
|
|
|
*
|
2000-09-24 04:21:53 +02:00
|
|
|
* Revision 1.5 2000/09/24 02:21:53 steve
|
|
|
|
|
* Add support for signal expressions.
|
|
|
|
|
*
|
2000-09-23 07:15:07 +02:00
|
|
|
* Revision 1.4 2000/09/23 05:15:07 steve
|
|
|
|
|
* Add enough tgt-verilog code to support hello world.
|
|
|
|
|
*
|
2000-09-22 05:58:30 +02:00
|
|
|
* Revision 1.3 2000/09/22 03:58:30 steve
|
|
|
|
|
* Access to the name of a system task call.
|
|
|
|
|
*
|
2000-09-19 06:15:27 +02:00
|
|
|
* Revision 1.2 2000/09/19 04:15:27 steve
|
|
|
|
|
* Introduce the means to get statement types.
|
|
|
|
|
*
|
2000-09-18 03:24:32 +02:00
|
|
|
* Revision 1.1 2000/09/18 01:24:32 steve
|
|
|
|
|
* Get the structure for ivl_statement_t worked out.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
#endif
|