2 * yosys -- Yosys Open SYnthesis Suite
4 * Copyright (C) 2012 Clifford Wolf <clifford@clifford.at>
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 * The Verilog frontend.
22 * This frontend is using the AST frontend library (see frontends/ast/).
23 * Thus this frontend does not generate RTLIL code directly but creates an
24 * AST directly from the Verilog parse tree and then passes this AST to
25 * the AST frontend library.
29 #ifndef VERILOG_FRONTEND_H
30 #define VERILOG_FRONTEND_H
32 #include "kernel/yosys.h"
33 #include "frontends/ast/ast.h"
40 namespace VERILOG_FRONTEND
42 // this variable is set to a new AST_DESIGN node and then filled with the AST by the bison parser
43 extern struct AST::AstNode
*current_ast
;
45 // this function converts a Verilog constant to an AST_CONSTANT node
46 AST::AstNode
*const2ast(std::string code
, char case_type
= 0, bool warn_z
= false);
48 // names of locally typedef'ed types in a stack
49 typedef std::map
<std::string
, AST::AstNode
*> UserTypeMap
;
50 extern std::vector
<UserTypeMap
*> user_type_stack
;
52 // names of package typedef'ed types
53 extern std::map
<std::string
, AST::AstNode
*> pkg_user_types
;
55 // state of `default_nettype
56 extern bool default_nettype_wire
;
58 // running in SystemVerilog mode
61 // running in -formal mode
62 extern bool formal_mode
;
64 // running in -noassert mode
65 extern bool noassert_mode
;
67 // running in -noassume mode
68 extern bool noassume_mode
;
70 // running in -norestrict mode
71 extern bool norestrict_mode
;
73 // running in -assume-asserts mode
74 extern bool assume_asserts_mode
;
76 // running in -assert-assumes mode
77 extern bool assert_assumes_mode
;
79 // running in -lib mode
82 // running in -specify mode
83 extern bool specify_mode
;
86 extern std::istream
*lexin
;
91 // the usual bison/flex stuff
92 extern int frontend_verilog_yydebug
;
93 void frontend_verilog_yyerror(char const *fmt
, ...);
94 void frontend_verilog_yyrestart(FILE *f
);
95 int frontend_verilog_yyparse(void);
96 int frontend_verilog_yylex_destroy(void);
97 int frontend_verilog_yyget_lineno(void);
98 void frontend_verilog_yyset_lineno (int);