2014-07-23 22:39:29 +02:00
|
|
|
#ifndef IVL_t_dll_H
|
|
|
|
|
#define IVL_t_dll_H
|
2000-09-18 03:24:32 +02:00
|
|
|
/*
|
2017-11-20 16:48:35 +01:00
|
|
|
* Copyright (c) 2000-2017 Stephen Williams (steve@icarus.com)
|
2000-09-18 03:24:32 +02:00
|
|
|
*
|
|
|
|
|
* 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
|
2012-08-29 03:41:23 +02:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2000-09-18 03:24:32 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
# include "target.h"
|
|
|
|
|
# include "ivl_target.h"
|
2008-06-02 04:45:12 +02:00
|
|
|
# include "ivl_target_priv.h"
|
2002-08-07 04:36:10 +02:00
|
|
|
# include "StringHeap.h"
|
2003-02-06 17:43:20 +01:00
|
|
|
# include "netlist.h"
|
2008-05-24 05:53:10 +02:00
|
|
|
# include <vector>
|
2009-12-10 22:24:27 +01:00
|
|
|
# include <map>
|
2000-09-18 03:24:32 +02:00
|
|
|
|
2001-05-20 17:09:39 +02:00
|
|
|
#if defined(__MINGW32__)
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
typedef void *ivl_dll_t;
|
|
|
|
|
#elif defined(HAVE_DLFCN_H)
|
2000-12-15 06:45:25 +01:00
|
|
|
# include <dlfcn.h>
|
|
|
|
|
typedef void* ivl_dll_t;
|
|
|
|
|
#elif defined(HAVE_DL_H)
|
|
|
|
|
# include <dl.h>
|
|
|
|
|
typedef shl_t ivl_dll_t;
|
2001-11-04 06:03:21 +01:00
|
|
|
#else
|
|
|
|
|
# error No DLL stub support for this target.
|
2000-12-15 06:45:25 +01:00
|
|
|
#endif
|
|
|
|
|
|
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
|
|
|
|
2008-09-08 06:54:46 +02:00
|
|
|
// This is a special function for loading and testing the
|
|
|
|
|
// version of a loadable target code generator.
|
|
|
|
|
void test_version(const char*target_name);
|
|
|
|
|
|
2000-09-18 03:24:32 +02:00
|
|
|
bool start_design(const Design*);
|
2001-03-27 05:31:06 +02:00
|
|
|
int end_design(const Design*);
|
2000-09-18 03:24:32 +02:00
|
|
|
|
|
|
|
|
bool bufz(const NetBUFZ*);
|
2008-11-10 06:42:12 +01:00
|
|
|
bool branch(const NetBranch*);
|
2012-12-01 21:03:01 +01:00
|
|
|
bool class_type(const NetScope*, netclass_t*);
|
2010-11-21 00:09:32 +01:00
|
|
|
bool enumeration(const NetScope*, netenum_t*);
|
2000-09-18 03:24:32 +02:00
|
|
|
void event(const NetEvent*);
|
|
|
|
|
void logic(const NetLogic*);
|
2008-05-20 06:42:52 +02:00
|
|
|
bool tran(const NetTran*);
|
2005-02-03 05:56:20 +01:00
|
|
|
bool ureduce(const NetUReduce*);
|
2001-06-19 05:01:10 +02:00
|
|
|
void net_case_cmp(const NetCaseCmp*);
|
2001-04-23 01:09:45 +02:00
|
|
|
void udp(const NetUDP*);
|
2008-05-06 07:00:39 +02:00
|
|
|
void lpm_abs(const NetAbs*);
|
2001-06-07 04:12:43 +02:00
|
|
|
void lpm_add_sub(const NetAddSub*);
|
2007-01-16 06:44:14 +01:00
|
|
|
bool lpm_array_dq(const NetArrayDq*);
|
2010-10-16 19:53:20 +02:00
|
|
|
bool lpm_cast_int2(const NetCastInt2*);
|
|
|
|
|
bool lpm_cast_int4(const NetCastInt4*);
|
2008-06-18 02:07:19 +02:00
|
|
|
bool lpm_cast_real(const NetCastReal*);
|
2001-07-05 00:59:25 +02:00
|
|
|
void lpm_clshift(const NetCLShift*);
|
2001-06-15 06:14:18 +02:00
|
|
|
void lpm_compare(const NetCompare*);
|
2001-10-16 04:19:26 +02:00
|
|
|
void lpm_divide(const NetDivide*);
|
2000-11-11 01:03:36 +01:00
|
|
|
void lpm_ff(const NetFF*);
|
2016-03-10 22:13:27 +01:00
|
|
|
void lpm_latch(const NetLatch*);
|
2002-01-03 05:19:01 +01:00
|
|
|
void lpm_modulo(const NetModulo*);
|
2001-06-17 01:45:05 +02:00
|
|
|
void lpm_mult(const NetMult*);
|
2001-04-26 07:12:02 +02:00
|
|
|
void lpm_mux(const NetMux*);
|
2008-01-31 02:53:06 +01:00
|
|
|
void lpm_pow(const NetPow*);
|
2004-12-30 00:55:43 +01:00
|
|
|
bool concat(const NetConcat*);
|
2004-12-11 03:31:25 +01:00
|
|
|
bool part_select(const NetPartSelect*);
|
2005-02-08 01:12:36 +01:00
|
|
|
bool replicate(const NetReplicate*);
|
2010-07-24 00:58:00 +02:00
|
|
|
void net_assign(const NetAssign_*) const;
|
2006-06-18 06:15:50 +02:00
|
|
|
bool net_sysfunction(const NetSysFunc*);
|
2002-03-09 03:10:22 +01:00
|
|
|
bool net_function(const NetUserFunc*);
|
2000-09-18 03:24:32 +02:00
|
|
|
bool net_const(const NetConst*);
|
2005-07-07 18:22:49 +02:00
|
|
|
bool net_literal(const NetLiteral*);
|
2000-09-18 03:24:32 +02:00
|
|
|
void net_probe(const NetEvProbe*);
|
2005-05-24 03:44:27 +02:00
|
|
|
bool sign_extend(const NetSignExtend*);
|
2014-07-14 03:09:13 +02:00
|
|
|
bool substitute(const NetSubstitute*);
|
2000-09-18 03:24:32 +02:00
|
|
|
|
|
|
|
|
bool process(const NetProcTop*);
|
2008-11-07 06:31:34 +01:00
|
|
|
bool process(const NetAnalogTop*);
|
2000-09-18 03:24:32 +02:00
|
|
|
void scope(const NetScope*);
|
2011-03-07 20:18:23 +01:00
|
|
|
void convert_module_ports(const NetScope*);
|
2000-09-18 03:24:32 +02:00
|
|
|
void signal(const NetNet*);
|
2006-11-10 06:44:44 +01:00
|
|
|
bool signal_paths(const NetNet*);
|
2000-12-15 06:45:25 +01:00
|
|
|
ivl_dll_t dll_;
|
2000-09-18 03:24:32 +02:00
|
|
|
|
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_;
|
2008-09-27 01:54:13 +02:00
|
|
|
void proc_alloc(const NetAlloc*);
|
2008-07-31 03:01:41 +02:00
|
|
|
bool proc_assign(const NetAssign*);
|
2001-04-03 06:50:37 +02:00
|
|
|
void proc_assign_nb(const NetAssignNB*);
|
2000-09-18 03:24:32 +02:00
|
|
|
bool proc_block(const NetBlock*);
|
2001-03-31 19:36:38 +02:00
|
|
|
void proc_case(const NetCase*);
|
2001-10-30 03:52:07 +01:00
|
|
|
bool proc_cassign(const NetCAssign*);
|
2002-01-19 20:02:08 +01:00
|
|
|
bool proc_condit(const NetCondit*);
|
2008-11-07 06:31:34 +01:00
|
|
|
bool proc_contribution(const NetContribution*);
|
2001-10-30 03:52:07 +01:00
|
|
|
bool proc_deassign(const NetDeassign*);
|
2000-09-18 03:24:32 +02:00
|
|
|
bool proc_delay(const NetPDelay*);
|
2001-04-07 21:24:36 +02:00
|
|
|
bool proc_disable(const NetDisable*);
|
2013-09-17 05:01:06 +02:00
|
|
|
void proc_do_while(const NetDoWhile*);
|
2001-11-14 04:28:49 +01:00
|
|
|
bool proc_force(const NetForce*);
|
2001-04-04 06:50:35 +02:00
|
|
|
void proc_forever(const NetForever*);
|
2008-09-27 01:54:13 +02:00
|
|
|
void proc_free(const NetFree*);
|
2001-11-14 04:28:49 +01:00
|
|
|
bool proc_release(const NetRelease*);
|
2001-04-05 05:20:57 +02:00
|
|
|
void proc_repeat(const NetRepeat*);
|
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*);
|
2001-04-02 04:28:12 +02:00
|
|
|
void proc_utask(const NetUTask*);
|
2000-09-18 03:24:32 +02:00
|
|
|
bool proc_wait(const NetEvWait*);
|
|
|
|
|
void proc_while(const NetWhile*);
|
|
|
|
|
|
2004-06-01 01:34:36 +02:00
|
|
|
bool func_def(const NetScope*);
|
2001-04-02 04:28:12 +02:00
|
|
|
void task_def(const NetScope*);
|
|
|
|
|
|
2000-09-23 07:15:07 +02:00
|
|
|
struct ivl_expr_s*expr_;
|
2008-07-31 03:01:41 +02:00
|
|
|
void expr_access_func(const NetEAccess*);
|
2013-10-10 05:15:10 +02:00
|
|
|
void expr_array_pattern(const NetEArrayPattern*);
|
2000-09-30 04:18:15 +02:00
|
|
|
void expr_binary(const NetEBinary*);
|
2000-10-28 19:55:03 +02:00
|
|
|
void expr_concat(const NetEConcat*);
|
2000-09-24 04:21:53 +02:00
|
|
|
void expr_const(const NetEConst*);
|
2003-01-26 22:15:58 +01:00
|
|
|
void expr_creal(const NetECReal*);
|
2014-08-17 01:11:40 +02:00
|
|
|
void expr_last(const NetELast*);
|
2012-11-17 18:20:13 +01:00
|
|
|
void expr_new(const NetENew*);
|
2012-11-12 02:42:31 +01:00
|
|
|
void expr_null(const NetENull*);
|
2003-03-11 00:40:53 +01:00
|
|
|
void expr_param(const NetEConstParam*);
|
2012-11-25 19:13:05 +01:00
|
|
|
void expr_property(const NetEProperty*);
|
2009-01-16 20:03:03 +01:00
|
|
|
void expr_rparam(const NetECRealParam*);
|
2003-04-22 06:48:29 +02:00
|
|
|
void expr_event(const NetEEvent*);
|
2001-04-02 02:28:35 +02:00
|
|
|
void expr_scope(const NetEScope*);
|
2013-04-28 04:54:13 +02:00
|
|
|
void expr_scopy(const NetEShallowCopy*);
|
2010-11-21 00:09:32 +01:00
|
|
|
void expr_netenum(const NetENetenum*);
|
2002-01-28 01:52:41 +01:00
|
|
|
void expr_select(const NetESelect*);
|
2000-10-05 07:03:01 +02:00
|
|
|
void expr_sfunc(const NetESFunc*);
|
2001-05-17 06:37:02 +02:00
|
|
|
void expr_ternary(const NetETernary*);
|
2001-04-06 04:28:02 +02:00
|
|
|
void expr_ufunc(const NetEUFunc*);
|
2001-03-29 04:52:39 +02:00
|
|
|
void expr_unary(const NetEUnary*);
|
2000-09-24 04:21:53 +02:00
|
|
|
void expr_signal(const NetESignal*);
|
2001-03-20 02:44:13 +01:00
|
|
|
|
|
|
|
|
ivl_scope_t lookup_scope_(const NetScope*scope);
|
2001-07-22 02:17:49 +02:00
|
|
|
|
2002-08-04 21:13:16 +02:00
|
|
|
ivl_attribute_s* fill_in_attributes(const Attrib*net);
|
2008-05-24 05:53:10 +02:00
|
|
|
void switch_attributes(struct ivl_switch_s *obj, const NetNode*net);
|
2002-08-04 21:13:16 +02:00
|
|
|
void logic_attributes(struct ivl_net_logic_s *obj, const NetNode*net);
|
2002-05-26 03:39:02 +02:00
|
|
|
|
2001-07-22 02:17:49 +02:00
|
|
|
private:
|
2002-08-04 21:13:16 +02:00
|
|
|
StringHeap strings_;
|
|
|
|
|
|
2001-10-19 23:53:24 +02:00
|
|
|
static ivl_scope_t find_scope(ivl_design_s &des, const NetScope*cur);
|
|
|
|
|
static ivl_signal_t find_signal(ivl_design_s &des, const NetNet*net);
|
2003-03-11 00:40:53 +01:00
|
|
|
static ivl_parameter_t scope_find_param(ivl_scope_t scope,
|
|
|
|
|
const char*name);
|
|
|
|
|
|
2013-03-18 01:44:15 +01:00
|
|
|
void add_root(const NetScope *s);
|
2002-05-26 03:39:02 +02:00
|
|
|
|
2013-11-17 01:27:05 +01:00
|
|
|
bool make_assign_lvals_(const NetAssignBase*net);
|
2013-11-22 21:02:03 +01:00
|
|
|
bool make_single_lval_(const LineInfo*li, struct ivl_lval_s*cur, const NetAssign_*asn);
|
2002-05-30 00:05:54 +02:00
|
|
|
void sub_off_from_expr_(long);
|
2002-06-16 22:39:12 +02:00
|
|
|
void mul_expr_by_const_(long);
|
2002-10-23 03:45:24 +02:00
|
|
|
|
2010-07-13 01:04:22 +02:00
|
|
|
void make_delays_(ivl_expr_t*delay, const NetObj*net);
|
2006-01-02 06:33:19 +01:00
|
|
|
void make_logic_delays_(struct ivl_net_logic_s*obj, const NetObj*net);
|
2010-07-13 01:04:22 +02:00
|
|
|
void make_switch_delays_(struct ivl_switch_s*obj, const NetObj*net);
|
2008-01-21 20:13:28 +01:00
|
|
|
void make_lpm_delays_(struct ivl_lpm_s*obj, const NetObj*net);
|
2008-02-14 03:10:12 +01:00
|
|
|
void make_const_delays_(struct ivl_net_const_s*obj, const NetObj*net);
|
2003-03-11 00:40:53 +01:00
|
|
|
void make_scope_parameters(ivl_scope_t scope, const NetScope*net);
|
2007-06-02 05:42:12 +02:00
|
|
|
void make_scope_param_expr(ivl_parameter_t cur_par, NetExpr*etmp);
|
2003-03-11 00:40:53 +01:00
|
|
|
|
2008-12-22 22:48:34 +01:00
|
|
|
ivl_event_t make_lpm_trigger(const NetEvWait*ev);
|
|
|
|
|
|
2010-10-16 19:53:20 +02:00
|
|
|
bool lpm_arith1_(ivl_lpm_type_t lpm_type, unsigned wid, bool signed_flag, const NetNode*net);
|
|
|
|
|
|
2002-10-23 03:45:24 +02:00
|
|
|
static ivl_expr_t expr_from_value_(const verinum&that);
|
2000-09-23 07:15:07 +02:00
|
|
|
};
|
2000-09-18 03:24:32 +02:00
|
|
|
|
2008-09-08 01:43:54 +02:00
|
|
|
extern struct dll_target dll_target_obj;
|
|
|
|
|
|
2000-09-18 03:24:32 +02:00
|
|
|
/*
|
|
|
|
|
* These are various private declarations used by the t-dll target.
|
|
|
|
|
*/
|
|
|
|
|
|
2006-09-23 06:57:19 +02:00
|
|
|
struct ivl_delaypath_s {
|
2007-11-01 05:39:29 +01:00
|
|
|
ivl_scope_t scope;
|
2006-09-23 06:57:19 +02:00
|
|
|
ivl_nexus_t src;
|
2007-03-01 07:19:38 +01:00
|
|
|
ivl_nexus_t condit;
|
2008-04-29 04:00:29 +02:00
|
|
|
bool conditional;
|
2007-03-02 07:13:22 +01:00
|
|
|
bool posedge;
|
|
|
|
|
bool negedge;
|
2006-09-23 06:57:19 +02:00
|
|
|
uint64_t delay[12];
|
|
|
|
|
};
|
|
|
|
|
|
2001-03-28 08:07:39 +02:00
|
|
|
struct ivl_event_s {
|
2004-02-19 07:57:10 +01:00
|
|
|
perm_string name;
|
2001-03-28 08:07:39 +02:00
|
|
|
ivl_scope_t scope;
|
2011-02-10 06:03:08 +01:00
|
|
|
perm_string file;
|
|
|
|
|
unsigned lineno;
|
2003-06-17 23:28:59 +02:00
|
|
|
unsigned nany, nneg, npos;
|
2001-03-28 08:07:39 +02:00
|
|
|
ivl_nexus_t*pins;
|
|
|
|
|
};
|
|
|
|
|
|
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_;
|
2003-01-26 22:15:58 +01:00
|
|
|
ivl_variable_type_t value_;
|
2012-10-01 03:03:10 +02:00
|
|
|
ivl_type_t net_type;
|
2007-12-22 23:19:45 +01:00
|
|
|
perm_string file;
|
|
|
|
|
unsigned lineno;
|
2000-09-26 02:30:07 +02:00
|
|
|
|
2003-06-17 23:28:59 +02:00
|
|
|
unsigned width_;
|
2000-09-26 02:30:07 +02:00
|
|
|
unsigned signed_ : 1;
|
2010-03-06 04:36:54 +01:00
|
|
|
unsigned sized_ : 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_;
|
|
|
|
|
|
2013-10-10 05:15:10 +02:00
|
|
|
struct {
|
|
|
|
|
size_t parms;
|
|
|
|
|
ivl_expr_t*parm;
|
|
|
|
|
} array_pattern_;
|
|
|
|
|
|
2011-02-23 18:15:36 +01:00
|
|
|
struct {
|
|
|
|
|
ivl_select_type_t sel_type_;
|
|
|
|
|
ivl_expr_t expr_;
|
|
|
|
|
ivl_expr_t base_;
|
|
|
|
|
} select_;
|
|
|
|
|
|
2013-04-28 04:54:13 +02:00
|
|
|
struct {
|
|
|
|
|
ivl_expr_t dest;
|
|
|
|
|
ivl_expr_t src;
|
|
|
|
|
} shallow_;
|
|
|
|
|
|
2008-11-12 05:41:14 +01:00
|
|
|
struct {
|
|
|
|
|
ivl_branch_t branch;
|
|
|
|
|
ivl_nature_t nature;
|
|
|
|
|
} branch_;
|
|
|
|
|
|
2000-10-29 00:32:34 +02:00
|
|
|
struct {
|
2003-06-17 23:28:59 +02:00
|
|
|
unsigned rept;
|
|
|
|
|
unsigned parms;
|
2000-10-29 00:32:34 +02:00
|
|
|
ivl_expr_t*parm;
|
|
|
|
|
} concat_;
|
|
|
|
|
|
2000-09-26 02:30:07 +02:00
|
|
|
struct {
|
|
|
|
|
char*bits_;
|
2003-03-11 00:40:53 +01:00
|
|
|
ivl_parameter_t parameter;
|
2000-09-26 02:30:07 +02:00
|
|
|
} number_;
|
|
|
|
|
|
2003-04-22 06:48:29 +02:00
|
|
|
struct {
|
|
|
|
|
ivl_event_t event;
|
|
|
|
|
} event_;
|
|
|
|
|
|
2001-04-02 02:28:35 +02:00
|
|
|
struct {
|
|
|
|
|
ivl_scope_t scope;
|
|
|
|
|
} scope_;
|
|
|
|
|
|
2010-11-21 00:09:32 +01:00
|
|
|
struct {
|
|
|
|
|
ivl_enumtype_t type;
|
|
|
|
|
} enumtype_;
|
|
|
|
|
|
2001-07-27 06:51:44 +02:00
|
|
|
struct {
|
|
|
|
|
ivl_signal_t sig;
|
2007-01-16 06:44:14 +01:00
|
|
|
ivl_expr_t word;
|
2001-07-27 06:51:44 +02:00
|
|
|
} signal_;
|
|
|
|
|
|
2000-10-05 07:03:01 +02:00
|
|
|
struct {
|
2003-06-17 23:28:59 +02:00
|
|
|
const char *name_;
|
|
|
|
|
ivl_expr_t *parm;
|
|
|
|
|
unsigned parms;
|
2000-10-05 07:03:01 +02:00
|
|
|
} sfunc_;
|
|
|
|
|
|
2000-09-23 07:15:07 +02:00
|
|
|
struct {
|
|
|
|
|
char*value_;
|
2003-03-11 00:40:53 +01:00
|
|
|
ivl_parameter_t parameter;
|
2000-09-23 07:15:07 +02:00
|
|
|
} string_;
|
2000-09-24 04:21:53 +02:00
|
|
|
|
2001-05-17 06:37:02 +02:00
|
|
|
struct {
|
|
|
|
|
ivl_expr_t cond;
|
|
|
|
|
ivl_expr_t true_e;
|
|
|
|
|
ivl_expr_t false_e;
|
|
|
|
|
} ternary_;
|
|
|
|
|
|
2001-05-06 19:48:20 +02:00
|
|
|
struct {
|
|
|
|
|
ivl_memory_t mem_;
|
|
|
|
|
ivl_expr_t idx_;
|
|
|
|
|
} memory_;
|
|
|
|
|
|
2001-04-06 04:28:02 +02:00
|
|
|
struct {
|
|
|
|
|
ivl_scope_t def;
|
2003-06-17 23:28:59 +02:00
|
|
|
ivl_expr_t *parm;
|
|
|
|
|
unsigned parms;
|
2001-04-06 04:28:02 +02:00
|
|
|
} ufunc_;
|
|
|
|
|
|
2001-04-15 04:58:11 +02:00
|
|
|
struct {
|
|
|
|
|
unsigned long value;
|
|
|
|
|
} ulong_;
|
|
|
|
|
|
2003-01-26 22:15:58 +01:00
|
|
|
struct {
|
|
|
|
|
double value;
|
2003-03-11 00:40:53 +01:00
|
|
|
ivl_parameter_t parameter;
|
2003-01-26 22:15:58 +01:00
|
|
|
} real_;
|
|
|
|
|
|
2001-03-29 04:52:39 +02:00
|
|
|
struct {
|
|
|
|
|
char op_;
|
|
|
|
|
ivl_expr_t sub_;
|
|
|
|
|
} unary_;
|
|
|
|
|
|
2009-02-17 01:44:52 +01:00
|
|
|
struct {
|
|
|
|
|
uint64_t value;
|
|
|
|
|
} delay_;
|
|
|
|
|
|
2012-11-18 01:44:25 +01:00
|
|
|
struct {
|
|
|
|
|
ivl_expr_t size;
|
2013-10-14 02:54:39 +02:00
|
|
|
ivl_expr_t init_val;
|
2012-11-18 01:44:25 +01:00
|
|
|
} new_;
|
|
|
|
|
|
2012-11-25 19:13:05 +01:00
|
|
|
struct {
|
|
|
|
|
ivl_signal_t sig;
|
2012-12-10 02:59:16 +01:00
|
|
|
unsigned prop_idx;
|
2014-09-12 22:07:34 +02:00
|
|
|
ivl_expr_t index;
|
2012-11-25 19:13:05 +01:00
|
|
|
} property_;
|
2000-09-23 07:15:07 +02:00
|
|
|
} u_;
|
|
|
|
|
};
|
2000-09-18 03:24:32 +02:00
|
|
|
|
2000-11-11 01:03:36 +01:00
|
|
|
/*
|
2001-04-26 07:12:02 +02:00
|
|
|
* LPM devices are handled by this suite of types. The ivl_lpm_s
|
|
|
|
|
* structure holds the core, including a type code, the object name
|
|
|
|
|
* and scope. The other properties of the device are held in the type
|
|
|
|
|
* specific member of the union.
|
2000-11-11 01:03:36 +01:00
|
|
|
*/
|
2001-04-26 07:12:02 +02:00
|
|
|
|
2000-11-11 01:03:36 +01:00
|
|
|
struct ivl_lpm_s {
|
|
|
|
|
ivl_lpm_type_t type;
|
|
|
|
|
ivl_scope_t scope;
|
2004-02-19 08:06:57 +01:00
|
|
|
perm_string name;
|
2008-01-01 23:41:45 +01:00
|
|
|
perm_string file;
|
|
|
|
|
unsigned lineno;
|
2006-06-18 06:15:50 +02:00
|
|
|
// Value returned by ivl_lpm_width;
|
|
|
|
|
unsigned width;
|
2008-01-21 20:13:28 +01:00
|
|
|
ivl_expr_t delay[3];
|
2000-11-11 01:03:36 +01:00
|
|
|
|
|
|
|
|
union {
|
2001-04-26 07:12:02 +02:00
|
|
|
struct ivl_lpm_ff_s {
|
2015-06-13 16:56:12 +02:00
|
|
|
unsigned negedge_flag :1;
|
2001-04-26 07:12:02 +02:00
|
|
|
ivl_nexus_t clk;
|
2001-09-01 00:58:39 +02:00
|
|
|
ivl_nexus_t we;
|
2002-09-26 05:18:04 +02:00
|
|
|
ivl_nexus_t aclr;
|
|
|
|
|
ivl_nexus_t aset;
|
2003-08-15 04:23:52 +02:00
|
|
|
ivl_nexus_t sclr;
|
|
|
|
|
ivl_nexus_t sset;
|
2001-04-26 07:12:02 +02:00
|
|
|
union {
|
|
|
|
|
ivl_nexus_t*pins;
|
|
|
|
|
ivl_nexus_t pin;
|
|
|
|
|
} q;
|
|
|
|
|
union {
|
|
|
|
|
ivl_nexus_t*pins;
|
|
|
|
|
ivl_nexus_t pin;
|
|
|
|
|
} d;
|
2002-10-23 03:45:24 +02:00
|
|
|
ivl_expr_t aset_value;
|
2003-09-04 01:33:29 +02:00
|
|
|
ivl_expr_t sset_value;
|
2001-04-26 07:12:02 +02:00
|
|
|
} ff;
|
2016-03-10 22:13:27 +01:00
|
|
|
struct ivl_lpm_latch_s {
|
2016-03-12 01:10:47 +01:00
|
|
|
ivl_nexus_t e;
|
2016-03-10 22:13:27 +01:00
|
|
|
union {
|
|
|
|
|
ivl_nexus_t*pins;
|
|
|
|
|
ivl_nexus_t pin;
|
|
|
|
|
} q;
|
|
|
|
|
union {
|
|
|
|
|
ivl_nexus_t*pins;
|
|
|
|
|
ivl_nexus_t pin;
|
|
|
|
|
} d;
|
|
|
|
|
} latch;
|
2001-04-26 07:12:02 +02:00
|
|
|
|
|
|
|
|
struct ivl_lpm_mux_s {
|
2003-06-17 23:28:59 +02:00
|
|
|
unsigned size;
|
|
|
|
|
unsigned swid;
|
2001-04-26 07:12:02 +02:00
|
|
|
ivl_nexus_t*d;
|
2005-02-12 07:25:40 +01:00
|
|
|
ivl_nexus_t q, s;
|
2001-04-26 07:12:02 +02:00
|
|
|
} mux;
|
|
|
|
|
|
2001-07-05 00:59:25 +02:00
|
|
|
struct ivl_lpm_shift_s {
|
2003-06-17 23:28:59 +02:00
|
|
|
unsigned select;
|
2004-06-30 04:16:26 +02:00
|
|
|
unsigned signed_flag :1;
|
2005-02-19 03:43:38 +01:00
|
|
|
ivl_nexus_t q, d, s;
|
2001-07-05 00:59:25 +02:00
|
|
|
} shift;
|
|
|
|
|
|
2001-06-07 04:12:43 +02:00
|
|
|
struct ivl_lpm_arith_s {
|
2003-04-11 07:18:08 +02:00
|
|
|
unsigned signed_flag :1;
|
2004-12-11 03:31:25 +01:00
|
|
|
ivl_nexus_t q, a, b;
|
2001-06-07 04:12:43 +02:00
|
|
|
} arith;
|
2002-03-09 03:10:22 +01:00
|
|
|
|
2007-01-16 06:44:14 +01:00
|
|
|
struct ivl_lpm_array_s {
|
|
|
|
|
ivl_signal_t sig;
|
|
|
|
|
unsigned swid;
|
|
|
|
|
ivl_nexus_t q, a;
|
|
|
|
|
} array;
|
|
|
|
|
|
2004-12-30 00:55:43 +01:00
|
|
|
struct ivl_concat_s {
|
|
|
|
|
unsigned inputs;
|
|
|
|
|
ivl_nexus_t*pins;
|
|
|
|
|
} concat;
|
|
|
|
|
|
2004-12-11 03:31:25 +01:00
|
|
|
struct ivl_part_s {
|
|
|
|
|
unsigned base;
|
|
|
|
|
unsigned signed_flag :1;
|
2005-05-09 01:40:14 +02:00
|
|
|
ivl_nexus_t q, a, s;
|
2004-12-11 03:31:25 +01:00
|
|
|
} part;
|
|
|
|
|
|
2005-05-24 03:44:27 +02:00
|
|
|
// IVL_LPM_RE_* and IVL_LPM_SIGN_EXT use this.
|
2005-02-03 05:56:20 +01:00
|
|
|
struct ivl_lpm_reduce_s {
|
|
|
|
|
ivl_nexus_t q, a;
|
|
|
|
|
} reduce;
|
|
|
|
|
|
2005-02-08 01:12:36 +01:00
|
|
|
struct ivl_lpm_repeat_s {
|
|
|
|
|
unsigned count;
|
|
|
|
|
ivl_nexus_t q, a;
|
|
|
|
|
} repeat;
|
|
|
|
|
|
2006-06-18 06:15:50 +02:00
|
|
|
struct ivl_lpm_sfunc_s {
|
|
|
|
|
const char* fun_name;
|
|
|
|
|
unsigned ports;
|
|
|
|
|
ivl_nexus_t*pins;
|
2008-12-22 22:48:34 +01:00
|
|
|
ivl_event_t trigger;
|
2006-06-18 06:15:50 +02:00
|
|
|
} sfunc;
|
|
|
|
|
|
2014-07-14 03:09:13 +02:00
|
|
|
struct ivl_lpm_substitute {
|
|
|
|
|
unsigned base;
|
|
|
|
|
ivl_nexus_t q, a, s;
|
|
|
|
|
} substitute;
|
|
|
|
|
|
2002-03-09 03:10:22 +01:00
|
|
|
struct ivl_lpm_ufunc_s {
|
|
|
|
|
ivl_scope_t def;
|
2003-06-17 23:28:59 +02:00
|
|
|
unsigned ports;
|
2002-03-09 03:10:22 +01:00
|
|
|
ivl_nexus_t*pins;
|
2008-12-22 22:48:34 +01:00
|
|
|
ivl_event_t trigger;
|
2002-03-09 03:10:22 +01:00
|
|
|
} ufunc;
|
2001-04-26 07:12:02 +02:00
|
|
|
} u_;
|
2000-11-11 01:03:36 +01:00
|
|
|
};
|
|
|
|
|
|
2000-10-18 22:04:39 +02:00
|
|
|
/*
|
2001-08-26 01:50:02 +02:00
|
|
|
* This object represents l-values to assignments. The l-value can be
|
|
|
|
|
* a register bit or part select, or a memory word select with a part
|
|
|
|
|
* select.
|
2000-10-18 22:04:39 +02:00
|
|
|
*/
|
2001-05-09 01:59:33 +02:00
|
|
|
|
|
|
|
|
enum ivl_lval_type_t {
|
|
|
|
|
IVL_LVAL_REG = 0,
|
2013-11-23 04:54:42 +01:00
|
|
|
IVL_LVAL_ARR = 4,
|
|
|
|
|
IVL_LVAL_LVAL= 5 // Nested l-value
|
2001-05-09 01:59:33 +02:00
|
|
|
};
|
|
|
|
|
|
2000-10-18 22:04:39 +02:00
|
|
|
struct ivl_lval_s {
|
2006-02-02 03:43:57 +01:00
|
|
|
ivl_expr_t loff;
|
2012-11-25 19:13:05 +01:00
|
|
|
ivl_select_type_t sel_type :3;
|
2006-02-02 03:43:57 +01:00
|
|
|
ivl_expr_t idx;
|
2003-06-17 23:28:59 +02:00
|
|
|
unsigned width_;
|
2013-11-23 04:54:42 +01:00
|
|
|
unsigned type_ : 8; /* values from ivl_lval_type_t */
|
2012-12-10 02:59:16 +01:00
|
|
|
int property_idx;
|
2000-10-18 22:04:39 +02:00
|
|
|
union {
|
2001-08-26 01:50:02 +02:00
|
|
|
ivl_signal_t sig;
|
2013-11-23 04:54:42 +01:00
|
|
|
ivl_lval_t nest; // type_ == IVL_LVAL_LVAL
|
2000-10-18 22:04:39 +02:00
|
|
|
} n;
|
|
|
|
|
};
|
|
|
|
|
|
2000-10-07 01:46:50 +02:00
|
|
|
/*
|
2005-07-07 18:22:49 +02:00
|
|
|
* This object represents a literal constant, possibly signed, in a
|
2000-10-07 01:46:50 +02:00
|
|
|
* structural context.
|
|
|
|
|
*/
|
2000-09-18 03:24:32 +02:00
|
|
|
struct ivl_net_const_s {
|
2014-08-01 02:56:16 +02:00
|
|
|
ivl_variable_type_t type : 4;
|
2009-12-10 22:24:27 +01:00
|
|
|
unsigned width_ : 24;
|
|
|
|
|
unsigned signed_ : 1;
|
2011-01-31 08:27:39 +01:00
|
|
|
perm_string file;
|
|
|
|
|
unsigned lineno;
|
2011-02-07 04:47:11 +01:00
|
|
|
ivl_scope_t scope;
|
2000-10-07 01:46:50 +02:00
|
|
|
|
|
|
|
|
union {
|
2005-07-07 18:22:49 +02:00
|
|
|
double real_value;
|
2000-10-07 01:46:50 +02:00
|
|
|
char bit_[sizeof(char*)];
|
2009-12-10 22:24:27 +01:00
|
|
|
const char* bits_;
|
2000-10-07 01:46:50 +02:00
|
|
|
} b;
|
|
|
|
|
|
2004-12-11 03:31:25 +01:00
|
|
|
ivl_nexus_t pin_;
|
2008-02-14 03:10:12 +01:00
|
|
|
ivl_expr_t delay[3];
|
2009-12-10 22:24:27 +01:00
|
|
|
|
|
|
|
|
void* operator new (size_t s);
|
|
|
|
|
void operator delete(void*obj, size_t s); // Not implemented
|
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_;
|
2004-12-11 03:31:25 +01:00
|
|
|
unsigned width_;
|
2011-03-22 18:58:18 +01:00
|
|
|
unsigned is_cassign;
|
2001-04-23 01:09:45 +02:00
|
|
|
ivl_udp_t udp;
|
2000-10-15 06:46:23 +02:00
|
|
|
|
2004-02-19 08:06:57 +01:00
|
|
|
perm_string name_;
|
2000-10-15 06:46:23 +02:00
|
|
|
ivl_scope_t scope_;
|
2011-01-17 18:29:21 +01:00
|
|
|
perm_string file;
|
|
|
|
|
unsigned lineno;
|
2000-10-15 06:46:23 +02:00
|
|
|
|
2000-10-07 01:46:50 +02:00
|
|
|
unsigned npins_;
|
|
|
|
|
ivl_nexus_t*pins_;
|
2001-09-17 00:19:42 +02:00
|
|
|
|
2002-05-23 05:08:50 +02:00
|
|
|
struct ivl_attribute_s*attr;
|
|
|
|
|
unsigned nattr;
|
2001-12-06 04:11:00 +01:00
|
|
|
|
2006-01-02 06:33:19 +01:00
|
|
|
ivl_expr_t delay[3];
|
2000-10-07 01:46:50 +02:00
|
|
|
};
|
|
|
|
|
|
2008-05-24 05:53:10 +02:00
|
|
|
struct ivl_switch_s {
|
|
|
|
|
ivl_switch_type_t type;
|
2008-06-03 20:16:25 +02:00
|
|
|
unsigned width;
|
|
|
|
|
unsigned part;
|
|
|
|
|
unsigned offset;
|
2008-05-24 05:53:10 +02:00
|
|
|
|
|
|
|
|
perm_string name;
|
|
|
|
|
ivl_scope_t scope;
|
2008-06-02 04:45:12 +02:00
|
|
|
ivl_island_t island;
|
2008-05-24 05:53:10 +02:00
|
|
|
|
|
|
|
|
struct ivl_attribute_s*attr;
|
|
|
|
|
unsigned nattr;
|
|
|
|
|
|
2010-07-13 01:04:22 +02:00
|
|
|
ivl_expr_t delay[3];
|
|
|
|
|
|
2008-05-24 05:53:10 +02:00
|
|
|
ivl_nexus_t pins[3];
|
|
|
|
|
perm_string file;
|
|
|
|
|
unsigned lineno;
|
|
|
|
|
};
|
2000-10-07 01:46:50 +02:00
|
|
|
|
2001-04-23 01:09:45 +02:00
|
|
|
/*
|
|
|
|
|
* UDP definition.
|
|
|
|
|
*/
|
|
|
|
|
struct ivl_udp_s {
|
2004-02-18 18:11:54 +01:00
|
|
|
perm_string name;
|
2001-04-23 01:09:45 +02:00
|
|
|
unsigned nin;
|
2008-01-25 22:34:51 +01:00
|
|
|
int sequ; /* boolean */
|
2001-04-23 01:09:45 +02:00
|
|
|
char init;
|
|
|
|
|
unsigned nrows;
|
2002-08-04 21:13:16 +02:00
|
|
|
typedef const char*ccharp_t;
|
|
|
|
|
ccharp_t*table; // zero terminated array of pointers
|
2011-02-07 04:47:11 +01:00
|
|
|
perm_string file;
|
|
|
|
|
unsigned lineno;
|
2011-02-20 19:57:27 +01:00
|
|
|
string*ports;
|
2001-04-23 01:09:45 +02:00
|
|
|
};
|
|
|
|
|
|
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.
|
2001-04-30 01:17:38 +02:00
|
|
|
*
|
|
|
|
|
* The type_ member specifies which of the object pointers in the
|
|
|
|
|
* union are valid.
|
|
|
|
|
*
|
|
|
|
|
* The drive01 members gives the strength of the drive that the device
|
|
|
|
|
* is applying to the nexus, with 0 HiZ and 3 supply. If the pin is an
|
|
|
|
|
* input to the device, then the drives are both HiZ.
|
2000-10-08 06:01:54 +02:00
|
|
|
*/
|
2000-10-15 06:46:23 +02:00
|
|
|
struct ivl_nexus_ptr_s {
|
2003-06-17 23:28:59 +02:00
|
|
|
unsigned pin_;
|
2000-10-08 06:01:54 +02:00
|
|
|
unsigned type_ : 8;
|
2001-04-30 01:17:38 +02:00
|
|
|
unsigned drive0 : 3;
|
|
|
|
|
unsigned drive1 : 3;
|
2000-10-08 06:01:54 +02:00
|
|
|
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-12-05 07:29:33 +01:00
|
|
|
ivl_lpm_t lpm; /* type 3 */
|
2008-05-24 05:53:10 +02:00
|
|
|
ivl_switch_t swi; /* type 4 */
|
2008-11-10 06:42:12 +01:00
|
|
|
ivl_branch_t bra; /* type 5 */
|
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-12-05 07:29:33 +01:00
|
|
|
# define __NEXUS_PTR_LPM 3
|
2008-05-24 05:53:10 +02:00
|
|
|
# define __NEXUS_PTR_SWI 4
|
2008-11-10 06:42:12 +01:00
|
|
|
# define __NEXUS_PTR_BRA 5
|
2000-10-08 06:01:54 +02:00
|
|
|
|
2007-03-26 22:32:47 +02:00
|
|
|
/*
|
2008-01-25 22:34:51 +01:00
|
|
|
* NOTE: ONLY allocate ivl_nexus_s objects with the included "new" operator.
|
2007-03-26 22:32:47 +02:00
|
|
|
*/
|
2000-10-07 01:46:50 +02:00
|
|
|
struct ivl_nexus_s {
|
2008-11-10 06:42:12 +01:00
|
|
|
ivl_nexus_s() : ptrs_(1), nexus_(0), name_(0), private_data(0) { }
|
|
|
|
|
vector<ivl_nexus_ptr_s>ptrs_;
|
2007-03-26 18:51:48 +02:00
|
|
|
const Nexus*nexus_;
|
2002-08-04 21:13:16 +02:00
|
|
|
const char*name_;
|
2001-08-10 02:40:45 +02:00
|
|
|
void*private_data;
|
2007-03-26 22:32:47 +02:00
|
|
|
|
|
|
|
|
void* operator new (size_t s);
|
|
|
|
|
void operator delete(void*obj, size_t s); // Not implemented
|
2000-09-18 03:24:32 +02:00
|
|
|
};
|
|
|
|
|
|
2003-03-11 00:40:53 +01:00
|
|
|
/*
|
|
|
|
|
* This is the implementation of a parameter. Each scope has a list of
|
|
|
|
|
* these.
|
|
|
|
|
*/
|
|
|
|
|
struct ivl_parameter_s {
|
2004-02-20 07:22:56 +01:00
|
|
|
perm_string basename;
|
2003-03-11 00:40:53 +01:00
|
|
|
ivl_scope_t scope;
|
|
|
|
|
ivl_expr_t value;
|
2013-07-04 20:26:39 +02:00
|
|
|
long msb;
|
|
|
|
|
long lsb;
|
|
|
|
|
bool signed_flag;
|
2012-06-04 21:43:33 +02:00
|
|
|
bool local;
|
2008-05-06 04:46:30 +02:00
|
|
|
perm_string file;
|
|
|
|
|
unsigned lineno;
|
2003-03-11 00:40:53 +01:00
|
|
|
};
|
2000-10-07 01:46:50 +02:00
|
|
|
/*
|
2008-08-01 23:59:53 +02:00
|
|
|
* All we know about a process is its type (initial or always) and the
|
2001-03-20 02:44:13 +01:00
|
|
|
* single statement that is it. A process also has a scope, although
|
|
|
|
|
* that generally only matters for VPI calls.
|
2000-10-07 01:46:50 +02:00
|
|
|
*/
|
2000-09-18 03:24:32 +02:00
|
|
|
struct ivl_process_s {
|
2017-11-20 16:48:35 +01:00
|
|
|
ivl_process_type_t type_ : 3;
|
2014-05-28 18:10:18 +02:00
|
|
|
unsigned int analog_flag : 1;
|
2001-03-20 02:44:13 +01:00
|
|
|
ivl_scope_t scope_;
|
2000-09-18 03:24:32 +02:00
|
|
|
ivl_statement_t stmt_;
|
2008-08-01 23:59:53 +02:00
|
|
|
perm_string file;
|
|
|
|
|
unsigned lineno;
|
2000-10-08 06:01:54 +02:00
|
|
|
|
2002-05-26 03:39:02 +02:00
|
|
|
struct ivl_attribute_s*attr;
|
|
|
|
|
unsigned nattr;
|
|
|
|
|
|
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
|
2011-03-11 20:27:54 +01:00
|
|
|
* by following its child pointer, then following sibling pointers from
|
2000-10-07 01:46:50 +02:00
|
|
|
* there.
|
|
|
|
|
*/
|
2000-09-30 04:18:15 +02:00
|
|
|
struct ivl_scope_s {
|
2016-02-01 00:29:52 +01:00
|
|
|
ivl_scope_s();
|
|
|
|
|
|
2009-12-10 22:24:27 +01:00
|
|
|
ivl_scope_t parent;
|
|
|
|
|
std::map<hname_t,ivl_scope_t> children;
|
2013-07-19 04:24:47 +02:00
|
|
|
// This is just like the children map above, but in vector
|
|
|
|
|
// form for convenient access.
|
|
|
|
|
std::vector<ivl_scope_t> child;
|
2000-09-30 04:18:15 +02:00
|
|
|
|
2004-02-18 18:11:54 +01:00
|
|
|
perm_string name_;
|
|
|
|
|
perm_string tname_;
|
2008-04-30 03:58:25 +02:00
|
|
|
perm_string file;
|
|
|
|
|
perm_string def_file;
|
|
|
|
|
unsigned lineno;
|
|
|
|
|
unsigned def_lineno;
|
2001-01-15 01:47:01 +01:00
|
|
|
ivl_scope_type_t type_;
|
2000-10-07 01:46:50 +02:00
|
|
|
|
2012-12-01 21:03:01 +01:00
|
|
|
std::vector<ivl_type_t> classes;
|
2010-11-21 00:09:32 +01:00
|
|
|
std::vector<ivl_enumtype_t> enumerations_;
|
|
|
|
|
|
2012-07-14 03:41:41 +02:00
|
|
|
std::vector<ivl_signal_t> sigs_;
|
2000-10-07 21:45:42 +02:00
|
|
|
|
|
|
|
|
unsigned nlog_;
|
|
|
|
|
ivl_net_logic_t*log_;
|
2000-11-11 01:03:36 +01:00
|
|
|
|
2001-03-28 08:07:39 +02:00
|
|
|
unsigned nevent_;
|
|
|
|
|
ivl_event_t* event_;
|
|
|
|
|
|
2000-11-11 01:03:36 +01:00
|
|
|
unsigned nlpm_;
|
|
|
|
|
ivl_lpm_t* lpm_;
|
2001-04-02 04:28:12 +02:00
|
|
|
|
2013-04-06 04:27:03 +02:00
|
|
|
std::vector<struct ivl_parameter_s> param;
|
2003-03-11 00:40:53 +01:00
|
|
|
|
2001-04-06 04:28:02 +02:00
|
|
|
/* Scopes that are tasks/functions have a definition. */
|
2001-04-02 04:28:12 +02:00
|
|
|
ivl_statement_t def;
|
2008-08-20 03:39:49 +02:00
|
|
|
unsigned is_auto;
|
2016-02-01 00:29:52 +01:00
|
|
|
ivl_variable_type_t func_type;
|
|
|
|
|
bool func_signed;
|
|
|
|
|
unsigned func_width;
|
2001-04-06 04:28:02 +02:00
|
|
|
|
2009-05-21 23:41:58 +02:00
|
|
|
unsigned is_cell;
|
|
|
|
|
|
2012-06-04 21:43:33 +02:00
|
|
|
// Ports of Module scope (just introspection data for VPI) - actual connections
|
|
|
|
|
// are nets defined in u_.net (may be > 1 per module port)
|
|
|
|
|
std::vector<PortInfo> module_ports_info;
|
|
|
|
|
|
2001-04-06 04:28:02 +02:00
|
|
|
unsigned ports;
|
2011-03-07 20:18:23 +01:00
|
|
|
union {
|
|
|
|
|
ivl_signal_t*port;
|
|
|
|
|
ivl_nexus_t*nex;
|
|
|
|
|
NetNet**net;
|
|
|
|
|
} u_;
|
2002-12-21 01:55:57 +01:00
|
|
|
|
2008-05-24 05:53:10 +02:00
|
|
|
std::vector<ivl_switch_t>switches;
|
|
|
|
|
|
2007-09-28 20:21:08 +02:00
|
|
|
signed int time_precision :8;
|
2002-12-21 01:55:57 +01:00
|
|
|
signed int time_units :8;
|
2003-06-23 03:25:44 +02:00
|
|
|
|
|
|
|
|
struct ivl_attribute_s*attr;
|
|
|
|
|
unsigned nattr;
|
2000-10-07 01:46:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*
|
2001-06-30 23:07:26 +02:00
|
|
|
* A signal is a thing like a wire, a reg, or whatever. It has a type,
|
|
|
|
|
* and if it is a port is also has a direction. Signals are collected
|
2000-10-07 01:46:50 +02:00
|
|
|
* 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_;
|
2012-06-04 21:43:33 +02:00
|
|
|
int module_port_index_;
|
2008-11-02 17:10:41 +01:00
|
|
|
ivl_discipline_t discipline;
|
2008-05-06 04:46:30 +02:00
|
|
|
perm_string file;
|
|
|
|
|
unsigned lineno;
|
2000-10-07 01:46:50 +02:00
|
|
|
|
2012-09-23 18:28:49 +02:00
|
|
|
// This is the type for the signal
|
|
|
|
|
ivl_type_t net_type;
|
2002-07-05 23:26:17 +02:00
|
|
|
unsigned local_ : 1;
|
2000-10-07 01:46:50 +02:00
|
|
|
|
2011-08-06 01:10:41 +02:00
|
|
|
unsigned forced_net_ : 1;
|
|
|
|
|
|
2007-04-02 03:12:34 +02:00
|
|
|
/* For now, support only 0 or 1 array dimensions. */
|
2012-05-26 00:58:29 +02:00
|
|
|
unsigned array_dimensions_ : 8;
|
2009-02-24 02:04:14 +01:00
|
|
|
unsigned array_addr_swapped : 1;
|
2007-04-02 03:12:34 +02:00
|
|
|
|
2012-02-11 02:17:59 +01:00
|
|
|
/* These encode the declared packed dimensions for the
|
|
|
|
|
signal, in case they are needed by the run-time */
|
2012-03-26 02:59:05 +02:00
|
|
|
std::vector<netrange_t> packed_dims;
|
2002-06-16 21:19:16 +02:00
|
|
|
|
2004-02-19 07:57:10 +01:00
|
|
|
perm_string name_;
|
2000-10-07 01:46:50 +02:00
|
|
|
ivl_scope_t scope_;
|
|
|
|
|
|
2007-01-16 06:44:14 +01:00
|
|
|
unsigned array_words;
|
|
|
|
|
int array_base;
|
|
|
|
|
union {
|
|
|
|
|
ivl_nexus_t pin;
|
|
|
|
|
ivl_nexus_t*pins;
|
|
|
|
|
};
|
2000-12-05 07:29:33 +01:00
|
|
|
|
2006-09-23 06:57:19 +02:00
|
|
|
ivl_delaypath_s*path;
|
|
|
|
|
unsigned npath;
|
|
|
|
|
|
2002-05-24 06:36:23 +02:00
|
|
|
struct ivl_attribute_s*attr;
|
|
|
|
|
unsigned nattr;
|
2000-09-30 04:18:15 +02:00
|
|
|
};
|
|
|
|
|
|
2012-06-04 21:43:33 +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_;
|
2007-12-22 15:31:24 +01:00
|
|
|
perm_string file;
|
|
|
|
|
unsigned lineno;
|
|
|
|
|
|
2000-09-18 03:24:32 +02:00
|
|
|
union {
|
2008-09-27 01:54:13 +02:00
|
|
|
struct { /* IVL_ST_ALLOC */
|
|
|
|
|
ivl_scope_t scope;
|
|
|
|
|
} alloc_;
|
|
|
|
|
|
2004-12-11 03:31:25 +01:00
|
|
|
struct { /* IVL_ST_ASSIGN IVL_ST_ASSIGN_NB
|
|
|
|
|
IVL_ST_CASSIGN, IVL_ST_DEASSIGN */
|
2000-10-18 22:04:39 +02:00
|
|
|
unsigned lvals_;
|
|
|
|
|
struct ivl_lval_s*lval_;
|
2011-11-28 01:46:02 +01:00
|
|
|
char oper; // Operator if this is a compressed assignment.
|
2000-10-07 01:46:50 +02:00
|
|
|
ivl_expr_t rval_;
|
2001-04-15 04:58:11 +02:00
|
|
|
ivl_expr_t delay;
|
2008-09-11 04:37:11 +02:00
|
|
|
// The following are only for NB event control.
|
|
|
|
|
ivl_expr_t count;
|
|
|
|
|
unsigned nevent;
|
|
|
|
|
union {
|
|
|
|
|
ivl_event_t event;
|
|
|
|
|
ivl_event_t*events;
|
|
|
|
|
};
|
2000-10-07 01:46:50 +02:00
|
|
|
} assign_;
|
|
|
|
|
|
2001-03-30 07:49:52 +02:00
|
|
|
struct { /* IVL_ST_BLOCK, IVL_ST_FORK */
|
2000-09-18 03:24:32 +02:00
|
|
|
struct ivl_statement_s*stmt_;
|
|
|
|
|
unsigned nstmt_;
|
2002-05-27 02:08:45 +02:00
|
|
|
ivl_scope_t scope;
|
2000-09-18 03:24:32 +02:00
|
|
|
} block_;
|
|
|
|
|
|
2001-03-31 19:36:38 +02:00
|
|
|
struct { /* IVL_ST_CASE, IVL_ST_CASEX, IVL_ST_CASEZ */
|
|
|
|
|
ivl_expr_t cond;
|
|
|
|
|
unsigned ncase;
|
|
|
|
|
ivl_expr_t*case_ex;
|
|
|
|
|
struct ivl_statement_s*case_st;
|
|
|
|
|
} case_;
|
|
|
|
|
|
2000-09-18 03:24:32 +02:00
|
|
|
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_;
|
|
|
|
|
|
2008-11-07 06:31:34 +01:00
|
|
|
struct { /* IVL_ST_CONTRIB */
|
|
|
|
|
ivl_expr_t lval;
|
|
|
|
|
ivl_expr_t rval;
|
|
|
|
|
} contrib_;
|
|
|
|
|
|
2000-09-18 03:24:32 +02:00
|
|
|
struct { /* IVL_ST_DELAY */
|
2009-02-17 01:44:52 +01:00
|
|
|
uint64_t value;
|
2000-09-18 03:24:32 +02:00
|
|
|
ivl_statement_t stmt_;
|
|
|
|
|
} delay_;
|
|
|
|
|
|
|
|
|
|
struct { /* IVL_ST_DELAYX */
|
2001-07-19 06:55:06 +02:00
|
|
|
ivl_expr_t expr; /* XXXX */
|
2000-09-18 03:24:32 +02:00
|
|
|
ivl_statement_t stmt_;
|
|
|
|
|
} delayx_;
|
|
|
|
|
|
2001-04-07 21:24:36 +02:00
|
|
|
struct { /* IVL_ST_DISABLE */
|
|
|
|
|
ivl_scope_t scope;
|
|
|
|
|
} disable_;
|
|
|
|
|
|
2001-04-04 06:50:35 +02:00
|
|
|
struct { /* IVL_ST_FOREVER */
|
|
|
|
|
ivl_statement_t stmt_;
|
|
|
|
|
} forever_;
|
|
|
|
|
|
2008-09-27 01:54:13 +02:00
|
|
|
struct { /* IVL_ST_FREE */
|
|
|
|
|
ivl_scope_t scope;
|
|
|
|
|
} free_;
|
|
|
|
|
|
2000-09-22 05:58:30 +02:00
|
|
|
struct { /* IVL_ST_STASK */
|
2003-03-01 07:25:30 +01:00
|
|
|
const char*name_;
|
2010-08-12 04:01:58 +02:00
|
|
|
ivl_sfunc_as_task_t sfunc_as_task_;
|
2003-03-01 07:25:30 +01:00
|
|
|
unsigned nparm_;
|
2000-09-23 07:15:07 +02:00
|
|
|
ivl_expr_t*parms_;
|
2000-09-22 05:58:30 +02:00
|
|
|
} stask_;
|
|
|
|
|
|
2001-04-02 04:28:12 +02:00
|
|
|
struct { /* IVL_ST_UTASK */
|
|
|
|
|
ivl_scope_t def;
|
|
|
|
|
} utask_;
|
|
|
|
|
|
2003-12-03 03:46:23 +01:00
|
|
|
struct { /* IVL_ST_TRIGGER IVL_ST_WAIT */
|
|
|
|
|
unsigned nevent;
|
|
|
|
|
union {
|
|
|
|
|
ivl_event_t event;
|
|
|
|
|
ivl_event_t*events;
|
|
|
|
|
};
|
2000-09-18 03:24:32 +02:00
|
|
|
ivl_statement_t stmt_;
|
|
|
|
|
} wait_;
|
|
|
|
|
|
2001-04-05 05:20:57 +02:00
|
|
|
struct { /* IVL_ST_WHILE IVL_ST_REPEAT */
|
2001-04-01 08:52:27 +02:00
|
|
|
ivl_expr_t cond_;
|
2000-09-18 03:24:32 +02:00
|
|
|
ivl_statement_t stmt_;
|
|
|
|
|
} while_;
|
|
|
|
|
} u_;
|
|
|
|
|
};
|
|
|
|
|
|
2007-12-22 23:19:45 +01:00
|
|
|
/*
|
|
|
|
|
* The FILE_NAME function is a shorthand for attaching file/line
|
|
|
|
|
* information to the statement object.
|
|
|
|
|
*/
|
|
|
|
|
static inline void FILE_NAME(ivl_expr_t expr, const LineInfo*info)
|
|
|
|
|
{
|
|
|
|
|
expr->file = info->get_file();
|
|
|
|
|
expr->lineno = info->get_lineno();
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-10 06:03:08 +01:00
|
|
|
static inline void FILE_NAME(ivl_event_t event, const LineInfo*info)
|
|
|
|
|
{
|
|
|
|
|
event->file = info->get_file();
|
|
|
|
|
event->lineno = info->get_lineno();
|
|
|
|
|
}
|
|
|
|
|
|
2008-01-01 23:41:45 +01:00
|
|
|
static inline void FILE_NAME(ivl_lpm_t lpm, const LineInfo*info)
|
|
|
|
|
{
|
|
|
|
|
lpm->file = info->get_file();
|
|
|
|
|
lpm->lineno = info->get_lineno();
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-07 04:47:11 +01:00
|
|
|
static inline void FILE_NAME(ivl_net_const_t net, const LineInfo*info)
|
|
|
|
|
{
|
|
|
|
|
net->file = info->get_file();
|
|
|
|
|
net->lineno = info->get_lineno();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void FILE_NAME(ivl_net_logic_t net, const LineInfo*info)
|
|
|
|
|
{
|
|
|
|
|
net->file = info->get_file();
|
|
|
|
|
net->lineno = info->get_lineno();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void FILE_NAME(ivl_parameter_t net, const LineInfo*info)
|
|
|
|
|
{
|
|
|
|
|
net->file = info->get_file();
|
|
|
|
|
net->lineno = info->get_lineno();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void FILE_NAME(ivl_process_t net, const LineInfo*info)
|
|
|
|
|
{
|
|
|
|
|
net->file = info->get_file();
|
|
|
|
|
net->lineno = info->get_lineno();
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-30 03:58:25 +02:00
|
|
|
static inline void FILE_NAME(ivl_scope_t scope, const NetScope*info)
|
|
|
|
|
{
|
|
|
|
|
scope->file = info->get_file();
|
|
|
|
|
scope->def_file = info->get_def_file();
|
|
|
|
|
scope->lineno = info->get_lineno();
|
|
|
|
|
scope->def_lineno = info->get_def_lineno();
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-07 04:47:11 +01:00
|
|
|
static inline void FILE_NAME(ivl_statement_t stmt, const LineInfo*info)
|
2008-05-24 05:53:10 +02:00
|
|
|
{
|
2011-02-07 04:47:11 +01:00
|
|
|
stmt->file = info->get_file();
|
|
|
|
|
stmt->lineno = info->get_lineno();
|
2008-05-24 05:53:10 +02:00
|
|
|
}
|
|
|
|
|
|
2011-02-07 04:47:11 +01:00
|
|
|
static inline void FILE_NAME(ivl_switch_t net, const LineInfo*info)
|
2008-08-01 23:59:53 +02:00
|
|
|
{
|
|
|
|
|
net->file = info->get_file();
|
|
|
|
|
net->lineno = info->get_lineno();
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-08 21:35:27 +02:00
|
|
|
static inline void FILE_NAME(ivl_signal_t net, const LineInfo*info)
|
|
|
|
|
{
|
|
|
|
|
net->file = info->get_file();
|
|
|
|
|
net->lineno = info->get_lineno();
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-23 22:39:29 +02:00
|
|
|
#endif /* IVL_t_dll_H */
|