2018-07-21 01:41:18 -05:00
|
|
|
/* -*- c++ -*-
|
2014-07-30 07:10:15 -05:00
|
|
|
* yosys -- Yosys Open SYnthesis Suite
|
|
|
|
*
|
2021-06-07 17:39:36 -05:00
|
|
|
* Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>
|
2015-07-02 04:14:30 -05:00
|
|
|
*
|
2014-07-30 07:10:15 -05:00
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
2015-07-02 04:14:30 -05:00
|
|
|
*
|
2014-07-30 07:10:15 -05:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
// *** NOTE TO THE READER ***
|
|
|
|
//
|
|
|
|
// Maybe you have just opened this file in the hope to learn more about the
|
|
|
|
// Yosys API. Let me congratulate you on this great decision! ;)
|
|
|
|
//
|
|
|
|
// If you want to know how the design is represented by Yosys in the memory,
|
|
|
|
// you should read "kernel/rtlil.h".
|
|
|
|
//
|
|
|
|
// If you want to know how to register a command with Yosys, you could read
|
|
|
|
// "kernel/register.h", but it would be easier to just look at a simple
|
|
|
|
// example instead. A simple one would be "passes/cmds/log.cc".
|
2014-07-31 06:19:47 -05:00
|
|
|
//
|
|
|
|
// This header is very boring. It just defines some general things that
|
|
|
|
// belong nowhere else and includes the interesting headers.
|
2014-09-16 04:26:44 -05:00
|
|
|
//
|
2021-03-22 13:16:25 -05:00
|
|
|
// Find more information in the "guidelines/GettingStarted" file.
|
2014-07-30 07:10:15 -05:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef YOSYS_H
|
|
|
|
#define YOSYS_H
|
|
|
|
|
2024-04-02 08:58:06 -05:00
|
|
|
#include "kernel/yosys_common.h"
|
2014-07-30 07:10:15 -05:00
|
|
|
|
|
|
|
#include "kernel/log.h"
|
|
|
|
#include "kernel/rtlil.h"
|
|
|
|
#include "kernel/register.h"
|
|
|
|
|
|
|
|
YOSYS_NAMESPACE_BEGIN
|
|
|
|
|
2014-07-31 06:19:47 -05:00
|
|
|
void yosys_setup();
|
2018-08-20 07:44:03 -05:00
|
|
|
|
|
|
|
#ifdef WITH_PYTHON
|
|
|
|
bool yosys_already_setup();
|
|
|
|
#endif
|
|
|
|
|
2014-07-31 06:19:47 -05:00
|
|
|
void yosys_shutdown();
|
|
|
|
|
2014-07-30 07:10:15 -05:00
|
|
|
#ifdef YOSYS_ENABLE_TCL
|
2014-07-31 06:19:47 -05:00
|
|
|
Tcl_Interp *yosys_get_tcl_interp();
|
2014-07-30 07:10:15 -05:00
|
|
|
#endif
|
|
|
|
|
2014-07-31 06:19:47 -05:00
|
|
|
extern RTLIL::Design *yosys_design;
|
|
|
|
|
|
|
|
RTLIL::Design *yosys_get_design();
|
|
|
|
std::string proc_self_dirname();
|
|
|
|
std::string proc_share_dirname();
|
2020-04-10 03:38:40 -05:00
|
|
|
std::string proc_program_prefix();
|
2014-07-31 06:19:47 -05:00
|
|
|
const char *create_prompt(RTLIL::Design *design, int recursion_counter);
|
2016-08-22 08:05:57 -05:00
|
|
|
std::vector<std::string> glob_filename(const std::string &filename_pattern);
|
2015-04-08 05:14:34 -05:00
|
|
|
void rewrite_filename(std::string &filename);
|
2014-07-31 06:19:47 -05:00
|
|
|
|
2015-02-01 06:38:46 -06:00
|
|
|
void run_pass(std::string command, RTLIL::Design *design = nullptr);
|
2021-12-09 15:24:58 -06:00
|
|
|
bool run_frontend(std::string filename, std::string command, RTLIL::Design *design = nullptr, std::string *from_to_label = nullptr);
|
2015-02-01 06:38:46 -06:00
|
|
|
void run_backend(std::string filename, std::string command, RTLIL::Design *design = nullptr);
|
2014-07-31 06:19:47 -05:00
|
|
|
void shell(RTLIL::Design *design);
|
|
|
|
|
2018-01-07 09:36:13 -06:00
|
|
|
// journal of all input and output files read (for "yosys -E")
|
|
|
|
extern std::set<std::string> yosys_input_files, yosys_output_files;
|
|
|
|
|
2014-07-30 07:10:15 -05:00
|
|
|
// from kernel/version_*.o (cc source generated from Makefile)
|
|
|
|
extern const char *yosys_version_str;
|
|
|
|
|
|
|
|
// from passes/cmds/design.cc
|
|
|
|
extern std::map<std::string, RTLIL::Design*> saved_designs;
|
|
|
|
extern std::vector<RTLIL::Design*> pushed_designs;
|
|
|
|
|
2014-08-22 06:58:36 -05:00
|
|
|
// from passes/cmds/pluginc.cc
|
|
|
|
extern std::map<std::string, void*> loaded_plugins;
|
2018-08-16 09:00:11 -05:00
|
|
|
#ifdef WITH_PYTHON
|
|
|
|
extern std::map<std::string, void*> loaded_python_plugins;
|
|
|
|
#endif
|
2014-08-22 06:58:36 -05:00
|
|
|
extern std::map<std::string, std::string> loaded_plugin_aliases;
|
|
|
|
void load_plugin(std::string filename, std::vector<std::string> aliases);
|
|
|
|
|
2020-11-06 07:17:15 -06:00
|
|
|
extern std::string yosys_share_dirname;
|
|
|
|
extern std::string yosys_abc_executable;
|
|
|
|
|
2014-07-30 07:10:15 -05:00
|
|
|
YOSYS_NAMESPACE_END
|
|
|
|
|
|
|
|
#endif
|