Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alias for write_rtlil only when ilang frontend doesn't exist #2685

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ set(synlig_SRC
${PROJECT_SOURCE_DIR}/src/mods/yosys_ast/synlig_const2ast.cc
${PROJECT_SOURCE_DIR}/src/mods/yosys_ast/synlig_edif.cc
${PROJECT_SOURCE_DIR}/src/mods/yosys_ast/synlig_simplify.cc
${PROJECT_SOURCE_DIR}/src/mods/yosys_ast/synlig_write_ilang.cc)
${PROJECT_SOURCE_DIR}/src/mods/yosys_ast/synlig_ilang.cc)

add_library(synlig SHARED ${synlig_SRC})

Expand Down
2 changes: 1 addition & 1 deletion src/frontends/systemverilog/Build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ${ts}.sources := \
${${ts}.mod_dir}synlig_const2ast.cc \
${${ts}.mod_dir}synlig_edif.cc \
${${ts}.mod_dir}synlig_simplify.cc \
${${ts}.mod_dir}synlig_write_ilang.cc
${${ts}.mod_dir}synlig_ilang.cc

define ${ts}.env =
export PKG_CONFIG_PATH=$(call ShQuote,${$(call GetTargetStructName,surelog).output_vars.PKG_CONFIG_PATH}$(if ${PKG_CONFIG_PATH},:${PKG_CONFIG_PATH}))
Expand Down
7 changes: 6 additions & 1 deletion src/frontends/systemverilog/uhdm_common_frontend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "uhdm_common_frontend.h"
#include "synlig_edif.h"
#include "synlig_ilang.h"

#ifdef __linux__
namespace Yosys
Expand All @@ -45,7 +46,11 @@ static void set_line_num(int) {}
/* Stub for AST::process */
static int get_line_num(void) { return 1; }

UhdmCommonFrontend::UhdmCommonFrontend(std::string name, std::string short_help) : Frontend(name, short_help) { register_synlig_edif_backend(); }
UhdmCommonFrontend::UhdmCommonFrontend(std::string name, std::string short_help) : Frontend(name, short_help)
{
register_synlig_edif_backend();
Synlig::register_synlig_ilang_alias();
}

void UhdmCommonFrontend::print_read_options()
{
Expand Down
2 changes: 1 addition & 1 deletion src/mods/yosys_ast/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ CXXFLAGS += -I $(SYNLIG_SRC)/mods/yosys_ast
SYNLIG_OBJS += mods/yosys_ast/synlig_const2ast.o
SYNLIG_OBJS += mods/yosys_ast/synlig_edif.o
SYNLIG_OBJS += mods/yosys_ast/synlig_simplify.o
SYNLIG_OBJS += mods/yosys_ast/synlig_write_ilang.o
SYNLIG_OBJS += mods/yosys_ast/synlig_ilang.o
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ struct WriteIlangAlias : public Pass {
cmd += " " + args[i];
run_pass(cmd, design);
}
} WriteIlangAliasPass;
};

void register_synlig_ilang_alias()
{
if (!pass_register.count("write_ilang")) {
static WriteIlangAlias *write_ilang_alias = new WriteIlangAlias;
write_ilang_alias->init_register();
}
}
} // namespace Synlig
4 changes: 4 additions & 0 deletions src/mods/yosys_ast/synlig_ilang.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace Synlig
{
void register_synlig_ilang_alias();
}
Loading