yosys-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
verilog_frontend.h
Go to the documentation of this file.
1 /*
2  * yosys -- Yosys Open SYnthesis Suite
3  *
4  * Copyright (C) 2012 Clifford Wolf <clifford@clifford.at>
5  *
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.
9  *
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.
17  *
18  * ---
19  *
20  * The Verilog frontend.
21  *
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.
26  *
27  */
28 
29 #ifndef VERILOG_FRONTEND_H
30 #define VERILOG_FRONTEND_H
31 
32 #include "kernel/yosys.h"
33 #include "frontends/ast/ast.h"
34 #include <stdio.h>
35 #include <stdint.h>
36 #include <list>
37 
39 
40 namespace VERILOG_FRONTEND
41 {
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;
44 
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);
47 
48  // state of `default_nettype
49  extern bool default_nettype_wire;
50 
51  // running in SystemVerilog mode
52  extern bool sv_mode;
53 
54  // lexer input stream
55  extern std::istream *lexin;
56 }
57 
58 // the pre-processor
59 std::string frontend_verilog_preproc(std::istream &f, std::string filename, const std::map<std::string, std::string> pre_defines_map, const std::list<std::string> include_dirs);
60 
62 
63 // the usual bison/flex stuff
64 extern int frontend_verilog_yydebug;
65 int frontend_verilog_yylex(void);
66 void frontend_verilog_yyerror(char const *fmt, ...);
67 void frontend_verilog_yyrestart(FILE *f);
68 int frontend_verilog_yyparse(void);
72 
73 #endif
#define YOSYS_NAMESPACE_END
Definition: yosys.h:100
void frontend_verilog_yyerror(char const *fmt,...)
int frontend_verilog_yyget_lineno(void)
YOSYS_NAMESPACE_END int frontend_verilog_yydebug
int frontend_verilog_yyparse(void)
int frontend_verilog_yylex(void)
std::string frontend_verilog_preproc(std::istream &f, std::string filename, const std::map< std::string, std::string > pre_defines_map, const std::list< std::string > include_dirs)
Definition: preproc.cc:212
#define YOSYS_NAMESPACE_BEGIN
Definition: yosys.h:99
std::string filename
Definition: ast.h:175
void frontend_verilog_yyrestart(FILE *f)
AST::AstNode * const2ast(std::string code, char case_type=0, bool warn_z=false)
Definition: const2ast.cc:135
struct AST::AstNode * current_ast
int frontend_verilog_yylex_destroy(void)
std::istream * lexin
void frontend_verilog_yyset_lineno(int)