2010-03-25 19:09:50 +01:00
|
|
|
#ifndef __vlog95_priv_H
|
|
|
|
|
#define __vlog95_priv_H
|
|
|
|
|
/*
|
2013-03-11 18:43:29 +01:00
|
|
|
* Copyright (C) 2010-2013 Cary R. (cygcary@yahoo.com)
|
2010-03-25 19:09:50 +01:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it 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.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
# include "config.h"
|
|
|
|
|
# include "ivl_target.h"
|
2011-01-13 23:11:41 +01:00
|
|
|
# include <inttypes.h>
|
2010-03-25 19:09:50 +01:00
|
|
|
# include <stdio.h>
|
|
|
|
|
# include <assert.h>
|
|
|
|
|
|
2011-01-17 19:51:05 +01:00
|
|
|
/*
|
|
|
|
|
* The design we are emitting.
|
|
|
|
|
*/
|
|
|
|
|
extern ivl_design_t design;
|
|
|
|
|
|
2010-03-25 19:09:50 +01:00
|
|
|
/*
|
|
|
|
|
* This is the file that the converted design is written to.
|
|
|
|
|
*/
|
|
|
|
|
extern FILE*vlog_out;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Keep a count of the fatal errors that happen during code generation.
|
|
|
|
|
*/
|
|
|
|
|
extern int vlog_errors;
|
|
|
|
|
|
2011-01-10 18:30:27 +01:00
|
|
|
/*
|
|
|
|
|
* Keep the simulation time precision so that we can scale delays.
|
|
|
|
|
*/
|
|
|
|
|
extern int sim_precision;
|
|
|
|
|
|
2013-07-05 19:33:23 +02:00
|
|
|
/*
|
|
|
|
|
* The expression code needs to know when a parameter definition is being
|
|
|
|
|
* emitted so it can emit the numeric value instead of the name.
|
|
|
|
|
*/
|
|
|
|
|
extern ivl_parameter_t emitting_param;
|
|
|
|
|
|
2013-07-19 19:48:39 +02:00
|
|
|
/*
|
|
|
|
|
* The statement code needs to know what name to use for a translated
|
|
|
|
|
* function return statement (disable).
|
|
|
|
|
*/
|
|
|
|
|
extern const char *func_rtn_name;
|
|
|
|
|
|
2011-01-10 18:30:27 +01:00
|
|
|
/*
|
|
|
|
|
* Keep the current indent level.
|
|
|
|
|
*/
|
|
|
|
|
extern unsigned indent;
|
|
|
|
|
extern unsigned indent_incr;
|
|
|
|
|
|
2011-02-10 06:08:29 +01:00
|
|
|
/*
|
|
|
|
|
* Set to non-zero when the user wants to emit all the file and line
|
|
|
|
|
* number information.
|
|
|
|
|
*/
|
|
|
|
|
extern unsigned emit_file_line;
|
|
|
|
|
|
2011-03-16 03:17:04 +01:00
|
|
|
/*
|
|
|
|
|
* Some tools that are mostly 1364-1995 compliant also support signed so
|
|
|
|
|
* add support for that as an extension.
|
|
|
|
|
*/
|
|
|
|
|
extern unsigned allow_signed;
|
|
|
|
|
|
2011-01-10 18:30:27 +01:00
|
|
|
/*
|
2011-01-17 19:51:05 +01:00
|
|
|
* Emit various Verilog types.
|
2011-01-10 18:30:27 +01:00
|
|
|
*/
|
2011-01-17 19:51:05 +01:00
|
|
|
extern void emit_event(ivl_scope_t scope, ivl_statement_t stmt);
|
2013-06-27 22:20:16 +02:00
|
|
|
extern void emit_expr(ivl_scope_t scope, ivl_expr_t expr, unsigned width,
|
2013-07-10 02:52:20 +02:00
|
|
|
unsigned is_lval_width, unsigned can_skip_unsigned,
|
|
|
|
|
unsigned is_full_prec);
|
2011-02-03 18:01:59 +01:00
|
|
|
extern void emit_logic(ivl_scope_t scope, ivl_net_logic_t nlogic);
|
|
|
|
|
extern void emit_lpm(ivl_scope_t scope, ivl_lpm_t lpm);
|
2011-01-17 19:51:05 +01:00
|
|
|
extern void emit_process(ivl_scope_t scope, ivl_process_t proc);
|
2011-01-10 18:30:27 +01:00
|
|
|
extern int emit_scope(ivl_scope_t scope, ivl_scope_t parent);
|
|
|
|
|
extern void emit_stmt(ivl_scope_t scope, ivl_statement_t stmt);
|
2011-02-03 18:01:59 +01:00
|
|
|
extern void emit_tran(ivl_scope_t scope, ivl_switch_t tran);
|
2011-01-10 18:30:27 +01:00
|
|
|
|
2011-01-17 19:51:05 +01:00
|
|
|
extern void emit_scaled_delay(ivl_scope_t scope, uint64_t delay);
|
2011-02-11 05:42:51 +01:00
|
|
|
extern void emit_scaled_delayx(ivl_scope_t scope, ivl_expr_t expr,
|
|
|
|
|
unsigned is_stmt);
|
2011-01-17 19:51:05 +01:00
|
|
|
extern void emit_scaled_expr(ivl_scope_t scope, ivl_expr_t expr,
|
|
|
|
|
int msb, int lsb);
|
|
|
|
|
extern void emit_scaled_range(ivl_scope_t scope, ivl_expr_t expr,
|
|
|
|
|
unsigned width, int msb, int lsb);
|
|
|
|
|
extern void emit_scope_path(ivl_scope_t scope, ivl_scope_t call_scope);
|
2011-01-31 08:53:53 +01:00
|
|
|
extern void emit_scope_variables(ivl_scope_t scope);
|
2011-03-07 20:33:22 +01:00
|
|
|
extern void emit_scope_call_path(ivl_scope_t scope, ivl_scope_t call_scope);
|
2011-01-17 19:51:05 +01:00
|
|
|
extern void emit_scope_module_path(ivl_scope_t scope, ivl_scope_t call_scope);
|
2012-01-02 20:28:50 +01:00
|
|
|
extern void emit_name_of_nexus(ivl_scope_t scope, ivl_nexus_t nex,
|
|
|
|
|
unsigned allow_UD);
|
|
|
|
|
extern void emit_nexus_as_ca(ivl_scope_t scope, ivl_nexus_t nex,
|
2013-06-28 04:42:45 +02:00
|
|
|
unsigned allow_UD, unsigned sign_extend);
|
2011-03-14 00:13:39 +01:00
|
|
|
extern void emit_nexus_port_driver_as_ca(ivl_scope_t scope, ivl_nexus_t nex);
|
2011-01-31 08:53:53 +01:00
|
|
|
extern void emit_const_nexus(ivl_scope_t scope, ivl_net_const_t const_net);
|
2011-02-07 05:08:23 +01:00
|
|
|
extern void emit_signal_net_const_as_ca(ivl_scope_t scope, ivl_signal_t sig);
|
2014-07-08 21:12:54 +02:00
|
|
|
extern void emit_icarus_generated_udps(void);
|
2011-02-07 05:08:23 +01:00
|
|
|
|
|
|
|
|
extern void add_udp_to_list(ivl_udp_t udp);
|
2014-07-08 21:12:54 +02:00
|
|
|
extern void emit_udp_list(void);
|
2011-02-10 06:08:29 +01:00
|
|
|
extern void emit_sig_file_line(ivl_signal_t sig);
|
2011-01-31 08:53:53 +01:00
|
|
|
|
2011-03-14 00:13:39 +01:00
|
|
|
extern void emit_id(const char *id);
|
2011-01-31 08:53:53 +01:00
|
|
|
extern void emit_real_number(double value);
|
|
|
|
|
extern void emit_number(const char *bits, unsigned nbits, unsigned is_signed,
|
|
|
|
|
const char *file, unsigned lineno);
|
2011-03-23 03:34:20 +01:00
|
|
|
extern void emit_string(const char *string);
|
2011-01-17 19:51:05 +01:00
|
|
|
|
2011-01-10 18:30:27 +01:00
|
|
|
/*
|
2011-01-17 19:51:05 +01:00
|
|
|
* Find the enclosing module scope.
|
2011-01-10 18:30:27 +01:00
|
|
|
*/
|
2011-01-17 19:51:05 +01:00
|
|
|
extern ivl_scope_t get_module_scope(ivl_scope_t scope);
|
2011-01-10 18:30:27 +01:00
|
|
|
|
2011-01-13 23:11:41 +01:00
|
|
|
/*
|
2011-01-17 19:51:05 +01:00
|
|
|
* Get an int32_t/uint64_t from a number is possible. The return type is
|
|
|
|
|
* 0 for a valid value, negative for a number with undefined bits and
|
|
|
|
|
* positive it the value is too large. The positive value is the minimum
|
|
|
|
|
* number of bits required to represent the value.
|
2011-01-13 23:11:41 +01:00
|
|
|
*/
|
2011-01-17 19:51:05 +01:00
|
|
|
extern int32_t get_int32_from_number(ivl_expr_t expr, int *return_type);
|
|
|
|
|
extern int64_t get_int64_from_number(ivl_expr_t expr, int *return_type);
|
|
|
|
|
extern uint64_t get_uint64_from_number(ivl_expr_t expr, int *return_type);
|
2011-01-13 23:11:41 +01:00
|
|
|
|
2013-03-11 18:43:29 +01:00
|
|
|
/*
|
|
|
|
|
* A package is translated to a module with a special name. This routine
|
|
|
|
|
* does that translation. To avoid a memory leak the calling routine must
|
|
|
|
|
* use free() to cleanup the string returned.
|
|
|
|
|
*/
|
|
|
|
|
extern char * get_package_name(ivl_scope_t scope);
|
|
|
|
|
|
2012-08-06 00:03:50 +02:00
|
|
|
/*
|
|
|
|
|
* Get the appropriate MSB and LSB for a signal.
|
|
|
|
|
*/
|
|
|
|
|
extern void get_sig_msb_lsb(ivl_signal_t sig, int *msb, int *lsb);
|
|
|
|
|
|
2011-01-14 04:57:53 +01:00
|
|
|
/*
|
|
|
|
|
* Cleanup functions.
|
|
|
|
|
*/
|
2014-07-08 21:12:54 +02:00
|
|
|
extern void free_emitted_scope_list(void);
|
2011-01-14 04:57:53 +01:00
|
|
|
|
2011-07-19 05:02:17 +02:00
|
|
|
/*
|
|
|
|
|
* Debug routine to dump the various pieces of nexus information.
|
|
|
|
|
*/
|
|
|
|
|
extern void dump_nexus_information(ivl_scope_t scope, ivl_nexus_t nex);
|
|
|
|
|
|
2010-03-25 19:09:50 +01:00
|
|
|
#endif /* __vlog95_priv_H */
|