2014-07-23 22:39:29 +02:00
|
|
|
#ifndef IVL_pform_H
|
|
|
|
|
#define IVL_pform_H
|
1998-11-04 00:28:49 +01:00
|
|
|
/*
|
2021-01-18 22:01:23 +01:00
|
|
|
* Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com)
|
1998-11-04 00:28:49 +01: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.
|
1998-11-04 00:28:49 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
# include "netlist.h"
|
2001-12-03 05:47:14 +01:00
|
|
|
# include "HName.h"
|
2000-01-09 06:50:48 +01:00
|
|
|
# include "named.h"
|
1998-11-04 00:28:49 +01:00
|
|
|
# include "Module.h"
|
|
|
|
|
# include "Statement.h"
|
2008-07-27 21:02:09 +02:00
|
|
|
# include "AStatement.h"
|
1998-11-04 00:28:49 +01:00
|
|
|
# include "PGate.h"
|
|
|
|
|
# include "PExpr.h"
|
1999-07-03 04:12:51 +02:00
|
|
|
# include "PTask.h"
|
1998-11-25 03:35:53 +01:00
|
|
|
# include "PUdp.h"
|
1998-11-04 00:28:49 +01:00
|
|
|
# include "PWire.h"
|
|
|
|
|
# include "verinum.h"
|
2008-05-12 03:52:27 +02:00
|
|
|
# include "discipline.h"
|
2002-06-06 20:57:18 +02:00
|
|
|
# include <iostream>
|
1998-11-04 00:28:49 +01:00
|
|
|
# include <string>
|
|
|
|
|
# include <list>
|
2010-10-24 20:21:17 +02:00
|
|
|
# include <memory>
|
2010-05-31 22:12:06 +02:00
|
|
|
# include <cstdio>
|
1998-11-04 00:28:49 +01:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* These classes implement the parsed form (P-form for short) of the
|
2008-01-29 21:19:59 +01:00
|
|
|
* original Verilog source. the parser generates the pform for the
|
1998-11-04 00:28:49 +01:00
|
|
|
* convenience of later processing steps.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Wire objects represent the named wires (of various flavor) declared
|
|
|
|
|
* in the source.
|
|
|
|
|
*
|
|
|
|
|
* Gate objects are the functional modules that are connected together
|
|
|
|
|
* by wires.
|
|
|
|
|
*
|
|
|
|
|
* Wires and gates, connected by joints, represent a netlist. The
|
|
|
|
|
* netlist is therefore a representation of the desired circuit.
|
|
|
|
|
*/
|
|
|
|
|
class PGate;
|
|
|
|
|
class PExpr;
|
2013-04-01 00:46:36 +02:00
|
|
|
class PPackage;
|
2006-09-23 06:57:19 +02:00
|
|
|
class PSpecPath;
|
2012-03-11 21:18:24 +01:00
|
|
|
class PClass;
|
2012-10-21 20:42:19 +02:00
|
|
|
class PPackage;
|
1999-06-02 17:38:46 +02:00
|
|
|
struct vlltype;
|
2022-03-11 09:21:42 +01:00
|
|
|
struct lgate;
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2000-07-29 19:58:20 +02:00
|
|
|
/*
|
|
|
|
|
* The min:typ:max expression s selected at parse time using the
|
2003-01-30 17:23:07 +01:00
|
|
|
* enumeration. When the compiler makes a choice, it also prints a
|
2000-07-29 19:58:20 +02:00
|
|
|
* warning if min_typ_max_warn > 0.
|
|
|
|
|
*/
|
|
|
|
|
extern enum MIN_TYP_MAX { MIN, TYP, MAX } min_typ_max_flag;
|
|
|
|
|
extern unsigned min_typ_max_warn;
|
|
|
|
|
PExpr* pform_select_mtm_expr(PExpr*min, PExpr*typ, PExpr*max);
|
|
|
|
|
|
2007-04-19 04:52:53 +02:00
|
|
|
/*
|
|
|
|
|
* This flag is true if the lexor thinks we are in a library source
|
|
|
|
|
* file.
|
|
|
|
|
*/
|
|
|
|
|
extern bool pform_library_flag;
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
/*
|
|
|
|
|
* These type are lexical types -- that is, types that are used as
|
|
|
|
|
* lexical values to decorate the parse tree during parsing. They are
|
|
|
|
|
* not in any way preserved once parsing is done.
|
|
|
|
|
*/
|
|
|
|
|
|
1999-05-29 04:36:17 +02:00
|
|
|
/* This is information about port name information for named port
|
|
|
|
|
connections. */
|
2000-01-09 06:50:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
struct parmvalue_t {
|
2021-11-04 17:12:04 +01:00
|
|
|
std::list<PExpr*>*by_order;
|
|
|
|
|
std::list<named_pexpr_t>*by_name;
|
1999-05-29 04:36:17 +02:00
|
|
|
};
|
|
|
|
|
|
2010-03-16 23:16:53 +01:00
|
|
|
struct str_pair_t { ivl_drive_t str0, str1; };
|
2000-05-06 17:41:56 +02:00
|
|
|
|
2008-09-05 06:27:21 +02:00
|
|
|
/* Use this function to transform the parted form of the attribute
|
|
|
|
|
list to the attribute map that is used later. */
|
2021-11-04 17:12:04 +01:00
|
|
|
extern void pform_bind_attributes(std::map<perm_string,PExpr*>&attributes,
|
|
|
|
|
std::list<named_pexpr_t>*attr,
|
2010-11-13 03:47:06 +01:00
|
|
|
bool keep_attr =false);
|
2008-05-11 21:00:11 +02:00
|
|
|
|
2004-06-13 06:56:53 +02:00
|
|
|
/* The lexor calls this function to change the default nettype. */
|
|
|
|
|
extern void pform_set_default_nettype(NetNet::Type net,
|
|
|
|
|
const char*file,
|
|
|
|
|
unsigned lineno);
|
|
|
|
|
|
2012-05-06 19:21:51 +02:00
|
|
|
/* Return true if currently processing a program block. This can be
|
|
|
|
|
used to reject statements that cannot exist in program blocks. */
|
|
|
|
|
extern bool pform_in_program_block(void);
|
|
|
|
|
|
2014-12-20 00:10:14 +01:00
|
|
|
/* Return true if currently processing an interface. This can be
|
|
|
|
|
used to reject statements that cannot exist in interfaces. */
|
|
|
|
|
extern bool pform_in_interface(void);
|
|
|
|
|
|
2008-05-12 02:30:33 +02:00
|
|
|
/*
|
|
|
|
|
* Look for the given wire in the current lexical scope. If the wire
|
|
|
|
|
* (including variables of any type) cannot be found in the current
|
|
|
|
|
* scope, then return 0.
|
|
|
|
|
*/
|
|
|
|
|
extern PWire* pform_get_wire_in_scope(perm_string name);
|
|
|
|
|
|
2018-02-18 18:51:56 +01:00
|
|
|
extern PWire* pform_get_make_wire_in_scope(const struct vlltype&li,
|
|
|
|
|
perm_string name,
|
|
|
|
|
NetNet::Type net_type,
|
|
|
|
|
ivl_variable_type_t vt_type);
|
2011-12-04 02:16:01 +01:00
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
/*
|
|
|
|
|
* The parser uses startmodule and endmodule together to build up a
|
|
|
|
|
* module as it parses it. The startmodule tells the pform code that a
|
|
|
|
|
* module has been noticed in the source file and the following events
|
|
|
|
|
* are to apply to the scope of that module. The endmodule causes the
|
|
|
|
|
* pform to close up and finish the named module.
|
2012-05-01 06:12:59 +02:00
|
|
|
*
|
2014-12-20 00:10:14 +01:00
|
|
|
* The program_block flag indicates that the module is actually a program
|
|
|
|
|
* block. The is_interface flag indicates that the module is actually
|
|
|
|
|
* an interface. These flags have implications during parse and during
|
2012-05-01 06:12:59 +02:00
|
|
|
* elaboration/code generation.
|
1998-11-04 00:28:49 +01:00
|
|
|
*/
|
2012-05-01 06:12:59 +02:00
|
|
|
extern void pform_startmodule(const struct vlltype&loc, const char*name,
|
2014-12-20 00:10:14 +01:00
|
|
|
bool program_block, bool is_interface,
|
2016-03-19 18:27:27 +01:00
|
|
|
LexicalScope::lifetime_t lifetime,
|
2021-11-04 17:12:04 +01:00
|
|
|
std::list<named_pexpr_t>*attr);
|
|
|
|
|
extern void pform_module_set_ports(std::vector<Module::port_t*>*);
|
2017-11-05 18:50:05 +01:00
|
|
|
extern void pform_set_scope_timescale(const struct vlltype&loc);
|
2002-05-20 04:06:01 +02:00
|
|
|
|
2016-04-04 21:40:30 +02:00
|
|
|
/* These functions are used when we have a complete port definition, either
|
|
|
|
|
in an ansi style or non-ansi style declaration. In this case, we have
|
|
|
|
|
everything needed to define the port, all in one place. */
|
2002-05-20 04:06:01 +02:00
|
|
|
extern void pform_module_define_port(const struct vlltype&li,
|
2008-02-25 04:40:54 +01:00
|
|
|
perm_string name,
|
2002-05-20 04:06:01 +02:00
|
|
|
NetNet::PortType,
|
|
|
|
|
NetNet::Type type,
|
2012-04-13 05:20:37 +02:00
|
|
|
data_type_t*vtype,
|
2022-04-11 09:48:29 +02:00
|
|
|
std::list<pform_range_t>*urange,
|
2021-11-04 17:12:04 +01:00
|
|
|
std::list<named_pexpr_t>*attr,
|
2016-04-04 21:40:30 +02:00
|
|
|
bool keep_attr =false);
|
|
|
|
|
extern void pform_module_define_port(const struct vlltype&li,
|
2021-11-04 17:12:04 +01:00
|
|
|
std::list<pform_port_t>*ports,
|
2016-04-04 21:40:30 +02:00
|
|
|
NetNet::PortType,
|
|
|
|
|
NetNet::Type type,
|
|
|
|
|
data_type_t*vtype,
|
2021-11-04 17:12:04 +01:00
|
|
|
std::list<named_pexpr_t>*attr);
|
2002-05-20 04:06:01 +02:00
|
|
|
|
2022-01-10 11:21:14 +01:00
|
|
|
extern Module::port_t* pform_module_port_reference(const struct vlltype&loc,
|
|
|
|
|
perm_string name);
|
2010-06-02 04:24:09 +02:00
|
|
|
extern void pform_endmodule(const char*, bool inside_celldefine,
|
|
|
|
|
Module::UCDriveType uc_drive_def);
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2012-03-11 21:18:24 +01:00
|
|
|
extern void pform_start_class_declaration(const struct vlltype&loc,
|
2013-10-31 02:35:00 +01:00
|
|
|
class_type_t*type,
|
2013-11-10 17:21:22 +01:00
|
|
|
data_type_t*base_type,
|
2016-03-19 18:27:27 +01:00
|
|
|
std::list<PExpr*>*base_exprs,
|
2022-09-19 20:23:02 +02:00
|
|
|
bool virtual_class);
|
2012-11-04 01:41:11 +01:00
|
|
|
extern void pform_class_property(const struct vlltype&loc,
|
|
|
|
|
property_qualifier_t pq,
|
|
|
|
|
data_type_t*data_type,
|
|
|
|
|
std::list<decl_assignment_t*>*decls);
|
2013-03-15 04:08:32 +01:00
|
|
|
extern void pform_set_this_class(const struct vlltype&loc, PTaskFunc*net);
|
2013-04-15 03:03:21 +02:00
|
|
|
extern void pform_set_constructor_return(PFunction*net);
|
2013-03-02 23:51:44 +01:00
|
|
|
|
2013-06-17 00:14:50 +02:00
|
|
|
extern void pform_end_class_declaration(const struct vlltype&loc);
|
2022-02-05 11:29:27 +01:00
|
|
|
extern bool pform_in_class();
|
2012-03-11 21:18:24 +01:00
|
|
|
|
2022-01-10 11:21:14 +01:00
|
|
|
extern void pform_make_udp(const struct vlltype&loc, perm_string name,
|
|
|
|
|
std::list<perm_string>*parms,
|
2021-11-04 17:12:04 +01:00
|
|
|
std::vector<PWire*>*decl, std::list<std::string>*table,
|
2022-01-10 11:21:14 +01:00
|
|
|
Statement*init);
|
1998-11-25 03:35:53 +01:00
|
|
|
|
2022-01-10 11:21:14 +01:00
|
|
|
extern void pform_make_udp(const struct vlltype&loc, perm_string name,
|
2004-03-08 01:10:29 +01:00
|
|
|
bool sync_flag, perm_string out_name,
|
|
|
|
|
PExpr*sync_init,
|
2021-11-04 17:12:04 +01:00
|
|
|
std::list<perm_string>*parms,
|
2022-01-10 11:21:14 +01:00
|
|
|
std::list<std::string>*table);
|
2013-02-15 02:53:47 +01:00
|
|
|
/*
|
|
|
|
|
* Package related functions.
|
|
|
|
|
*/
|
|
|
|
|
extern void pform_start_package_declaration(const struct vlltype&loc,
|
2016-03-19 18:27:27 +01:00
|
|
|
const char*type,
|
|
|
|
|
LexicalScope::lifetime_t lifetime);
|
2013-02-15 02:53:47 +01:00
|
|
|
extern void pform_end_package_declaration(const struct vlltype&loc);
|
|
|
|
|
extern void pform_package_import(const struct vlltype&loc,
|
2013-04-01 00:46:36 +02:00
|
|
|
PPackage*pkg, const char*ident);
|
2022-10-03 19:05:55 +02:00
|
|
|
extern void pform_package_export(const struct vlltype &loc, PPackage *pkg,
|
|
|
|
|
const char *ident);
|
|
|
|
|
PPackage *pform_package_importable(PPackage *pkg, perm_string name);
|
|
|
|
|
PPackage *pform_find_potential_import(const struct vlltype&loc, LexicalScope*scope,
|
|
|
|
|
perm_string name, bool tf_call, bool make_explicit);
|
|
|
|
|
|
2004-03-08 01:10:29 +01:00
|
|
|
|
2013-02-17 23:42:07 +01:00
|
|
|
extern PExpr* pform_package_ident(const struct vlltype&loc,
|
2013-04-08 01:38:48 +02:00
|
|
|
PPackage*pkg, pform_name_t*ident);
|
2013-02-17 23:42:07 +01:00
|
|
|
|
2015-01-10 12:09:42 +01:00
|
|
|
/*
|
|
|
|
|
* Interface related functions.
|
|
|
|
|
*/
|
|
|
|
|
extern void pform_start_modport_item(const struct vlltype&loc, const char*name);
|
|
|
|
|
extern void pform_end_modport_item(const struct vlltype&loc);
|
|
|
|
|
extern void pform_add_modport_port(const struct vlltype&loc,
|
|
|
|
|
NetNet::PortType port_type,
|
2015-01-16 02:46:54 +01:00
|
|
|
perm_string name, PExpr*expr);
|
2015-01-10 12:09:42 +01:00
|
|
|
|
2013-02-18 01:22:24 +01:00
|
|
|
/*
|
|
|
|
|
* This creates an identifier aware of names that may have been
|
|
|
|
|
* imported from other packages.
|
|
|
|
|
*/
|
2019-09-27 00:35:57 +02:00
|
|
|
extern PEIdent* pform_new_ident(const struct vlltype&loc, const pform_name_t&name);
|
2013-02-18 01:22:24 +01:00
|
|
|
|
2019-09-29 22:11:01 +02:00
|
|
|
extern PTrigger* pform_new_trigger(const struct vlltype&loc, PPackage*pkg,
|
|
|
|
|
const pform_name_t&name);
|
2021-02-20 08:21:12 +01:00
|
|
|
extern PNBTrigger* pform_new_nb_trigger(const struct vlltype&loc,
|
2021-11-04 17:12:04 +01:00
|
|
|
const std::list<PExpr*>*dly,
|
2021-02-20 08:21:12 +01:00
|
|
|
const pform_name_t&name);
|
2019-09-28 22:00:17 +02:00
|
|
|
|
1999-06-24 06:24:18 +02:00
|
|
|
/*
|
2001-12-03 05:47:14 +01:00
|
|
|
* Enter/exit name scopes. The push_scope function pushes the scope
|
|
|
|
|
* name string onto the scope hierarchy. The pop pulls it off and
|
|
|
|
|
* deletes it. Thus, the string pushed must be allocated.
|
1999-06-24 06:24:18 +02:00
|
|
|
*/
|
|
|
|
|
extern void pform_pop_scope();
|
|
|
|
|
|
2013-02-15 02:53:47 +01:00
|
|
|
/*
|
|
|
|
|
* Peek at the current (most recently active) scope.
|
|
|
|
|
*/
|
|
|
|
|
extern LexicalScope* pform_peek_scope();
|
|
|
|
|
|
2022-12-19 00:55:09 +01:00
|
|
|
extern PClass* pform_push_class_scope(const struct vlltype&loc, perm_string name);
|
2016-03-19 18:27:27 +01:00
|
|
|
|
2013-04-15 03:03:21 +02:00
|
|
|
extern PFunction*pform_push_constructor_scope(const struct vlltype&loc);
|
2016-03-19 18:27:27 +01:00
|
|
|
|
|
|
|
|
extern PPackage* pform_push_package_scope(const struct vlltype&loc, perm_string name,
|
|
|
|
|
LexicalScope::lifetime_t lifetime);
|
|
|
|
|
|
2009-04-25 04:07:48 +02:00
|
|
|
extern PTask*pform_push_task_scope(const struct vlltype&loc, char*name,
|
2016-03-19 18:27:27 +01:00
|
|
|
LexicalScope::lifetime_t lifetime);
|
|
|
|
|
|
2013-04-15 03:03:21 +02:00
|
|
|
extern PFunction*pform_push_function_scope(const struct vlltype&loc, const char*name,
|
2016-03-19 18:27:27 +01:00
|
|
|
LexicalScope::lifetime_t lifetime);
|
|
|
|
|
|
2019-09-27 01:46:39 +02:00
|
|
|
extern PBlock*pform_push_block_scope(const struct vlltype&loc, char*name,
|
|
|
|
|
PBlock::BL_TYPE tt);
|
2008-02-16 06:20:24 +01:00
|
|
|
|
2008-07-27 21:02:09 +02:00
|
|
|
extern void pform_put_behavior_in_scope(AProcess*proc);
|
2003-04-14 05:37:47 +02:00
|
|
|
|
|
|
|
|
extern verinum* pform_verinum_with_size(verinum*s, verinum*val,
|
2008-05-06 04:46:30 +02:00
|
|
|
const char*file, unsigned lineno);
|
2003-04-14 05:37:47 +02:00
|
|
|
|
2006-04-10 02:37:42 +02:00
|
|
|
/*
|
|
|
|
|
* This function takes the list of names as new genvars to declare in
|
2009-08-22 14:57:40 +02:00
|
|
|
* the current module or generate scope.
|
2006-04-10 02:37:42 +02:00
|
|
|
*/
|
2021-11-04 17:12:04 +01:00
|
|
|
extern void pform_genvars(const struct vlltype&li, std::list<perm_string>*names);
|
2006-04-10 02:37:42 +02:00
|
|
|
|
2021-08-03 22:29:46 +02:00
|
|
|
/*
|
|
|
|
|
* This flag is set by the parser to indicate the current generate block
|
|
|
|
|
* was not enclosed in a begin-end pair. This is a pre-requisite for
|
|
|
|
|
* directly nesting generate constructs.
|
|
|
|
|
*/
|
|
|
|
|
extern bool pform_generate_single_item;
|
|
|
|
|
|
2006-04-10 02:37:42 +02:00
|
|
|
extern void pform_start_generate_for(const struct vlltype&li,
|
2020-01-31 21:29:22 +01:00
|
|
|
bool local_index,
|
2006-04-10 02:37:42 +02:00
|
|
|
char*ident1,
|
|
|
|
|
PExpr*init,
|
|
|
|
|
PExpr*test,
|
|
|
|
|
char*ident2,
|
|
|
|
|
PExpr*next);
|
2007-06-22 04:04:48 +02:00
|
|
|
extern void pform_start_generate_if(const struct vlltype&li, PExpr*test);
|
|
|
|
|
extern void pform_start_generate_else(const struct vlltype&li);
|
2008-02-10 07:19:42 +01:00
|
|
|
extern void pform_start_generate_case(const struct vlltype&lp, PExpr*test);
|
2008-11-15 03:35:39 +01:00
|
|
|
extern void pform_start_generate_nblock(const struct vlltype&lp, char*name);
|
2021-11-04 17:12:04 +01:00
|
|
|
extern void pform_generate_case_item(const struct vlltype&lp, std::list<PExpr*>*test);
|
2006-04-10 02:37:42 +02:00
|
|
|
extern void pform_generate_block_name(char*name);
|
2019-09-27 00:35:57 +02:00
|
|
|
extern void pform_endgenerate(bool end_conditional);
|
2006-04-10 02:37:42 +02:00
|
|
|
|
2010-03-12 01:06:02 +01:00
|
|
|
/*
|
|
|
|
|
* This function returns the lexically containing generate scheme, if
|
|
|
|
|
* there is one. The parser may use this to check if we are within a
|
|
|
|
|
* generate scheme.
|
|
|
|
|
*/
|
|
|
|
|
extern PGenerate* pform_parent_generate(void);
|
2006-04-10 02:37:42 +02:00
|
|
|
|
2022-02-03 10:48:42 +01:00
|
|
|
bool pform_error_in_generate(const vlltype&loc, const char *type);
|
|
|
|
|
|
2021-02-01 09:20:09 +01:00
|
|
|
extern void pform_make_elab_task(const struct vlltype&li,
|
|
|
|
|
perm_string name,
|
|
|
|
|
const std::list<PExpr*>¶ms);
|
|
|
|
|
|
2022-04-23 15:05:53 +02:00
|
|
|
extern void pform_set_typedef(const struct vlltype&loc, perm_string name,
|
|
|
|
|
data_type_t*data_type,
|
2022-03-31 15:08:51 +02:00
|
|
|
std::list<pform_range_t>*unp_ranges = nullptr);
|
|
|
|
|
extern void pform_forward_typedef(const struct vlltype&loc, perm_string name,
|
|
|
|
|
enum typedef_t::basic_type basic_type);
|
2012-01-09 02:51:18 +01:00
|
|
|
|
2019-09-29 20:16:35 +02:00
|
|
|
extern void pform_set_type_referenced(const struct vlltype&loc, const char*name);
|
|
|
|
|
|
2013-04-01 00:46:36 +02:00
|
|
|
/*
|
2019-09-22 10:16:10 +02:00
|
|
|
* This function makes a PECallFunction of the named function.
|
2013-04-01 00:46:36 +02:00
|
|
|
*/
|
|
|
|
|
extern PECallFunction* pform_make_call_function(const struct vlltype&loc,
|
|
|
|
|
const pform_name_t&name,
|
2013-04-09 03:12:54 +02:00
|
|
|
const std::list<PExpr*>&parms);
|
|
|
|
|
extern PCallTask* pform_make_call_task(const struct vlltype&loc,
|
|
|
|
|
const pform_name_t&name,
|
|
|
|
|
const std::list<PExpr*>&parms);
|
|
|
|
|
|
2014-08-22 00:47:46 +02:00
|
|
|
extern void pform_make_foreach_declarations(const struct vlltype&loc,
|
|
|
|
|
std::list<perm_string>*loop_vars);
|
|
|
|
|
extern PForeach* pform_make_foreach(const struct vlltype&loc,
|
|
|
|
|
char*ident,
|
|
|
|
|
std::list<perm_string>*loop_vars,
|
|
|
|
|
Statement*stmt);
|
2013-04-01 00:46:36 +02:00
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
/*
|
|
|
|
|
* The makewire functions announce to the pform code new wires. These
|
|
|
|
|
* go into a module that is currently opened.
|
|
|
|
|
*/
|
2022-04-17 20:57:03 +02:00
|
|
|
extern PWire *pform_makewire(const struct vlltype&li, perm_string name,
|
|
|
|
|
NetNet::Type type,
|
|
|
|
|
std::list<pform_range_t> *indices);
|
2002-05-20 04:06:01 +02:00
|
|
|
|
2005-07-07 18:22:49 +02:00
|
|
|
/* This form handles assignment declarations. */
|
|
|
|
|
|
2013-04-08 01:38:48 +02:00
|
|
|
extern void pform_makewire(const struct vlltype&li,
|
|
|
|
|
std::list<PExpr*>*delay,
|
|
|
|
|
str_pair_t str,
|
|
|
|
|
std::list<decl_assignment_t*>*assign_list,
|
|
|
|
|
NetNet::Type type,
|
2022-01-22 09:56:07 +01:00
|
|
|
data_type_t*data_type,
|
|
|
|
|
std::list<named_pexpr_t>*attr = 0);
|
2013-04-08 01:38:48 +02:00
|
|
|
|
2022-01-22 17:22:18 +01:00
|
|
|
extern void pform_make_var(const struct vlltype&loc,
|
|
|
|
|
std::list<decl_assignment_t*>*assign_list,
|
|
|
|
|
data_type_t*data_type,
|
|
|
|
|
std::list<named_pexpr_t>*attr = 0);
|
2011-12-18 21:00:18 +01:00
|
|
|
|
2016-03-19 14:04:38 +01:00
|
|
|
extern void pform_make_var_init(const struct vlltype&li,
|
|
|
|
|
perm_string name, PExpr*expr);
|
2002-05-20 01:37:28 +02:00
|
|
|
|
2016-04-04 21:40:30 +02:00
|
|
|
/* This function is used when we have an incomplete port definition in
|
|
|
|
|
a non-ansi style declaration. Look up the names of the wires, and set
|
|
|
|
|
the port type, i.e. input, output or inout, and, if specified, the
|
|
|
|
|
range and signedness. If the wire does not exist, create it. */
|
2001-11-10 03:08:49 +01:00
|
|
|
extern void pform_set_port_type(const struct vlltype&li,
|
2021-11-04 17:12:04 +01:00
|
|
|
std::list<pform_port_t>*ports,
|
2013-05-19 10:16:24 +02:00
|
|
|
NetNet::PortType,
|
2016-04-04 21:40:30 +02:00
|
|
|
data_type_t*dt,
|
2021-11-04 17:12:04 +01:00
|
|
|
std::list<named_pexpr_t>*attr);
|
2012-03-10 03:54:05 +01:00
|
|
|
|
2022-04-17 20:57:03 +02:00
|
|
|
extern void pform_set_data_type(const struct vlltype&li,
|
|
|
|
|
data_type_t *data_type,
|
|
|
|
|
std::vector<PWire*> *wires,
|
|
|
|
|
NetNet::Type net_type,
|
|
|
|
|
std::list<named_pexpr_t>*attr);
|
2010-10-24 20:21:17 +02:00
|
|
|
|
2018-02-18 18:51:56 +01:00
|
|
|
extern void pform_set_string_type(const struct vlltype&li, const string_type_t*string_type, std::list<perm_string>*names, NetNet::Type net_type, std::list<named_pexpr_t>*attr);
|
2011-12-04 02:16:01 +01:00
|
|
|
|
2018-02-18 18:51:56 +01:00
|
|
|
extern void pform_set_class_type(const struct vlltype&li, class_type_t*class_type, std::list<perm_string>*names, NetNet::Type net_type, std::list<named_pexpr_t>*addr);
|
2012-11-12 02:42:31 +01:00
|
|
|
|
|
|
|
|
|
2002-05-23 05:08:50 +02:00
|
|
|
/* pform_set_attrib and pform_set_type_attrib exist to support the
|
|
|
|
|
$attribute syntax, which can only set string values to
|
|
|
|
|
attributes. The functions keep the value strings that are
|
|
|
|
|
passed in. */
|
2004-02-20 19:53:33 +01:00
|
|
|
extern void pform_set_attrib(perm_string name, perm_string key,
|
2002-05-23 05:08:50 +02:00
|
|
|
char*value);
|
2021-11-04 17:12:04 +01:00
|
|
|
extern void pform_set_type_attrib(perm_string name, const std::string&key,
|
2002-05-23 05:08:50 +02:00
|
|
|
char*value);
|
|
|
|
|
|
2008-09-17 22:25:59 +02:00
|
|
|
extern LexicalScope::range_t* pform_parameter_value_range(bool exclude_flag,
|
2008-05-13 06:26:38 +02:00
|
|
|
bool low_open, PExpr*low_expr,
|
|
|
|
|
bool hig_open, PExpr*hig_expr);
|
|
|
|
|
|
|
|
|
|
extern void pform_set_parameter(const struct vlltype&loc,
|
|
|
|
|
perm_string name,
|
2021-12-20 17:00:24 +01:00
|
|
|
bool is_local, bool is_type,
|
2020-12-25 03:12:06 +01:00
|
|
|
data_type_t*data_type,
|
2008-09-17 22:25:59 +02:00
|
|
|
PExpr*expr, LexicalScope::range_t*value_range);
|
2012-05-07 00:11:26 +02:00
|
|
|
extern void pform_set_specparam(const struct vlltype&loc,
|
|
|
|
|
perm_string name,
|
2021-11-04 17:12:04 +01:00
|
|
|
std::list<pform_range_t>*range,
|
2012-05-07 00:11:26 +02:00
|
|
|
PExpr*expr);
|
2007-05-24 06:07:11 +02:00
|
|
|
extern void pform_set_defparam(const pform_name_t&name, PExpr*expr);
|
2002-05-26 03:39:02 +02:00
|
|
|
|
2021-01-18 22:01:23 +01:00
|
|
|
extern void pform_make_let(const struct vlltype&loc,
|
|
|
|
|
perm_string name,
|
2021-11-04 17:12:04 +01:00
|
|
|
std::list<PLet::let_port_t*>*ports,
|
2021-01-18 22:01:23 +01:00
|
|
|
PExpr*expr);
|
|
|
|
|
|
|
|
|
|
extern PLet::let_port_t* pform_make_let_port(data_type_t*data_type,
|
|
|
|
|
perm_string name,
|
2021-11-04 17:12:04 +01:00
|
|
|
std::list<pform_range_t>*range,
|
2021-01-18 22:01:23 +01:00
|
|
|
PExpr*def);
|
|
|
|
|
|
2003-02-27 07:45:11 +01:00
|
|
|
/*
|
|
|
|
|
* Functions related to specify blocks.
|
|
|
|
|
*/
|
2006-09-23 06:57:19 +02:00
|
|
|
extern PSpecPath*pform_make_specify_path(const struct vlltype&li,
|
2021-11-04 17:12:04 +01:00
|
|
|
std::list<perm_string>*src, char pol,
|
|
|
|
|
bool full_flag, std::list<perm_string>*dst);
|
2007-02-12 02:52:21 +01:00
|
|
|
extern PSpecPath*pform_make_specify_edge_path(const struct vlltype&li,
|
2007-04-13 04:34:35 +02:00
|
|
|
int edge_flag, /*posedge==true */
|
2021-11-04 17:12:04 +01:00
|
|
|
std::list<perm_string>*src, char pol,
|
|
|
|
|
bool full_flag, std::list<perm_string>*dst,
|
2007-02-12 02:52:21 +01:00
|
|
|
PExpr*data_source_expression);
|
2021-11-04 17:12:04 +01:00
|
|
|
extern PSpecPath*pform_assign_path_delay(PSpecPath*obj, std::list<PExpr*>*delays);
|
2007-02-12 02:52:21 +01:00
|
|
|
|
2006-09-23 06:57:19 +02:00
|
|
|
extern void pform_module_specify_path(PSpecPath*obj);
|
2003-02-27 07:45:11 +01:00
|
|
|
|
2002-05-26 03:39:02 +02:00
|
|
|
/*
|
|
|
|
|
* pform_make_behavior creates processes that are declared with always
|
|
|
|
|
* or initial items.
|
|
|
|
|
*/
|
2008-10-22 07:15:49 +02:00
|
|
|
extern PProcess* pform_make_behavior(ivl_process_type_t, Statement*,
|
2021-11-04 17:12:04 +01:00
|
|
|
std::list<named_pexpr_t>*attr);
|
2014-07-16 03:03:40 +02:00
|
|
|
extern void pform_mc_translate_on(bool flag);
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2021-11-04 17:12:04 +01:00
|
|
|
extern std::vector<PWire*>* pform_make_udp_input_ports(std::list<perm_string>*);
|
1998-11-25 03:35:53 +01:00
|
|
|
|
2022-01-10 11:21:14 +01:00
|
|
|
extern void pform_make_events(const struct vlltype&loc,
|
|
|
|
|
std::list<perm_string>*names);
|
1998-11-04 00:28:49 +01:00
|
|
|
/*
|
|
|
|
|
* The makegate function creates a new gate (which need not have a
|
|
|
|
|
* name) and connects it to the specified wires.
|
|
|
|
|
*/
|
2012-05-15 04:13:57 +02:00
|
|
|
extern void pform_makegates(const struct vlltype&loc,
|
|
|
|
|
PGBuiltin::Type type,
|
2000-05-08 07:30:19 +02:00
|
|
|
struct str_pair_t str,
|
2021-11-04 17:12:04 +01:00
|
|
|
std::list<PExpr*>*delay,
|
2022-02-17 10:48:43 +01:00
|
|
|
std::vector<lgate>*gates,
|
2021-11-04 17:12:04 +01:00
|
|
|
std::list<named_pexpr_t>*attr);
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2012-05-15 04:13:57 +02:00
|
|
|
extern void pform_make_modgates(const struct vlltype&loc,
|
|
|
|
|
perm_string type,
|
2000-01-09 06:50:48 +01:00
|
|
|
struct parmvalue_t*overrides,
|
2022-02-17 10:48:43 +01:00
|
|
|
std::vector<lgate>*gates,
|
2021-11-04 17:12:04 +01:00
|
|
|
std::list<named_pexpr_t>*attr);
|
1998-11-04 00:28:49 +01:00
|
|
|
|
|
|
|
|
/* Make a continuous assignment node, with optional bit- or part- select. */
|
2022-01-10 11:21:14 +01:00
|
|
|
extern void pform_make_pgassign_list(const struct vlltype&loc,
|
|
|
|
|
std::list<PExpr*>*alist,
|
2021-11-04 17:12:04 +01:00
|
|
|
std::list<PExpr*>*del,
|
2022-01-10 11:21:14 +01:00
|
|
|
struct str_pair_t str);
|
1999-07-24 04:11:19 +02:00
|
|
|
|
2013-09-14 02:04:25 +02:00
|
|
|
extern std::vector<pform_tf_port_t>*pform_make_task_ports(const struct vlltype&loc,
|
2012-02-19 19:29:50 +01:00
|
|
|
NetNet::PortType pt,
|
|
|
|
|
data_type_t*vtype,
|
2022-02-19 22:44:02 +01:00
|
|
|
std::list<pform_port_t>*ports,
|
2022-01-04 16:16:08 +01:00
|
|
|
bool allow_implicit = false);
|
2012-02-19 19:29:50 +01:00
|
|
|
|
2012-02-20 03:54:58 +01:00
|
|
|
/*
|
|
|
|
|
* The parser uses this function to convert a unary
|
2012-04-07 01:38:38 +02:00
|
|
|
* increment/decrement expression to the equivalent compressed
|
2012-02-20 03:54:58 +01:00
|
|
|
* assignment statement.
|
|
|
|
|
*/
|
|
|
|
|
extern PAssign* pform_compressed_assign_from_inc_dec(const struct vlltype&loc,
|
|
|
|
|
PExpr*exp);
|
1999-07-24 04:11:19 +02:00
|
|
|
|
2020-01-30 22:45:04 +01:00
|
|
|
/*
|
|
|
|
|
* The parser uses this function to convert a genvar increment/decrement
|
|
|
|
|
* expression to the equivalent binary add/subtract expression.
|
|
|
|
|
*/
|
|
|
|
|
extern PExpr* pform_genvar_inc_dec(const struct vlltype&loc, const char*name,
|
|
|
|
|
bool inc_flag);
|
|
|
|
|
|
2022-10-04 00:09:25 +02:00
|
|
|
extern PExpr* pform_genvar_compressed(const struct vlltype &loc,
|
|
|
|
|
const char *name, char op, PExpr *rval);
|
|
|
|
|
|
1998-11-04 00:28:49 +01:00
|
|
|
/*
|
|
|
|
|
* These are functions that the outside-the-parser code uses the do
|
2008-01-29 21:19:59 +01:00
|
|
|
* interesting things to the Verilog. The parse function reads and
|
1998-11-04 00:28:49 +01:00
|
|
|
* parses the source file and places all the modules it finds into the
|
|
|
|
|
* mod list. The dump function dumps a module to the output stream.
|
|
|
|
|
*/
|
2021-11-04 17:12:04 +01:00
|
|
|
extern void pform_dump(std::ostream&out, Module*mod);
|
1998-11-04 00:28:49 +01:00
|
|
|
|
2008-05-11 21:00:11 +02:00
|
|
|
/* ** pform_discipline.cc
|
|
|
|
|
* Functions for handling the parse of natures and disciplines. These
|
|
|
|
|
* functions are in pform_disciplines.cc
|
|
|
|
|
*/
|
|
|
|
|
|
2008-05-12 03:52:27 +02:00
|
|
|
extern void pform_start_nature(const char*name);
|
|
|
|
|
extern void pform_end_nature(const struct vlltype&loc);
|
|
|
|
|
|
|
|
|
|
extern void pform_nature_access(const struct vlltype&loc, const char*name);
|
|
|
|
|
|
2008-05-11 21:00:11 +02:00
|
|
|
extern void pform_start_discipline(const char*name);
|
|
|
|
|
extern void pform_end_discipline(const struct vlltype&loc);
|
|
|
|
|
|
2008-11-02 17:10:41 +01:00
|
|
|
extern void pform_discipline_domain(const struct vlltype&loc, ivl_dis_domain_t use_domain);
|
2008-05-12 03:52:27 +02:00
|
|
|
extern void pform_discipline_potential(const struct vlltype&loc, const char*name);
|
|
|
|
|
extern void pform_discipline_flow(const struct vlltype&loc, const char*name);
|
|
|
|
|
|
2008-05-11 21:00:11 +02:00
|
|
|
extern void pform_attach_discipline(const struct vlltype&loc,
|
2021-11-04 17:12:04 +01:00
|
|
|
ivl_discipline_t discipline, std::list<perm_string>*names);
|
2008-05-11 21:00:11 +02:00
|
|
|
|
2021-11-04 17:12:04 +01:00
|
|
|
extern void pform_dump(std::ostream&out, const ivl_nature_s*);
|
|
|
|
|
extern void pform_dump(std::ostream&out, const ivl_discipline_s*);
|
2008-05-11 21:00:11 +02:00
|
|
|
|
2008-07-27 21:02:09 +02:00
|
|
|
/* ** pform_analog.cc
|
|
|
|
|
*/
|
|
|
|
|
extern void pform_make_analog_behavior(const struct vlltype&loc,
|
2008-10-23 06:56:00 +02:00
|
|
|
ivl_process_type_t type, Statement*st);
|
2008-07-27 21:02:09 +02:00
|
|
|
|
2008-10-23 06:56:00 +02:00
|
|
|
extern AContrib*pform_contribution_statement(const struct vlltype&loc,
|
|
|
|
|
PExpr*lval, PExpr*rval);
|
2008-07-27 21:02:09 +02:00
|
|
|
|
2008-07-27 23:22:19 +02:00
|
|
|
extern PExpr* pform_make_branch_probe_expression(const struct vlltype&loc,
|
|
|
|
|
char*name, char*n1, char*n2);
|
|
|
|
|
|
|
|
|
|
extern PExpr* pform_make_branch_probe_expression(const struct vlltype&loc,
|
|
|
|
|
char*name, char*branch);
|
2009-08-06 23:42:13 +02:00
|
|
|
|
2010-10-02 20:02:27 +02:00
|
|
|
/*
|
2009-08-06 23:42:13 +02:00
|
|
|
* Parse configuration file with format <key>=<value>, where key
|
|
|
|
|
* is the hierarchical name of a valid parameter name and value
|
|
|
|
|
* is the value user wants to assign to. The value should be constant.
|
|
|
|
|
*/
|
2021-11-04 17:12:04 +01:00
|
|
|
extern void parm_to_defparam_list(const std::string¶m);
|
2009-08-06 23:42:13 +02:00
|
|
|
|
2009-06-20 05:58:46 +02:00
|
|
|
/*
|
2009-07-11 03:19:59 +02:00
|
|
|
* Tasks to set the timeunit or timeprecision for SystemVerilog.
|
2009-06-20 05:58:46 +02:00
|
|
|
*/
|
2011-07-05 19:11:56 +02:00
|
|
|
extern bool get_time_unit(const char*cp, int &unit);
|
|
|
|
|
extern int pform_get_timeunit();
|
2021-02-13 10:10:38 +01:00
|
|
|
extern int pform_get_timeprec();
|
2017-11-06 01:37:56 +01:00
|
|
|
extern void pform_set_timeunit(const char*txt, bool initial_decl);
|
|
|
|
|
extern void pform_set_timeprec(const char*txt, bool initial_decl);
|
|
|
|
|
/*
|
|
|
|
|
* Flags to determine whether this is an initial declaration.
|
|
|
|
|
*/
|
|
|
|
|
extern bool allow_timeunit_decl;
|
|
|
|
|
extern bool allow_timeprec_decl;
|
2009-06-20 05:58:46 +02:00
|
|
|
|
2022-01-15 13:08:32 +01:00
|
|
|
void pform_put_enum_type_in_scope(enum_type_t*enum_set);
|
|
|
|
|
|
2022-02-05 10:49:34 +01:00
|
|
|
bool pform_requires_sv(const struct vlltype&loc, const char *feature);
|
|
|
|
|
|
2022-02-10 14:03:46 +01:00
|
|
|
void pform_start_parameter_port_list();
|
|
|
|
|
void pform_end_parameter_port_list();
|
|
|
|
|
|
2022-01-20 15:59:28 +01:00
|
|
|
void pform_check_net_data_type(const struct vlltype&loc, NetNet::Type net_type,
|
|
|
|
|
const data_type_t *data_type);
|
|
|
|
|
|
2014-07-23 22:39:29 +02:00
|
|
|
#endif /* IVL_pform_H */
|