mirror of https://github.com/YosysHQ/yosys.git
Replace "ILANG" with "RTLIL" everywhere.
The only difference between "RTLIL" and "ILANG" is that the latter is the text representation of the former, as opposed to the in-memory graph representation. This distinction serves no purpose but confuses people: it is not obvious that the ILANG backend writes RTLIL graphs. Passes `write_ilang` and `read_ilang` are provided as aliases to `write_rtlil` and `read_rtlil` for compatibility.
This commit is contained in:
parent
4f2b78e19a
commit
00e7dec7f5
6
Makefile
6
Makefile
|
@ -593,7 +593,7 @@ $(eval $(call add_include_file,libs/sha1/sha1.h))
|
|||
$(eval $(call add_include_file,libs/json11/json11.hpp))
|
||||
$(eval $(call add_include_file,passes/fsm/fsmdata.h))
|
||||
$(eval $(call add_include_file,frontends/ast/ast.h))
|
||||
$(eval $(call add_include_file,backends/ilang/ilang_backend.h))
|
||||
$(eval $(call add_include_file,backends/rtlil/rtlil_backend.h))
|
||||
$(eval $(call add_include_file,backends/cxxrtl/cxxrtl.h))
|
||||
$(eval $(call add_include_file,backends/cxxrtl/cxxrtl_vcd.h))
|
||||
$(eval $(call add_include_file,backends/cxxrtl/cxxrtl_capi.cc))
|
||||
|
@ -634,7 +634,7 @@ include $(YOSYS_SRC)/techlibs/*/Makefile.inc
|
|||
else
|
||||
|
||||
include $(YOSYS_SRC)/frontends/verilog/Makefile.inc
|
||||
include $(YOSYS_SRC)/frontends/ilang/Makefile.inc
|
||||
include $(YOSYS_SRC)/frontends/rtlil/Makefile.inc
|
||||
include $(YOSYS_SRC)/frontends/ast/Makefile.inc
|
||||
include $(YOSYS_SRC)/frontends/blif/Makefile.inc
|
||||
|
||||
|
@ -651,7 +651,7 @@ include $(YOSYS_SRC)/passes/opt/Makefile.inc
|
|||
include $(YOSYS_SRC)/passes/techmap/Makefile.inc
|
||||
|
||||
include $(YOSYS_SRC)/backends/verilog/Makefile.inc
|
||||
include $(YOSYS_SRC)/backends/ilang/Makefile.inc
|
||||
include $(YOSYS_SRC)/backends/rtlil/Makefile.inc
|
||||
|
||||
include $(YOSYS_SRC)/techlibs/common/Makefile.inc
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
|
||||
OBJS += backends/ilang/ilang_backend.o
|
||||
|
|
@ -59,7 +59,7 @@ struct IntersynthBackend : public Backend {
|
|||
log(" do not generate celltypes and conntypes commands. i.e. just output\n");
|
||||
log(" the netlists. this is used for postsilicon synthesis.\n");
|
||||
log("\n");
|
||||
log(" -lib <verilog_or_ilang_file>\n");
|
||||
log(" -lib <verilog_or_rtlil_file>\n");
|
||||
log(" Use the specified library file for determining whether cell ports are\n");
|
||||
log(" inputs or outputs. This option can be used multiple times to specify\n");
|
||||
log(" more than one library.\n");
|
||||
|
@ -108,7 +108,7 @@ struct IntersynthBackend : public Backend {
|
|||
if (f.fail())
|
||||
log_error("Can't open lib file `%s'.\n", filename.c_str());
|
||||
RTLIL::Design *lib = new RTLIL::Design;
|
||||
Frontend::frontend_call(lib, &f, filename, (filename.size() > 3 && filename.compare(filename.size()-3, std::string::npos, ".il") == 0 ? "ilang" : "verilog"));
|
||||
Frontend::frontend_call(lib, &f, filename, (filename.size() > 3 && filename.compare(filename.size()-3, std::string::npos, ".il") == 0 ? "rtlil" : "verilog"));
|
||||
libs.push_back(lib);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
OBJS += backends/rtlil/rtlil_backend.o
|
||||
|
|
@ -18,19 +18,19 @@
|
|||
* ---
|
||||
*
|
||||
* A very simple and straightforward backend for the RTLIL text
|
||||
* representation (as understood by the 'ilang' frontend).
|
||||
* representation.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ilang_backend.h"
|
||||
#include "rtlil_backend.h"
|
||||
#include "kernel/yosys.h"
|
||||
#include <errno.h>
|
||||
|
||||
USING_YOSYS_NAMESPACE
|
||||
using namespace ILANG_BACKEND;
|
||||
using namespace RTLIL_BACKEND;
|
||||
YOSYS_NAMESPACE_BEGIN
|
||||
|
||||
void ILANG_BACKEND::dump_const(std::ostream &f, const RTLIL::Const &data, int width, int offset, bool autoint)
|
||||
void RTLIL_BACKEND::dump_const(std::ostream &f, const RTLIL::Const &data, int width, int offset, bool autoint)
|
||||
{
|
||||
if (width < 0)
|
||||
width = data.bits.size() - offset;
|
||||
|
@ -83,7 +83,7 @@ void ILANG_BACKEND::dump_const(std::ostream &f, const RTLIL::Const &data, int wi
|
|||
}
|
||||
}
|
||||
|
||||
void ILANG_BACKEND::dump_sigchunk(std::ostream &f, const RTLIL::SigChunk &chunk, bool autoint)
|
||||
void RTLIL_BACKEND::dump_sigchunk(std::ostream &f, const RTLIL::SigChunk &chunk, bool autoint)
|
||||
{
|
||||
if (chunk.wire == NULL) {
|
||||
dump_const(f, chunk.data, chunk.width, chunk.offset, autoint);
|
||||
|
@ -97,7 +97,7 @@ void ILANG_BACKEND::dump_sigchunk(std::ostream &f, const RTLIL::SigChunk &chunk,
|
|||
}
|
||||
}
|
||||
|
||||
void ILANG_BACKEND::dump_sigspec(std::ostream &f, const RTLIL::SigSpec &sig, bool autoint)
|
||||
void RTLIL_BACKEND::dump_sigspec(std::ostream &f, const RTLIL::SigSpec &sig, bool autoint)
|
||||
{
|
||||
if (sig.is_chunk()) {
|
||||
dump_sigchunk(f, sig.as_chunk(), autoint);
|
||||
|
@ -111,7 +111,7 @@ void ILANG_BACKEND::dump_sigspec(std::ostream &f, const RTLIL::SigSpec &sig, boo
|
|||
}
|
||||
}
|
||||
|
||||
void ILANG_BACKEND::dump_wire(std::ostream &f, std::string indent, const RTLIL::Wire *wire)
|
||||
void RTLIL_BACKEND::dump_wire(std::ostream &f, std::string indent, const RTLIL::Wire *wire)
|
||||
{
|
||||
for (auto &it : wire->attributes) {
|
||||
f << stringf("%s" "attribute %s ", indent.c_str(), it.first.c_str());
|
||||
|
@ -136,7 +136,7 @@ void ILANG_BACKEND::dump_wire(std::ostream &f, std::string indent, const RTLIL::
|
|||
f << stringf("%s\n", wire->name.c_str());
|
||||
}
|
||||
|
||||
void ILANG_BACKEND::dump_memory(std::ostream &f, std::string indent, const RTLIL::Memory *memory)
|
||||
void RTLIL_BACKEND::dump_memory(std::ostream &f, std::string indent, const RTLIL::Memory *memory)
|
||||
{
|
||||
for (auto &it : memory->attributes) {
|
||||
f << stringf("%s" "attribute %s ", indent.c_str(), it.first.c_str());
|
||||
|
@ -153,7 +153,7 @@ void ILANG_BACKEND::dump_memory(std::ostream &f, std::string indent, const RTLIL
|
|||
f << stringf("%s\n", memory->name.c_str());
|
||||
}
|
||||
|
||||
void ILANG_BACKEND::dump_cell(std::ostream &f, std::string indent, const RTLIL::Cell *cell)
|
||||
void RTLIL_BACKEND::dump_cell(std::ostream &f, std::string indent, const RTLIL::Cell *cell)
|
||||
{
|
||||
for (auto &it : cell->attributes) {
|
||||
f << stringf("%s" "attribute %s ", indent.c_str(), it.first.c_str());
|
||||
|
@ -177,7 +177,7 @@ void ILANG_BACKEND::dump_cell(std::ostream &f, std::string indent, const RTLIL::
|
|||
f << stringf("%s" "end\n", indent.c_str());
|
||||
}
|
||||
|
||||
void ILANG_BACKEND::dump_proc_case_body(std::ostream &f, std::string indent, const RTLIL::CaseRule *cs)
|
||||
void RTLIL_BACKEND::dump_proc_case_body(std::ostream &f, std::string indent, const RTLIL::CaseRule *cs)
|
||||
{
|
||||
for (auto it = cs->actions.begin(); it != cs->actions.end(); ++it)
|
||||
{
|
||||
|
@ -192,7 +192,7 @@ void ILANG_BACKEND::dump_proc_case_body(std::ostream &f, std::string indent, con
|
|||
dump_proc_switch(f, indent, *it);
|
||||
}
|
||||
|
||||
void ILANG_BACKEND::dump_proc_switch(std::ostream &f, std::string indent, const RTLIL::SwitchRule *sw)
|
||||
void RTLIL_BACKEND::dump_proc_switch(std::ostream &f, std::string indent, const RTLIL::SwitchRule *sw)
|
||||
{
|
||||
for (auto it = sw->attributes.begin(); it != sw->attributes.end(); ++it) {
|
||||
f << stringf("%s" "attribute %s ", indent.c_str(), it->first.c_str());
|
||||
|
@ -225,7 +225,7 @@ void ILANG_BACKEND::dump_proc_switch(std::ostream &f, std::string indent, const
|
|||
f << stringf("%s" "end\n", indent.c_str());
|
||||
}
|
||||
|
||||
void ILANG_BACKEND::dump_proc_sync(std::ostream &f, std::string indent, const RTLIL::SyncRule *sy)
|
||||
void RTLIL_BACKEND::dump_proc_sync(std::ostream &f, std::string indent, const RTLIL::SyncRule *sy)
|
||||
{
|
||||
f << stringf("%s" "sync ", indent.c_str());
|
||||
switch (sy->type) {
|
||||
|
@ -251,7 +251,7 @@ void ILANG_BACKEND::dump_proc_sync(std::ostream &f, std::string indent, const RT
|
|||
}
|
||||
}
|
||||
|
||||
void ILANG_BACKEND::dump_proc(std::ostream &f, std::string indent, const RTLIL::Process *proc)
|
||||
void RTLIL_BACKEND::dump_proc(std::ostream &f, std::string indent, const RTLIL::Process *proc)
|
||||
{
|
||||
for (auto it = proc->attributes.begin(); it != proc->attributes.end(); ++it) {
|
||||
f << stringf("%s" "attribute %s ", indent.c_str(), it->first.c_str());
|
||||
|
@ -265,7 +265,7 @@ void ILANG_BACKEND::dump_proc(std::ostream &f, std::string indent, const RTLIL::
|
|||
f << stringf("%s" "end\n", indent.c_str());
|
||||
}
|
||||
|
||||
void ILANG_BACKEND::dump_conn(std::ostream &f, std::string indent, const RTLIL::SigSpec &left, const RTLIL::SigSpec &right)
|
||||
void RTLIL_BACKEND::dump_conn(std::ostream &f, std::string indent, const RTLIL::SigSpec &left, const RTLIL::SigSpec &right)
|
||||
{
|
||||
f << stringf("%s" "connect ", indent.c_str());
|
||||
dump_sigspec(f, left);
|
||||
|
@ -274,7 +274,7 @@ void ILANG_BACKEND::dump_conn(std::ostream &f, std::string indent, const RTLIL::
|
|||
f << stringf("\n");
|
||||
}
|
||||
|
||||
void ILANG_BACKEND::dump_module(std::ostream &f, std::string indent, RTLIL::Module *module, RTLIL::Design *design, bool only_selected, bool flag_m, bool flag_n)
|
||||
void RTLIL_BACKEND::dump_module(std::ostream &f, std::string indent, RTLIL::Module *module, RTLIL::Design *design, bool only_selected, bool flag_m, bool flag_n)
|
||||
{
|
||||
bool print_header = flag_m || design->selected_whole_module(module->name);
|
||||
bool print_body = !flag_n || !design->selected_whole_module(module->name);
|
||||
|
@ -360,7 +360,7 @@ void ILANG_BACKEND::dump_module(std::ostream &f, std::string indent, RTLIL::Modu
|
|||
f << stringf("%s" "end\n", indent.c_str());
|
||||
}
|
||||
|
||||
void ILANG_BACKEND::dump_design(std::ostream &f, RTLIL::Design *design, bool only_selected, bool flag_m, bool flag_n)
|
||||
void RTLIL_BACKEND::dump_design(std::ostream &f, RTLIL::Design *design, bool only_selected, bool flag_m, bool flag_n)
|
||||
{
|
||||
int init_autoidx = autoidx;
|
||||
|
||||
|
@ -396,15 +396,15 @@ void ILANG_BACKEND::dump_design(std::ostream &f, RTLIL::Design *design, bool onl
|
|||
YOSYS_NAMESPACE_END
|
||||
PRIVATE_NAMESPACE_BEGIN
|
||||
|
||||
struct IlangBackend : public Backend {
|
||||
IlangBackend() : Backend("ilang", "write design to ilang file") { }
|
||||
struct RTLILBackend : public Backend {
|
||||
RTLILBackend() : Backend("rtlil", "write design to RTLIL file") { }
|
||||
void help() override
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
log(" write_ilang [filename]\n");
|
||||
log(" write_rtlil [filename]\n");
|
||||
log("\n");
|
||||
log("Write the current design to an 'ilang' file. (ilang is a text representation\n");
|
||||
log("Write the current design to an RTLIL file. (RTLIL is a text representation\n");
|
||||
log("of a design in yosys's internal format.)\n");
|
||||
log("\n");
|
||||
log(" -selected\n");
|
||||
|
@ -415,7 +415,7 @@ struct IlangBackend : public Backend {
|
|||
{
|
||||
bool selected = false;
|
||||
|
||||
log_header(design, "Executing ILANG backend.\n");
|
||||
log_header(design, "Executing RTLIL backend.\n");
|
||||
|
||||
size_t argidx;
|
||||
for (argidx = 1; argidx < args.size(); argidx++) {
|
||||
|
@ -432,12 +432,27 @@ struct IlangBackend : public Backend {
|
|||
|
||||
log("Output filename: %s\n", filename.c_str());
|
||||
*f << stringf("# Generated by %s\n", yosys_version_str);
|
||||
ILANG_BACKEND::dump_design(*f, design, selected, true, false);
|
||||
RTLIL_BACKEND::dump_design(*f, design, selected, true, false);
|
||||
}
|
||||
} RTLILBackend;
|
||||
|
||||
struct IlangBackend : public Backend {
|
||||
IlangBackend() : Backend("ilang", "(deprecated) alias of write_rtlil") { }
|
||||
void help() override
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
log("See `help write_rtlil`.\n");
|
||||
log("\n");
|
||||
}
|
||||
void execute(std::ostream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *design) override
|
||||
{
|
||||
RTLILBackend.execute(f, filename, args, design);
|
||||
}
|
||||
} IlangBackend;
|
||||
|
||||
struct DumpPass : public Pass {
|
||||
DumpPass() : Pass("dump", "print parts of the design in ilang format") { }
|
||||
DumpPass() : Pass("dump", "print parts of the design in RTLIL format") { }
|
||||
void help() override
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
|
@ -445,7 +460,7 @@ struct DumpPass : public Pass {
|
|||
log(" dump [options] [selection]\n");
|
||||
log("\n");
|
||||
log("Write the selected parts of the design to the console or specified file in\n");
|
||||
log("ilang format.\n");
|
||||
log("RTLIL format.\n");
|
||||
log("\n");
|
||||
log(" -m\n");
|
||||
log(" also dump the module headers, even if only parts of a single\n");
|
||||
|
@ -508,7 +523,7 @@ struct DumpPass : public Pass {
|
|||
f = &buf;
|
||||
}
|
||||
|
||||
ILANG_BACKEND::dump_design(*f, design, true, flag_m, flag_n);
|
||||
RTLIL_BACKEND::dump_design(*f, design, true, flag_m, flag_n);
|
||||
|
||||
if (!filename.empty()) {
|
||||
delete f;
|
|
@ -18,19 +18,19 @@
|
|||
* ---
|
||||
*
|
||||
* A very simple and straightforward backend for the RTLIL text
|
||||
* representation (as understood by the 'ilang' frontend).
|
||||
* representation.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ILANG_BACKEND_H
|
||||
#define ILANG_BACKEND_H
|
||||
#ifndef RTLIL_BACKEND_H
|
||||
#define RTLIL_BACKEND_H
|
||||
|
||||
#include "kernel/yosys.h"
|
||||
#include <stdio.h>
|
||||
|
||||
YOSYS_NAMESPACE_BEGIN
|
||||
|
||||
namespace ILANG_BACKEND {
|
||||
namespace RTLIL_BACKEND {
|
||||
void dump_const(std::ostream &f, const RTLIL::Const &data, int width = -1, int offset = 0, bool autoint = true);
|
||||
void dump_sigchunk(std::ostream &f, const RTLIL::SigChunk &chunk, bool autoint = true);
|
||||
void dump_sigspec(std::ostream &f, const RTLIL::SigSpec &sig, bool autoint = true);
|
|
@ -1,4 +0,0 @@
|
|||
ilang_lexer.cc
|
||||
ilang_parser.output
|
||||
ilang_parser.tab.cc
|
||||
ilang_parser.tab.hh
|
|
@ -1,19 +0,0 @@
|
|||
|
||||
GENFILES += frontends/ilang/ilang_parser.tab.cc
|
||||
GENFILES += frontends/ilang/ilang_parser.tab.hh
|
||||
GENFILES += frontends/ilang/ilang_parser.output
|
||||
GENFILES += frontends/ilang/ilang_lexer.cc
|
||||
|
||||
frontends/ilang/ilang_parser.tab.cc: frontends/ilang/ilang_parser.y
|
||||
$(Q) mkdir -p $(dir $@)
|
||||
$(P) $(BISON) -o $@ -d -r all -b frontends/ilang/ilang_parser $<
|
||||
|
||||
frontends/ilang/ilang_parser.tab.hh: frontends/ilang/ilang_parser.tab.cc
|
||||
|
||||
frontends/ilang/ilang_lexer.cc: frontends/ilang/ilang_lexer.l
|
||||
$(Q) mkdir -p $(dir $@)
|
||||
$(P) flex -o frontends/ilang/ilang_lexer.cc $<
|
||||
|
||||
OBJS += frontends/ilang/ilang_parser.tab.o frontends/ilang/ilang_lexer.o
|
||||
OBJS += frontends/ilang/ilang_frontend.o
|
||||
|
|
@ -378,7 +378,7 @@ struct RpcFrontend : public Pass {
|
|||
log(" -> {\"method\": \"derive\", \"module\": \"<module-name\">, \"parameters\": {\n");
|
||||
log(" \"<param-name>\": {\"type\": \"[unsigned|signed|string|real]\",\n");
|
||||
log(" \"value\": \"<param-value>\"}, ...}}\n");
|
||||
log(" <- {\"frontend\": \"[ilang|verilog|...]\",\"source\": \"<source>\"}}\n");
|
||||
log(" <- {\"frontend\": \"[rtlil|verilog|...]\",\"source\": \"<source>\"}}\n");
|
||||
log(" <- {\"error\": \"<error-message>\"}\n");
|
||||
log(" request for the module <module-name> to be derived for a specific set of\n");
|
||||
log(" parameters. <param-name> starts with \\ for named parameters, and with $\n");
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
rtlil_lexer.cc
|
||||
rtlil_parser.output
|
||||
rtlil_parser.tab.cc
|
||||
rtlil_parser.tab.hh
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
GENFILES += frontends/rtlil/rtlil_parser.tab.cc
|
||||
GENFILES += frontends/rtlil/rtlil_parser.tab.hh
|
||||
GENFILES += frontends/rtlil/rtlil_parser.output
|
||||
GENFILES += frontends/rtlil/rtlil_lexer.cc
|
||||
|
||||
frontends/rtlil/rtlil_parser.tab.cc: frontends/rtlil/rtlil_parser.y
|
||||
$(Q) mkdir -p $(dir $@)
|
||||
$(P) $(BISON) -o $@ -d -r all -b frontends/rtlil/rtlil_parser $<
|
||||
|
||||
frontends/rtlil/rtlil_parser.tab.hh: frontends/rtlil/rtlil_parser.tab.cc
|
||||
|
||||
frontends/rtlil/rtlil_lexer.cc: frontends/rtlil/rtlil_lexer.l
|
||||
$(Q) mkdir -p $(dir $@)
|
||||
$(P) flex -o frontends/rtlil/rtlil_lexer.cc $<
|
||||
|
||||
OBJS += frontends/rtlil/rtlil_parser.tab.o frontends/rtlil/rtlil_lexer.o
|
||||
OBJS += frontends/rtlil/rtlil_frontend.o
|
||||
|
|
@ -18,30 +18,30 @@
|
|||
* ---
|
||||
*
|
||||
* A very simple and straightforward frontend for the RTLIL text
|
||||
* representation (as generated by the 'ilang' backend).
|
||||
* representation.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ilang_frontend.h"
|
||||
#include "rtlil_frontend.h"
|
||||
#include "kernel/register.h"
|
||||
#include "kernel/log.h"
|
||||
|
||||
void rtlil_frontend_ilang_yyerror(char const *s)
|
||||
void rtlil_frontend_yyerror(char const *s)
|
||||
{
|
||||
YOSYS_NAMESPACE_PREFIX log_error("Parser error in line %d: %s\n", rtlil_frontend_ilang_yyget_lineno(), s);
|
||||
YOSYS_NAMESPACE_PREFIX log_error("Parser error in line %d: %s\n", rtlil_frontend_yyget_lineno(), s);
|
||||
}
|
||||
|
||||
YOSYS_NAMESPACE_BEGIN
|
||||
|
||||
struct IlangFrontend : public Frontend {
|
||||
IlangFrontend() : Frontend("ilang", "read modules from ilang file") { }
|
||||
struct RTLILFrontend : public Frontend {
|
||||
RTLILFrontend() : Frontend("rtlil", "read modules from RTLIL file") { }
|
||||
void help() override
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
log(" read_ilang [filename]\n");
|
||||
log(" read_rtlil [filename]\n");
|
||||
log("\n");
|
||||
log("Load modules from an ilang file to the current design. (ilang is a text\n");
|
||||
log("Load modules from an RTLIL file to the current design. (RTLIL is a text\n");
|
||||
log("representation of a design in yosys's internal format.)\n");
|
||||
log("\n");
|
||||
log(" -nooverwrite\n");
|
||||
|
@ -58,27 +58,27 @@ struct IlangFrontend : public Frontend {
|
|||
}
|
||||
void execute(std::istream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *design) override
|
||||
{
|
||||
ILANG_FRONTEND::flag_nooverwrite = false;
|
||||
ILANG_FRONTEND::flag_overwrite = false;
|
||||
ILANG_FRONTEND::flag_lib = false;
|
||||
RTLIL_FRONTEND::flag_nooverwrite = false;
|
||||
RTLIL_FRONTEND::flag_overwrite = false;
|
||||
RTLIL_FRONTEND::flag_lib = false;
|
||||
|
||||
log_header(design, "Executing ILANG frontend.\n");
|
||||
log_header(design, "Executing RTLIL frontend.\n");
|
||||
|
||||
size_t argidx;
|
||||
for (argidx = 1; argidx < args.size(); argidx++) {
|
||||
std::string arg = args[argidx];
|
||||
if (arg == "-nooverwrite") {
|
||||
ILANG_FRONTEND::flag_nooverwrite = true;
|
||||
ILANG_FRONTEND::flag_overwrite = false;
|
||||
RTLIL_FRONTEND::flag_nooverwrite = true;
|
||||
RTLIL_FRONTEND::flag_overwrite = false;
|
||||
continue;
|
||||
}
|
||||
if (arg == "-overwrite") {
|
||||
ILANG_FRONTEND::flag_nooverwrite = false;
|
||||
ILANG_FRONTEND::flag_overwrite = true;
|
||||
RTLIL_FRONTEND::flag_nooverwrite = false;
|
||||
RTLIL_FRONTEND::flag_overwrite = true;
|
||||
continue;
|
||||
}
|
||||
if (arg == "-lib") {
|
||||
ILANG_FRONTEND::flag_lib = true;
|
||||
RTLIL_FRONTEND::flag_lib = true;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
@ -87,12 +87,27 @@ struct IlangFrontend : public Frontend {
|
|||
|
||||
log("Input filename: %s\n", filename.c_str());
|
||||
|
||||
ILANG_FRONTEND::lexin = f;
|
||||
ILANG_FRONTEND::current_design = design;
|
||||
rtlil_frontend_ilang_yydebug = false;
|
||||
rtlil_frontend_ilang_yyrestart(NULL);
|
||||
rtlil_frontend_ilang_yyparse();
|
||||
rtlil_frontend_ilang_yylex_destroy();
|
||||
RTLIL_FRONTEND::lexin = f;
|
||||
RTLIL_FRONTEND::current_design = design;
|
||||
rtlil_frontend_yydebug = false;
|
||||
rtlil_frontend_yyrestart(NULL);
|
||||
rtlil_frontend_yyparse();
|
||||
rtlil_frontend_yylex_destroy();
|
||||
}
|
||||
} RTLILFrontend;
|
||||
|
||||
struct IlangFrontend : public Frontend {
|
||||
IlangFrontend() : Frontend("ilang", "(deprecated) alias of read_rtlil") { }
|
||||
void help() override
|
||||
{
|
||||
// |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
|
||||
log("\n");
|
||||
log("See `help read_rtlil`.\n");
|
||||
log("\n");
|
||||
}
|
||||
void execute(std::istream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *design) override
|
||||
{
|
||||
RTLILFrontend.execute(f, filename, args, design);
|
||||
}
|
||||
} IlangFrontend;
|
||||
|
|
@ -18,18 +18,18 @@
|
|||
* ---
|
||||
*
|
||||
* A very simple and straightforward frontend for the RTLIL text
|
||||
* representation (as generated by the 'ilang' backend).
|
||||
* representation.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ILANG_FRONTEND_H
|
||||
#define ILANG_FRONTEND_H
|
||||
#ifndef RTLIL_FRONTEND_H
|
||||
#define RTLIL_FRONTEND_H
|
||||
|
||||
#include "kernel/yosys.h"
|
||||
|
||||
YOSYS_NAMESPACE_BEGIN
|
||||
|
||||
namespace ILANG_FRONTEND {
|
||||
namespace RTLIL_FRONTEND {
|
||||
extern std::istream *lexin;
|
||||
extern RTLIL::Design *current_design;
|
||||
extern bool flag_nooverwrite;
|
||||
|
@ -39,13 +39,13 @@ namespace ILANG_FRONTEND {
|
|||
|
||||
YOSYS_NAMESPACE_END
|
||||
|
||||
extern int rtlil_frontend_ilang_yydebug;
|
||||
int rtlil_frontend_ilang_yylex(void);
|
||||
void rtlil_frontend_ilang_yyerror(char const *s);
|
||||
void rtlil_frontend_ilang_yyrestart(FILE *f);
|
||||
int rtlil_frontend_ilang_yyparse(void);
|
||||
int rtlil_frontend_ilang_yylex_destroy(void);
|
||||
int rtlil_frontend_ilang_yyget_lineno(void);
|
||||
extern int rtlil_frontend_yydebug;
|
||||
int rtlil_frontend_yylex(void);
|
||||
void rtlil_frontend_yyerror(char const *s);
|
||||
void rtlil_frontend_yyrestart(FILE *f);
|
||||
int rtlil_frontend_yyparse(void);
|
||||
int rtlil_frontend_yylex_destroy(void);
|
||||
int rtlil_frontend_yyget_lineno(void);
|
||||
|
||||
#endif
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
* ---
|
||||
*
|
||||
* A very simple and straightforward frontend for the RTLIL text
|
||||
* representation (as generated by the 'ilang' backend).
|
||||
* representation.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -30,20 +30,20 @@
|
|||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include "frontends/ilang/ilang_frontend.h"
|
||||
#include "ilang_parser.tab.hh"
|
||||
#include "frontends/rtlil/rtlil_frontend.h"
|
||||
#include "rtlil_parser.tab.hh"
|
||||
|
||||
USING_YOSYS_NAMESPACE
|
||||
|
||||
#define YY_INPUT(buf,result,max_size) \
|
||||
result = readsome(*ILANG_FRONTEND::lexin, buf, max_size)
|
||||
result = readsome(*RTLIL_FRONTEND::lexin, buf, max_size)
|
||||
|
||||
%}
|
||||
|
||||
%option yylineno
|
||||
%option noyywrap
|
||||
%option nounput
|
||||
%option prefix="rtlil_frontend_ilang_yy"
|
||||
%option prefix="rtlil_frontend_yy"
|
||||
|
||||
%x STRING
|
||||
|
||||
|
@ -84,11 +84,11 @@ USING_YOSYS_NAMESPACE
|
|||
|
||||
[a-z]+ { return TOK_INVALID; }
|
||||
|
||||
"\\"[^ \t\r\n]+ { rtlil_frontend_ilang_yylval.string = strdup(yytext); return TOK_ID; }
|
||||
"$"[^ \t\r\n]+ { rtlil_frontend_ilang_yylval.string = strdup(yytext); return TOK_ID; }
|
||||
"."[0-9]+ { rtlil_frontend_ilang_yylval.string = strdup(yytext); return TOK_ID; }
|
||||
"\\"[^ \t\r\n]+ { rtlil_frontend_yylval.string = strdup(yytext); return TOK_ID; }
|
||||
"$"[^ \t\r\n]+ { rtlil_frontend_yylval.string = strdup(yytext); return TOK_ID; }
|
||||
"."[0-9]+ { rtlil_frontend_yylval.string = strdup(yytext); return TOK_ID; }
|
||||
|
||||
[0-9]+'[01xzm-]* { rtlil_frontend_ilang_yylval.string = strdup(yytext); return TOK_VALUE; }
|
||||
[0-9]+'[01xzm-]* { rtlil_frontend_yylval.string = strdup(yytext); return TOK_VALUE; }
|
||||
-?[0-9]+ {
|
||||
char *end = nullptr;
|
||||
errno = 0;
|
||||
|
@ -98,7 +98,7 @@ USING_YOSYS_NAMESPACE
|
|||
return TOK_INVALID; // literal out of range of long
|
||||
if (value < INT_MIN || value > INT_MAX)
|
||||
return TOK_INVALID; // literal out of range of int (relevant mostly for LP64 platforms)
|
||||
rtlil_frontend_ilang_yylval.integer = value;
|
||||
rtlil_frontend_yylval.integer = value;
|
||||
return TOK_INT;
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ USING_YOSYS_NAMESPACE
|
|||
yystr[j++] = yystr[i++];
|
||||
}
|
||||
yystr[j] = 0;
|
||||
rtlil_frontend_ilang_yylval.string = yystr;
|
||||
rtlil_frontend_yylval.string = yystr;
|
||||
return TOK_STRING;
|
||||
}
|
||||
<STRING>. { yymore(); }
|
||||
|
@ -145,6 +145,6 @@ USING_YOSYS_NAMESPACE
|
|||
%%
|
||||
|
||||
// this is a hack to avoid the 'yyinput defined but not used' error msgs
|
||||
void *rtlil_frontend_ilang_avoid_input_warnings() {
|
||||
void *rtlil_frontend_avoid_input_warnings() {
|
||||
return (void*)&yyinput;
|
||||
}
|
|
@ -18,15 +18,15 @@
|
|||
* ---
|
||||
*
|
||||
* A very simple and straightforward frontend for the RTLIL text
|
||||
* representation (as generated by the 'ilang' backend).
|
||||
* representation.
|
||||
*
|
||||
*/
|
||||
|
||||
%{
|
||||
#include <list>
|
||||
#include "frontends/ilang/ilang_frontend.h"
|
||||
#include "frontends/rtlil/rtlil_frontend.h"
|
||||
YOSYS_NAMESPACE_BEGIN
|
||||
namespace ILANG_FRONTEND {
|
||||
namespace RTLIL_FRONTEND {
|
||||
std::istream *lexin;
|
||||
RTLIL::Design *current_design;
|
||||
RTLIL::Module *current_module;
|
||||
|
@ -40,12 +40,12 @@ namespace ILANG_FRONTEND {
|
|||
bool flag_nooverwrite, flag_overwrite, flag_lib;
|
||||
bool delete_current_module;
|
||||
}
|
||||
using namespace ILANG_FRONTEND;
|
||||
using namespace RTLIL_FRONTEND;
|
||||
YOSYS_NAMESPACE_END
|
||||
USING_YOSYS_NAMESPACE
|
||||
%}
|
||||
|
||||
%define api.prefix {rtlil_frontend_ilang_yy}
|
||||
%define api.prefix {rtlil_frontend_yy}
|
||||
|
||||
/* The union is defined in the header, so we need to provide all the
|
||||
* includes it requires
|
||||
|
@ -53,7 +53,7 @@ USING_YOSYS_NAMESPACE
|
|||
%code requires {
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "frontends/ilang/ilang_frontend.h"
|
||||
#include "frontends/rtlil/rtlil_frontend.h"
|
||||
}
|
||||
|
||||
%union {
|
||||
|
@ -87,7 +87,7 @@ input:
|
|||
attrbuf.clear();
|
||||
} design {
|
||||
if (attrbuf.size() != 0)
|
||||
rtlil_frontend_ilang_yyerror("dangling attribute");
|
||||
rtlil_frontend_yyerror("dangling attribute");
|
||||
};
|
||||
|
||||
EOL:
|
||||
|
@ -111,7 +111,7 @@ module:
|
|||
log("Ignoring blackbox re-definition of module %s.\n", $2);
|
||||
delete_current_module = true;
|
||||
} else if (!flag_nooverwrite && !flag_overwrite && !existing_mod->get_bool_attribute(ID::blackbox)) {
|
||||
rtlil_frontend_ilang_yyerror(stringf("ilang error: redefinition of module %s.", $2).c_str());
|
||||
rtlil_frontend_yyerror(stringf("RTLIL error: redefinition of module %s.", $2).c_str());
|
||||
} else if (flag_nooverwrite) {
|
||||
log("Ignoring re-definition of module %s.\n", $2);
|
||||
delete_current_module = true;
|
||||
|
@ -129,7 +129,7 @@ module:
|
|||
free($2);
|
||||
} module_body TOK_END {
|
||||
if (attrbuf.size() != 0)
|
||||
rtlil_frontend_ilang_yyerror("dangling attribute");
|
||||
rtlil_frontend_yyerror("dangling attribute");
|
||||
current_module->fixup_ports();
|
||||
if (delete_current_module)
|
||||
delete current_module;
|
||||
|
@ -172,12 +172,12 @@ autoidx_stmt:
|
|||
|
||||
wire_stmt:
|
||||
TOK_WIRE {
|
||||
current_wire = current_module->addWire("$__ilang_frontend_tmp__");
|
||||
current_wire = current_module->addWire("$__rtlil_frontend_tmp__");
|
||||
current_wire->attributes = attrbuf;
|
||||
attrbuf.clear();
|
||||
} wire_options TOK_ID EOL {
|
||||
if (current_module->wire($4) != nullptr)
|
||||
rtlil_frontend_ilang_yyerror(stringf("ilang error: redefinition of wire %s.", $4).c_str());
|
||||
rtlil_frontend_yyerror(stringf("RTLIL error: redefinition of wire %s.", $4).c_str());
|
||||
current_module->rename(current_wire, $4);
|
||||
free($4);
|
||||
};
|
||||
|
@ -187,7 +187,7 @@ wire_options:
|
|||
current_wire->width = $3;
|
||||
} |
|
||||
wire_options TOK_WIDTH TOK_INVALID {
|
||||
rtlil_frontend_ilang_yyerror("ilang error: invalid wire width");
|
||||
rtlil_frontend_yyerror("RTLIL error: invalid wire width");
|
||||
} |
|
||||
wire_options TOK_UPTO {
|
||||
current_wire->upto = true;
|
||||
|
@ -222,7 +222,7 @@ memory_stmt:
|
|||
attrbuf.clear();
|
||||
} memory_options TOK_ID EOL {
|
||||
if (current_module->memories.count($4) != 0)
|
||||
rtlil_frontend_ilang_yyerror(stringf("ilang error: redefinition of memory %s.", $4).c_str());
|
||||
rtlil_frontend_yyerror(stringf("RTLIL error: redefinition of memory %s.", $4).c_str());
|
||||
current_memory->name = $4;
|
||||
current_module->memories[$4] = current_memory;
|
||||
free($4);
|
||||
|
@ -243,7 +243,7 @@ memory_options:
|
|||
cell_stmt:
|
||||
TOK_CELL TOK_ID TOK_ID EOL {
|
||||
if (current_module->cell($3) != nullptr)
|
||||
rtlil_frontend_ilang_yyerror(stringf("ilang error: redefinition of cell %s.", $3).c_str());
|
||||
rtlil_frontend_yyerror(stringf("RTLIL error: redefinition of cell %s.", $3).c_str());
|
||||
current_cell = current_module->addCell($3, $2);
|
||||
current_cell->attributes = attrbuf;
|
||||
attrbuf.clear();
|
||||
|
@ -271,7 +271,7 @@ cell_body:
|
|||
} |
|
||||
cell_body TOK_CONNECT TOK_ID sigspec EOL {
|
||||
if (current_cell->hasPort($3))
|
||||
rtlil_frontend_ilang_yyerror(stringf("ilang error: redefinition of cell port %s.", $3).c_str());
|
||||
rtlil_frontend_yyerror(stringf("RTLIL error: redefinition of cell port %s.", $3).c_str());
|
||||
current_cell->setPort($3, *$4);
|
||||
delete $4;
|
||||
free($3);
|
||||
|
@ -281,7 +281,7 @@ cell_body:
|
|||
proc_stmt:
|
||||
TOK_PROCESS TOK_ID EOL {
|
||||
if (current_module->processes.count($2) != 0)
|
||||
rtlil_frontend_ilang_yyerror(stringf("ilang error: redefinition of process %s.", $2).c_str());
|
||||
rtlil_frontend_yyerror(stringf("RTLIL error: redefinition of process %s.", $2).c_str());
|
||||
current_process = new RTLIL::Process;
|
||||
current_process->name = $2;
|
||||
current_process->attributes = attrbuf;
|
||||
|
@ -342,7 +342,7 @@ case_body:
|
|||
assign_stmt:
|
||||
TOK_ASSIGN sigspec sigspec EOL {
|
||||
if (attrbuf.size() != 0)
|
||||
rtlil_frontend_ilang_yyerror("dangling attribute");
|
||||
rtlil_frontend_yyerror("dangling attribute");
|
||||
case_stack.back()->actions.push_back(RTLIL::SigSig(*$2, *$3));
|
||||
delete $2;
|
||||
delete $3;
|
||||
|
@ -438,19 +438,19 @@ sigspec:
|
|||
} |
|
||||
TOK_ID {
|
||||
if (current_module->wire($1) == nullptr)
|
||||
rtlil_frontend_ilang_yyerror(stringf("ilang error: wire %s not found", $1).c_str());
|
||||
rtlil_frontend_yyerror(stringf("RTLIL error: wire %s not found", $1).c_str());
|
||||
$$ = new RTLIL::SigSpec(current_module->wire($1));
|
||||
free($1);
|
||||
} |
|
||||
sigspec '[' TOK_INT ']' {
|
||||
if ($3 >= $1->size() || $3 < 0)
|
||||
rtlil_frontend_ilang_yyerror("bit index out of range");
|
||||
rtlil_frontend_yyerror("bit index out of range");
|
||||
$$ = new RTLIL::SigSpec($1->extract($3));
|
||||
delete $1;
|
||||
} |
|
||||
sigspec '[' TOK_INT ':' TOK_INT ']' {
|
||||
if ($3 >= $1->size() || $3 < 0 || $3 < $5)
|
||||
rtlil_frontend_ilang_yyerror("invalid slice");
|
||||
rtlil_frontend_yyerror("invalid slice");
|
||||
$$ = new RTLIL::SigSpec($1->extract($5, $3 - $5 + 1));
|
||||
delete $1;
|
||||
} |
|
||||
|
@ -477,7 +477,7 @@ sigspec_list: sigspec_list_reversed {
|
|||
conn_stmt:
|
||||
TOK_CONNECT sigspec sigspec EOL {
|
||||
if (attrbuf.size() != 0)
|
||||
rtlil_frontend_ilang_yyerror("dangling attribute");
|
||||
rtlil_frontend_yyerror("dangling attribute");
|
||||
current_module->connect(*$2, *$3);
|
||||
delete $2;
|
||||
delete $3;
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "kernel/yosys.h"
|
||||
#include "libs/sha1/sha1.h"
|
||||
#include "backends/ilang/ilang_backend.h"
|
||||
#include "backends/rtlil/rtlil_backend.h"
|
||||
|
||||
#if !defined(_WIN32) || defined(__MINGW32__)
|
||||
# include <sys/time.h>
|
||||
|
@ -600,7 +600,7 @@ void log_dump_val_worker(RTLIL::State v) {
|
|||
const char *log_signal(const RTLIL::SigSpec &sig, bool autoint)
|
||||
{
|
||||
std::stringstream buf;
|
||||
ILANG_BACKEND::dump_sigspec(buf, sig, autoint);
|
||||
RTLIL_BACKEND::dump_sigspec(buf, sig, autoint);
|
||||
|
||||
if (string_buf.size() < 100) {
|
||||
string_buf.push_back(buf.str());
|
||||
|
@ -647,21 +647,21 @@ const char *log_id(RTLIL::IdString str)
|
|||
void log_module(RTLIL::Module *module, std::string indent)
|
||||
{
|
||||
std::stringstream buf;
|
||||
ILANG_BACKEND::dump_module(buf, indent, module, module->design, false);
|
||||
RTLIL_BACKEND::dump_module(buf, indent, module, module->design, false);
|
||||
log("%s", buf.str().c_str());
|
||||
}
|
||||
|
||||
void log_cell(RTLIL::Cell *cell, std::string indent)
|
||||
{
|
||||
std::stringstream buf;
|
||||
ILANG_BACKEND::dump_cell(buf, indent, cell);
|
||||
RTLIL_BACKEND::dump_cell(buf, indent, cell);
|
||||
log("%s", buf.str().c_str());
|
||||
}
|
||||
|
||||
void log_wire(RTLIL::Wire *wire, std::string indent)
|
||||
{
|
||||
std::stringstream buf;
|
||||
ILANG_BACKEND::dump_wire(buf, indent, wire);
|
||||
RTLIL_BACKEND::dump_wire(buf, indent, wire);
|
||||
log("%s", buf.str().c_str());
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "kernel/celltypes.h"
|
||||
#include "frontends/verilog/verilog_frontend.h"
|
||||
#include "frontends/verilog/preproc.h"
|
||||
#include "backends/ilang/ilang_backend.h"
|
||||
#include "backends/rtlil/rtlil_backend.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
|
@ -923,7 +923,7 @@ namespace {
|
|||
void error(int linenr)
|
||||
{
|
||||
std::stringstream buf;
|
||||
ILANG_BACKEND::dump_cell(buf, " ", cell);
|
||||
RTLIL_BACKEND::dump_cell(buf, " ", cell);
|
||||
|
||||
log_error("Found error in internal cell %s%s%s (%s) at %s:%d:\n%s",
|
||||
module ? module->name.c_str() : "", module ? "." : "",
|
||||
|
|
|
@ -930,7 +930,7 @@ void run_frontend(std::string filename, std::string command, std::string *backen
|
|||
else if (filename_trim.size() > 4 && filename_trim.compare(filename_trim.size()-5, std::string::npos, ".json") == 0)
|
||||
command = "json";
|
||||
else if (filename_trim.size() > 3 && filename_trim.compare(filename_trim.size()-3, std::string::npos, ".il") == 0)
|
||||
command = "ilang";
|
||||
command = "rtlil";
|
||||
else if (filename_trim.size() > 3 && filename_trim.compare(filename_trim.size()-3, std::string::npos, ".ys") == 0)
|
||||
command = "script";
|
||||
else if (filename_trim.size() > 3 && filename_trim.compare(filename_trim.size()-4, std::string::npos, ".tcl") == 0)
|
||||
|
@ -1053,7 +1053,7 @@ void run_backend(std::string filename, std::string command, RTLIL::Design *desig
|
|||
else if (filename.size() > 3 && filename.compare(filename.size()-3, std::string::npos, ".sv") == 0)
|
||||
command = "verilog -sv";
|
||||
else if (filename.size() > 3 && filename.compare(filename.size()-3, std::string::npos, ".il") == 0)
|
||||
command = "ilang";
|
||||
command = "rtlil";
|
||||
else if (filename.size() > 3 && filename.compare(filename.size()-3, std::string::npos, ".cc") == 0)
|
||||
command = "cxxrtl";
|
||||
else if (filename.size() > 4 && filename.compare(filename.size()-4, std::string::npos, ".aig") == 0)
|
||||
|
@ -1065,7 +1065,7 @@ void run_backend(std::string filename, std::string command, RTLIL::Design *desig
|
|||
else if (filename.size() > 5 && filename.compare(filename.size()-5, std::string::npos, ".json") == 0)
|
||||
command = "json";
|
||||
else if (filename == "-")
|
||||
command = "ilang";
|
||||
command = "rtlil";
|
||||
else if (filename.empty())
|
||||
return;
|
||||
else
|
||||
|
|
|
@ -39,15 +39,15 @@ the RTL Intermediate Language (RTLIL). A more detailed description of this forma
|
|||
is given in the next section.
|
||||
|
||||
There is also a text representation of the RTLIL data structure that can be
|
||||
parsed using the ILANG Frontend.
|
||||
parsed using the RTLIL Frontend.
|
||||
|
||||
The design data may then be transformed using a series of passes that all
|
||||
operate on the RTLIL representation of the design.
|
||||
|
||||
Finally the design in RTLIL representation is converted back to text by one
|
||||
of the backends, namely the Verilog Backend for generating Verilog netlists
|
||||
and the ILANG Backend for writing the RTLIL data in the same format that is
|
||||
understood by the ILANG Frontend.
|
||||
and the RTLIL Backend for writing the RTLIL data in the same format that is
|
||||
understood by the RTLIL Frontend.
|
||||
|
||||
With the exception of the AST Frontend, which is called by the high-level HDL
|
||||
frontends and can't be called directly by the user, all program modules are
|
||||
|
@ -67,13 +67,13 @@ in different stages of the synthesis.
|
|||
\tikzstyle{data} = [draw, fill=blue!10, ellipse, minimum height=3em, minimum width=7em, node distance=15em]
|
||||
\node[process] (vlog) {Verilog Frontend};
|
||||
\node[process, dashed, fill=green!5] (vhdl) [right of=vlog] {VHDL Frontend};
|
||||
\node[process] (ilang) [right of=vhdl] {ILANG Frontend};
|
||||
\node[process] (ilang) [right of=vhdl] {RTLIL Frontend};
|
||||
\node[data] (ast) [below of=vlog, node distance=5em, xshift=7.5em] {AST};
|
||||
\node[process] (astfe) [below of=ast, node distance=5em] {AST Frontend};
|
||||
\node[data] (rtlil) [below of=astfe, node distance=5em, xshift=7.5em] {RTLIL};
|
||||
\node[process] (pass) [right of=rtlil, node distance=5em, xshift=7.5em] {Passes};
|
||||
\node[process] (vlbe) [below of=rtlil, node distance=7em, xshift=-13em] {Verilog Backend};
|
||||
\node[process] (ilangbe) [below of=rtlil, node distance=7em, xshift=0em] {ILANG Backend};
|
||||
\node[process] (ilangbe) [below of=rtlil, node distance=7em, xshift=0em] {RTLIL Backend};
|
||||
\node[process, dashed, fill=green!5] (otherbe) [below of=rtlil, node distance=7em, xshift=+13em] {Other Backends};
|
||||
|
||||
\draw[-latex] (vlog) -- (ast);
|
||||
|
@ -92,8 +92,7 @@ in different stages of the synthesis.
|
|||
|
||||
\section{The RTL Intermediate Language}
|
||||
|
||||
All frontends, passes and backends in Yosys operate on a design in RTLIL\footnote{The {\it Language} in {\it RTL Intermediate Language}
|
||||
refers to the fact, that RTLIL also has a text representation, usually referred to as {\it Intermediate Language} (ILANG).} representation.
|
||||
All frontends, passes and backends in Yosys operate on a design in RTLIL} representation.
|
||||
The only exception are the high-level frontends that use the AST representation as an intermediate step before generating RTLIL
|
||||
data.
|
||||
|
||||
|
@ -316,7 +315,7 @@ endmodule
|
|||
|
||||
In this example there is no data path and therefore the RTLIL::Module generated by
|
||||
the frontend only contains a few RTLIL::Wire objects and an RTLIL::Process.
|
||||
The RTLIL::Process in ILANG syntax:
|
||||
The RTLIL::Process in RTLIL syntax:
|
||||
|
||||
\begin{lstlisting}[numbers=left,frame=single,language=rtlil]
|
||||
process $proc$ff_with_en_and_async_reset.v:4$1
|
||||
|
@ -362,7 +361,7 @@ also contains an RTLIL::SwitchRule object (lines $3 \dots 12$). Such an object i
|
|||
statement as it uses a control signal ({\tt \textbackslash{}reset} in this case) to determine
|
||||
which of its cases should be active. The RTLIL::SwitchRule object then contains one RTLIL::CaseRule
|
||||
object per case. In this example there is a case\footnote{The
|
||||
syntax {\tt 1'1} in the ILANG code specifies a constant with a length of one bit (the first ``1''),
|
||||
syntax {\tt 1'1} in the RTLIL code specifies a constant with a length of one bit (the first ``1''),
|
||||
and this bit is a one (the second ``1'').} for {\tt \textbackslash{}reset == 1} that causes
|
||||
{\tt \$0\textbackslash{}q[0:0]} to be set (lines 4 and 5) and a default case that in turn contains a switch that
|
||||
sets {\tt \$0\textbackslash{}q[0:0]} to the value of {\tt \textbackslash{}d} if {\tt
|
||||
|
|
|
@ -231,7 +231,7 @@ as Qflow\footnote[frame]{\url{http://opencircuitdesign.com/qflow/}} for ASIC des
|
|||
\node[data] (rtlil) [below of=astfe, node distance=5em, xshift=7.5em] {RTLIL};
|
||||
\node[process] (pass) [right of=rtlil, node distance=5em, xshift=7.5em] {Passes};
|
||||
\node[process] (vlbe) [below of=rtlil, node distance=7em, xshift=-13em] {Verilog Backend};
|
||||
\node[process] (ilangbe) [below of=rtlil, node distance=7em, xshift=0em] {ILANG Backend};
|
||||
\node[process] (ilangbe) [below of=rtlil, node distance=7em, xshift=0em] {RTLIL Backend};
|
||||
\node[process, fill=green!5] (otherbe) [below of=rtlil, node distance=7em, xshift=+13em] {Other Backends};
|
||||
|
||||
\draw[-latex] (vlog) -- (ast);
|
||||
|
@ -484,7 +484,7 @@ Commands for design navigation and investigation:
|
|||
\begin{lstlisting}[xleftmargin=1cm, basicstyle=\ttfamily\fontsize{8pt}{10pt}\selectfont, language=ys]
|
||||
cd # a shortcut for 'select -module <name>'
|
||||
ls # list modules or objects in modules
|
||||
dump # print parts of the design in ilang format
|
||||
dump # print parts of the design in RTLIL format
|
||||
show # generate schematics using graphviz
|
||||
select # modify and view the list of selected objects
|
||||
\end{lstlisting}
|
||||
|
@ -502,7 +502,7 @@ Commands for executing scripts or entering interactive mode:
|
|||
\begin{frame}[fragile]{\subsecname{} 2/3 \hspace{0pt plus 1 filll} (excerpt)}
|
||||
Commands for reading and elaborating the design:
|
||||
\begin{lstlisting}[xleftmargin=1cm, basicstyle=\ttfamily\fontsize{8pt}{10pt}\selectfont, language=ys]
|
||||
read_ilang # read modules from ilang file
|
||||
read_rtlil # read modules from RTLIL file
|
||||
read_verilog # read modules from Verilog file
|
||||
hierarchy # check, expand and clean up design hierarchy
|
||||
\end{lstlisting}
|
||||
|
@ -534,7 +534,7 @@ Commands for writing the results:
|
|||
write_blif # write design to BLIF file
|
||||
write_btor # write design to BTOR file
|
||||
write_edif # write design to EDIF netlist file
|
||||
write_ilang # write design to ilang file
|
||||
write_rtlil # write design to RTLIL file
|
||||
write_spice # write design to SPICE netlist file
|
||||
write_verilog # write design to Verilog file
|
||||
\end{lstlisting}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
\node[data] (rtlil) [below of=astfe, node distance=5em, xshift=7.5em] {RTLIL};
|
||||
\node[process] (pass) [right of=rtlil, node distance=5em, xshift=7.5em] {Passes};
|
||||
\node[process] (vlbe) [below of=rtlil, node distance=7em, xshift=-13em] {Verilog Backend};
|
||||
\node[process] (ilangbe) [below of=rtlil, node distance=7em, xshift=0em] {ILANG Backend};
|
||||
\node[process] (ilangbe) [below of=rtlil, node distance=7em, xshift=0em] {RTLIL Backend};
|
||||
\node[process, fill=green!5] (otherbe) [below of=rtlil, node distance=7em, xshift=+13em] {Other Backends};
|
||||
|
||||
\draw[-latex] (vlog) -- (ast);
|
||||
|
@ -105,8 +105,7 @@ For simplicity we only discuss this version of RTLIL in this presentation.
|
|||
|
||||
\begin{frame}{\subsecname}
|
||||
\begin{itemize}
|
||||
\item The {\tt dump} command prints the design (or parts of it) in ILANG format. This is
|
||||
a text representation of RTLIL.
|
||||
\item The {\tt dump} command prints the design (or parts of it) in the text representation of RTLIL.
|
||||
|
||||
\bigskip
|
||||
\item The {\tt show} command visualizes how the components in the design are connected.
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
*/
|
||||
|
||||
#include "kernel/yosys.h"
|
||||
#include "backends/ilang/ilang_backend.h"
|
||||
#include "backends/rtlil/rtlil_backend.h"
|
||||
|
||||
USING_YOSYS_NAMESPACE
|
||||
using namespace ILANG_BACKEND;
|
||||
using namespace RTLIL_BACKEND;
|
||||
PRIVATE_NAMESPACE_BEGIN
|
||||
|
||||
struct BugpointPass : public Pass {
|
||||
|
@ -90,7 +90,7 @@ struct BugpointPass : public Pass {
|
|||
design->sort();
|
||||
|
||||
std::ofstream f("bugpoint-case.il");
|
||||
ILANG_BACKEND::dump_design(f, design, /*only_selected=*/false, /*flag_m=*/true, /*flag_n=*/false);
|
||||
RTLIL_BACKEND::dump_design(f, design, /*only_selected=*/false, /*flag_m=*/true, /*flag_n=*/false);
|
||||
f.close();
|
||||
|
||||
string yosys_cmdline = stringf("%s -qq -L bugpoint-case.log -s %s bugpoint-case.il", yosys_cmd.c_str(), script.c_str());
|
||||
|
|
|
@ -605,7 +605,7 @@ struct ShowPass : public Pass {
|
|||
log(" generate a .dot file, or other <format> strings such as 'svg' or 'ps'\n");
|
||||
log(" to generate files in other formats (this calls the 'dot' command).\n");
|
||||
log("\n");
|
||||
log(" -lib <verilog_or_ilang_file>\n");
|
||||
log(" -lib <verilog_or_rtlil_file>\n");
|
||||
log(" Use the specified library file for determining whether cell ports are\n");
|
||||
log(" inputs or outputs. This option can be used multiple times to specify\n");
|
||||
log(" more than one library.\n");
|
||||
|
@ -811,7 +811,7 @@ struct ShowPass : public Pass {
|
|||
if (f.fail())
|
||||
log_error("Can't open lib file `%s'.\n", filename.c_str());
|
||||
RTLIL::Design *lib = new RTLIL::Design;
|
||||
Frontend::frontend_call(lib, &f, filename, (filename.size() > 3 && filename.compare(filename.size()-3, std::string::npos, ".il") == 0 ? "ilang" : "verilog"));
|
||||
Frontend::frontend_call(lib, &f, filename, (filename.size() > 3 && filename.compare(filename.size()-3, std::string::npos, ".il") == 0 ? "rtlil" : "verilog"));
|
||||
libs.push_back(lib);
|
||||
}
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ bool expand_module(RTLIL::Design *design, RTLIL::Module *module, bool flag_check
|
|||
{
|
||||
{".v", "verilog"},
|
||||
{".sv", "verilog -sv"},
|
||||
{".il", "ilang"}
|
||||
{".il", "rtlil"}
|
||||
};
|
||||
|
||||
for (auto &ext : extensions_list)
|
||||
|
|
|
@ -354,7 +354,7 @@ struct ExtractPass : public Pass {
|
|||
log("\n");
|
||||
log("This pass looks for subcircuits that are isomorphic to any of the modules\n");
|
||||
log("in the given map file and replaces them with instances of this modules. The\n");
|
||||
log("map file can be a Verilog source file (*.v) or an ilang file (*.il).\n");
|
||||
log("map file can be a Verilog source file (*.v) or an RTLIL source file (*.il).\n");
|
||||
log("\n");
|
||||
log(" -map <map_file>\n");
|
||||
log(" use the modules in this file as reference. This option can be used\n");
|
||||
|
@ -409,7 +409,7 @@ struct ExtractPass : public Pass {
|
|||
log("the following options are to be used instead of the -map option.\n");
|
||||
log("\n");
|
||||
log(" -mine <out_file>\n");
|
||||
log(" mine for frequent subcircuits and write them to the given ilang file\n");
|
||||
log(" mine for frequent subcircuits and write them to the given RTLIL file\n");
|
||||
log("\n");
|
||||
log(" -mine_cells_span <min> <max>\n");
|
||||
log(" only mine for subcircuits with the specified number of cells\n");
|
||||
|
@ -578,7 +578,7 @@ struct ExtractPass : public Pass {
|
|||
}
|
||||
|
||||
if (map_filenames.empty() && mine_outfile.empty())
|
||||
log_cmd_error("Missing option -map <verilog_or_ilang_file> or -mine <output_ilang_file>.\n");
|
||||
log_cmd_error("Missing option -map <verilog_or_rtlil_file> or -mine <output_rtlil_file>.\n");
|
||||
|
||||
RTLIL::Design *map = nullptr;
|
||||
|
||||
|
@ -606,7 +606,7 @@ struct ExtractPass : public Pass {
|
|||
delete map;
|
||||
log_cmd_error("Can't open map file `%s'.\n", filename.c_str());
|
||||
}
|
||||
Frontend::frontend_call(map, &f, filename, (filename.size() > 3 && filename.compare(filename.size()-3, std::string::npos, ".il") == 0 ? "ilang" : "verilog"));
|
||||
Frontend::frontend_call(map, &f, filename, (filename.size() > 3 && filename.compare(filename.size()-3, std::string::npos, ".il") == 0 ? "rtlil" : "verilog"));
|
||||
f.close();
|
||||
|
||||
if (filename.size() <= 3 || filename.compare(filename.size()-3, std::string::npos, ".il") != 0) {
|
||||
|
@ -744,7 +744,7 @@ struct ExtractPass : public Pass {
|
|||
f.open(mine_outfile.c_str(), std::ofstream::trunc);
|
||||
if (f.fail())
|
||||
log_error("Can't open output file `%s'.\n", mine_outfile.c_str());
|
||||
Backend::backend_call(map, &f, mine_outfile, "ilang");
|
||||
Backend::backend_call(map, &f, mine_outfile, "rtlil");
|
||||
f.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -985,7 +985,7 @@ struct TechmapPass : public Pass {
|
|||
log(" techmap [-map filename] [selection]\n");
|
||||
log("\n");
|
||||
log("This pass implements a very simple technology mapper that replaces cells in\n");
|
||||
log("the design with implementations given in form of a Verilog or ilang source\n");
|
||||
log("the design with implementations given in form of a Verilog or RTLIL source\n");
|
||||
log("file.\n");
|
||||
log("\n");
|
||||
log(" -map filename\n");
|
||||
|
@ -1212,7 +1212,7 @@ struct TechmapPass : public Pass {
|
|||
if (!map->module(mod->name))
|
||||
map->add(mod->clone());
|
||||
} else {
|
||||
Frontend::frontend_call(map, nullptr, fn, (fn.size() > 3 && fn.compare(fn.size()-3, std::string::npos, ".il") == 0 ? "ilang" : verilog_frontend));
|
||||
Frontend::frontend_call(map, nullptr, fn, (fn.size() > 3 && fn.compare(fn.size()-3, std::string::npos, ".il") == 0 ? "rtlil" : verilog_frontend));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ static void test_abcloop()
|
|||
}
|
||||
|
||||
log("Found viable UUT after %d cycles:\n", create_cycles);
|
||||
Pass::call(design, "write_ilang");
|
||||
Pass::call(design, "write_rtlil");
|
||||
Pass::call(design, "abc");
|
||||
|
||||
log("\n");
|
||||
|
|
|
@ -678,12 +678,12 @@ struct TestCellPass : public Pass {
|
|||
log(" -s {positive_integer}\n");
|
||||
log(" use this value as rng seed value (default = unix time).\n");
|
||||
log("\n");
|
||||
log(" -f {ilang_file}\n");
|
||||
log(" don't generate circuits. instead load the specified ilang file.\n");
|
||||
log(" -f {rtlil_file}\n");
|
||||
log(" don't generate circuits. instead load the specified RTLIL file.\n");
|
||||
log("\n");
|
||||
log(" -w {filename_prefix}\n");
|
||||
log(" don't test anything. just generate the circuits and write them\n");
|
||||
log(" to ilang files with the specified prefix\n");
|
||||
log(" to RTLIL files with the specified prefix\n");
|
||||
log("\n");
|
||||
log(" -map {filename}\n");
|
||||
log(" pass this option to techmap.\n");
|
||||
|
@ -724,7 +724,7 @@ struct TestCellPass : public Pass {
|
|||
{
|
||||
int num_iter = 100;
|
||||
std::string techmap_cmd = "techmap -assert";
|
||||
std::string ilang_file, write_prefix;
|
||||
std::string rtlil_file, write_prefix;
|
||||
xorshift32_state = 0;
|
||||
std::ofstream vlog_file;
|
||||
bool muxdiv = false;
|
||||
|
@ -750,7 +750,7 @@ struct TestCellPass : public Pass {
|
|||
continue;
|
||||
}
|
||||
if (args[argidx] == "-f" && argidx+1 < GetSize(args)) {
|
||||
ilang_file = args[++argidx];
|
||||
rtlil_file = args[++argidx];
|
||||
num_iter = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -910,10 +910,10 @@ struct TestCellPass : public Pass {
|
|||
selected_cell_types.push_back(args[argidx]);
|
||||
}
|
||||
|
||||
if (!ilang_file.empty()) {
|
||||
if (!rtlil_file.empty()) {
|
||||
if (!selected_cell_types.empty())
|
||||
log_cmd_error("Do not specify any cell types when using -f.\n");
|
||||
selected_cell_types.push_back(ID(ilang));
|
||||
selected_cell_types.push_back(ID(rtlil));
|
||||
}
|
||||
|
||||
if (selected_cell_types.empty())
|
||||
|
@ -925,12 +925,12 @@ struct TestCellPass : public Pass {
|
|||
for (int i = 0; i < num_iter; i++)
|
||||
{
|
||||
RTLIL::Design *design = new RTLIL::Design;
|
||||
if (cell_type == ID(ilang))
|
||||
Frontend::frontend_call(design, NULL, std::string(), "ilang " + ilang_file);
|
||||
if (cell_type == ID(rtlil))
|
||||
Frontend::frontend_call(design, NULL, std::string(), "rtlil " + rtlil_file);
|
||||
else
|
||||
create_gold_module(design, cell_type, cell_types.at(cell_type), constmode, muxdiv);
|
||||
if (!write_prefix.empty()) {
|
||||
Pass::call(design, stringf("write_ilang %s_%s_%05d.il", write_prefix.c_str(), cell_type.c_str()+1, i));
|
||||
Pass::call(design, stringf("write_rtlil %s_%s_%05d.il", write_prefix.c_str(), cell_type.c_str()+1, i));
|
||||
} else if (edges) {
|
||||
Pass::call(design, "dump gold");
|
||||
run_edges_test(design, verbose);
|
||||
|
|
Loading…
Reference in New Issue