Skip to content

Commit

Permalink
Add alias for write_rtlil only when ilang frontend doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Szelwiga committed Nov 26, 2024
1 parent fa2bcb1 commit 144fb82
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
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();
}

0 comments on commit 144fb82

Please sign in to comment.