From e150268946dadbcccd1c1f8be0c5aaaffd8c5f11 Mon Sep 17 00:00:00 2001 From: Cassie Jones Date: Fri, 6 Mar 2020 22:45:01 +0100 Subject: [PATCH] Change install directory Plugins in the yosys-plugins project install themselves into datdir/plugins/..., so we should do the same. Yosys seems to support this specifically, so now we can refer to the plugin as simply "nangate" instead of specifying the full path. Use: yosys -m nangate Or in your synthesis scripts, include: plugin -i nangate --- Makefile | 7 +++++-- example/example.ys | 2 +- nangate.cc | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 8eea1b8..52d62bb 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +PLUGIN_DIR=$(shell yosys-config --datdir)/plugins + all: test test: example/example.sv example/example.ys nangate.so @@ -10,8 +12,9 @@ nangate.so: nangate.cc erase_b2f_pm.h dff_nan_pm.h share_nan_pm.h yosys-config --build $@ $< install: nangate.so techlib.sv - yosys-config --exec mkdir -p --datdir/nangate - yosys-config --exec cp $^ --datdir/nangate/ + mkdir -p $(PLUGIN_DIR)/nangate/ + cp nangate.so $(PLUGIN_DIR) + cp techlib.sv $(PLUGIN_DIR)/nangate/ clean: rm -rf -- *.d *.so *.so.dSYM *_pm.h diff --git a/example/example.ys b/example/example.ys index 262cb4f..ff9f6b2 100644 --- a/example/example.ys +++ b/example/example.ys @@ -1,4 +1,4 @@ -plugin -i nangate.so +plugin -i nangate read_verilog -sv example/example.sv synth_nan -top hello show hello diff --git a/nangate.cc b/nangate.cc index a64d4f0..00859f7 100644 --- a/nangate.cc +++ b/nangate.cc @@ -69,7 +69,7 @@ struct NandToNaNPass : public Pass { void execute(vector args, Design *design) override { log_header(design, "Executing NAND_TO_NaN pass (implementing tom7 logic)\n"); log_push(); - Pass::call(design, "read_verilog -lib -sv +/nangate/techlib.sv"); + Pass::call(design, "read_verilog -lib -sv +/plugins/nangate/techlib.sv"); log_pop(); (void) args; @@ -166,7 +166,7 @@ struct ShareNaN : public Pass { struct TechmapNaN : public Pass { TechmapNaN() : Pass("techmap_nan", "techmap NaN gates") {} void execute(vector, Design *design) override { - Pass::call(design, "techmap -autoproc -extern -map +/nangate/techlib.sv"); + Pass::call(design, "techmap -autoproc -extern -map +/plugins/nangate/techlib.sv"); } } TechmapNaNPass; -- 2.43.2