From b00abe4a26ca24d22c822e5400e2f3aede93df48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Wed, 10 Apr 2024 11:45:12 +0200 Subject: [PATCH 01/92] Extend `log` command with `-push`, `-pop`, `-header` options --- passes/cmds/logcmd.cc | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/passes/cmds/logcmd.cc b/passes/cmds/logcmd.cc index 20cbd894345..8e51af4b3b7 100644 --- a/passes/cmds/logcmd.cc +++ b/passes/cmds/logcmd.cc @@ -31,7 +31,8 @@ struct LogPass : public Pass { { // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| log("\n"); - log(" log string\n"); + log(" log [options] string\n"); + log(" log [ -push | -pop ]\n"); log("\n"); log("Print the given string to the screen and/or the log file. This is useful for TCL\n"); log("scripts, because the TCL command \"puts\" only goes to stdout but not to\n"); @@ -52,14 +53,26 @@ struct LogPass : public Pass { log(" -n\n"); log(" do not append a newline\n"); log("\n"); + log(" -header\n"); + log(" log a pass header\n"); + log("\n"); + log(" -push\n"); + log(" push a new level on the pass counter\n"); + log("\n"); + log(" -push\n"); + log(" pop from the pass counter\n"); + log("\n"); } - void execute(std::vector args, RTLIL::Design*) override + void execute(std::vector args, RTLIL::Design* design) override { size_t argidx; bool to_stdout = false; bool to_stderr = false; bool to_log = true; bool newline = true; + bool header = false; + bool push = false; + bool pop = false; std::string text; for (argidx = 1; argidx < args.size(); argidx++) @@ -68,15 +81,30 @@ struct LogPass : public Pass { else if (args[argidx] == "-stderr") to_stderr = true; else if (args[argidx] == "-nolog") to_log = false; else if (args[argidx] == "-n") newline = false; + else if (args[argidx] == "-header") header = true; + else if (args[argidx] == "-push") push = true; + else if (args[argidx] == "-pop") pop = true; else break; } + + if ((push || pop) && args.size() != 2) + log_cmd_error("Bad usage: 'log -push' or 'log -pop' must be used without other arguments.\n"); + + if (push) { log_push(); return; } + if (pop) { log_pop(); return; } + for (; argidx < args.size(); argidx++) text += args[argidx] + ' '; if (!text.empty()) text.resize(text.size()-1); - if (to_stdout) fprintf(stdout, (newline ? "%s\n" : "%s"), text.c_str()); - if (to_stderr) fprintf(stderr, (newline ? "%s\n" : "%s"), text.c_str()); - if (to_log) log ( (newline ? "%s\n" : "%s"), text.c_str()); + const char *fmtline = newline ? "%s\n" : "%s"; + + if (to_stdout) fprintf(stdout, fmtline, text.c_str()); + if (to_stderr) fprintf(stderr, fmtline, text.c_str()); + if (to_log) { + if (!header) log(fmtline, text.c_str()); + else log_header(design, fmtline, text.c_str()); + } } } LogPass; From f2ebc3f7b14e1847798fecdf1c12cd3311cb214e Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 25 Apr 2024 09:39:23 +1200 Subject: [PATCH 02/92] github: Add template for documentation issues --- .github/ISSUE_TEMPLATE/docs_report.yml | 55 ++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/docs_report.yml diff --git a/.github/ISSUE_TEMPLATE/docs_report.yml b/.github/ISSUE_TEMPLATE/docs_report.yml new file mode 100644 index 00000000000..aa65c63b9c9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/docs_report.yml @@ -0,0 +1,55 @@ +name: Documentation Report +description: Report a problem with the Yosys documentation +labels: ["pending-verification"] +body: + - type: markdown + attributes: + value: > + + If you have a general question, please ask it in the [Discussions](https://github.com/YosysHQ/yosys/discussions) area + or join our [IRC Channel](https://web.libera.chat/#yosys) or [Community Slack](https://join.slack.com/t/yosyshq/shared_invite/zt-1aopkns2q-EiQ97BeQDt_pwvE41sGSuA). + + + If you have found a bug in Yosys, or in building the documentation, + please fill out the Bug Report issue form, this form is for problems + with the live documentation on [Read the + Docs](https://yosyshq.readthedocs.io/projects/yosys/). Please only + report problems that appear on the latest version of the documentation. + + + Please contact [YosysHQ GmbH](https://www.yosyshq.com/) if you need + commercial support for Yosys. + + - type: input + id: docs_url + attributes: + label: Link to page + description: "Please provide a link to the page where the problem was found." + placeholder: "e.g. https://yosyshq.readthedocs.io/projects/yosys/" + validations: + required: true + + - type: input + id: build_number + attributes: + label: Build number + description: "If possible, please provide the latest build number from https://readthedocs.org/projects/yosys/builds/." + placeholder: "e.g. Build #24078236" + validations: + required: false + + - type: textarea + id: problem + attributes: + label: Issue + description: "Please describe what is incorrect, invalid, or missing." + validations: + required: true + + - type: textarea + id: expected + attributes: + label: Expected + description: "If applicable, please describe what should appear instead." + validations: + required: false From 374cd3966d65cf8dda4cdfd2563462211ab3216f Mon Sep 17 00:00:00 2001 From: Jason Wu Date: Mon, 29 Apr 2024 10:04:34 +0800 Subject: [PATCH 03/92] export define marco to qtcreator.config --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 22fe373a68a..d77cacd54c6 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,7 @@ YOSYS_SRC := $(dir $(firstword $(MAKEFILE_LIST))) VPATH := $(YOSYS_SRC) CXXSTD ?= c++11 -CXXFLAGS := $(CXXFLAGS) -Wall -Wextra -ggdb -I. -I"$(YOSYS_SRC)" -MD -MP -D_YOSYS_ -fPIC -I$(PREFIX)/include +CXXFLAGS := $(CXXFLAGS) -Wall -Wextra -ggdb -I. -I"$(YOSYS_SRC)" -MD -MP -D_YOSYS_ -fPIC -I$(PREFIX)/include LIBS := $(LIBS) -lstdc++ -lm PLUGIN_LINKFLAGS := PLUGIN_LIBS := @@ -1045,11 +1045,12 @@ coverage: genhtml coverage.info --output-directory coverage_html qtcreator: + echo "$(CXXFLAGS)" | grep -o '\-D[^ ]*' | tr ' ' '\n' | sed 's/-D/#define /' | sed 's/=/ /'> qtcreator.config { for file in $(basename $(OBJS)); do \ for prefix in cc y l; do if [ -f $${file}.$${prefix} ]; then echo $$file.$${prefix}; fi; done \ done; find backends frontends kernel libs passes -type f \( -name '*.h' -o -name '*.hh' \); } > qtcreator.files { echo .; find backends frontends kernel libs passes -type f \( -name '*.h' -o -name '*.hh' \) -printf '%h\n' | sort -u; } > qtcreator.includes - touch qtcreator.config qtcreator.creator + touch qtcreator.creator vcxsrc: $(GENFILES) $(EXTRA_TARGETS) rm -rf yosys-win32-vcxsrc-$(YOSYS_VER){,.zip} From f1672b2f14cbf4aac89bd2e922bbd6919f808c6d Mon Sep 17 00:00:00 2001 From: Jason Wu <41063703+offline3@users.noreply.github.com> Date: Mon, 29 Apr 2024 10:16:22 +0800 Subject: [PATCH 04/92] Update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d77cacd54c6..296d66d0dad 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,7 @@ YOSYS_SRC := $(dir $(firstword $(MAKEFILE_LIST))) VPATH := $(YOSYS_SRC) CXXSTD ?= c++11 -CXXFLAGS := $(CXXFLAGS) -Wall -Wextra -ggdb -I. -I"$(YOSYS_SRC)" -MD -MP -D_YOSYS_ -fPIC -I$(PREFIX)/include +CXXFLAGS := $(CXXFLAGS) -Wall -Wextra -ggdb -I. -I"$(YOSYS_SRC)" -MD -MP -D_YOSYS_ -fPIC -I$(PREFIX)/include LIBS := $(LIBS) -lstdc++ -lm PLUGIN_LINKFLAGS := PLUGIN_LIBS := From 8cc9aa7fc6a4d9008e68a4e146358a191cb854c4 Mon Sep 17 00:00:00 2001 From: Lofty Date: Fri, 3 May 2024 11:16:34 +0100 Subject: [PATCH 05/92] intel_alm: drop quartus support --- techlibs/intel_alm/Makefile.inc | 3 - techlibs/intel_alm/common/alm_sim.v | 414 +-------------------- techlibs/intel_alm/common/bram_m20k.txt | 33 -- techlibs/intel_alm/common/bram_m20k_map.v | 31 -- techlibs/intel_alm/common/dff_sim.v | 32 -- techlibs/intel_alm/common/mem_sim.v | 56 +-- techlibs/intel_alm/common/quartus_rename.v | 311 ---------------- techlibs/intel_alm/synth_intel_alm.cc | 81 +--- tests/arch/intel_alm/add_sub.ys | 9 - tests/arch/intel_alm/adffs.ys | 46 --- tests/arch/intel_alm/blockram.ys | 1 + tests/arch/intel_alm/counter.ys | 14 - tests/arch/intel_alm/dffs.ys | 22 -- tests/arch/intel_alm/fsm.ys | 22 -- tests/arch/intel_alm/logic.ys | 13 - tests/arch/intel_alm/lutram.ys | 1 + tests/arch/intel_alm/mul.ys | 25 -- tests/arch/intel_alm/mux.ys | 43 --- tests/arch/intel_alm/quartus_ice.ys | 26 -- tests/arch/intel_alm/shifter.ys | 11 - tests/arch/intel_alm/tribuf.ys | 14 - 21 files changed, 18 insertions(+), 1190 deletions(-) delete mode 100644 techlibs/intel_alm/common/bram_m20k.txt delete mode 100644 techlibs/intel_alm/common/bram_m20k_map.v delete mode 100644 techlibs/intel_alm/common/quartus_rename.v delete mode 100644 tests/arch/intel_alm/quartus_ice.ys diff --git a/techlibs/intel_alm/Makefile.inc b/techlibs/intel_alm/Makefile.inc index b5f279a921c..9e24d695e85 100644 --- a/techlibs/intel_alm/Makefile.inc +++ b/techlibs/intel_alm/Makefile.inc @@ -20,10 +20,7 @@ $(eval $(call add_share_file,share/intel_alm/cyclonev,techlibs/intel_alm/cyclone # RAM $(eval $(call add_share_file,share/intel_alm/common,techlibs/intel_alm/common/bram_m10k.txt)) $(eval $(call add_share_file,share/intel_alm/common,techlibs/intel_alm/common/bram_m10k_map.v)) -$(eval $(call add_share_file,share/intel_alm/common,techlibs/intel_alm/common/bram_m20k.txt)) -$(eval $(call add_share_file,share/intel_alm/common,techlibs/intel_alm/common/bram_m20k_map.v)) $(eval $(call add_share_file,share/intel_alm/common,techlibs/intel_alm/common/lutram_mlab.txt)) # Miscellaneous $(eval $(call add_share_file,share/intel_alm/common,techlibs/intel_alm/common/megafunction_bb.v)) -$(eval $(call add_share_file,share/intel_alm/common,techlibs/intel_alm/common/quartus_rename.v)) diff --git a/techlibs/intel_alm/common/alm_sim.v b/techlibs/intel_alm/common/alm_sim.v index d3bd673903f..858e43c76cc 100644 --- a/techlibs/intel_alm/common/alm_sim.v +++ b/techlibs/intel_alm/common/alm_sim.v @@ -1,4 +1,4 @@ -// The core logic primitive of the Cyclone V/10GX is the Adaptive Logic Module +// The core logic primitive of the Cyclone V is the Adaptive Logic Module // (ALM). Each ALM is made up of an 8-input, 2-output look-up table, covered // in this file, connected to combinational outputs, a carry chain, and four // D flip-flops (which are covered as MISTRAL_FF in dff_sim.v). @@ -77,14 +77,6 @@ // SUMOUT 368 1342 1323 887 927 - 785 - // CARRYOUT 71 1082 1062 866 813 - 1198 - -// Arria V LUT output timings (picoseconds): -// -// CARRY A B C D E F G -// COMBOUT - 387 375 316 317 - 76 319 (LUT6) -// COMBOUT - 387 375 316 317 218 76 319 (LUT7) -// SUMOUT 249 744 732 562 576 - 511 - -// CARRYOUT 19 629 623 530 514 - 696 - - (* abc9_lut=2, lib_whitebox *) module MISTRAL_ALUT6(input A, B, C, D, E, F, output Q); @@ -100,26 +92,6 @@ specify (F => Q) = 97; endspecify `endif -`ifdef arriav -specify - (A => Q) = 387; - (B => Q) = 375; - (C => Q) = 316; - (D => Q) = 317; - (E => Q) = 319; - (F => Q) = 76; -endspecify -`endif -`ifdef cyclone10gx -specify - (A => Q) = 275; - (B => Q) = 272; - (C => Q) = 175; - (D => Q) = 165; - (E => Q) = 162; - (F => Q) = 53; -endspecify -`endif assign Q = LUT >> {F, E, D, C, B, A}; @@ -140,24 +112,6 @@ specify (E => Q) = 97; endspecify `endif -`ifdef arriav -specify - (A => Q) = 375; - (B => Q) = 316; - (C => Q) = 317; - (D => Q) = 319; - (E => Q) = 76; -endspecify -`endif -`ifdef cyclone10gx -specify - (A => Q) = 272; - (B => Q) = 175; - (C => Q) = 165; - (D => Q) = 162; - (E => Q) = 53; -endspecify -`endif assign Q = LUT >> {E, D, C, B, A}; @@ -177,22 +131,6 @@ specify (D => Q) = 97; endspecify `endif -`ifdef arriav -specify - (A => Q) = 316; - (B => Q) = 317; - (C => Q) = 319; - (D => Q) = 76; -endspecify -`endif -`ifdef cyclone10gx -specify - (A => Q) = 175; - (B => Q) = 165; - (C => Q) = 162; - (D => Q) = 53; -endspecify -`endif assign Q = LUT >> {D, C, B, A}; @@ -211,20 +149,6 @@ specify (C => Q) = 97; endspecify `endif -`ifdef arriav -specify - (A => Q) = 316; - (B => Q) = 317; - (C => Q) = 76; -endspecify -`endif -`ifdef cyclone10gx -specify - (A => Q) = 165; - (B => Q) = 162; - (C => Q) = 53; -endspecify -`endif assign Q = LUT >> {C, B, A}; @@ -242,18 +166,6 @@ specify (B => Q) = 97; endspecify `endif -`ifdef arriav -specify - (A => Q) = 316; - (B => Q) = 76; -endspecify -`endif -`ifdef cyclone10gx -specify - (A => Q) = 162; - (B => Q) = 53; -endspecify -`endif assign Q = LUT >> {B, A}; @@ -268,16 +180,6 @@ specify (A => Q) = 97; endspecify `endif -`ifdef arriav -specify - (A => Q) = 76; -endspecify -`endif -`ifdef cyclone10gx -specify - (A => Q) = 53; -endspecify -`endif assign Q = ~A; @@ -306,40 +208,6 @@ specify (CI => CO) = 36; // Divided by 2 to account for there being two ALUT_ARITHs in an ALM) endspecify `endif -`ifdef arriav -specify - (A => SO) = 744; - (B => SO) = 732; - (C => SO) = 562; - (D0 => SO) = 576; - (D1 => SO) = 511; - (CI => SO) = 249; - - (A => CO) = 629; - (B => CO) = 623; - (C => CO) = 530; - (D0 => CO) = 514; - (D1 => CO) = 696; - (CI => CO) = 10; // Divided by 2 to account for there being two ALUT_ARITHs in an ALM) -endspecify -`endif -`ifdef cyclone10gx -specify - (A => SO) = 644; - (B => SO) = 477; - (C => SO) = 416; - (D0 => SO) = 380; - (D1 => SO) = 431; - (CI => SO) = 276; - - (A => CO) = 525; - (B => CO) = 433; - (C => CO) = 712; - (D0 => CO) = 653; - (D1 => CO) = 593; - (CI => CO) = 16; -endspecify -`endif wire q0, q1; @@ -349,283 +217,3 @@ assign q1 = LUT1 >> {D1, C, B, A}; assign {CO, SO} = q0 + !q1 + CI; endmodule - - -/* -// A, B, C0, C1, E0, E1, F0, F1: data inputs -// CARRYIN: carry input -// SHAREIN: shared-arithmetic input -// CLK0, CLK1, CLK2: clock inputs -// -// COMB0, COMB1: combinational outputs -// FF0, FF1, FF2, FF3: DFF outputs -// SUM0, SUM1: adder outputs -// CARRYOUT: carry output -// SHAREOUT: shared-arithmetic output -module MISTRAL_ALM( - input A, B, C0, C1, E0, E1, F0, F1, CARRYIN, SHAREIN, // LUT path - input CLK0, CLK1, CLK2, AC0, AC1, // FF path - output COMB0, COMB1, SUM0, SUM1, CARRYOUT, SHAREOUT, - output FF0, FF1, FF2, FF3 -); - -parameter LUT0 = 16'b0000; -parameter LUT1 = 16'b0000; -parameter LUT2 = 16'b0000; -parameter LUT3 = 16'b0000; - -parameter INIT0 = 1'b0; -parameter INIT1 = 1'b0; -parameter INIT2 = 1'b0; -parameter INIT3 = 1'b0; - -parameter C0_MUX = "C0"; -parameter C1_MUX = "C1"; - -parameter F0_MUX = "VCC"; -parameter F1_MUX = "GND"; - -parameter FEEDBACK0 = "FF0"; -parameter FEEDBACK1 = "FF2"; - -parameter ADD_MUX = "LUT"; - -parameter DFF01_DATA_MUX = "COMB"; -parameter DFF23_DATA_MUX = "COMB"; - -parameter DFF0_CLK = "CLK0"; -parameter DFF1_CLK = "CLK0"; -parameter DFF2_CLK = "CLK0"; -parameter DFF3_CLK = "CLK0"; - -parameter DFF0_AC = "AC0"; -parameter DFF1_AC = "AC0"; -parameter DFF2_AC = "AC0"; -parameter DFF3_AC = "AC0"; - -// Feedback muxes from the flip-flop outputs. -wire ff_feedback_mux0, ff_feedback_mux1; - -// C-input muxes which can be set to also use the F-input. -wire c0_input_mux, c1_input_mux; - -// F-input muxes which can be set to a constant to allow LUT5 use. -wire f0_input_mux, f1_input_mux; - -// Adder input muxes to select between shared-arithmetic mode and arithmetic mode. -wire add0_input_mux, add1_input_mux; - -// Combinational-output muxes for LUT #1 and LUT #3 -wire lut1_comb_mux, lut3_comb_mux; - -// Sum-output muxes for LUT #1 and LUT #3 -wire lut1_sum_mux, lut3_sum_mux; - -// DFF data-input muxes -wire dff01_data_mux, dff23_data_mux; - -// DFF clock selectors -wire dff0_clk, dff1_clk, dff2_clk, dff3_clk; - -// DFF asynchronous-clear selectors -wire dff0_ac, dff1_ac, dff2_ac, dff3_ac; - -// LUT, DFF and adder output wires for routing. -wire lut0_out, lut1a_out, lut1b_out, lut2_out, lut3a_out, lut3b_out; -wire dff0_out, dff1_out, dff2_out, dff3_out; -wire add0_sum, add1_sum, add0_carry, add1_carry; - -generate - if (FEEDBACK0 === "FF0") - assign ff_feedback_mux0 = dff0_out; - else if (FEEDBACK0 === "FF1") - assign ff_feedback_mux0 = dff1_out; - else - $error("Invalid FEEDBACK0 setting!"); - - if (FEEDBACK1 == "FF2") - assign ff_feedback_mux1 = dff2_out; - else if (FEEDBACK1 == "FF3") - assign ff_feedback_mux1 = dff3_out; - else - $error("Invalid FEEDBACK1 setting!"); - - if (C0_MUX === "C0") - assign c0_input_mux = C0; - else if (C0_MUX === "F1") - assign c0_input_mux = F1; - else if (C0_MUX === "FEEDBACK1") - assign c0_input_mux = ff_feedback_mux1; - else - $error("Invalid C0_MUX setting!"); - - if (C1_MUX === "C1") - assign c1_input_mux = C1; - else if (C1_MUX === "F0") - assign c1_input_mux = F0; - else if (C1_MUX === "FEEDBACK0") - assign c1_input_mux = ff_feedback_mux0; - else - $error("Invalid C1_MUX setting!"); - - // F0 == VCC is LUT5 - // F0 == F0 is LUT6 - // F0 == FEEDBACK is unknown - if (F0_MUX === "VCC") - assign f0_input_mux = 1'b1; - else if (F0_MUX === "F0") - assign f0_input_mux = F0; - else if (F0_MUX === "FEEDBACK0") - assign f0_input_mux = ff_feedback_mux0; - else - $error("Invalid F0_MUX setting!"); - - // F1 == GND is LUT5 - // F1 == F1 is LUT6 - // F1 == FEEDBACK is unknown - if (F1_MUX === "GND") - assign f1_input_mux = 1'b0; - else if (F1_MUX === "F1") - assign f1_input_mux = F1; - else if (F1_MUX === "FEEDBACK1") - assign f1_input_mux = ff_feedback_mux1; - else - $error("Invalid F1_MUX setting!"); - - if (ADD_MUX === "LUT") begin - assign add0_input_mux = ~lut1_sum_mux; - assign add1_input_mux = ~lut3_sum_mux; - end else if (ADD_MUX === "SHARE") begin - assign add0_input_mux = SHAREIN; - assign add1_input_mux = lut1_comb_mux; - end else - $error("Invalid ADD_MUX setting!"); - - if (DFF01_DATA_MUX === "COMB") - assign dff01_data_mux = COMB0; - else if (DFF01_DATA_MUX === "SUM") - assign dff01_data_mux = SUM0; - else - $error("Invalid DFF01_DATA_MUX setting!"); - - if (DFF23_DATA_MUX === "COMB") - assign dff23_data_mux = COMB0; - else if (DFF23_DATA_MUX === "SUM") - assign dff23_data_mux = SUM0; - else - $error("Invalid DFF23_DATA_MUX setting!"); - - if (DFF0_CLK === "CLK0") - assign dff0_clk = CLK0; - else if (DFF0_CLK === "CLK1") - assign dff0_clk = CLK1; - else if (DFF0_CLK === "CLK2") - assign dff0_clk = CLK2; - else - $error("Invalid DFF0_CLK setting!"); - - if (DFF1_CLK === "CLK0") - assign dff1_clk = CLK0; - else if (DFF1_CLK === "CLK1") - assign dff1_clk = CLK1; - else if (DFF1_CLK === "CLK2") - assign dff1_clk = CLK2; - else - $error("Invalid DFF1_CLK setting!"); - - if (DFF2_CLK === "CLK0") - assign dff2_clk = CLK0; - else if (DFF2_CLK === "CLK1") - assign dff2_clk = CLK1; - else if (DFF2_CLK === "CLK2") - assign dff2_clk = CLK2; - else - $error("Invalid DFF2_CLK setting!"); - - if (DFF3_CLK === "CLK0") - assign dff3_clk = CLK0; - else if (DFF3_CLK === "CLK1") - assign dff3_clk = CLK1; - else if (DFF3_CLK === "CLK2") - assign dff3_clk = CLK2; - else - $error("Invalid DFF3_CLK setting!"); - - if (DFF0_AC === "AC0") - assign dff0_ac = AC0; - else if (DFF0_AC === "AC1") - assign dff0_ac = AC1; - else - $error("Invalid DFF0_AC setting!"); - - if (DFF1_AC === "AC0") - assign dff1_ac = AC0; - else if (DFF1_AC === "AC1") - assign dff1_ac = AC1; - else - $error("Invalid DFF1_AC setting!"); - - if (DFF2_AC === "AC0") - assign dff2_ac = AC0; - else if (DFF2_AC === "AC1") - assign dff2_ac = AC1; - else - $error("Invalid DFF2_AC setting!"); - - if (DFF3_AC === "AC0") - assign dff3_ac = AC0; - else if (DFF3_AC === "AC1") - assign dff3_ac = AC1; - else - $error("Invalid DFF3_AC setting!"); - -endgenerate - -// F0 on the Quartus diagram -MISTRAL_ALUT4 #(.LUT(LUT0)) lut0 (.A(A), .B(B), .C(C0), .D(c1_input_mux), .Q(lut0_out)); - -// F2 on the Quartus diagram -MISTRAL_ALUT4 #(.LUT(LUT1)) lut1_comb (.A(A), .B(B), .C(C0), .D(c1_input_mux), .Q(lut1_comb_mux)); -MISTRAL_ALUT4 #(.LUT(LUT1)) lut1_sum (.A(A), .B(B), .C(C0), .D(E0), .Q(lut1_sum_mux)); - -// F1 on the Quartus diagram -MISTRAL_ALUT4 #(.LUT(LUT2)) lut2 (.A(A), .B(B), .C(C1), .D(c0_input_mux), .Q(lut2_out)); - -// F3 on the Quartus diagram -MISTRAL_ALUT4 #(.LUT(LUT3)) lut3_comb (.A(A), .B(B), .C(C1), .D(c0_input_mux), .Q(lut3_comb_mux)); -MISTRAL_ALUT4 #(.LUT(LUT3)) lut3_sum (.A(A), .B(B), .C(C1), .D(E1), .Q(lut3_sum_mux)); - -MISTRAL_FF #(.INIT(INIT0)) dff0 (.D(dff01_data_mux), .CLK(dff0_clk), .ACn(dff0_ac), .Q(dff0_out)); -MISTRAL_FF #(.INIT(INIT1)) dff1 (.D(dff01_data_mux), .CLK(dff1_clk), .ACn(dff1_ac), .Q(dff1_out)); -MISTRAL_FF #(.INIT(INIT2)) dff2 (.D(dff23_data_mux), .CLK(dff2_clk), .ACn(dff2_ac), .Q(dff2_out)); -MISTRAL_FF #(.INIT(INIT3)) dff3 (.D(dff23_data_mux), .CLK(dff3_clk), .ACn(dff3_ac), .Q(dff3_out)); - -// Adders -assign {add0_carry, add0_sum} = CARRYIN + lut0_out + lut1_sum_mux; -assign {add1_carry, add1_sum} = add0_carry + lut2_out + lut3_sum_mux; - -// COMBOUT outputs on the Quartus diagram -assign COMB0 = E0 ? (f0_input_mux ? lut3_comb_mux : lut1_comb_mux) - : (f0_input_mux ? lut2_out : lut0_out); - -assign COMB1 = E1 ? (f1_input_mux ? lut3_comb_mux : lut1_comb_mux) - : (f1_input_mux ? lut2_out : lut0_out); - -// SUMOUT output on the Quartus diagram -assign SUM0 = add0_sum; -assign SUM1 = add1_sum; - -// COUT output on the Quartus diagram -assign CARRYOUT = add1_carry; - -// SHAREOUT output on the Quartus diagram -assign SHAREOUT = lut3_comb_mux; - -// REGOUT outputs on the Quartus diagram -assign FF0 = dff0_out; -assign FF1 = dff1_out; -assign FF2 = dff2_out; -assign FF3 = dff3_out; - -endmodule -*/ diff --git a/techlibs/intel_alm/common/bram_m20k.txt b/techlibs/intel_alm/common/bram_m20k.txt deleted file mode 100644 index b4c5a537287..00000000000 --- a/techlibs/intel_alm/common/bram_m20k.txt +++ /dev/null @@ -1,33 +0,0 @@ -bram __MISTRAL_M20K_SDP - init 1 # TODO: Re-enable when I figure out how BRAM init works - abits 14 @D16384x1 - dbits 1 @D16384x1 - abits 13 @D8192x2 - dbits 2 @D8192x2 - abits 12 @D4096x4 @D4096x5 - dbits 4 @D4096x4 - dbits 5 @D4096x5 - abits 11 @D2048x8 @D2048x10 - dbits 8 @D2048x8 - dbits 10 @D2048x10 - abits 10 @D1024x16 @D1024x20 - dbits 16 @D1024x16 - dbits 20 @D1024x20 - abits 9 @D512x32 @D512x40 - dbits 32 @D512x32 - dbits 40 @D512x40 - groups 2 - ports 1 1 - wrmode 1 0 - # read enable; write enable + byte enables (only for multiples of 8) - enable 1 1 - transp 0 0 - clocks 1 1 - clkpol 1 1 -endbram - - -match __MISTRAL_M20K_SDP - min efficiency 5 - make_transp -endmatch diff --git a/techlibs/intel_alm/common/bram_m20k_map.v b/techlibs/intel_alm/common/bram_m20k_map.v deleted file mode 100644 index 15739d66a2e..00000000000 --- a/techlibs/intel_alm/common/bram_m20k_map.v +++ /dev/null @@ -1,31 +0,0 @@ -module __MISTRAL_M20K_SDP(CLK1, A1ADDR, A1DATA, A1EN, B1ADDR, B1DATA, B1EN); - -parameter CFG_ABITS = 10; -parameter CFG_DBITS = 20; -parameter CFG_ENABLE_A = 1; -parameter CFG_ENABLE_B = 1; - -input CLK1; -input [CFG_ABITS-1:0] A1ADDR, B1ADDR; -input [CFG_DBITS-1:0] A1DATA; -output [CFG_DBITS-1:0] B1DATA; -input [CFG_ENABLE_A-1:0] A1EN, B1EN; - -altsyncram #( - .operation_mode("dual_port"), - .ram_block_type("m20k"), - .widthad_a(CFG_ABITS), - .width_a(CFG_DBITS), - .widthad_b(CFG_ABITS), - .width_b(CFG_DBITS), -) _TECHMAP_REPLACE_ ( - .address_a(A1ADDR), - .data_a(A1DATA), - .wren_a(A1EN), - .address_b(B1ADDR), - .q_b(B1DATA), - .clock0(CLK1), - .clock1(CLK1) -); - -endmodule diff --git a/techlibs/intel_alm/common/dff_sim.v b/techlibs/intel_alm/common/dff_sim.v index 8d58bf61485..a558973f9fd 100644 --- a/techlibs/intel_alm/common/dff_sim.v +++ b/techlibs/intel_alm/common/dff_sim.v @@ -77,38 +77,6 @@ specify if (ACLR === 1'b0) (ACLR => Q) = 282; endspecify `endif -`ifdef arriav -specify - if (ENA && ACLR !== 1'b0 && !SCLR && !SLOAD) (posedge CLK => (Q : DATAIN)) = 470; - if (ENA && SCLR) (posedge CLK => (Q : 1'b0)) = 633; - if (ENA && !SCLR && SLOAD) (posedge CLK => (Q : SDATA)) = 439; - - $setup(DATAIN, posedge CLK, /* -170 */ 0); - $setup(ENA, posedge CLK, /* -170 */ 0); - $setup(SCLR, posedge CLK, /* -170 */ 0); - $setup(SLOAD, posedge CLK, /* -170 */ 0); - $setup(SDATA, posedge CLK, /* -170 */ 0); - - if (ACLR === 1'b0) (ACLR => Q) = 215; -endspecify -`endif -`ifdef cyclone10gx -specify - // TODO (long-term): investigate these numbers. - // It seems relying on the Quartus Timing Analyzer was not the best idea; it's too fiddly. - if (ENA && ACLR !== 1'b0 && !SCLR && !SLOAD) (posedge CLK => (Q : DATAIN)) = 219; - if (ENA && SCLR) (posedge CLK => (Q : 1'b0)) = 219; - if (ENA && !SCLR && SLOAD) (posedge CLK => (Q : SDATA)) = 219; - - $setup(DATAIN, posedge CLK, 268); - $setup(ENA, posedge CLK, 268); - $setup(SCLR, posedge CLK, 268); - $setup(SLOAD, posedge CLK, 268); - $setup(SDATA, posedge CLK, 268); - - if (ACLR === 1'b0) (ACLR => Q) = 0; -endspecify -`endif initial begin // Altera flops initialise to zero. diff --git a/techlibs/intel_alm/common/mem_sim.v b/techlibs/intel_alm/common/mem_sim.v index 563f1d2413e..5ab1b73261f 100644 --- a/techlibs/intel_alm/common/mem_sim.v +++ b/techlibs/intel_alm/common/mem_sim.v @@ -1,7 +1,7 @@ // The MLAB // -------- // In addition to Logic Array Blocks (LABs) that contain ten Adaptive Logic -// Modules (ALMs, see alm_sim.v), the Cyclone V/10GX also contain +// Modules (ALMs, see alm_sim.v), the Cyclone V also contains // Memory/Logic Array Blocks (MLABs) that can act as either ten ALMs, or utilise // the memory the ALM uses to store the look-up table data for general usage, // producing a 32 address by 20-bit block of memory. MLABs are spread out @@ -14,11 +14,8 @@ // or shift registers (by using the output of the Nth bit as input for the N+1th // bit). // -// Oddly, instead of providing a block 32 address by 20-bit cell, Quartus asks -// synthesis tools to build MLABs out of 32 address by 1-bit cells, and tries -// to put these cells in the same MLAB during cell placement. Because of this -// a MISTRAL_MLAB cell represents one of these 32 address by 1-bit cells, and -// 20 of them represent a physical MLAB. +// For historical reasons a MISTRAL_MLAB cell represents a 32 address by 1-bit cell, +// and 20 of them represent a physical MLAB. // // How the MLAB works // ------------------ @@ -28,10 +25,7 @@ // by the Yosys `memory_bram` pass, and it doesn't make sense to me to use // `techmap` just for the sake of renaming the cell ports. // -// The MLAB can be initialised to any value, but unfortunately Quartus only -// allows memory initialisation from a file. Since Yosys doesn't preserve input -// file information, or write the contents of an `initial` block to a file, -// Yosys can't currently initialise the MLAB in a way Quartus will accept. +// The MLAB can be initialised to any value. // // The MLAB takes in data from A1DATA at the rising edge of CLK1, and if A1EN // is high, writes it to the address in A1ADDR. A1EN can therefore be used to @@ -39,9 +33,7 @@ // // Simultaneously, the MLAB reads data from B1ADDR, and outputs it to B1DATA, // asynchronous to CLK1 and ignoring A1EN. If a synchronous read is needed -// then the output can be fed to embedded flops. Presently, Yosys assumes -// Quartus will pack external flops into the MLAB, but this is an assumption -// that needs testing. +// then the output can be fed to embedded flops. // The vendor sim model outputs 'x for a very short period (a few // combinational delta cycles) after each write. This has been omitted from @@ -69,33 +61,6 @@ specify (B1ADDR[4] => B1DATA) = 96; endspecify `endif -`ifdef arriav -specify - $setup(A1ADDR, posedge CLK1, 62); - $setup(A1DATA, posedge CLK1, 62); - $setup(A1EN, posedge CLK1, 62); - - (B1ADDR[0] => B1DATA) = 370; - (B1ADDR[1] => B1DATA) = 292; - (B1ADDR[2] => B1DATA) = 218; - (B1ADDR[3] => B1DATA) = 74; - (B1ADDR[4] => B1DATA) = 177; -endspecify -`endif -`ifdef cyclone10gx -// TODO: Cyclone 10 GX timings; the below timings are for Cyclone V -specify - $setup(A1ADDR, posedge CLK1, 86); - $setup(A1DATA, posedge CLK1, 86); - $setup(A1EN, posedge CLK1, 86); - - (B1ADDR[0] => B1DATA) = 487; - (B1ADDR[1] => B1DATA) = 475; - (B1ADDR[2] => B1DATA) = 382; - (B1ADDR[3] => B1DATA) = 284; - (B1ADDR[4] => B1DATA) = 96; -endspecify -`endif always @(posedge CLK1) if (A1EN) mem[A1ADDR] <= A1DATA; @@ -134,17 +99,6 @@ specify if (B1EN) (posedge CLK1 => (B1DATA : A1DATA)) = 1004; endspecify `endif -`ifdef arriav -specify - $setup(A1ADDR, posedge CLK1, 97); - $setup(A1DATA, posedge CLK1, 74); - $setup(A1EN, posedge CLK1, 109); - $setup(B1ADDR, posedge CLK1, 97); - $setup(B1EN, posedge CLK1, 126); - - if (B1EN) (posedge CLK1 => (B1DATA : A1DATA)) = 787; -endspecify -`endif always @(posedge CLK1) begin if (!A1EN) diff --git a/techlibs/intel_alm/common/quartus_rename.v b/techlibs/intel_alm/common/quartus_rename.v deleted file mode 100644 index 217dc5de98b..00000000000 --- a/techlibs/intel_alm/common/quartus_rename.v +++ /dev/null @@ -1,311 +0,0 @@ -`ifdef cyclonev -`define LCELL cyclonev_lcell_comb -`define MAC cyclonev_mac -`define MLAB cyclonev_mlab_cell -`define RAM_BLOCK cyclonev_ram_block -`define IBUF cyclonev_io_ibuf -`define OBUF cyclonev_io_obuf -`define CLKENA cyclonev_clkena -`endif -`ifdef arriav -`define LCELL arriav_lcell_comb -`define MAC arriav_mac -`define MLAB arriav_mlab_cell -`define RAM_BLOCK arriav_ram_block -`define IBUF arriav_io_ibuf -`define OBUF arriav_io_obuf -`define CLKENA arriav_clkena -`endif -`ifdef cyclone10gx -`define LCELL cyclone10gx_lcell_comb -`define MAC cyclone10gx_mac -`define MLAB cyclone10gx_mlab_cell -`define RAM_BLOCK cyclone10gx_ram_block -`define IBUF cyclone10gx_io_ibuf -`define OBUF cyclone10gx_io_obuf -`define CLKENA cyclone10gx_clkena -`endif - -module __MISTRAL_VCC(output Q); - -MISTRAL_ALUT2 #(.LUT(4'b1111)) _TECHMAP_REPLACE_ (.A(1'b1), .B(1'b1), .Q(Q)); - -endmodule - - -module __MISTRAL_GND(output Q); - -MISTRAL_ALUT2 #(.LUT(4'b0000)) _TECHMAP_REPLACE_ (.A(1'b1), .B(1'b1), .Q(Q)); - -endmodule - - -module MISTRAL_FF(input DATAIN, CLK, ACLR, ENA, SCLR, SLOAD, SDATA, output reg Q); - -dffeas #(.power_up("low"), .is_wysiwyg("true")) _TECHMAP_REPLACE_ (.d(DATAIN), .clk(CLK), .clrn(ACLR), .ena(ENA), .sclr(SCLR), .sload(SLOAD), .asdata(SDATA), .q(Q)); - -endmodule - - -module MISTRAL_ALUT6(input A, B, C, D, E, F, output Q); -parameter [63:0] LUT = 64'h0000_0000_0000_0000; - -`LCELL #(.lut_mask(LUT)) _TECHMAP_REPLACE_ (.dataa(A), .datab(B), .datac(C), .datad(D), .datae(E), .dataf(F), .combout(Q)); - -endmodule - - -module MISTRAL_ALUT5(input A, B, C, D, E, output Q); -parameter [31:0] LUT = 32'h0000_0000; - -`LCELL #(.lut_mask({2{LUT}})) _TECHMAP_REPLACE_ (.dataa(A), .datab(B), .datac(C), .datad(D), .datae(E), .combout(Q)); - -endmodule - - -module MISTRAL_ALUT4(input A, B, C, D, output Q); -parameter [15:0] LUT = 16'h0000; - -`LCELL #(.lut_mask({4{LUT}})) _TECHMAP_REPLACE_ (.dataa(A), .datab(B), .datac(C), .datad(D), .combout(Q)); - -endmodule - - -module MISTRAL_ALUT3(input A, B, C, output Q); -parameter [7:0] LUT = 8'h00; - -`LCELL #(.lut_mask({8{LUT}})) _TECHMAP_REPLACE_ (.dataa(A), .datab(B), .datac(C), .combout(Q)); - -endmodule - - -module MISTRAL_ALUT2(input A, B, output Q); -parameter [3:0] LUT = 4'h0; - -`LCELL #(.lut_mask({16{LUT}})) _TECHMAP_REPLACE_ (.dataa(A), .datab(B), .combout(Q)); - -endmodule - - -module MISTRAL_NOT(input A, output Q); - -NOT _TECHMAP_REPLACE_ (.IN(A), .OUT(Q)); - -endmodule - - -module MISTRAL_ALUT_ARITH(input A, B, C, D0, D1, CI, output SO, CO); -parameter LUT0 = 16'h0000; -parameter LUT1 = 16'h0000; - -`LCELL #(.lut_mask({16'h0, LUT1, 16'h0, LUT0})) _TECHMAP_REPLACE_ (.dataa(A), .datab(B), .datac(C), .datad(D0), .dataf(D1), .cin(CI), .sumout(SO), .cout(CO)); - -endmodule - - -module MISTRAL_MLAB(input [4:0] A1ADDR, input A1DATA, A1EN, CLK1, input [4:0] B1ADDR, output B1DATA); - -parameter _TECHMAP_CELLNAME_ = ""; - -// Here we get to an unfortunate situation. The cell has a mem_init0 parameter, -// which takes in a hexadecimal string that could be used to initialise RAM. -// In the vendor simulation models, this appears to work fine, but Quartus, -// either intentionally or not, forgets about this parameter and initialises the -// RAM to zero. -// -// Because of this, RAM initialisation is presently disabled, but the source -// used to generate mem_init0 is kept (commented out) in case this gets fixed -// or an undocumented way to get Quartus to initialise from mem_init0 is found. - -`MLAB #( - .logical_ram_name(_TECHMAP_CELLNAME_), - .logical_ram_depth(32), - .logical_ram_width(1), - .mixed_port_feed_through_mode("Dont Care"), - .first_bit_number(0), - .first_address(0), - .last_address(31), - .address_width(5), - .data_width(1), - .byte_enable_mask_width(1), - .port_b_data_out_clock("NONE"), - // .mem_init0($sformatf("%08x", INIT)) -) _TECHMAP_REPLACE_ ( - .portaaddr(A1ADDR), - .portadatain(A1DATA), - .portbaddr(B1ADDR), - .portbdataout(B1DATA), - .ena0(A1EN), - .clk0(CLK1) -); - -endmodule - - -module MISTRAL_M10K(A1ADDR, A1DATA, A1EN, CLK1, B1ADDR, B1DATA, B1EN); - -parameter CFG_ABITS = 10; -parameter CFG_DBITS = 10; - -parameter _TECHMAP_CELLNAME_ = ""; - -input [CFG_ABITS-1:0] A1ADDR, B1ADDR; -input [CFG_DBITS-1:0] A1DATA; -input CLK1, A1EN, B1EN; -output [CFG_DBITS-1:0] B1DATA; - -// Much like the MLAB, the M10K has mem_init[01234] parameters which would let -// you initialise the RAM cell via hex literals. If they were implemented. - -// Since the MISTRAL_M10K block has an inverted write-enable (like the real hardware) -// but the Quartus primitive expects a normal write-enable, we add an inverter. -wire A1EN_N; -NOT wren_inv (.IN(A1EN), .OUT(A1EN_N)); - -`RAM_BLOCK #( - .operation_mode("dual_port"), - .logical_ram_name(_TECHMAP_CELLNAME_), - .port_a_address_width(CFG_ABITS), - .port_a_data_width(CFG_DBITS), - .port_a_logical_ram_depth(2**CFG_ABITS), - .port_a_logical_ram_width(CFG_DBITS), - .port_a_first_address(0), - .port_a_last_address(2**CFG_ABITS - 1), - .port_a_first_bit_number(0), - .port_b_address_width(CFG_ABITS), - .port_b_data_width(CFG_DBITS), - .port_b_logical_ram_depth(2**CFG_ABITS), - .port_b_logical_ram_width(CFG_DBITS), - .port_b_first_address(0), - .port_b_last_address(2**CFG_ABITS - 1), - .port_b_first_bit_number(0), - .port_b_address_clock("clock0"), - .port_b_read_enable_clock("clock0") -) ram_block ( - .portaaddr(A1ADDR), - .portadatain(A1DATA), - .portawe(A1EN_N), - .portbaddr(B1ADDR), - .portbdataout(B1DATA), - .portbre(B1EN), - .clk0(CLK1) -); - -endmodule - - -module MISTRAL_MUL27X27(input [26:0] A, B, output [53:0] Y); - -parameter A_SIGNED = 1; -parameter B_SIGNED = 1; - -`MAC #( - .ax_width(27), - .signed_max(A_SIGNED ? "true" : "false"), - .ay_scan_in_width(27), - .signed_may(B_SIGNED ? "true" : "false"), - .result_a_width(54), - .operation_mode("M27x27") -) _TECHMAP_REPLACE_ ( - .ax(A), - .ay(B), - .resulta(Y) -); - -endmodule - - -module MISTRAL_MUL18X18(input [17:0] A, B, output [35:0] Y); - -parameter A_SIGNED = 1; -parameter B_SIGNED = 1; - -`MAC #( - .ax_width(18), - .signed_max(A_SIGNED ? "true" : "false"), - .ay_scan_in_width(18), - .signed_may(B_SIGNED ? "true" : "false"), - .result_a_width(36), - .operation_mode("M18x18_FULL") -) _TECHMAP_REPLACE_ ( - .ax(A), - .ay(B), - .resulta(Y) -); - -endmodule - - -module MISTRAL_MUL9X9(input [8:0] A, B, output [17:0] Y); - -parameter A_SIGNED = 1; -parameter B_SIGNED = 1; - -`MAC #( - .ax_width(9), - .signed_max(A_SIGNED ? "true" : "false"), - .ay_scan_in_width(9), - .signed_may(B_SIGNED ? "true" : "false"), - .result_a_width(18), - .operation_mode("M9x9") -) _TECHMAP_REPLACE_ ( - .ax(A), - .ay(B), - .resulta(Y) -); - -endmodule - -module MISTRAL_IB(input PAD, output O); -`IBUF #( - .bus_hold("false"), - .differential_mode("false") -) _TECHMAP_REPLACE_ ( - .i(PAD), - .o(O) -); -endmodule - -module MISTRAL_OB(output PAD, input I, OE); -`OBUF #( - .bus_hold("false"), - .differential_mode("false") -) _TECHMAP_REPLACE_ ( - .i(I), - .o(PAD), - .oe(OE) -); -endmodule - -module MISTRAL_IO(output PAD, input I, OE, output O); -`IBUF #( - .bus_hold("false"), - .differential_mode("false") -) ibuf ( - .i(PAD), - .o(O) -); - -`OBUF #( - .bus_hold("false"), - .differential_mode("false") -) obuf ( - .i(I), - .o(PAD), - .oe(OE) -); -endmodule - -module MISTRAL_CLKBUF (input A, output Q); -`CLKENA #( - .clock_type("auto"), - .ena_register_mode("always enabled"), - .ena_register_power_up("high"), - .disable_mode("low"), - .test_syn("high") -) _TECHMAP_REPLACE_ ( - .inclk(A), - .ena(1'b1), - .outclk(Q) -); -endmodule diff --git a/techlibs/intel_alm/synth_intel_alm.cc b/techlibs/intel_alm/synth_intel_alm.cc index c33eb43bf35..cdae9586eb0 100644 --- a/techlibs/intel_alm/synth_intel_alm.cc +++ b/techlibs/intel_alm/synth_intel_alm.cc @@ -2,7 +2,7 @@ * yosys -- Yosys Open SYnthesis Suite * * Copyright (C) 2012 Claire Xenia Wolf - * Copyright (C) 2019 Dan Ravensloft + * Copyright (C) 2019 Hannah Ravensloft * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -43,21 +43,11 @@ struct SynthIntelALMPass : public ScriptPass { log(" -family \n"); log(" target one of:\n"); log(" \"cyclonev\" - Cyclone V (default)\n"); - log(" \"arriav\" - Arria V (non-GZ)\n"); - log(" \"cyclone10gx\" - Cyclone 10GX\n"); - log("\n"); - log(" -vqm \n"); - log(" write the design to the specified Verilog Quartus Mapping File. Writing\n"); - log(" of an output file is omitted if this parameter is not specified. Implies\n"); - log(" -quartus.\n"); log("\n"); log(" -noflatten\n"); log(" do not flatten design before synthesis; useful for per-module area\n"); log(" statistics\n"); log("\n"); - log(" -quartus\n"); - log(" output a netlist using Quartus cells instead of MISTRAL_* cells\n"); - log("\n"); log(" -dff\n"); log(" pass DFFs to ABC to perform sequential logic optimisations\n"); log(" (EXPERIMENTAL)\n"); @@ -87,17 +77,15 @@ struct SynthIntelALMPass : public ScriptPass { log("\n"); } - string top_opt, family_opt, bram_type, vout_file; - bool flatten, quartus, nolutram, nobram, dff, nodsp, noiopad, noclkbuf; + string top_opt, family_opt, bram_type; + bool flatten, nolutram, nobram, dff, nodsp, noiopad, noclkbuf; void clear_flags() override { top_opt = "-auto-top"; family_opt = "cyclonev"; bram_type = "m10k"; - vout_file = ""; flatten = true; - quartus = false; nolutram = false; nobram = false; dff = false; @@ -121,11 +109,6 @@ struct SynthIntelALMPass : public ScriptPass { top_opt = "-top " + args[++argidx]; continue; } - if (args[argidx] == "-vqm" && argidx + 1 < args.size()) { - quartus = true; - vout_file = args[++argidx]; - continue; - } if (args[argidx] == "-run" && argidx + 1 < args.size()) { size_t pos = args[argidx + 1].find(':'); if (pos == std::string::npos) @@ -134,10 +117,6 @@ struct SynthIntelALMPass : public ScriptPass { run_to = args[argidx].substr(pos + 1); continue; } - if (args[argidx] == "-quartus") { - quartus = true; - continue; - } if (args[argidx] == "-nolutram") { nolutram = true; continue; @@ -173,18 +152,6 @@ struct SynthIntelALMPass : public ScriptPass { if (!design->full_selection()) log_cmd_error("This command only operates on fully selected designs!\n"); - if (family_opt == "cyclonev" || family_opt == "arriav") { - bram_type = "m10k"; - } else if (family_opt == "cyclone10gx") { - bram_type = "m20k"; - } else if (family_opt == "arriva") { - // I have typoed "arriav" as "arriva" (a local bus company) - // so many times I thought it would be funny to have an easter egg. - log_cmd_error("synth_intel_alm cannot synthesize for bus companies. (did you mean '-family arriav'?)\n"); - } else { - log_cmd_error("Invalid family specified: '%s'\n", family_opt.c_str()); - } - log_header(design, "Executing SYNTH_INTEL_ALM pass.\n"); log_push(); @@ -237,22 +204,16 @@ struct SynthIntelALMPass : public ScriptPass { if (help_mode) { run("techmap -map +/mul2dsp.v [...]", "(unless -nodsp)"); } else if (!nodsp) { - // Cyclone V/Arria V supports 9x9 multiplication, Cyclone 10 GX does not. run("techmap -map +/mul2dsp.v -D DSP_A_MAXWIDTH=27 -D DSP_B_MAXWIDTH=27 -D DSP_A_MINWIDTH=19 -D DSP_B_MINWIDTH=4 -D DSP_NAME=__MUL27X27"); run("chtype -set $mul t:$__soft_mul"); run("techmap -map +/mul2dsp.v -D DSP_A_MAXWIDTH=27 -D DSP_B_MAXWIDTH=27 -D DSP_A_MINWIDTH=4 -D DSP_B_MINWIDTH=19 -D DSP_NAME=__MUL27X27"); run("chtype -set $mul t:$__soft_mul"); - if (family_opt == "cyclonev" || family_opt == "arriav") { - run("techmap -map +/mul2dsp.v -D DSP_A_MAXWIDTH=18 -D DSP_B_MAXWIDTH=18 -D DSP_A_MINWIDTH=10 -D DSP_B_MINWIDTH=4 -D DSP_NAME=__MUL18X18"); - run("chtype -set $mul t:$__soft_mul"); - run("techmap -map +/mul2dsp.v -D DSP_A_MAXWIDTH=18 -D DSP_B_MAXWIDTH=18 -D DSP_A_MINWIDTH=4 -D DSP_B_MINWIDTH=10 -D DSP_NAME=__MUL18X18"); - run("chtype -set $mul t:$__soft_mul"); - run("techmap -map +/mul2dsp.v -D DSP_A_MAXWIDTH=9 -D DSP_B_MAXWIDTH=9 -D DSP_A_MINWIDTH=4 -D DSP_B_MINWIDTH=4 -D DSP_NAME=__MUL9X9"); - run("chtype -set $mul t:$__soft_mul"); - } else if (family_opt == "cyclone10gx") { - run("techmap -map +/mul2dsp.v -D DSP_A_MAXWIDTH=18 -D DSP_B_MAXWIDTH=18 -D DSP_A_MINWIDTH=4 -D DSP_B_MINWIDTH=4 -D DSP_NAME=__MUL18X18"); - run("chtype -set $mul t:$__soft_mul"); - } + run("techmap -map +/mul2dsp.v -D DSP_A_MAXWIDTH=18 -D DSP_B_MAXWIDTH=18 -D DSP_A_MINWIDTH=10 -D DSP_B_MINWIDTH=4 -D DSP_NAME=__MUL18X18"); + run("chtype -set $mul t:$__soft_mul"); + run("techmap -map +/mul2dsp.v -D DSP_A_MAXWIDTH=18 -D DSP_B_MAXWIDTH=18 -D DSP_A_MINWIDTH=4 -D DSP_B_MINWIDTH=10 -D DSP_NAME=__MUL18X18"); + run("chtype -set $mul t:$__soft_mul"); + run("techmap -map +/mul2dsp.v -D DSP_A_MAXWIDTH=9 -D DSP_B_MAXWIDTH=9 -D DSP_A_MINWIDTH=4 -D DSP_B_MINWIDTH=4 -D DSP_NAME=__MUL9X9"); + run("chtype -set $mul t:$__soft_mul"); } run("alumacc"); if (!noiopad) @@ -269,7 +230,7 @@ struct SynthIntelALMPass : public ScriptPass { } if (!nolutram && check_label("map_lutram", "(skip if -nolutram)")) { - run("memory_bram -rules +/intel_alm/common/lutram_mlab.txt", "(for Cyclone V / Cyclone 10GX)"); + run("memory_bram -rules +/intel_alm/common/lutram_mlab.txt", "(for Cyclone V)"); } if (check_label("map_ffram")) { @@ -303,28 +264,6 @@ struct SynthIntelALMPass : public ScriptPass { run("check"); run("blackbox =A:whitebox"); } - - if (check_label("quartus")) { - if (quartus || help_mode) { - // Quartus ICEs if you have a wire which has `[]` in its name, - // which Yosys produces when building memories out of flops. - run("rename -hide w:*[* w:*]*"); - // VQM mode does not support 'x, so replace those with zero. - run("setundef -zero"); - // VQM mode does not support multi-bit constant assignments - // (e.g. 2'b00 is an error), so as a workaround use references - // to constant driver cells, which Quartus accepts. - run("hilomap -singleton -hicell __MISTRAL_VCC Q -locell __MISTRAL_GND Q"); - // Rename from Yosys-internal MISTRAL_* cells to Quartus cells. - run(stringf("techmap -D %s -map +/intel_alm/common/quartus_rename.v", family_opt.c_str())); - } - } - - if (check_label("vqm")) { - if (!vout_file.empty() || help_mode) { - run(stringf("write_verilog -attr2comment -defparam -nohex -decimal %s", help_mode ? "" : vout_file.c_str())); - } - } } } SynthIntelALMPass; diff --git a/tests/arch/intel_alm/add_sub.ys b/tests/arch/intel_alm/add_sub.ys index 8f87adf2713..6453da116a1 100644 --- a/tests/arch/intel_alm/add_sub.ys +++ b/tests/arch/intel_alm/add_sub.ys @@ -7,12 +7,3 @@ stat select -assert-count 9 t:MISTRAL_ALUT_ARITH select -assert-none t:MISTRAL_ALUT_ARITH %% t:* %D -design -reset -read_verilog ../common/add_sub.v -hierarchy -top top -equiv_opt -assert -map +/intel_alm/common/alm_sim.v synth_intel_alm -family cyclone10gx -noiopad -noclkbuf # equivalency check -design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) -cd top # Constrain all select calls below inside the top module -stat -select -assert-count 9 t:MISTRAL_ALUT_ARITH -select -assert-none t:MISTRAL_ALUT_ARITH %% t:* %D diff --git a/tests/arch/intel_alm/adffs.ys b/tests/arch/intel_alm/adffs.ys index d7487c40bec..1f81902ec5a 100644 --- a/tests/arch/intel_alm/adffs.ys +++ b/tests/arch/intel_alm/adffs.ys @@ -12,18 +12,6 @@ select -assert-count 1 t:MISTRAL_NOT select -assert-none t:MISTRAL_FF t:MISTRAL_NOT %% t:* %D -design -load read -hierarchy -top adff -proc -equiv_opt -async2sync -assert -map +/intel_alm/common/alm_sim.v -map +/intel_alm/common/dff_sim.v synth_intel_alm -family cyclone10gx -noiopad -noclkbuf # equivalency check -design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) -cd adff # Constrain all select calls below inside the top module -select -assert-count 1 t:MISTRAL_FF -select -assert-count 1 t:MISTRAL_NOT - -select -assert-none t:MISTRAL_FF t:MISTRAL_NOT %% t:* %D - - design -load read hierarchy -top adffn proc @@ -35,17 +23,6 @@ select -assert-count 1 t:MISTRAL_FF select -assert-none t:MISTRAL_FF %% t:* %D -design -load read -hierarchy -top adffn -proc -equiv_opt -async2sync -assert -map +/intel_alm/common/alm_sim.v -map +/intel_alm/common/dff_sim.v synth_intel_alm -family cyclone10gx -noiopad -noclkbuf # equivalency check -design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) -cd adffn # Constrain all select calls below inside the top module -select -assert-count 1 t:MISTRAL_FF - -select -assert-none t:MISTRAL_FF %% t:* %D - - design -load read hierarchy -top dffs proc @@ -58,18 +35,6 @@ select -assert-count 1 t:MISTRAL_ALUT2 select -assert-none t:MISTRAL_FF t:MISTRAL_ALUT2 %% t:* %D -design -load read -hierarchy -top dffs -proc -equiv_opt -async2sync -assert -map +/intel_alm/common/alm_sim.v -map +/intel_alm/common/dff_sim.v synth_intel_alm -family cyclone10gx -noiopad -noclkbuf # equivalency check -design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) -cd dffs # Constrain all select calls below inside the top module -select -assert-count 1 t:MISTRAL_FF -select -assert-count 1 t:MISTRAL_ALUT2 - -select -assert-none t:MISTRAL_FF t:MISTRAL_ALUT2 %% t:* %D - - design -load read hierarchy -top ndffnr proc @@ -81,14 +46,3 @@ select -assert-count 2 t:MISTRAL_NOT select -assert-none t:MISTRAL_FF t:MISTRAL_NOT %% t:* %D - -design -load read -hierarchy -top ndffnr -proc -equiv_opt -async2sync -assert -map +/intel_alm/common/alm_sim.v -map +/intel_alm/common/dff_sim.v synth_intel_alm -family cyclone10gx -noiopad -noclkbuf # equivalency check -design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) -cd ndffnr # Constrain all select calls below inside the top module -select -assert-count 1 t:MISTRAL_FF -select -assert-count 2 t:MISTRAL_NOT - -select -assert-none t:MISTRAL_FF t:MISTRAL_NOT %% t:* %D diff --git a/tests/arch/intel_alm/blockram.ys b/tests/arch/intel_alm/blockram.ys index 21b5ecbfb60..4af59e7d434 100644 --- a/tests/arch/intel_alm/blockram.ys +++ b/tests/arch/intel_alm/blockram.ys @@ -5,3 +5,4 @@ cd sync_ram_sdp select -assert-count 1 t:MISTRAL_NOT select -assert-count 1 t:MISTRAL_M10K select -assert-none t:MISTRAL_NOT t:MISTRAL_M10K %% t:* %D + diff --git a/tests/arch/intel_alm/counter.ys b/tests/arch/intel_alm/counter.ys index 2b428fb3e51..44e00081445 100644 --- a/tests/arch/intel_alm/counter.ys +++ b/tests/arch/intel_alm/counter.ys @@ -11,17 +11,3 @@ select -assert-count 8 t:MISTRAL_ALUT_ARITH select -assert-count 8 t:MISTRAL_FF select -assert-none t:MISTRAL_NOT t:MISTRAL_ALUT_ARITH t:MISTRAL_FF %% t:* %D - -design -reset -read_verilog ../common/counter.v -hierarchy -top top -proc -flatten -equiv_opt -assert -async2sync -map +/intel_alm/common/alm_sim.v -map +/intel_alm/common/dff_sim.v synth_intel_alm -family cyclone10gx -noiopad -noclkbuf # equivalency check -design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) -cd top # Constrain all select calls below inside the top module - -select -assert-count 2 t:MISTRAL_NOT -select -assert-count 8 t:MISTRAL_ALUT_ARITH -select -assert-count 8 t:MISTRAL_FF -select -assert-none t:MISTRAL_NOT t:MISTRAL_ALUT_ARITH t:MISTRAL_FF %% t:* %D diff --git a/tests/arch/intel_alm/dffs.ys b/tests/arch/intel_alm/dffs.ys index 34b99f04cbf..aeaae4aa3ce 100644 --- a/tests/arch/intel_alm/dffs.ys +++ b/tests/arch/intel_alm/dffs.ys @@ -7,17 +7,6 @@ equiv_opt -async2sync -assert -map +/intel_alm/common/alm_sim.v -map +/intel_alm design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) cd dff # Constrain all select calls below inside the top module select -assert-count 1 t:MISTRAL_FF - -select -assert-none t:MISTRAL_FF %% t:* %D - -design -load read -hierarchy -top dff -proc -equiv_opt -async2sync -assert -map +/intel_alm/common/alm_sim.v -map +/intel_alm/common/dff_sim.v synth_intel_alm -family cyclone10gx -noiopad -noclkbuf # equivalency check -design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) -cd dff # Constrain all select calls below inside the top module -select -assert-count 1 t:MISTRAL_FF - select -assert-none t:MISTRAL_FF %% t:* %D @@ -28,16 +17,5 @@ equiv_opt -async2sync -assert -map +/intel_alm/common/alm_sim.v -map +/intel_alm design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) cd dffe # Constrain all select calls below inside the top module select -assert-count 1 t:MISTRAL_FF - select -assert-none t:MISTRAL_FF %% t:* %D - -design -load read -hierarchy -top dffe -proc -equiv_opt -async2sync -assert -map +/intel_alm/common/alm_sim.v -map +/intel_alm/common/dff_sim.v synth_intel_alm -family cyclone10gx -noiopad -noclkbuf # equivalency check -design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) -cd dffe # Constrain all select calls below inside the top module -select -assert-count 1 t:MISTRAL_FF - -select -assert-none t:MISTRAL_FF %% t:* %D diff --git a/tests/arch/intel_alm/fsm.ys b/tests/arch/intel_alm/fsm.ys index 0aeea450ac5..f3060684a9f 100644 --- a/tests/arch/intel_alm/fsm.ys +++ b/tests/arch/intel_alm/fsm.ys @@ -20,25 +20,3 @@ select -assert-max 6 t:MISTRAL_ALUT5 # Clang returns 5, GCC returns 4 select -assert-max 2 t:MISTRAL_ALUT6 # Clang returns 1, GCC returns 2 select -assert-none t:MISTRAL_FF t:MISTRAL_NOT t:MISTRAL_ALUT2 t:MISTRAL_ALUT3 t:MISTRAL_ALUT4 t:MISTRAL_ALUT5 t:MISTRAL_ALUT6 %% t:* %D -design -reset -read_verilog ../common/fsm.v -hierarchy -top fsm -proc -flatten - -equiv_opt -run :prove -map +/intel_alm/common/alm_sim.v -map +/intel_alm/common/dff_sim.v synth_intel_alm -family cyclone10gx -noiopad -noclkbuf -async2sync -miter -equiv -make_assert -flatten gold gate miter -sat -verify -prove-asserts -show-public -set-at 1 in_reset 1 -seq 20 -prove-skip 1 miter - -design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) -cd fsm # Constrain all select calls below inside the top module - -select -assert-count 6 t:MISTRAL_FF -select -assert-max 1 t:MISTRAL_NOT -select -assert-max 2 t:MISTRAL_ALUT2 # Clang returns 2, GCC returns 1 -select -assert-max 2 t:MISTRAL_ALUT3 # Clang returns 2, GCC returns 1 -select -assert-max 2 t:MISTRAL_ALUT4 # Clang returns 0, GCC returns 1 -select -assert-max 6 t:MISTRAL_ALUT5 # Clang returns 5, GCC returns 4 -select -assert-max 2 t:MISTRAL_ALUT6 # Clang returns 1, GCC returns 2 -select -assert-none t:MISTRAL_FF t:MISTRAL_NOT t:MISTRAL_ALUT2 t:MISTRAL_ALUT3 t:MISTRAL_ALUT4 t:MISTRAL_ALUT5 t:MISTRAL_ALUT6 %% t:* %D diff --git a/tests/arch/intel_alm/logic.ys b/tests/arch/intel_alm/logic.ys index d34d1bc65de..831f9f1741e 100644 --- a/tests/arch/intel_alm/logic.ys +++ b/tests/arch/intel_alm/logic.ys @@ -10,16 +10,3 @@ select -assert-count 6 t:MISTRAL_ALUT2 select -assert-count 2 t:MISTRAL_ALUT4 select -assert-none t:MISTRAL_NOT t:MISTRAL_ALUT2 t:MISTRAL_ALUT4 %% t:* %D - -design -reset -read_verilog ../common/logic.v -hierarchy -top top -proc -equiv_opt -assert -map +/intel_alm/common/alm_sim.v synth_intel_alm -family cyclone10gx -noiopad -noclkbuf # equivalency check -design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) -cd top # Constrain all select calls below inside the top module - -select -assert-count 1 t:MISTRAL_NOT -select -assert-count 6 t:MISTRAL_ALUT2 -select -assert-count 2 t:MISTRAL_ALUT4 -select -assert-none t:MISTRAL_NOT t:MISTRAL_ALUT2 t:MISTRAL_ALUT4 %% t:* %D \ No newline at end of file diff --git a/tests/arch/intel_alm/lutram.ys b/tests/arch/intel_alm/lutram.ys index 9ddb1ec874e..4e77afded78 100644 --- a/tests/arch/intel_alm/lutram.ys +++ b/tests/arch/intel_alm/lutram.ys @@ -37,3 +37,4 @@ select -assert-count 2 t:MISTRAL_ALUT2 select -assert-count 8 t:MISTRAL_ALUT3 select -assert-count 8 t:MISTRAL_FF select -assert-none t:MISTRAL_ALUT2 t:MISTRAL_ALUT3 t:MISTRAL_FF t:MISTRAL_MLAB %% t:* %D + diff --git a/tests/arch/intel_alm/mul.ys b/tests/arch/intel_alm/mul.ys index e147d93ac1e..75b32846304 100644 --- a/tests/arch/intel_alm/mul.ys +++ b/tests/arch/intel_alm/mul.ys @@ -9,8 +9,6 @@ cd top # Constrain all select calls below inside the top module select -assert-count 1 t:MISTRAL_MUL9X9 select -assert-none t:MISTRAL_MUL9X9 %% t:* %D -# Cyclone 10 GX does not have 9x9 multipliers. - design -reset read_verilog ../common/mul.v chparam -set X_WIDTH 17 -set Y_WIDTH 17 -set A_WIDTH 34 @@ -23,18 +21,6 @@ cd top # Constrain all select calls below inside the top module select -assert-count 1 t:MISTRAL_MUL18X18 select -assert-none t:MISTRAL_MUL18X18 %% t:* %D -design -reset -read_verilog ../common/mul.v -chparam -set X_WIDTH 17 -set Y_WIDTH 17 -set A_WIDTH 34 -hierarchy -top top -proc -equiv_opt -assert -map +/intel_alm/common/dsp_sim.v synth_intel_alm -family cyclone10gx -noiopad -noclkbuf # equivalency check -design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) -cd top # Constrain all select calls below inside the top module - -select -assert-count 1 t:MISTRAL_MUL18X18 -select -assert-none t:MISTRAL_MUL18X18 %% t:* %D - design -reset read_verilog ../common/mul.v chparam -set X_WIDTH 26 -set Y_WIDTH 26 -set A_WIDTH 52 @@ -47,14 +33,3 @@ cd top # Constrain all select calls below inside the top module select -assert-count 1 t:MISTRAL_MUL27X27 select -assert-none t:MISTRAL_MUL27X27 %% t:* %D -design -reset -read_verilog ../common/mul.v -chparam -set X_WIDTH 26 -set Y_WIDTH 26 -set A_WIDTH 52 -hierarchy -top top -proc -equiv_opt -assert -map +/intel_alm/common/dsp_sim.v synth_intel_alm -family cyclone10gx -noiopad -noclkbuf # equivalency check -design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) -cd top # Constrain all select calls below inside the top module - -select -assert-count 1 t:MISTRAL_MUL27X27 -select -assert-none t:MISTRAL_MUL27X27 %% t:* %D diff --git a/tests/arch/intel_alm/mux.ys b/tests/arch/intel_alm/mux.ys index 20969ead35f..951b0eff6b4 100644 --- a/tests/arch/intel_alm/mux.ys +++ b/tests/arch/intel_alm/mux.ys @@ -11,16 +11,6 @@ select -assert-count 1 t:MISTRAL_ALUT3 select -assert-none t:MISTRAL_ALUT3 %% t:* %D -design -load read -hierarchy -top mux2 -proc -equiv_opt -assert -map +/intel_alm/common/alm_sim.v synth_intel_alm -family cyclone10gx -noiopad -noclkbuf # equivalency check -design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) -cd mux2 # Constrain all select calls below inside the top module -select -assert-count 1 t:MISTRAL_ALUT3 -select -assert-none t:MISTRAL_ALUT3 %% t:* %D - - design -load read hierarchy -top mux4 proc @@ -31,16 +21,6 @@ select -assert-count 1 t:MISTRAL_ALUT6 select -assert-none t:MISTRAL_ALUT6 %% t:* %D -design -load read -hierarchy -top mux4 -proc -equiv_opt -assert -map +/intel_alm/common/alm_sim.v synth_intel_alm -family cyclone10gx -noiopad -noclkbuf # equivalency check -design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) -cd mux4 # Constrain all select calls below inside the top module -select -assert-count 1 t:MISTRAL_ALUT6 -select -assert-none t:MISTRAL_ALUT6 %% t:* %D - - design -load read hierarchy -top mux8 proc @@ -52,17 +32,6 @@ select -assert-count 2 t:MISTRAL_ALUT6 select -assert-none t:MISTRAL_ALUT3 t:MISTRAL_ALUT6 %% t:* %D -design -load read -hierarchy -top mux8 -proc -equiv_opt -assert -map +/intel_alm/common/alm_sim.v synth_intel_alm -family cyclone10gx -noiopad -noclkbuf # equivalency check -design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) -cd mux8 # Constrain all select calls below inside the top module -select -assert-count 1 t:MISTRAL_ALUT3 -select -assert-count 2 t:MISTRAL_ALUT6 -select -assert-none t:MISTRAL_ALUT3 t:MISTRAL_ALUT6 %% t:* %D - - design -load read hierarchy -top mux16 proc @@ -74,15 +43,3 @@ select -assert-max 2 t:MISTRAL_ALUT5 select -assert-max 5 t:MISTRAL_ALUT6 select -assert-none t:MISTRAL_ALUT3 t:MISTRAL_ALUT5 t:MISTRAL_ALUT6 %% t:* %D - -design -load read -hierarchy -top mux16 -proc -equiv_opt -assert -map +/intel_alm/common/alm_sim.v synth_intel_alm -family cyclone10gx -noiopad -noclkbuf # equivalency check -design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) -cd mux16 # Constrain all select calls below inside the top module -select -assert-max 1 t:MISTRAL_ALUT3 -select -assert-max 2 t:MISTRAL_ALUT5 -select -assert-max 5 t:MISTRAL_ALUT6 - -select -assert-none t:MISTRAL_ALUT3 t:MISTRAL_ALUT5 t:MISTRAL_ALUT6 %% t:* %D diff --git a/tests/arch/intel_alm/quartus_ice.ys b/tests/arch/intel_alm/quartus_ice.ys deleted file mode 100644 index 4e1896b82a8..00000000000 --- a/tests/arch/intel_alm/quartus_ice.ys +++ /dev/null @@ -1,26 +0,0 @@ -read_verilog < Date: Wed, 10 Apr 2024 15:20:01 +0200 Subject: [PATCH 06/92] Add new `bbox_derive` command for blackbox derivation --- passes/cmds/Makefile.inc | 1 + passes/cmds/bbox_derive.cc | 90 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 passes/cmds/bbox_derive.cc diff --git a/passes/cmds/Makefile.inc b/passes/cmds/Makefile.inc index d7e572462b0..b1c9c67f0d0 100644 --- a/passes/cmds/Makefile.inc +++ b/passes/cmds/Makefile.inc @@ -48,3 +48,4 @@ OBJS += passes/cmds/clean_zerowidth.o OBJS += passes/cmds/xprop.o OBJS += passes/cmds/dft_tag.o OBJS += passes/cmds/future.o +OBJS += passes/cmds/bbox_derive.o diff --git a/passes/cmds/bbox_derive.cc b/passes/cmds/bbox_derive.cc new file mode 100644 index 00000000000..de0869cb1eb --- /dev/null +++ b/passes/cmds/bbox_derive.cc @@ -0,0 +1,90 @@ +/* + * yosys -- Yosys Open SYnthesis Suite + * + * Copyright (C) 2024 Martin Povišer + * + * 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. + * + * 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. + * + */ +#include "kernel/yosys.h" + +USING_YOSYS_NAMESPACE +PRIVATE_NAMESPACE_BEGIN + +struct BboxDerivePass : Pass { + BboxDerivePass() : Pass("bbox_derive", "derive blackbox modules") {} + void help() override + { + // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| + log("\n"); + log(" bbox_derive [-base ] [-naming_attr ] [selection]\n"); + log("\n"); + } + void execute(std::vector args, RTLIL::Design *d) override + { + log_header(d, "Executing BBOX_DERIVE pass. (derive modules for blackboxes)\n"); + + size_t argidx; + IdString naming_attr; + IdString base_name; + for (argidx = 1; argidx < args.size(); argidx++) { + if (args[argidx] == "-naming_attr" && argidx + 1 < args.size()) + naming_attr = RTLIL::escape_id(args[++argidx]); + else if (args[argidx] == "-base" && argidx + 1 < args.size()) + base_name = RTLIL::escape_id(args[++argidx]); + else + break; + } + extra_args(args, argidx, d); + + Module *base_override; + if (!base_name.empty()) { + base_override = d->module(base_name); + if (!base_override) + log_cmd_error("Base module %s not found.\n", log_id(base_name)); + } + + dict, Module*> done; + + for (auto module : d->selected_modules()) { + for (auto cell : module->selected_cells()) { + Module *inst_module = d->module(cell->type); + if (!inst_module || !inst_module->get_blackbox_attribute()) + continue; + + if (cell->parameters.empty() || done.count(cell->parameters)) + continue; + + Module *base = inst_module; + if (base_override) + base = base_override; + + IdString derived_type = base->derive(d, cell->parameters); + Module *derived = d->module(derived_type); + + if (!naming_attr.empty() && derived->has_attribute(naming_attr)) { + IdString new_name = RTLIL::escape_id(derived->get_string_attribute(naming_attr)); + if (!new_name.isPublic()) + log_error("Derived module %s cannot be renamed to private name %s.\n", + log_id(derived), log_id(new_name)); + derived->attributes.erase(naming_attr); + d->rename(derived, new_name); + } + + done[cell->parameters] = derived; + } + } + } +} BboxDerivePass; + +PRIVATE_NAMESPACE_END From e8c58a55280192db2c35006734f42c7983cd9b81 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Fri, 3 May 2024 20:41:42 +0200 Subject: [PATCH 07/92] bbox_derive: fix unininitialized memory UB when run with no named args --- passes/cmds/bbox_derive.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/passes/cmds/bbox_derive.cc b/passes/cmds/bbox_derive.cc index de0869cb1eb..758f793004a 100644 --- a/passes/cmds/bbox_derive.cc +++ b/passes/cmds/bbox_derive.cc @@ -47,7 +47,7 @@ struct BboxDerivePass : Pass { } extra_args(args, argidx, d); - Module *base_override; + Module *base_override = nullptr; if (!base_name.empty()) { base_override = d->module(base_name); if (!base_override) From 44b0fdc2bf8bac019641f4f5c5f9d29294fc0624 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Fri, 3 May 2024 20:43:01 +0200 Subject: [PATCH 08/92] bbox_derive: add assert and debug print --- passes/cmds/bbox_derive.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/passes/cmds/bbox_derive.cc b/passes/cmds/bbox_derive.cc index 758f793004a..a35e9629058 100644 --- a/passes/cmds/bbox_derive.cc +++ b/passes/cmds/bbox_derive.cc @@ -71,6 +71,8 @@ struct BboxDerivePass : Pass { IdString derived_type = base->derive(d, cell->parameters); Module *derived = d->module(derived_type); + log_assert(derived && "Failed to derive module\n"); + log_debug("derived %s\n", derived_type.c_str()); if (!naming_attr.empty() && derived->has_attribute(naming_attr)) { IdString new_name = RTLIL::escape_id(derived->get_string_attribute(naming_attr)); From 1c89e2ab92d5786dfa2ead8ba1c0f822697c5a24 Mon Sep 17 00:00:00 2001 From: Roland Coeurjoly Date: Wed, 8 May 2024 03:52:12 +0200 Subject: [PATCH 09/92] Add nix flake and lock file. Add nix build step. Pending nix flake update step --- .github/workflows/nix-github-actions.yml | 13 +++++ flake.lock | 61 ++++++++++++++++++++++++ flake.nix | 44 +++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 .github/workflows/nix-github-actions.yml create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.github/workflows/nix-github-actions.yml b/.github/workflows/nix-github-actions.yml new file mode 100644 index 00000000000..a11584bc641 --- /dev/null +++ b/.github/workflows/nix-github-actions.yml @@ -0,0 +1,13 @@ +name: "build nix flake" +on: + pull_request: + push: +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - uses: cachix/install-nix-action@v25 + - run: nix build '.?submodules=1' diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000000..2545f4ce057 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1708807242, + "narHash": "sha256-sRTRkhMD4delO/hPxxi+XwLqPn8BuUq6nnj4JqLwOu0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "73de017ef2d18a04ac4bfd0c02650007ccb31c2a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000000..1143d538c25 --- /dev/null +++ b/flake.nix @@ -0,0 +1,44 @@ +{ + description = "A nix flake for the Yosys synthesis suite"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + }; + customYosys = pkgs.clangStdenv.mkDerivation { + name = "yosys"; + src = ./. ; + buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git ]; + checkInputs = with pkgs; [ gtest ]; + propagatedBuildInputs = with pkgs; [ abc-verifier ]; + preConfigure = "make config-clang"; + checkTarget = "test"; + installPhase = '' + make install PREFIX=$out + ''; + buildPhase = '' + make -j$(nproc) + ''; + meta = with pkgs.lib; { + description = "Yosys Open SYnthesis Suite"; + homepage = "https://yosyshq.net/yosys/"; + license = licenses.isc; + maintainers = with maintainers; [ ]; + }; + }; + in { + packages.default = customYosys; + defaultPackage = customYosys; + devShell = pkgs.mkShell { + buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git gtest abc-verifier ]; + }; + } + ); +} From 6f9507a16f3c2a8838827e6695fae2b31eb9fa9b Mon Sep 17 00:00:00 2001 From: Roland Coeurjoly Date: Wed, 8 May 2024 04:47:40 +0200 Subject: [PATCH 10/92] Add pkg-config --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 1143d538c25..d97be4ef671 100644 --- a/flake.nix +++ b/flake.nix @@ -15,7 +15,7 @@ customYosys = pkgs.clangStdenv.mkDerivation { name = "yosys"; src = ./. ; - buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git ]; + buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git pkg-configUpstream ]; checkInputs = with pkgs; [ gtest ]; propagatedBuildInputs = with pkgs; [ abc-verifier ]; preConfigure = "make config-clang"; From fd84a3378eee639663005577c0b180b83cbbbd91 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Thu, 9 May 2024 18:31:18 +0200 Subject: [PATCH 11/92] docs: Document $lut and $sop --- .../yosys_internals/formats/cell_library.rst | 44 ++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/docs/source/yosys_internals/formats/cell_library.rst b/docs/source/yosys_internals/formats/cell_library.rst index 2b8dc300154..69e82774c1f 100644 --- a/docs/source/yosys_internals/formats/cell_library.rst +++ b/docs/source/yosys_internals/formats/cell_library.rst @@ -661,6 +661,48 @@ The CONFIG parameter carries the following information: B is an array of concatenated 1-bit-wide unsigned integers to also be summed up. +Arbitrary logic functions +~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ``$lut`` cell type implements a single-output LUT (lookup table). +It implements an arbitrary logic function with its ``\LUT`` parameter to map +input port ``\A`` to values of ``\Y`` output port values. +In psuedocode: ``Y = \LUT[A]``. +``\A`` has width set by parameter ``\WIDTH`` and ``\Y`` has a width of 1. +Every logic function with a single bit output has a unique ``$lut`` +representation. + +The ``$sop`` cell type implements a sum-of-products expression, also known +as disjunctive normal form (DNF). It implements an arbitrary logic function. +Its structure mimics a programmable logic array (PLA). +Output port ``\Y`` is the sum of products of the bits of the input port ``\A`` +as defined by parameter ``\TABLE``. ``\A`` is ``\WIDTH`` bits wide. +The number of products in the sum is set by parameter ``\DEPTH``, and each +product has two bits for each input bit - for the presence of the +unnegated and negated version of said input bit in the product. +Therefore the ``\TABLE`` parameter holds ``2 * \WIDTH * \DEPTH`` bits. + +For example: + +Let ``\WIDTH`` be 3. We would like to represent ``\Y =~\A[0] + \A[1]~\A[2]``. +There are 2 products to be summed, so ``\DEPTH`` shall be 2. + +.. code-block:: + ~A[2]-----┐ + A[2]----┐| + ~A[1]---┐|| + A[1]--┐||| + ~A[0]-┐|||| + A[0]┐||||| product formula + 010000 ~\A[0] + 001001 \A[1]~\A[2] + +So the value of ``\TABLE`` will become ``010000001001``. + +Any logic function with a single bit output can be represented with +``$sop`` but may have variously minimized or ordered summands represented +in the ``\TABLE`` values. + Specify rules ~~~~~~~~~~~~~ @@ -1192,6 +1234,4 @@ file via ABC using the abc pass. .. todo:: Add information about ``$slice`` and ``$concat`` cells. -.. todo:: Add information about ``$lut`` and ``$sop`` cells. - .. todo:: Add information about ``$alu``, ``$fa``, and ``$lcu`` cells. From 69eb39582b36101f005ca6c73eb908ca708f3417 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 5 Feb 2024 21:48:25 +1300 Subject: [PATCH 12/92] ci: Introduce artifacts Separates `test-linux` into `build-linux` and `test-linux`, wherein `build-` builds out of tree, and uploading the build for the `test-` job. Tar compression is done to retain execution permissions when downloading build artifact. When calling `make test`, override `TARGETS` and `EXTRA_TARGETS` to prevent rebuild. --- .github/workflows/test-linux.yml | 66 ++++++++++++++++++++++++++------ .github/workflows/test-macos.yml | 9 ++++- 2 files changed, 61 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 911b3b66e4d..c4098edbeff 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -1,6 +1,12 @@ name: Build and run tests (Linux) -on: [push, pull_request] +on: + pull_request: + branches: + - master + push: + branches: + - master jobs: pre_job: @@ -17,7 +23,7 @@ jobs: # only run on push *or* pull_request, not both concurrent_skipping: 'same_content_newer' - test-linux: + build-linux: needs: pre_job if: needs.pre_job.outputs.should_skip != 'true' runs-on: ${{ matrix.os.id }} @@ -123,25 +129,61 @@ jobs: make -j${{ env.procs }} make install - - name: Build yosys + - name: Build yosys out-of-tree + shell: bash + run: | + mkdir build + cd build + make -f ../Makefile config-${CC%%-*} + make -f ../Makefile -j${{ env.procs }} CXXSTD=${{ matrix.cpp_std }} CC=$CC CXX=$CC LD=$CC + + - name: Log yosys-config output + run: | + ./yosys-config || true + + - name: Compress build shell: bash run: | - make config-${CC%%-*} - make -j${{ env.procs }} CXXSTD=${{ matrix.cpp_std }} CC=$CC CXX=$CC LD=$CC + cd build + tar -cvf ../build.tar Makefile.conf share/ yosys yosys-* - name: Store build artifact if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'gcc-11') uses: actions/upload-artifact@v4 with: - name: compiled-yosys - path: yosys + name: build-artifact + path: build.tar + retention-days: 1 - - name: Run tests - if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'gcc-11') + test-linux: + name: Run tests + needs: build-linux + runs-on: ubuntu-latest + steps: + - name: Install Dependencies + shell: bash + run: | + sudo apt-get update + sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev + + - name: Runtime environment shell: bash + env: + WORKSPACE: ${{ github.workspace }} run: | - make -j${{ env.procs }} test CXXSTD=${{ matrix.cpp_std }} CC=$CC CXX=$CC LD=$CC + echo "procs=$(nproc)" >> $GITHUB_ENV - - name: Log yosys-config output + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: build-artifact + + - name: Uncompress build + shell: bash + run: + tar -xvf build.tar + + - name: Run tests + shell: bash run: | - ./yosys-config || true + make -j${{ env.procs }} test TARGETS= EXTRA_TARGETS= diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index cbba8adbd66..ed63c8f35b7 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -1,6 +1,12 @@ name: Build and run tests (macOS) -on: [push, pull_request] +on: + pull_request: + branches: + - master + push: + branches: + - master jobs: pre_job: @@ -27,7 +33,6 @@ jobs: - { id: macos-13, name: 'Ventura' } cpp_std: - 'c++11' - - 'c++17' fail-fast: false steps: - name: Install Dependencies From 7873fe791eb60436ba48104b6b6443754097459c Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 5 Feb 2024 21:50:41 +1300 Subject: [PATCH 13/92] Makefile: ignore missing docs e.g. when calling `make clean` out-of-tree --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 507d46f230d..f359ab76749 100644 --- a/Makefile +++ b/Makefile @@ -1022,7 +1022,9 @@ clean: rm -rf vloghtb/Makefile vloghtb/refdat vloghtb/rtl vloghtb/scripts vloghtb/spec vloghtb/check_yosys vloghtb/vloghammer_tb.tar.bz2 vloghtb/temp vloghtb/log_test_* rm -f tests/svinterfaces/*.log_stdout tests/svinterfaces/*.log_stderr tests/svinterfaces/dut_result.txt tests/svinterfaces/reference_result.txt tests/svinterfaces/a.out tests/svinterfaces/*_syn.v tests/svinterfaces/*.diff rm -f tests/tools/cmp_tbdata - $(MAKE) -C docs clean + -$(MAKE) -C docs clean + -$(MAKE) -C docs/images clean + rm -rf docs/source/cmd docs/util/__pycache__ clean-abc: $(MAKE) -C abc DEP= clean From 8e2dae21ad21e5cc87d7ecc8fc07871ce694aa92 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 6 Feb 2024 10:30:37 +1300 Subject: [PATCH 14/92] ci: Checkout Yosys --- .github/workflows/test-linux.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index c4098edbeff..752d69a0694 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -173,6 +173,9 @@ jobs: run: | echo "procs=$(nproc)" >> $GITHUB_ENV + - name: Checkout Yosys + uses: actions/checkout@v4 + - name: Download build artifact uses: actions/download-artifact@v4 with: From 2bec6e3e0af83b0bdc5e4fa31f1bc7980a57e0db Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 6 Feb 2024 10:56:20 +1300 Subject: [PATCH 15/92] ci: Move iverilog from build to test --- .github/workflows/test-linux.yml | 58 ++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 752d69a0694..e488c2f6c34 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -104,30 +104,6 @@ jobs: uses: actions/checkout@v4 with: submodules: true - - name: Get iverilog - shell: bash - run: | - git clone https://github.com/steveicarus/iverilog.git - cd iverilog - echo "IVERILOG_GIT=$(git rev-parse HEAD)" >> $GITHUB_ENV - - - name: Cache iverilog - id: cache-iverilog - uses: actions/cache@v4 - with: - path: .local/ - key: ${{ matrix.os.id }}-${{ env.IVERILOG_GIT }} - - - name: Build iverilog - if: steps.cache-iverilog.outputs.cache-hit != 'true' - shell: bash - run: | - mkdir -p $GITHUB_WORKSPACE/.local/ - cd iverilog - autoconf - CC=gcc CXX=g++ ./configure --prefix=$GITHUB_WORKSPACE/.local - make -j${{ env.procs }} - make install - name: Build yosys out-of-tree shell: bash @@ -158,7 +134,11 @@ jobs: test-linux: name: Run tests needs: build-linux - runs-on: ubuntu-latest + runs-on: ${{ matrix.os.id }} + strategy: + matrix: + os: + - { id: ubuntu-20.04, name: focal } steps: - name: Install Dependencies shell: bash @@ -171,11 +151,39 @@ jobs: env: WORKSPACE: ${{ github.workspace }} run: | + echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV + echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH echo "procs=$(nproc)" >> $GITHUB_ENV - name: Checkout Yosys uses: actions/checkout@v4 + - name: Get iverilog + shell: bash + run: | + git clone https://github.com/steveicarus/iverilog.git + cd iverilog + git checkout 192b6aec96fde982e6ddcb28b346d5893aa8e874 + echo "IVERILOG_GIT=$(git rev-parse HEAD)" >> $GITHUB_ENV + + - name: Cache iverilog + id: cache-iverilog + uses: actions/cache@v4 + with: + path: .local/ + key: ${{ matrix.os.id }}-${{ env.IVERILOG_GIT }} + + - name: Build iverilog + if: steps.cache-iverilog.outputs.cache-hit != 'true' + shell: bash + run: | + mkdir -p $GITHUB_WORKSPACE/.local/ + cd iverilog + autoconf + CC=gcc CXX=g++ ./configure --prefix=$GITHUB_WORKSPACE/.local + make -j${{ env.procs }} + make install + - name: Download build artifact uses: actions/download-artifact@v4 with: From 1ef21efe3ff2cd6ead409803556c813c3f97d580 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 6 Feb 2024 11:48:38 +1300 Subject: [PATCH 16/92] ci: working on test setup --- .github/workflows/test-linux.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index e488c2f6c34..fd875d4ae87 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -121,7 +121,7 @@ jobs: shell: bash run: | cd build - tar -cvf ../build.tar Makefile.conf share/ yosys yosys-* + tar -cvf ../build.tar share/ yosys yosys-* - name: Store build artifact if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'gcc-11') @@ -134,11 +134,12 @@ jobs: test-linux: name: Run tests needs: build-linux - runs-on: ${{ matrix.os.id }} + runs-on: ${{ matrix.os }} + env: + CC: clang strategy: matrix: - os: - - { id: ubuntu-20.04, name: focal } + os: [ubuntu-20.04] steps: - name: Install Dependencies shell: bash @@ -171,7 +172,7 @@ jobs: uses: actions/cache@v4 with: path: .local/ - key: ${{ matrix.os.id }}-${{ env.IVERILOG_GIT }} + key: ${{ matrix.os }}-${{ env.IVERILOG_GIT }} - name: Build iverilog if: steps.cache-iverilog.outputs.cache-hit != 'true' @@ -197,4 +198,4 @@ jobs: - name: Run tests shell: bash run: | - make -j${{ env.procs }} test TARGETS= EXTRA_TARGETS= + make -j$procs test TARGETS= EXTRA_TARGETS= CONFIG=$CC From 93bee0fc3b89f692a866d4bdf22dc98f6e9f1aba Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 6 Feb 2024 12:18:52 +1300 Subject: [PATCH 17/92] ci: more context var use Also reduce `${{}}` expansion in `run` blocks. --- .github/workflows/test-linux.yml | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index fd875d4ae87..17aa050558d 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -27,6 +27,9 @@ jobs: needs: pre_job if: needs.pre_job.outputs.should_skip != 'true' runs-on: ${{ matrix.os.id }} + env: + CC: ${{ matrix.compiler }} + CXXSTD: ${{ matrix.cpp_std }} strategy: matrix: os: @@ -63,11 +66,8 @@ jobs: sudo apt-add-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install $CC $CXX - echo "CC=$CC" >> $GITHUB_ENV echo "CXX=$CXX" >> $GITHUB_ENV echo "CXXFLAGS=-Wp,-D_GLIBCXX_ASSERTIONS" >> $GITHUB_ENV - env: - CC: ${{ matrix.compiler }} - name: Setup Clang if: startsWith(matrix.compiler, 'clang') @@ -80,18 +80,12 @@ jobs: sudo apt-get update CXX=${CC/#clang/clang++} sudo apt-get install $CC $CXX - echo "CC=$CC" >> $GITHUB_ENV echo "CXX=$CXX" >> $GITHUB_ENV - env: - CC: ${{ matrix.compiler }} - name: Runtime environment shell: bash - env: - WORKSPACE: ${{ github.workspace }} run: | - echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV - echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH echo "procs=$(nproc)" >> $GITHUB_ENV - name: Tool versions @@ -111,7 +105,7 @@ jobs: mkdir build cd build make -f ../Makefile config-${CC%%-*} - make -f ../Makefile -j${{ env.procs }} CXXSTD=${{ matrix.cpp_std }} CC=$CC CXX=$CC LD=$CC + make -f ../Makefile -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CC LD=$CC - name: Log yosys-config output run: | @@ -149,11 +143,8 @@ jobs: - name: Runtime environment shell: bash - env: - WORKSPACE: ${{ github.workspace }} run: | - echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV - echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH echo "procs=$(nproc)" >> $GITHUB_ENV - name: Checkout Yosys @@ -178,11 +169,11 @@ jobs: if: steps.cache-iverilog.outputs.cache-hit != 'true' shell: bash run: | - mkdir -p $GITHUB_WORKSPACE/.local/ + mkdir -p ${{ github.workspace }}/.local/ cd iverilog autoconf - CC=gcc CXX=g++ ./configure --prefix=$GITHUB_WORKSPACE/.local - make -j${{ env.procs }} + CC=gcc CXX=g++ ./configure --prefix=${{ github.workspace }}/.local + make -j$procs make install - name: Download build artifact From 5ceafea0eca31301f962f572c757f97674e968fb Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 6 Feb 2024 17:25:25 +1300 Subject: [PATCH 18/92] ci: Default clang build Switch build artifact to a default clang build. Testing with the build artifact locally, `make test` is failing with `/lib/x86_64-linux-gnu/libstdc++.so.6: version 'GLIBCXX_3.4.29' not found`. Using the gcc-11 build (might be?) installing GLIBCXX_3.4.29 but not linking it into the build. Rather than trying to get it to link, just use the pre-installed `clang` instead. --- .github/workflows/test-linux.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 17aa050558d..489995615a3 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -29,12 +29,14 @@ jobs: runs-on: ${{ matrix.os.id }} env: CC: ${{ matrix.compiler }} + CXX: ${{ matrix.compiler }} CXXSTD: ${{ matrix.cpp_std }} strategy: matrix: os: - { id: ubuntu-20.04, name: focal } compiler: + - 'clang' - 'clang-12' - 'gcc-11' cpp_std: @@ -70,7 +72,7 @@ jobs: echo "CXXFLAGS=-Wp,-D_GLIBCXX_ASSERTIONS" >> $GITHUB_ENV - name: Setup Clang - if: startsWith(matrix.compiler, 'clang') + if: startsWith(matrix.compiler, 'clang') && (matrix.compiler != 'clang') shell: bash run: | wget https://apt.llvm.org/llvm-snapshot.gpg.key @@ -105,7 +107,7 @@ jobs: mkdir build cd build make -f ../Makefile config-${CC%%-*} - make -f ../Makefile -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CC LD=$CC + make -f ../Makefile -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CXX LD=$CC - name: Log yosys-config output run: | @@ -118,7 +120,7 @@ jobs: tar -cvf ../build.tar share/ yosys yosys-* - name: Store build artifact - if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'gcc-11') + if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'clang') uses: actions/upload-artifact@v4 with: name: build-artifact From e3f77ff11fc7b9cee3b9fad081c9312b89cdf4a5 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 6 Feb 2024 17:56:15 +1300 Subject: [PATCH 19/92] ci: Add error reporting --- .github/workflows/test-linux.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 489995615a3..c6088fd09f8 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -192,3 +192,9 @@ jobs: shell: bash run: | make -j$procs test TARGETS= EXTRA_TARGETS= CONFIG=$CC + + - name: Report errors + if: ${{ failure() }} + shell: bash + run: | + find tests/**/*.err -print -exec cat {} \; From aa470ccb4745452e45cb290ff5590f2f09424c5f Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 6 Feb 2024 18:31:53 +1300 Subject: [PATCH 20/92] ci: Unify test-*.yml Also rename `build-artifact` to use `matrix.os` for compatibility with testing across OS. --- .../{test-linux.yml => test-build.yml} | 53 +++++++--- .github/workflows/test-macos.yml | 97 ------------------- 2 files changed, 38 insertions(+), 112 deletions(-) rename .github/workflows/{test-linux.yml => test-build.yml} (80%) delete mode 100644 .github/workflows/test-macos.yml diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-build.yml similarity index 80% rename from .github/workflows/test-linux.yml rename to .github/workflows/test-build.yml index c6088fd09f8..ec132e7c192 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-build.yml @@ -1,4 +1,4 @@ -name: Build and run tests (Linux) +name: Build and run tests on: pull_request: @@ -23,10 +23,10 @@ jobs: # only run on push *or* pull_request, not both concurrent_skipping: 'same_content_newer' - build-linux: + build-yosys: needs: pre_job if: needs.pre_job.outputs.should_skip != 'true' - runs-on: ${{ matrix.os.id }} + runs-on: ${{ matrix.os }} env: CC: ${{ matrix.compiler }} CXX: ${{ matrix.compiler }} @@ -34,9 +34,9 @@ jobs: strategy: matrix: os: - - { id: ubuntu-20.04, name: focal } + - ubuntu-20.04 + - macos-13 compiler: - - 'clang' - 'clang-12' - 'gcc-11' cpp_std: @@ -45,21 +45,34 @@ jobs: - 'c++17' - 'c++20' include: - # Limit the older compilers to C++11 mode - - os: { id: ubuntu-20.04, name: focal } + # Build for testing + - os: ubuntu-20.04 + compiler: 'clang' + cpp_std: 'c++11' + # Limited testing for older compilers + - os: ubuntu-20.04 compiler: 'clang-11' cpp_std: 'c++11' - - os: { id: ubuntu-20.04, name: focal } + - os: ubuntu-20.04 compiler: 'gcc-10' cpp_std: 'c++11' + # Add os_name + - os: ubuntu-20.04 + os_name: focal fail-fast: false steps: - - name: Install Dependencies + - name: Install Linux Dependencies + if: runner.os == 'Linux' shell: bash run: | sudo apt-get update sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev + - name: Install macOS Dependencies + if: runner.os == 'macOS' + run: | + brew install bison flex gawk libffi pkg-config bash + - name: Setup GCC if: startsWith(matrix.compiler, 'gcc') shell: bash @@ -78,18 +91,28 @@ jobs: wget https://apt.llvm.org/llvm-snapshot.gpg.key sudo apt-key add llvm-snapshot.gpg.key rm llvm-snapshot.gpg.key - sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os.name }}/ llvm-toolchain-${{ matrix.os.name }} main" + sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os_name }}/ llvm-toolchain-${{ matrix.os_name }} main" sudo apt-get update CXX=${CC/#clang/clang++} sudo apt-get install $CC $CXX echo "CXX=$CXX" >> $GITHUB_ENV - - name: Runtime environment + - name: Linux runtime environment + if: runner.os == 'Linux' shell: bash run: | echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH echo "procs=$(nproc)" >> $GITHUB_ENV + - name: macOS runtime environment + if: runner.os == 'macOS' + shell: bash + run: | + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH + echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH + echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV + - name: Tool versions shell: bash run: | @@ -123,13 +146,13 @@ jobs: if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'clang') uses: actions/upload-artifact@v4 with: - name: build-artifact + name: build-${{ matrix.os }} path: build.tar retention-days: 1 - test-linux: + test-yosys: name: Run tests - needs: build-linux + needs: build-yosys runs-on: ${{ matrix.os }} env: CC: clang @@ -181,7 +204,7 @@ jobs: - name: Download build artifact uses: actions/download-artifact@v4 with: - name: build-artifact + name: build-${{ matrix.os }} - name: Uncompress build shell: bash diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml deleted file mode 100644 index ed63c8f35b7..00000000000 --- a/.github/workflows/test-macos.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Build and run tests (macOS) - -on: - pull_request: - branches: - - master - push: - branches: - - master - -jobs: - pre_job: - runs-on: ubuntu-latest - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@v5 - with: - paths_ignore: '["**/README.md", "docs/**", "guidelines/**"]' - # cancel previous builds if a new commit is pushed - cancel_others: 'true' - # only run on push *or* pull_request, not both - concurrent_skipping: 'same_content_newer' - - test-macos: - needs: pre_job - if: needs.pre_job.outputs.should_skip != 'true' - runs-on: ${{ matrix.os.id }} - strategy: - matrix: - os: - - { id: macos-13, name: 'Ventura' } - cpp_std: - - 'c++11' - fail-fast: false - steps: - - name: Install Dependencies - run: | - HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install bison flex gawk libffi pkg-config bash - - - name: Runtime environment - shell: bash - env: - WORKSPACE: ${{ github.workspace }} - run: | - echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV - echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH - echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH - echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH - echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV - - - name: Tool versions - shell: bash - run: | - cc --version - - - name: Checkout Yosys - uses: actions/checkout@v4 - with: - submodules: true - - name: Get iverilog - shell: bash - run: | - git clone https://github.com/steveicarus/iverilog.git - cd iverilog - echo "IVERILOG_GIT=$(git rev-parse HEAD)" >> $GITHUB_ENV - - - name: Cache iverilog - id: cache-iverilog - uses: actions/cache@v4 - with: - path: .local/ - key: ${{ matrix.os.id }}-${{ env.IVERILOG_GIT }} - - - name: Build iverilog - if: steps.cache-iverilog.outputs.cache-hit != 'true' - shell: bash - run: | - mkdir -p $GITHUB_WORKSPACE/.local/ - cd iverilog - autoconf - CC=gcc CXX=g++ ./configure --prefix=$GITHUB_WORKSPACE/.local/ - make -j${{ env.procs }} - make install - - - name: Build yosys - shell: bash - run: | - make config-clang - make -j${{ env.procs }} CXXSTD=${{ matrix.cpp_std }} CC=cc CXX=cc LD=cc - - - name: Run tests - if: matrix.cpp_std == 'c++11' - shell: bash - run: | - make -j${{ env.procs }} test CXXSTD=${{ matrix.cpp_std }} CC=cc CXX=cc LD=cc From f408b4de05775c5735742114641d302f87bcb989 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 6 Feb 2024 18:56:11 +1300 Subject: [PATCH 21/92] ci: fix compiler setup `os_name` in include section needs to be explicit (putting it at the end doesn't apply to the extra jobs). Move macOS test to extra job instead of doing all gcc/clang (which isn't setup for mac anyway). Also adds name to build-yosys task. --- .github/workflows/test-build.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index ec132e7c192..20417479522 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -24,9 +24,10 @@ jobs: concurrent_skipping: 'same_content_newer' build-yosys: + name: Build Yosys + runs-on: ${{ matrix.os }} needs: pre_job if: needs.pre_job.outputs.should_skip != 'true' - runs-on: ${{ matrix.os }} env: CC: ${{ matrix.compiler }} CXX: ${{ matrix.compiler }} @@ -35,7 +36,6 @@ jobs: matrix: os: - ubuntu-20.04 - - macos-13 compiler: - 'clang-12' - 'gcc-11' @@ -45,20 +45,27 @@ jobs: - 'c++17' - 'c++20' include: + # Add os_name + - os: ubuntu-20.04 + os_name: focal # Build for testing - os: ubuntu-20.04 + os_name: focal + compiler: 'clang' + cpp_std: 'c++11' + # macOS build + - os: macos-13 compiler: 'clang' cpp_std: 'c++11' # Limited testing for older compilers - os: ubuntu-20.04 + os_name: focal compiler: 'clang-11' cpp_std: 'c++11' - os: ubuntu-20.04 + os_name: focal compiler: 'gcc-10' cpp_std: 'c++11' - # Add os_name - - os: ubuntu-20.04 - os_name: focal fail-fast: false steps: - name: Install Linux Dependencies From 8bc206928f9c1b269de4b0416fb8a0ee14235f37 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 9 Feb 2024 05:43:10 +1300 Subject: [PATCH 22/92] ci: split test build from matrix Allow test suite to run if, for example, the C++20 builds are failing but C++11 are fine. --- .github/workflows/test-build.yml | 75 ++++++++++++++++++++++++++++---- 1 file changed, 67 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 20417479522..853a2b12b46 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -23,8 +23,8 @@ jobs: # only run on push *or* pull_request, not both concurrent_skipping: 'same_content_newer' - build-yosys: - name: Build Yosys + test-builds: + name: Compiler testing runs-on: ${{ matrix.os }} needs: pre_job if: needs.pre_job.outputs.should_skip != 'true' @@ -48,11 +48,6 @@ jobs: # Add os_name - os: ubuntu-20.04 os_name: focal - # Build for testing - - os: ubuntu-20.04 - os_name: focal - compiler: 'clang' - cpp_std: 'c++11' # macOS build - os: macos-13 compiler: 'clang' @@ -131,7 +126,71 @@ jobs: with: submodules: true - - name: Build yosys out-of-tree + - name: Build + shell: bash + run: | + make config-${CC%%-*} + make -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CXX LD=$CC + + build-yosys: + name: Reusable Yosys build + runs-on: ${{ matrix.os }} + env: + CC: ${{ matrix.compiler }} + CXX: ${{ matrix.compiler }} + CXXSTD: ${{ matrix.cpp_std }} + strategy: + matrix: + os: + - ubuntu-20.04 + compiler: + - 'clang' + cpp_std: + - 'c++11' + include: + # Add os_name + - os: ubuntu-20.04 + os_name: focal + fail-fast: false + steps: + - name: Install Linux Dependencies + if: runner.os == 'Linux' + shell: bash + run: | + sudo apt-get update + sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev + + - name: Install macOS Dependencies + if: runner.os == 'macOS' + run: | + brew install bison flex gawk libffi pkg-config bash + + - name: Linux runtime environment + if: runner.os == 'Linux' + shell: bash + run: | + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + echo "procs=$(nproc)" >> $GITHUB_ENV + + - name: macOS runtime environment + if: runner.os == 'macOS' + shell: bash + run: | + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH + echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH + echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV + + - name: Tool versions + shell: bash + run: | + $CC --version + $CXX --version + + - name: Checkout Yosys + uses: actions/checkout@v4 + + - name: Build shell: bash run: | mkdir build From 934822115417c7323c72f9b4b0d992dcd691c354 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Sat, 10 Feb 2024 12:34:07 +1300 Subject: [PATCH 23/92] ci: simplify tests a bit Remove compiler and cpp_std from `build-yosys` matrix. Using `config-$CC` will instead fall back to default values. Drop `Tool versions` step and introduce `yosys-config` output instead. Rename `test-builds` to `test-compile`. --- .github/workflows/test-build.yml | 34 ++++++++++---------------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 853a2b12b46..b27a37a8719 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -23,7 +23,7 @@ jobs: # only run on push *or* pull_request, not both concurrent_skipping: 'same_content_newer' - test-builds: + test-compile: name: Compiler testing runs-on: ${{ matrix.os }} needs: pre_job @@ -133,24 +133,13 @@ jobs: make -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CXX LD=$CC build-yosys: - name: Reusable Yosys build + name: Reusable build runs-on: ${{ matrix.os }} env: - CC: ${{ matrix.compiler }} - CXX: ${{ matrix.compiler }} - CXXSTD: ${{ matrix.cpp_std }} + CC: clang strategy: matrix: - os: - - ubuntu-20.04 - compiler: - - 'clang' - cpp_std: - - 'c++11' - include: - # Add os_name - - os: ubuntu-20.04 - os_name: focal + os: [ubuntu-20.04] fail-fast: false steps: - name: Install Linux Dependencies @@ -181,12 +170,6 @@ jobs: echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV - - name: Tool versions - shell: bash - run: | - $CC --version - $CXX --version - - name: Checkout Yosys uses: actions/checkout@v4 @@ -195,8 +178,12 @@ jobs: run: | mkdir build cd build - make -f ../Makefile config-${CC%%-*} - make -f ../Makefile -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CXX LD=$CC + make -f ../Makefile config-$CC + make -f ../Makefile -j$procs + + - name: Log yosys-config output + run: | + ./yosys-config || true - name: Log yosys-config output run: | @@ -209,7 +196,6 @@ jobs: tar -cvf ../build.tar share/ yosys yosys-* - name: Store build artifact - if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'clang') uses: actions/upload-artifact@v4 with: name: build-${{ matrix.os }} From c9c6b96ba92a50ae32515e1ffb76f1f18a7c78fe Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 15 Feb 2024 09:49:02 +1300 Subject: [PATCH 24/92] ci: add missing macOS build `test-macos.yml` included c++17 which was missing in `test-build.yml`. --- .github/workflows/test-build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index b27a37a8719..7f581af277e 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -48,10 +48,13 @@ jobs: # Add os_name - os: ubuntu-20.04 os_name: focal - # macOS build + # macOS builds - os: macos-13 compiler: 'clang' cpp_std: 'c++11' + - os: macos-13 + compiler: 'clang' + cpp_std: 'c++17' # Limited testing for older compilers - os: ubuntu-20.04 os_name: focal From 154464e7ce79f46f5647b0e06e7cb226c756fec5 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 15 Feb 2024 10:00:22 +1300 Subject: [PATCH 25/92] ci: add macos test build --- .github/workflows/test-build.yml | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 7f581af277e..f223bde24d1 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -142,7 +142,7 @@ jobs: CC: clang strategy: matrix: - os: [ubuntu-20.04] + os: [ubuntu-20.04, macos-13] fail-fast: false steps: - name: Install Linux Dependencies @@ -213,20 +213,36 @@ jobs: CC: clang strategy: matrix: - os: [ubuntu-20.04] + os: [ubuntu-20.04, macos-13] steps: - - name: Install Dependencies + - name: Install Linux Dependencies + if: runner.os == 'Linux' shell: bash run: | sudo apt-get update - sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev + sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev + + - name: Install macOS Dependencies + if: runner.os == 'macOS' + run: | + brew install bison flex gawk libffi pkg-config bash - - name: Runtime environment + - name: Linux runtime environment + if: runner.os == 'Linux' shell: bash run: | echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH echo "procs=$(nproc)" >> $GITHUB_ENV + - name: macOS runtime environment + if: runner.os == 'macOS' + shell: bash + run: | + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH + echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH + echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV + - name: Checkout Yosys uses: actions/checkout@v4 From 326d802220acaf8102d967b49247d95153396d55 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 15 Feb 2024 10:00:58 +1300 Subject: [PATCH 26/92] ci: split test-compile from test-build --- .github/workflows/test-build.yml | 114 +----------------------- .github/workflows/test-compile.yml | 137 +++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+), 112 deletions(-) create mode 100644 .github/workflows/test-compile.yml diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index f223bde24d1..8ad44f0b550 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -23,121 +23,11 @@ jobs: # only run on push *or* pull_request, not both concurrent_skipping: 'same_content_newer' - test-compile: - name: Compiler testing - runs-on: ${{ matrix.os }} - needs: pre_job - if: needs.pre_job.outputs.should_skip != 'true' - env: - CC: ${{ matrix.compiler }} - CXX: ${{ matrix.compiler }} - CXXSTD: ${{ matrix.cpp_std }} - strategy: - matrix: - os: - - ubuntu-20.04 - compiler: - - 'clang-12' - - 'gcc-11' - cpp_std: - - 'c++11' - - 'c++14' - - 'c++17' - - 'c++20' - include: - # Add os_name - - os: ubuntu-20.04 - os_name: focal - # macOS builds - - os: macos-13 - compiler: 'clang' - cpp_std: 'c++11' - - os: macos-13 - compiler: 'clang' - cpp_std: 'c++17' - # Limited testing for older compilers - - os: ubuntu-20.04 - os_name: focal - compiler: 'clang-11' - cpp_std: 'c++11' - - os: ubuntu-20.04 - os_name: focal - compiler: 'gcc-10' - cpp_std: 'c++11' - fail-fast: false - steps: - - name: Install Linux Dependencies - if: runner.os == 'Linux' - shell: bash - run: | - sudo apt-get update - sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev - - - name: Install macOS Dependencies - if: runner.os == 'macOS' - run: | - brew install bison flex gawk libffi pkg-config bash - - - name: Setup GCC - if: startsWith(matrix.compiler, 'gcc') - shell: bash - run: | - CXX=${CC/#gcc/g++} - sudo apt-add-repository ppa:ubuntu-toolchain-r/test - sudo apt-get update - sudo apt-get install $CC $CXX - echo "CXX=$CXX" >> $GITHUB_ENV - echo "CXXFLAGS=-Wp,-D_GLIBCXX_ASSERTIONS" >> $GITHUB_ENV - - - name: Setup Clang - if: startsWith(matrix.compiler, 'clang') && (matrix.compiler != 'clang') - shell: bash - run: | - wget https://apt.llvm.org/llvm-snapshot.gpg.key - sudo apt-key add llvm-snapshot.gpg.key - rm llvm-snapshot.gpg.key - sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os_name }}/ llvm-toolchain-${{ matrix.os_name }} main" - sudo apt-get update - CXX=${CC/#clang/clang++} - sudo apt-get install $CC $CXX - echo "CXX=$CXX" >> $GITHUB_ENV - - - name: Linux runtime environment - if: runner.os == 'Linux' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "procs=$(nproc)" >> $GITHUB_ENV - - - name: macOS runtime environment - if: runner.os == 'macOS' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH - echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH - echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV - - - name: Tool versions - shell: bash - run: | - $CC --version - $CXX --version - - - name: Checkout Yosys - uses: actions/checkout@v4 - with: - submodules: true - - - name: Build - shell: bash - run: | - make config-${CC%%-*} - make -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CXX LD=$CC - build-yosys: name: Reusable build runs-on: ${{ matrix.os }} + needs: pre_job + if: needs.pre_job.outputs.should_skip != 'true' env: CC: clang strategy: diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml new file mode 100644 index 00000000000..5d1c0aca94b --- /dev/null +++ b/.github/workflows/test-compile.yml @@ -0,0 +1,137 @@ +name: Compiler testing + +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + pre_job: + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v5 + with: + paths_ignore: '["**/README.md", "docs/**", "guidelines/**"]' + # cancel previous builds if a new commit is pushed + cancel_others: 'true' + # only run on push *or* pull_request, not both + concurrent_skipping: 'same_content_newer' + + test-compile: + runs-on: ${{ matrix.os }} + needs: pre_job + if: needs.pre_job.outputs.should_skip != 'true' + env: + CC: ${{ matrix.compiler }} + CXX: ${{ matrix.compiler }} + CXXSTD: ${{ matrix.cpp_std }} + strategy: + matrix: + os: + - ubuntu-20.04 + compiler: + - 'clang-12' + - 'gcc-11' + cpp_std: + - 'c++11' + - 'c++14' + - 'c++17' + - 'c++20' + include: + # Add os_name + - os: ubuntu-20.04 + os_name: focal + # macOS builds + - os: macos-13 + compiler: 'clang' + cpp_std: 'c++11' + - os: macos-13 + compiler: 'clang' + cpp_std: 'c++17' + # Limited testing for older compilers + - os: ubuntu-20.04 + os_name: focal + compiler: 'clang-11' + cpp_std: 'c++11' + - os: ubuntu-20.04 + os_name: focal + compiler: 'gcc-10' + cpp_std: 'c++11' + fail-fast: false + steps: + - name: Install Linux Dependencies + if: runner.os == 'Linux' + shell: bash + run: | + sudo apt-get update + sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev + + - name: Install macOS Dependencies + if: runner.os == 'macOS' + run: | + brew install bison flex gawk libffi pkg-config bash + + - name: Setup GCC + if: startsWith(matrix.compiler, 'gcc') + shell: bash + run: | + CXX=${CC/#gcc/g++} + sudo apt-add-repository ppa:ubuntu-toolchain-r/test + sudo apt-get update + sudo apt-get install $CC $CXX + echo "CXX=$CXX" >> $GITHUB_ENV + echo "CXXFLAGS=-Wp,-D_GLIBCXX_ASSERTIONS" >> $GITHUB_ENV + + - name: Setup Clang + if: startsWith(matrix.compiler, 'clang') && (matrix.compiler != 'clang') + shell: bash + run: | + wget https://apt.llvm.org/llvm-snapshot.gpg.key + sudo apt-key add llvm-snapshot.gpg.key + rm llvm-snapshot.gpg.key + sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os_name }}/ llvm-toolchain-${{ matrix.os_name }} main" + sudo apt-get update + CXX=${CC/#clang/clang++} + sudo apt-get install $CC $CXX + echo "CXX=$CXX" >> $GITHUB_ENV + + - name: Linux runtime environment + if: runner.os == 'Linux' + shell: bash + run: | + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + echo "procs=$(nproc)" >> $GITHUB_ENV + + - name: macOS runtime environment + if: runner.os == 'macOS' + shell: bash + run: | + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH + echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH + echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV + + - name: Tool versions + shell: bash + run: | + $CC --version + $CXX --version + + - name: Checkout Yosys + uses: actions/checkout@v4 + + - name: Build + shell: bash + run: | + make config-${CC%%-*} + make -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CXX LD=$CC + + - name: Log yosys-config output + run: | + ./yosys-config || true From 616848b773297ed8c37d94c0a5cf68c84b416284 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 4 Mar 2024 11:37:25 +1300 Subject: [PATCH 27/92] ci: Use aminya/setup-cpp --- .github/workflows/test-compile.yml | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index 5d1c0aca94b..b03af924346 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -28,9 +28,8 @@ jobs: needs: pre_job if: needs.pre_job.outputs.should_skip != 'true' env: - CC: ${{ matrix.compiler }} - CXX: ${{ matrix.compiler }} CXXSTD: ${{ matrix.cpp_std }} + CXXFLAGS: ${{ startsWith(matrix.compiler, 'gcc') && '-Wp,-D_GLIBCXX_ASSERTIONS' || ''}} strategy: matrix: os: @@ -77,29 +76,10 @@ jobs: run: | brew install bison flex gawk libffi pkg-config bash - - name: Setup GCC - if: startsWith(matrix.compiler, 'gcc') - shell: bash - run: | - CXX=${CC/#gcc/g++} - sudo apt-add-repository ppa:ubuntu-toolchain-r/test - sudo apt-get update - sudo apt-get install $CC $CXX - echo "CXX=$CXX" >> $GITHUB_ENV - echo "CXXFLAGS=-Wp,-D_GLIBCXX_ASSERTIONS" >> $GITHUB_ENV - - - name: Setup Clang - if: startsWith(matrix.compiler, 'clang') && (matrix.compiler != 'clang') - shell: bash - run: | - wget https://apt.llvm.org/llvm-snapshot.gpg.key - sudo apt-key add llvm-snapshot.gpg.key - rm llvm-snapshot.gpg.key - sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os_name }}/ llvm-toolchain-${{ matrix.os_name }} main" - sudo apt-get update - CXX=${CC/#clang/clang++} - sudo apt-get install $CC $CXX - echo "CXX=$CXX" >> $GITHUB_ENV + - name: Setup Cpp + uses: aminya/setup-cpp@v1 + with: + compiler: ${{ matrix.compiler }} - name: Linux runtime environment if: runner.os == 'Linux' From 62440246ec2d9fdc16d9a9ae535087c3498fc273 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 4 Mar 2024 12:00:51 +1300 Subject: [PATCH 28/92] ci: Add CC_SHORT env var New Setup Cpp step uses fully qualified paths for $CC and $CXX so ${CC%%-*} no longer works. Remove os_name since it's not needed anymore. --- .github/workflows/test-compile.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index b03af924346..9c25874bbcd 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -30,6 +30,7 @@ jobs: env: CXXSTD: ${{ matrix.cpp_std }} CXXFLAGS: ${{ startsWith(matrix.compiler, 'gcc') && '-Wp,-D_GLIBCXX_ASSERTIONS' || ''}} + CC_SHORT: ${{ startsWith(matrix.compiler, 'gcc') && 'gcc' || 'clang' }} strategy: matrix: os: @@ -43,9 +44,6 @@ jobs: - 'c++17' - 'c++20' include: - # Add os_name - - os: ubuntu-20.04 - os_name: focal # macOS builds - os: macos-13 compiler: 'clang' @@ -55,11 +53,9 @@ jobs: cpp_std: 'c++17' # Limited testing for older compilers - os: ubuntu-20.04 - os_name: focal compiler: 'clang-11' cpp_std: 'c++11' - os: ubuntu-20.04 - os_name: focal compiler: 'gcc-10' cpp_std: 'c++11' fail-fast: false @@ -109,8 +105,8 @@ jobs: - name: Build shell: bash run: | - make config-${CC%%-*} - make -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CXX LD=$CC + make config-$CC_SHORT + make -j$procs CXXSTD=$CXXSTD - name: Log yosys-config output run: | From d07323e7ddca262727c39750a8c5ec29fcbd59d1 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 4 Mar 2024 13:10:50 +1300 Subject: [PATCH 29/92] ci: Add action for reusable build env setup --- .github/actions/setup-build-env/action.yml | 32 ++++++++++++ .github/workflows/test-build.yml | 58 ++-------------------- .github/workflows/test-compile.yml | 29 +---------- 3 files changed, 38 insertions(+), 81 deletions(-) create mode 100644 .github/actions/setup-build-env/action.yml diff --git a/.github/actions/setup-build-env/action.yml b/.github/actions/setup-build-env/action.yml new file mode 100644 index 00000000000..e1b550e5ca8 --- /dev/null +++ b/.github/actions/setup-build-env/action.yml @@ -0,0 +1,32 @@ +name: Build environment setup +description: Configure build env for Yosys builds +runs: + using: composite + steps: + - name: Install Linux Dependencies + if: runner.os == 'Linux' + shell: bash + run: | + sudo apt-get update + sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev + + - name: Install macOS Dependencies + if: runner.os == 'macOS' + run: | + brew install bison flex gawk libffi pkg-config bash + + - name: Linux runtime environment + if: runner.os == 'Linux' + shell: bash + run: | + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + echo "procs=$(nproc)" >> $GITHUB_ENV + + - name: macOS runtime environment + if: runner.os == 'macOS' + shell: bash + run: | + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH + echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH + echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV \ No newline at end of file diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 8ad44f0b550..37322883106 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -35,33 +35,8 @@ jobs: os: [ubuntu-20.04, macos-13] fail-fast: false steps: - - name: Install Linux Dependencies - if: runner.os == 'Linux' - shell: bash - run: | - sudo apt-get update - sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev - - - name: Install macOS Dependencies - if: runner.os == 'macOS' - run: | - brew install bison flex gawk libffi pkg-config bash - - - name: Linux runtime environment - if: runner.os == 'Linux' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "procs=$(nproc)" >> $GITHUB_ENV - - - name: macOS runtime environment - if: runner.os == 'macOS' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH - echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH - echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV + - name: Setup environment + uses: ./.github/actions/setup-build-env - name: Checkout Yosys uses: actions/checkout@v4 @@ -105,33 +80,8 @@ jobs: matrix: os: [ubuntu-20.04, macos-13] steps: - - name: Install Linux Dependencies - if: runner.os == 'Linux' - shell: bash - run: | - sudo apt-get update - sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev - - - name: Install macOS Dependencies - if: runner.os == 'macOS' - run: | - brew install bison flex gawk libffi pkg-config bash - - - name: Linux runtime environment - if: runner.os == 'Linux' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "procs=$(nproc)" >> $GITHUB_ENV - - - name: macOS runtime environment - if: runner.os == 'macOS' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH - echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH - echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV + - name: Setup environment + uses: ./.github/actions/setup-build-env - name: Checkout Yosys uses: actions/checkout@v4 diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index 9c25874bbcd..6a0b69c8bb3 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -60,39 +60,14 @@ jobs: cpp_std: 'c++11' fail-fast: false steps: - - name: Install Linux Dependencies - if: runner.os == 'Linux' - shell: bash - run: | - sudo apt-get update - sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev - - - name: Install macOS Dependencies - if: runner.os == 'macOS' - run: | - brew install bison flex gawk libffi pkg-config bash + - name: Setup environment + uses: ./.github/actions/setup-build-env - name: Setup Cpp uses: aminya/setup-cpp@v1 with: compiler: ${{ matrix.compiler }} - - name: Linux runtime environment - if: runner.os == 'Linux' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "procs=$(nproc)" >> $GITHUB_ENV - - - name: macOS runtime environment - if: runner.os == 'macOS' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH - echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH - echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV - - name: Tool versions shell: bash run: | From 3c65ddbea07a12e6f0d4cbcee4b18e9c6297913c Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 4 Mar 2024 13:12:45 +1300 Subject: [PATCH 30/92] ci: Checkout goes first --- .github/workflows/test-build.yml | 12 ++++++------ .github/workflows/test-compile.yml | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 37322883106..cdc19b0e35a 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -35,12 +35,12 @@ jobs: os: [ubuntu-20.04, macos-13] fail-fast: false steps: - - name: Setup environment - uses: ./.github/actions/setup-build-env - - name: Checkout Yosys uses: actions/checkout@v4 + - name: Setup environment + uses: ./.github/actions/setup-build-env + - name: Build shell: bash run: | @@ -80,12 +80,12 @@ jobs: matrix: os: [ubuntu-20.04, macos-13] steps: - - name: Setup environment - uses: ./.github/actions/setup-build-env - - name: Checkout Yosys uses: actions/checkout@v4 + - name: Setup environment + uses: ./.github/actions/setup-build-env + - name: Get iverilog shell: bash run: | diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index 6a0b69c8bb3..c541b68ff30 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -60,6 +60,9 @@ jobs: cpp_std: 'c++11' fail-fast: false steps: + - name: Checkout Yosys + uses: actions/checkout@v4 + - name: Setup environment uses: ./.github/actions/setup-build-env @@ -74,9 +77,6 @@ jobs: $CC --version $CXX --version - - name: Checkout Yosys - uses: actions/checkout@v4 - - name: Build shell: bash run: | From 6451a6a0dc480a67bf681610577a76b4e6d58559 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 4 Mar 2024 13:13:43 +1300 Subject: [PATCH 31/92] ci: Fix action.yml --- .github/actions/setup-build-env/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/setup-build-env/action.yml b/.github/actions/setup-build-env/action.yml index e1b550e5ca8..f61d6565e51 100644 --- a/.github/actions/setup-build-env/action.yml +++ b/.github/actions/setup-build-env/action.yml @@ -12,6 +12,7 @@ runs: - name: Install macOS Dependencies if: runner.os == 'macOS' + shell: bash run: | brew install bison flex gawk libffi pkg-config bash From 112a5cfc6752c04f5fcec35c750df30b812c56d8 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 21 Mar 2024 10:01:01 +1300 Subject: [PATCH 32/92] ci: Add testing for newer compilers --- .github/workflows/test-compile.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index c541b68ff30..5b0c716f0be 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -58,6 +58,28 @@ jobs: - os: ubuntu-20.04 compiler: 'gcc-10' cpp_std: 'c++11' + # Limited testing for newer compilers + - os: ubuntu-20.04 + compiler: 'clang-13' + cpp_std: 'c++11' + - os: ubuntu-20.04 + compiler: 'clang-14' + cpp_std: 'c++11' + - os: ubuntu-20.04 + compiler: 'clang-15' + cpp_std: 'c++11' + - os: ubuntu-20.04 + compiler: 'clang-16' + cpp_std: 'c++11' + - os: ubuntu-20.04 + compiler: 'clang-17' + cpp_std: 'c++11' + - os: ubuntu-20.04 + compiler: 'gcc-12' + cpp_std: 'c++11' + - os: ubuntu-20.04 + compiler: 'gcc-13' + cpp_std: 'c++11' fail-fast: false steps: - name: Checkout Yosys From 6f602e79d4abe113eff11d61d9072e18a4bf6733 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 21 Mar 2024 11:02:18 +1300 Subject: [PATCH 33/92] docs: Debugging macro test fail Call yosys-config post build extraction for sanity check. Report absolute path for yosys exe if it can't be found. --- .github/workflows/test-build.yml | 43 +++++++++++++++++++++++++++++++- docs/tests/macro_commands.py | 7 +++--- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index cdc19b0e35a..605ce570da4 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -72,8 +72,9 @@ jobs: test-yosys: name: Run tests - needs: build-yosys runs-on: ${{ matrix.os }} + needs: [build-yosys, pre_job] + if: needs.pre_job.outputs.should_skip != 'true' env: CC: clang strategy: @@ -122,6 +123,10 @@ jobs: run: tar -xvf build.tar + - name: Log yosys-config output + run: | + ./yosys-config || true + - name: Run tests shell: bash run: | @@ -132,3 +137,39 @@ jobs: shell: bash run: | find tests/**/*.err -print -exec cat {} \; + + test-docs: + name: Run docs tests + runs-on: ${{ matrix.os }} + needs: [build-yosys, pre_job] + if: needs.pre_job.outputs.should_skip != 'true' + env: + CC: clang + strategy: + matrix: + os: [ubuntu-20.04, macos-13] + steps: + - name: Checkout Yosys + uses: actions/checkout@v4 + + - name: Setup environment + uses: ./.github/actions/setup-build-env + + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: build-${{ matrix.os }} + + - name: Uncompress build + shell: bash + run: + tar -xvf build.tar + + - name: Log yosys-config output + run: | + ./yosys-config || true + + - name: Run tests + shell: bash + run: | + make -C docs test -j${{ env.procs }} diff --git a/docs/tests/macro_commands.py b/docs/tests/macro_commands.py index faf2baa530b..d879e4365b2 100755 --- a/docs/tests/macro_commands.py +++ b/docs/tests/macro_commands.py @@ -12,12 +12,13 @@ # expects __file__ = yosys/docs/tests/macro_commands.py TESTS_DIR = Path(__file__).parent ROOT_DIR = TESTS_DIR.parent.parent +logging.log(logging.INFO, f"Using {ROOT_DIR.absolute()} as root directory") THIS_FILE = (TESTS_DIR / "macro_commands.py").relative_to(ROOT_DIR) MACRO_SOURCE = TESTS_DIR.parent / "source" / "code_examples" / "macro_commands" -assert MACRO_SOURCE.exists(), f"can't find macro_commands in {MACRO_SOURCE}" +assert MACRO_SOURCE.exists(), f"can't find macro_commands in {MACRO_SOURCE.absolute()}" -YOSYS = TESTS_DIR.parent.parent / "yosys" -assert YOSYS.exists(), f"can't find yosys executable in {YOSYS}" +YOSYS = ROOT_DIR / "yosys" +assert YOSYS.exists(), f"can't find yosys executable in {YOSYS.absolute()}" raise_error = False # get all macro commands being used From 0720020226426838c8f670b8288b71284244ed16 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 21 Mar 2024 11:04:24 +1300 Subject: [PATCH 34/92] ci: Drop gcc-12 Setup script unable to install gcc-12 under ubuntu-20.04. --- .github/workflows/test-compile.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index 5b0c716f0be..ae48c618081 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -74,9 +74,6 @@ jobs: - os: ubuntu-20.04 compiler: 'clang-17' cpp_std: 'c++11' - - os: ubuntu-20.04 - compiler: 'gcc-12' - cpp_std: 'c++11' - os: ubuntu-20.04 compiler: 'gcc-13' cpp_std: 'c++11' From a4c3dcc5a0cc6a32dd4ac756a66394b41cc060f0 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 22 Mar 2024 09:13:39 +1300 Subject: [PATCH 35/92] docs: Fix macro_commands Get absolute path for `TESTS_DIR` to work from `docs` directory or from `docs/tests` in addition to `yosys` directory. --- docs/tests/macro_commands.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/tests/macro_commands.py b/docs/tests/macro_commands.py index d879e4365b2..7ceb092d867 100755 --- a/docs/tests/macro_commands.py +++ b/docs/tests/macro_commands.py @@ -10,15 +10,15 @@ logging.basicConfig(level=logging.INFO) # expects __file__ = yosys/docs/tests/macro_commands.py -TESTS_DIR = Path(__file__).parent +TESTS_DIR = Path(__file__).parent.absolute() ROOT_DIR = TESTS_DIR.parent.parent -logging.log(logging.INFO, f"Using {ROOT_DIR.absolute()} as root directory") +logging.log(logging.INFO, f"Using {ROOT_DIR} as root directory") THIS_FILE = (TESTS_DIR / "macro_commands.py").relative_to(ROOT_DIR) MACRO_SOURCE = TESTS_DIR.parent / "source" / "code_examples" / "macro_commands" -assert MACRO_SOURCE.exists(), f"can't find macro_commands in {MACRO_SOURCE.absolute()}" +assert MACRO_SOURCE.exists(), f"can't find macro_commands in {MACRO_SOURCE}" YOSYS = ROOT_DIR / "yosys" -assert YOSYS.exists(), f"can't find yosys executable in {YOSYS.absolute()}" +assert YOSYS.exists(), f"can't find yosys executable in {YOSYS}" raise_error = False # get all macro commands being used From 7fbf286b3f240fe82ca89a22f07497b5f92c6eaa Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 22 Mar 2024 09:16:43 +1300 Subject: [PATCH 36/92] ci: Update for main branch rename --- .github/workflows/test-build.yml | 4 ++-- .github/workflows/test-compile.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 605ce570da4..5a957e5bb70 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -3,10 +3,10 @@ name: Build and run tests on: pull_request: branches: - - master + - main push: branches: - - master + - main jobs: pre_job: diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index ae48c618081..88eaed90c35 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -3,10 +3,10 @@ name: Compiler testing on: pull_request: branches: - - master + - main push: branches: - - master + - main jobs: pre_job: From c89c5c34a0782d5cdcac37ed60c6b40be08921cc Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 22 Mar 2024 10:06:30 +1300 Subject: [PATCH 37/92] ci: Disable fail fast for test runs --- .github/workflows/test-build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 5a957e5bb70..2f078ae6974 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -80,6 +80,7 @@ jobs: strategy: matrix: os: [ubuntu-20.04, macos-13] + fail-fast: false steps: - name: Checkout Yosys uses: actions/checkout@v4 @@ -148,6 +149,7 @@ jobs: strategy: matrix: os: [ubuntu-20.04, macos-13] + fail-fast: false steps: - name: Checkout Yosys uses: actions/checkout@v4 From 7d8928af4b9488dca402ba90f7d2878c13151bc7 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 22 Mar 2024 10:24:07 +1300 Subject: [PATCH 38/92] ci: Remove macOS from test-docs macOS fails due to missing gvpack, but trying to install graphviz triggers a Python update which breaks the macOS runner. --- .github/workflows/test-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 2f078ae6974..beb98e60e35 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -148,7 +148,7 @@ jobs: CC: clang strategy: matrix: - os: [ubuntu-20.04, macos-13] + os: [ubuntu-20.04] fail-fast: false steps: - name: Checkout Yosys From 144d3c9601341730705920da7e5c73cc20a99d36 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 25 Apr 2024 09:58:07 +1200 Subject: [PATCH 39/92] Add empty line to action.yml --- .github/actions/setup-build-env/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-build-env/action.yml b/.github/actions/setup-build-env/action.yml index f61d6565e51..56565ce89fd 100644 --- a/.github/actions/setup-build-env/action.yml +++ b/.github/actions/setup-build-env/action.yml @@ -30,4 +30,4 @@ runs: echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH - echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV \ No newline at end of file + echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV From fc48c3a8719c413dd48aa122695166d506673173 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 25 Apr 2024 10:41:28 +1200 Subject: [PATCH 40/92] ci: Update OS/compiler targets --- .github/workflows/test-compile.yml | 32 ++++++++++++++++++------------ 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index 88eaed90c35..935167b629c 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -34,7 +34,7 @@ jobs: strategy: matrix: os: - - ubuntu-20.04 + - ubuntu-22.04 compiler: - 'clang-12' - 'gcc-11' @@ -45,36 +45,42 @@ jobs: - 'c++20' include: # macOS builds + - os: macos-latest + compiler: 'clang' + cpp_std: 'c++11' - os: macos-13 compiler: 'clang' cpp_std: 'c++11' - os: macos-13 compiler: 'clang' cpp_std: 'c++17' - # Limited testing for older compilers - - os: ubuntu-20.04 + # ubuntu-22.04 compilers + - os: ubuntu-22.04 compiler: 'clang-11' cpp_std: 'c++11' - - os: ubuntu-20.04 - compiler: 'gcc-10' - cpp_std: 'c++11' - # Limited testing for newer compilers - - os: ubuntu-20.04 + - os: ubuntu-22.04 compiler: 'clang-13' cpp_std: 'c++11' - - os: ubuntu-20.04 + # ubuntu-latest compilers + - os: ubuntu-latest compiler: 'clang-14' cpp_std: 'c++11' - - os: ubuntu-20.04 + - os: ubuntu-latest compiler: 'clang-15' cpp_std: 'c++11' - - os: ubuntu-20.04 + - os: ubuntu-latest compiler: 'clang-16' cpp_std: 'c++11' - - os: ubuntu-20.04 + - os: ubuntu-latest compiler: 'clang-17' cpp_std: 'c++11' - - os: ubuntu-20.04 + - os: ubuntu-latest + compiler: 'gcc-10' + cpp_std: 'c++11' + - os: ubuntu-latest + compiler: 'gcc-12' + cpp_std: 'c++11' + - os: ubuntu-latest compiler: 'gcc-13' cpp_std: 'c++11' fail-fast: false From 8fc7dcb5165ccc051fb3f838843fd3f50d076450 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 25 Apr 2024 10:42:50 +1200 Subject: [PATCH 41/92] ci: Drop python2 --- .github/actions/setup-build-env/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-build-env/action.yml b/.github/actions/setup-build-env/action.yml index 56565ce89fd..d938d6b27ae 100644 --- a/.github/actions/setup-build-env/action.yml +++ b/.github/actions/setup-build-env/action.yml @@ -8,7 +8,7 @@ runs: shell: bash run: | sudo apt-get update - sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev + sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev - name: Install macOS Dependencies if: runner.os == 'macOS' From eae7356c701d8419859e378bada12b6550d65262 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 25 Apr 2024 08:37:44 +0200 Subject: [PATCH 42/92] Cleanups and update of VS action --- .github/workflows/test-build.yml | 14 ++++---------- .github/workflows/test-compile.yml | 8 +------- .gitignore | 1 - 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index beb98e60e35..703cb6bd70a 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -1,12 +1,6 @@ name: Build and run tests -on: - pull_request: - branches: - - main - push: - branches: - - main +on: [push, pull_request] jobs: pre_job: @@ -32,7 +26,7 @@ jobs: CC: clang strategy: matrix: - os: [ubuntu-20.04, macos-13] + os: [ubuntu-latest, macos-13] fail-fast: false steps: - name: Checkout Yosys @@ -79,7 +73,7 @@ jobs: CC: clang strategy: matrix: - os: [ubuntu-20.04, macos-13] + os: [ubuntu-latest, macos-13] fail-fast: false steps: - name: Checkout Yosys @@ -148,7 +142,7 @@ jobs: CC: clang strategy: matrix: - os: [ubuntu-20.04] + os: [ubuntu-latest] fail-fast: false steps: - name: Checkout Yosys diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index 935167b629c..6dd348102b5 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -1,12 +1,6 @@ name: Compiler testing -on: - pull_request: - branches: - - main - push: - branches: - - main +on: [push, pull_request] jobs: pre_job: diff --git a/.gitignore b/.gitignore index b4797d63884..6f3e521d62e 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,3 @@ __pycache__ /tests/unit/bintest/ /tests/unit/objtest/ /tests/ystests -/build From 24b3690c255d8e23a0d422daf3c5dad20e645952 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 30 Apr 2024 11:01:30 +1200 Subject: [PATCH 43/92] test-build: Use macos-latest (macOS 14, M1) --- .github/workflows/test-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 703cb6bd70a..c73aa995347 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -26,7 +26,7 @@ jobs: CC: clang strategy: matrix: - os: [ubuntu-latest, macos-13] + os: [ubuntu-latest, macos-latest] fail-fast: false steps: - name: Checkout Yosys @@ -73,7 +73,7 @@ jobs: CC: clang strategy: matrix: - os: [ubuntu-latest, macos-13] + os: [ubuntu-latest, macos-latest] fail-fast: false steps: - name: Checkout Yosys From 6908330005f8e1b08a5367fe25a82b2670c482d0 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 30 Apr 2024 11:11:46 +1200 Subject: [PATCH 44/92] ci: Reduce number of jobs Limit compilers to oldest and newest. Oldest compilers test with minimum supported standard. Newest compilers test with minimum *and* maximum supported standard. --- .github/workflows/test-compile.yml | 66 ++++++++---------------------- Makefile | 6 +++ 2 files changed, 24 insertions(+), 48 deletions(-) diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index 6dd348102b5..6a9097ad33a 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -22,61 +22,26 @@ jobs: needs: pre_job if: needs.pre_job.outputs.should_skip != 'true' env: - CXXSTD: ${{ matrix.cpp_std }} CXXFLAGS: ${{ startsWith(matrix.compiler, 'gcc') && '-Wp,-D_GLIBCXX_ASSERTIONS' || ''}} CC_SHORT: ${{ startsWith(matrix.compiler, 'gcc') && 'gcc' || 'clang' }} strategy: matrix: os: - - ubuntu-22.04 + - ubuntu-latest compiler: - - 'clang-12' - - 'gcc-11' - cpp_std: - - 'c++11' - - 'c++14' - - 'c++17' - - 'c++20' + # oldest supported + - 'clang-14' + - 'gcc-10' + # newest + - 'clang' + - 'gcc' include: - # macOS builds - - os: macos-latest - compiler: 'clang' - cpp_std: 'c++11' - - os: macos-13 - compiler: 'clang' - cpp_std: 'c++11' + # macOS - os: macos-13 compiler: 'clang' - cpp_std: 'c++17' - # ubuntu-22.04 compilers + # oldest clang not available on ubuntu-latest - os: ubuntu-22.04 compiler: 'clang-11' - cpp_std: 'c++11' - - os: ubuntu-22.04 - compiler: 'clang-13' - cpp_std: 'c++11' - # ubuntu-latest compilers - - os: ubuntu-latest - compiler: 'clang-14' - cpp_std: 'c++11' - - os: ubuntu-latest - compiler: 'clang-15' - cpp_std: 'c++11' - - os: ubuntu-latest - compiler: 'clang-16' - cpp_std: 'c++11' - - os: ubuntu-latest - compiler: 'clang-17' - cpp_std: 'c++11' - - os: ubuntu-latest - compiler: 'gcc-10' - cpp_std: 'c++11' - - os: ubuntu-latest - compiler: 'gcc-12' - cpp_std: 'c++11' - - os: ubuntu-latest - compiler: 'gcc-13' - cpp_std: 'c++11' fail-fast: false steps: - name: Checkout Yosys @@ -96,12 +61,17 @@ jobs: $CC --version $CXX --version - - name: Build + # minimum standard + - name: Build C++11 shell: bash run: | make config-$CC_SHORT - make -j$procs CXXSTD=$CXXSTD + make -j$procs CXXSTD=c++11 compile-only - - name: Log yosys-config output + # maximum standard, only on newest compilers + - name: Build C++20 + if: ${{ matrix.compiler == 'clang' || matrix.compiler == 'gcc'}} + shell: bash run: | - ./yosys-config || true + make config-$CC_SHORT + make -j$procs CXXSTD=c++20 compile-only diff --git a/Makefile b/Makefile index f359ab76749..85391d47013 100644 --- a/Makefile +++ b/Makefile @@ -727,6 +727,12 @@ top-all: $(TARGETS) $(EXTRA_TARGETS) @echo " Build successful." @echo "" +.PHONY: compile-only +compile-only: $(OBJS) + @echo "" + @echo " Compile successful." + @echo "" + ifeq ($(CONFIG),emcc) yosys.js: $(filter-out yosysjs-$(YOSYS_VER).zip,$(EXTRA_TARGETS)) endif From 4d8ce13aa4d4e347b552b9e365238e83c6a14b3c Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 30 Apr 2024 11:18:42 +1200 Subject: [PATCH 45/92] compile-only: Include genfiles and extra_targets --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 85391d47013..8f427579d92 100644 --- a/Makefile +++ b/Makefile @@ -728,7 +728,7 @@ top-all: $(TARGETS) $(EXTRA_TARGETS) @echo "" .PHONY: compile-only -compile-only: $(OBJS) +compile-only: $(OBJS) $(GENFILES) $(EXTRA_TARGETS) @echo "" @echo " Compile successful." @echo "" From ff730f486a80d73f6502cb6b39ec7c25571a90e1 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 30 Apr 2024 11:38:05 +1200 Subject: [PATCH 46/92] ci: Add autoconf to macos dependencies --- .github/actions/setup-build-env/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-build-env/action.yml b/.github/actions/setup-build-env/action.yml index d938d6b27ae..345b6db8ada 100644 --- a/.github/actions/setup-build-env/action.yml +++ b/.github/actions/setup-build-env/action.yml @@ -14,7 +14,7 @@ runs: if: runner.os == 'macOS' shell: bash run: | - brew install bison flex gawk libffi pkg-config bash + HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install bison flex gawk libffi pkg-config bash autoconf - name: Linux runtime environment if: runner.os == 'Linux' From 7905921bd0cdeafb714886aa13021e96b42ffff4 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 10 May 2024 10:00:33 +1200 Subject: [PATCH 47/92] Remove test-docs.yml in favour of test-build --- .github/workflows/test-docs.yml | 58 --------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 .github/workflows/test-docs.yml diff --git a/.github/workflows/test-docs.yml b/.github/workflows/test-docs.yml deleted file mode 100644 index 7b3906c52ca..00000000000 --- a/.github/workflows/test-docs.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Build and test doc code samples - -on: - pull_request: - branches: - - main - -jobs: - pre_job: - runs-on: ubuntu-latest - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@v5 - with: - # cancel previous builds if a new commit is pushed - cancel_others: 'true' - # only run on push *or* pull_request, not both - concurrent_skipping: 'same_content_newer' - - test-docs: - needs: pre_job - if: needs.pre_job.outputs.should_skip != 'true' - runs-on: ubuntu-latest - steps: - - name: Install Dependencies - shell: bash - run: | - sudo apt-get update - sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev - - - name: Setup GCC - uses: Dup4/actions-setup-gcc@v1 - - - name: Runtime environment - shell: bash - env: - WORKSPACE: ${{ github.workspace }} - run: | - echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV - echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH - echo "procs=$(nproc)" >> $GITHUB_ENV - - - name: Checkout Yosys - uses: actions/checkout@v4 - with: - submodules: true - - name: Build yosys - shell: bash - run: | - make config-gcc - make -j${{ env.procs }} - - - name: Run tests - shell: bash - run: | - make -C docs test -j${{ env.procs }} From c24a9063b6c5cb6591906ceed497b89b1f4ee36f Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 10 May 2024 10:15:03 +1200 Subject: [PATCH 48/92] Fix submodules --- .github/workflows/test-build.yml | 2 ++ .github/workflows/test-compile.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index c73aa995347..e13b96816ab 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -31,6 +31,8 @@ jobs: steps: - name: Checkout Yosys uses: actions/checkout@v4 + with: + submodules: true - name: Setup environment uses: ./.github/actions/setup-build-env diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index 6a9097ad33a..375ea7fc54a 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -46,6 +46,8 @@ jobs: steps: - name: Checkout Yosys uses: actions/checkout@v4 + with: + submodules: true - name: Setup environment uses: ./.github/actions/setup-build-env From 16579176936a475428c74a3e540eb70e43e485dd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 00:16:44 +0000 Subject: [PATCH 49/92] Bump version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 507d46f230d..106396d726d 100644 --- a/Makefile +++ b/Makefile @@ -142,7 +142,7 @@ LIBS += -lrt endif endif -YOSYS_VER := 0.41+8 +YOSYS_VER := 0.41+24 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo From d73771b0d96f414a48609a27a2a0162031df477b Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 10 May 2024 15:01:39 +0200 Subject: [PATCH 50/92] Make abc Makefile check for dependancies --- Makefile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 106396d726d..f5bc4072981 100644 --- a/Makefile +++ b/Makefile @@ -788,7 +788,6 @@ check-git-abc: echo "Initialize the submodule: Run 'git submodule update --init' to set up 'abc' as a submodule."; \ exit 1; \ elif git -C "$(YOSYS_SRC)" submodule status abc 2>/dev/null | grep -q '^ '; then \ - echo "'abc' is a git submodule. Continuing."; \ exit 0; \ elif [ -f "$(YOSYS_SRC)/abc/.gitcommit" ] && ! grep -q '\$$Format:%h\$$' "$(YOSYS_SRC)/abc/.gitcommit"; then \ echo "'abc' comes from a tarball. Continuing."; \ @@ -806,9 +805,7 @@ check-git-abc: exit 1; \ fi -ABC_SOURCES := $(wildcard $(YOSYS_SRC)/abc/*) - -abc/abc$(EXE) abc/libabc.a: $(ABC_SOURCES) check-git-abc +abc/abc$(EXE) abc/libabc.a: check-git-abc $(P) $(Q) mkdir -p abc && $(MAKE) -C $(PROGRAM_PREFIX)abc -f "$(realpath $(YOSYS_SRC)/abc/Makefile)" ABCSRC="$(realpath $(YOSYS_SRC)/abc/)" $(S) $(ABCMKARGS) $(if $(filter %.a,$@),PROG="abc",PROG="abc$(EXE)") MSG_PREFIX="$(eval P_OFFSET = 5)$(call P_SHOW)$(eval P_OFFSET = 10) ABC: " $(if $(filter %.a,$@),libabc.a) From a31620fda3283cb91d9157b61d699ac4044ba40c Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 10 May 2024 15:02:06 +0200 Subject: [PATCH 51/92] make yosys-abc build before yosys --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f5bc4072981..7e06deb13d7 100644 --- a/Makefile +++ b/Makefile @@ -495,7 +495,7 @@ LIBS += -lpthread endif else ifeq ($(ABCEXTERNAL),) -TARGETS += $(PROGRAM_PREFIX)yosys-abc$(EXE) +TARGETS := $(PROGRAM_PREFIX)yosys-abc$(EXE) $(TARGETS) endif endif endif From cef8bedf63edce900731d7ce296d34d3597efd93 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 10 May 2024 15:03:17 +0200 Subject: [PATCH 52/92] Remove emcc target from Makefile --- Makefile | 54 +----------------------------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/Makefile b/Makefile index 7e06deb13d7..e2354853f17 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,6 @@ CONFIG := none # CONFIG := clang # CONFIG := gcc # CONFIG := afl-gcc -# CONFIG := emcc # CONFIG := wasi # CONFIG := mxe # CONFIG := msys2-32 @@ -254,45 +253,6 @@ CXX = g++ CXXFLAGS += -std=gnu++11 -Os ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H" -else ifeq ($(CONFIG),emcc) -CXX = emcc -CXXFLAGS := -std=$(CXXSTD) $(filter-out -fPIC -ggdb,$(CXXFLAGS)) -ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H -DABC_MEMALIGN=8" -EMCC_CXXFLAGS := -Os -Wno-warn-absolute-paths -EMCC_LINKFLAGS := --embed-file share -EMCC_LINKFLAGS += -s NO_EXIT_RUNTIME=1 -EMCC_LINKFLAGS += -s EXPORTED_FUNCTIONS="['_main','_run','_prompt','_errmsg','_memset']" -EMCC_LINKFLAGS += -s TOTAL_MEMORY=134217728 -EMCC_LINKFLAGS += -s EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]' -# https://github.com/kripken/emscripten/blob/master/src/settings.js -CXXFLAGS += $(EMCC_CXXFLAGS) -LINKFLAGS += $(EMCC_LINKFLAGS) -LIBS = -EXE = .js - -DISABLE_SPAWN := 1 - -TARGETS := $(filter-out $(PROGRAM_PREFIX)yosys-config,$(TARGETS)) -EXTRA_TARGETS += yosysjs-$(YOSYS_VER).zip - -ifeq ($(ENABLE_ABC),1) -LINK_ABC := 1 -DISABLE_ABC_THREADS := 1 -endif - -viz.js: - wget -O viz.js.part https://github.com/mdaines/viz.js/releases/download/0.0.3/viz.js - mv viz.js.part viz.js - -yosysjs-$(YOSYS_VER).zip: yosys.js viz.js misc/yosysjs/* - rm -rf yosysjs-$(YOSYS_VER) yosysjs-$(YOSYS_VER).zip - mkdir -p yosysjs-$(YOSYS_VER) - cp viz.js misc/yosysjs/* yosys.js yosys.wasm yosysjs-$(YOSYS_VER)/ - zip -r yosysjs-$(YOSYS_VER).zip yosysjs-$(YOSYS_VER) - -yosys.html: misc/yosys.html - $(P) cp misc/yosys.html yosys.html - else ifeq ($(CONFIG),wasi) ifeq ($(WASI_SDK),) CXX = clang++ @@ -357,7 +317,7 @@ CXXFLAGS += -std=$(CXXSTD) -Os ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H $(ABC_ARCHFLAGS)" else -$(error Invalid CONFIG setting '$(CONFIG)'. Valid values: clang, gcc, emcc, mxe, msys2-32, msys2-64, none) +$(error Invalid CONFIG setting '$(CONFIG)'. Valid values: clang, gcc, mxe, msys2-32, msys2-64, none) endif ifeq ($(ENABLE_LIBYOSYS),1) @@ -727,10 +687,6 @@ top-all: $(TARGETS) $(EXTRA_TARGETS) @echo " Build successful." @echo "" -ifeq ($(CONFIG),emcc) -yosys.js: $(filter-out yosysjs-$(YOSYS_VER).zip,$(EXTRA_TARGETS)) -endif - $(PROGRAM_PREFIX)yosys$(EXE): $(OBJS) $(P) $(CXX) -o $(PROGRAM_PREFIX)yosys$(EXE) $(EXE_LINKFLAGS) $(LINKFLAGS) $(OBJS) $(LIBS) $(LIBS_VERIFIC) @@ -1082,14 +1038,6 @@ config-gcc-static: clean config-afl-gcc: clean echo 'CONFIG := afl-gcc' > Makefile.conf -config-emcc: clean - echo 'CONFIG := emcc' > Makefile.conf - echo 'ENABLE_TCL := 0' >> Makefile.conf - echo 'ENABLE_ABC := 0' >> Makefile.conf - echo 'ENABLE_PLUGINS := 0' >> Makefile.conf - echo 'ENABLE_READLINE := 0' >> Makefile.conf - echo 'ENABLE_ZLIB := 0' >> Makefile.conf - config-wasi: clean echo 'CONFIG := wasi' > Makefile.conf echo 'ENABLE_TCL := 0' >> Makefile.conf From 6dde8107c3214a917eb7f1c1683576fde4922840 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 10 May 2024 15:46:32 +0200 Subject: [PATCH 53/92] Remove checkout for specific iverilog git version --- .github/workflows/test-build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index e13b96816ab..5966ec3afdf 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -89,7 +89,6 @@ jobs: run: | git clone https://github.com/steveicarus/iverilog.git cd iverilog - git checkout 192b6aec96fde982e6ddcb28b346d5893aa8e874 echo "IVERILOG_GIT=$(git rev-parse HEAD)" >> $GITHUB_ENV - name: Cache iverilog From 9be7089f4f90365ff3105824f3867b84d6bca077 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Sat, 11 May 2024 10:40:28 +1200 Subject: [PATCH 54/92] Docs-css: Add invert-helper class for images Use svg color filter matrix from @jix to invert brightness for images when using dark theme. Co-authored-by: Jannis Harder --- docs/source/_static/yosyshq.css | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/source/_static/yosyshq.css b/docs/source/_static/yosyshq.css index 57ae8f87a5f..447c8536743 100644 --- a/docs/source/_static/yosyshq.css +++ b/docs/source/_static/yosyshq.css @@ -24,3 +24,17 @@ a.external { th { text-align: left; } + +body[data-theme="dark"] { + .invert-helper { + filter: url("data:image/svg+xml,#f"); + } +} + +@media (prefers-color-scheme: dark) { + body:not([data-theme="light"]) { + .invert-helper { + filter: url("data:image/svg+xml,#f"); + } + } +} \ No newline at end of file From 3a36612ec7bbf4e445e5dc80a902002f1bd0bfa4 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Sat, 11 May 2024 10:40:54 +1200 Subject: [PATCH 55/92] Docs: Apply invert-helper where needed --- docs/source/appendix/primer.rst | 8 ++-- docs/source/getting_started/example_synth.rst | 32 +++++++-------- .../getting_started/scripting_intro.rst | 6 +-- docs/source/introduction.rst | 2 +- .../interactive_investigation.rst | 24 +++++------ .../using_yosys/more_scripting/selections.rst | 26 ++++++------ .../using_yosys/synthesis/cell_libs.rst | 8 ++-- docs/source/using_yosys/synthesis/extract.rst | 40 +++++++++---------- docs/source/using_yosys/synthesis/memory.rst | 4 +- docs/source/using_yosys/synthesis/opt.rst | 8 ++-- docs/source/using_yosys/synthesis/proc.rst | 6 +-- .../extending_yosys/extensions.rst | 4 +- .../yosys_internals/flow/control_and_data.rst | 2 +- docs/source/yosys_internals/flow/overview.rst | 2 +- .../yosys_internals/flow/verilog_frontend.rst | 2 +- .../yosys_internals/formats/rtlil_rep.rst | 2 +- docs/source/yosys_internals/techmap.rst | 10 ++--- 17 files changed, 93 insertions(+), 93 deletions(-) diff --git a/docs/source/appendix/primer.rst b/docs/source/appendix/primer.rst index 101723e32cb..50656af780e 100644 --- a/docs/source/appendix/primer.rst +++ b/docs/source/appendix/primer.rst @@ -24,7 +24,7 @@ circuit to a functionally equivalent low-level representation of a circuit. abstraction and how they relate to different kinds of synthesis. .. figure:: /_images/primer/basics_abstractions.* - :class: width-helper + :class: width-helper invert-helper :name: fig:Basics_abstractions Different levels of abstraction and synthesis. @@ -499,7 +499,7 @@ using a series of tools and the results are again verified using simulation. This process is illustrated in :numref:`Fig. %s `. .. figure:: /_images/primer/basics_flow.* - :class: width-helper + :class: width-helper invert-helper :name: fig:Basics_flow Typical design flow. Green boxes represent manually created models. @@ -598,7 +598,7 @@ Let's consider the following BNF (in Bison syntax): expr: TOK_IDENTIFIER | TOK_NUMBER | expr TOK_PLUS expr; .. figure:: /_images/primer/basics_parsetree.* - :class: width-helper + :class: width-helper invert-helper :name: fig:Basics_parsetree Example parse tree for the Verilog expression @@ -627,7 +627,7 @@ suitable for further processing. In compilers this is often an assembler-like three-address-code intermediate representation. :cite:p:`Dragonbook` .. figure:: /_images/primer/basics_ast.* - :class: width-helper + :class: width-helper invert-helper :name: fig:Basics_ast Example abstract syntax tree for the Verilog expression diff --git a/docs/source/getting_started/example_synth.rst b/docs/source/getting_started/example_synth.rst index 916bef9fabd..ae0a9a36620 100644 --- a/docs/source/getting_started/example_synth.rst +++ b/docs/source/getting_started/example_synth.rst @@ -122,7 +122,7 @@ Since we're just getting started, let's instead begin with :yoscrypt:`hierarchy Our ``addr_gen`` circuit now looks like this: .. figure:: /_images/code_examples/fifo/addr_gen_hier.* - :class: width-helper + :class: width-helper invert-helper :name: addr_gen_hier ``addr_gen`` module after :cmd:ref:`hierarchy` @@ -145,7 +145,7 @@ we run it. For now, we will call :yoscrypt:`proc -noopt` to prevent some automatic optimizations which would normally happen. .. figure:: /_images/code_examples/fifo/addr_gen_proc.* - :class: width-helper + :class: width-helper invert-helper :name: addr_gen_proc ``addr_gen`` module after :yoscrypt:`proc -noopt` @@ -166,7 +166,7 @@ the same time by separating them with a colon and space: :yoscrypt:`opt_expr; clean`. .. figure:: /_images/code_examples/fifo/addr_gen_clean.* - :class: width-helper + :class: width-helper invert-helper :name: addr_gen_clean ``addr_gen`` module after :yoscrypt:`opt_expr; clean` @@ -252,7 +252,7 @@ command only works with a single module, so you may need to call it with :doc:`/getting_started/scripting_intro` has more on how to use :cmd:ref:`show`. .. figure:: /_images/code_examples/fifo/rdata_proc.* - :class: width-helper + :class: width-helper invert-helper :name: rdata_proc ``rdata`` output after :cmd:ref:`proc` @@ -298,7 +298,7 @@ optimizations between modules which would otherwise be missed. Let's run :caption: output of :yoscrypt:`flatten;;` .. figure:: /_images/code_examples/fifo/rdata_flat.* - :class: width-helper + :class: width-helper invert-helper :name: rdata_flat ``rdata`` output after :yoscrypt:`flatten;;` @@ -385,7 +385,7 @@ options is able to fold one of the ``$mux`` cells into the ``$adff`` to form an :caption: output of :cmd:ref:`opt_dff` .. figure:: /_images/code_examples/fifo/rdata_adffe.* - :class: width-helper + :class: width-helper invert-helper :name: rdata_adffe ``rdata`` output after :cmd:ref:`opt_dff` @@ -424,7 +424,7 @@ the schematic and see the output of that cell has now changed. .. todo:: pending bugfix in :cmd:ref:`wreduce` and/or :cmd:ref:`opt_clean` .. figure:: /_images/code_examples/fifo/rdata_wreduce.* - :class: width-helper + :class: width-helper invert-helper :name: rdata_wreduce ``rdata`` output after :cmd:ref:`wreduce` @@ -446,7 +446,7 @@ Our next command to run is :caption: output of :cmd:ref:`memory_dff` .. figure:: /_images/code_examples/fifo/rdata_memrdv2.* - :class: width-helper + :class: width-helper invert-helper :name: rdata_memrdv2 ``rdata`` output after :cmd:ref:`memory_dff` @@ -535,7 +535,7 @@ example design: :caption: output of :cmd:ref:`alumacc` .. figure:: /_images/code_examples/fifo/rdata_alumacc.* - :class: width-helper + :class: width-helper invert-helper :name: rdata_alumacc ``rdata`` output after :cmd:ref:`alumacc` @@ -553,7 +553,7 @@ operating on the same memory only in the abstract. :cmd:ref:`memory_collect` combines all of the reads and writes for a memory block into a single cell. .. figure:: /_images/code_examples/fifo/rdata_coarse.* - :class: width-helper + :class: width-helper invert-helper :name: rdata_coarse ``rdata`` output after :cmd:ref:`memory_collect` @@ -604,7 +604,7 @@ Mapping to hard memory blocks uses a combination of :cmd:ref:`memory_libmap` and :caption: ``map_ram`` section .. figure:: /_images/code_examples/fifo/rdata_map_ram.* - :class: width-helper + :class: width-helper invert-helper :name: rdata_map_ram ``rdata`` output after :ref:`map_ram` @@ -646,7 +646,7 @@ into flip flops (the ``logic fallback``) with :cmd:ref:`memory_map`. :caption: ``map_ffram`` section .. figure:: /_images/code_examples/fifo/rdata_map_ffram.* - :class: width-helper + :class: width-helper invert-helper :name: rdata_map_ffram ``rdata`` output after :ref:`map_ffram` @@ -682,7 +682,7 @@ replaced with single-bit ``$_MUX_`` and ``$_DFFE_PP0P_`` cells, while the :caption: ``map_gates`` section .. figure:: /_images/code_examples/fifo/rdata_map_gates.* - :class: width-helper + :class: width-helper invert-helper :name: rdata_map_gates ``rdata`` output after :ref:`map_gates` @@ -711,7 +711,7 @@ instead with an ``$_AND_`` cell. :caption: ``map_ffs`` section .. figure:: /_images/code_examples/fifo/rdata_map_ffs.* - :class: width-helper + :class: width-helper invert-helper :name: rdata_map_ffs ``rdata`` output after :ref:`map_ffs` @@ -737,7 +737,7 @@ what the difference between these two commands are, refer to :caption: ``map_luts`` section .. figure:: /_images/code_examples/fifo/rdata_map_luts.* - :class: width-helper + :class: width-helper invert-helper :name: rdata_map_luts ``rdata`` output after :ref:`map_luts` @@ -754,7 +754,7 @@ Finally we use :cmd:ref:`techmap` to map the generic ``$lut`` cells to iCE40 :caption: ``map_cells`` section .. figure:: /_images/code_examples/fifo/rdata_map_cells.* - :class: width-helper + :class: width-helper invert-helper :name: rdata_map_cells ``rdata`` output after :ref:`map_cells` diff --git a/docs/source/getting_started/scripting_intro.rst b/docs/source/getting_started/scripting_intro.rst index 63eca990125..bda76b74e9a 100644 --- a/docs/source/getting_started/scripting_intro.rst +++ b/docs/source/getting_started/scripting_intro.rst @@ -108,7 +108,7 @@ what the different symbols represent, see :ref:`interactive_show` and the :doc:`/using_yosys/more_scripting/interactive_investigation` page. .. figure:: /_images/code_examples/fifo/addr_gen_show.* - :class: width-helper + :class: width-helper invert-helper :name: addr_gen_show Calling :yoscrypt:`show addr_gen` after :cmd:ref:`hierarchy` @@ -158,7 +158,7 @@ selection` and called it ``new_cells``? We saw in the ``$eq``. We can call :cmd:ref:`show` on that selection just as easily: .. figure:: /_images/code_examples/fifo/new_cells_show.* - :class: width-helper + :class: width-helper invert-helper :name: new_cells_show Calling :yoscrypt:`show -notitle @new_cells` @@ -173,7 +173,7 @@ the two ``PROC`` blocks. To achieve this highlight, we make use of the :yoscrypt:`-color` option: .. figure:: /_images/code_examples/fifo/addr_gen_hier.* - :class: width-helper + :class: width-helper invert-helper Calling :yoscrypt:`show -color maroon3 @new_cells -color cornflowerblue p:* -notitle` diff --git a/docs/source/introduction.rst b/docs/source/introduction.rst index 936784d7411..1d9cd008044 100644 --- a/docs/source/introduction.rst +++ b/docs/source/introduction.rst @@ -151,7 +151,7 @@ extensible and therefore is a good basis for implementing custom synthesis tools for specialised tasks. .. figure:: /_images/primer/levels_of_abstraction.* - :class: width-helper + :class: width-helper invert-helper :name: fig:Levels_of_abstraction Where Yosys exists in the layers of abstraction diff --git a/docs/source/using_yosys/more_scripting/interactive_investigation.rst b/docs/source/using_yosys/more_scripting/interactive_investigation.rst index f56543bebbb..db34f041bb9 100644 --- a/docs/source/using_yosys/more_scripting/interactive_investigation.rst +++ b/docs/source/using_yosys/more_scripting/interactive_investigation.rst @@ -56,7 +56,7 @@ is shown. ``xdot example_first.dot`` etc. .. figure:: /_images/code_examples/show/example_first.* - :class: width-helper + :class: width-helper invert-helper Output of the first :cmd:ref:`show` command in :numref:`example_ys` @@ -88,7 +88,7 @@ The :cmd:ref:`proc` command transforms the process from the first diagram into a multiplexer and a d-type flip-flop, which brings us to the second diagram: .. figure:: /_images/code_examples/show/example_second.* - :class: width-helper + :class: width-helper invert-helper Output of the second :cmd:ref:`show` command in :numref:`example_ys` @@ -110,7 +110,7 @@ In this script we directly call :cmd:ref:`opt` as the next step, which finally leads us to the third diagram: .. figure:: /_images/code_examples/show/example_third.* - :class: width-helper + :class: width-helper invert-helper :name: example_out Output of the third :cmd:ref:`show` command in :ref:`example_ys` @@ -137,7 +137,7 @@ that operate on wide integers, it also introduces some additional complexity when the individual bits of of a signal vector are accessed. .. figure:: /_images/code_examples/show/splice.* - :class: width-helper + :class: width-helper invert-helper :name: splice_dia Output of ``yosys -p 'prep -top splice_demo; show' splice.v`` @@ -165,7 +165,7 @@ Gate level netlists mapped to a cell library: .. figure:: /_images/code_examples/show/cmos_00.* - :class: width-helper + :class: width-helper invert-helper :name: first_pitfall A half-adder built from simple CMOS gates, demonstrating common pitfalls when @@ -185,7 +185,7 @@ column. Secondly the two-bit vector ``y`` requires breakout-boxes for its individual bits, resulting in an unnecessary complex diagram. .. figure:: /_images/code_examples/show/cmos_01.* - :class: width-helper + :class: width-helper invert-helper :name: second_pitfall Effects of :cmd:ref:`splitnets` command and of providing a cell library on @@ -358,10 +358,10 @@ reorganizing a module in Yosys and checking the resulting circuit. :end-before: cd .. .. figure:: /_images/code_examples/scrambler/scrambler_p01.* - :class: width-helper + :class: width-helper invert-helper .. figure:: /_images/code_examples/scrambler/scrambler_p02.* - :class: width-helper + :class: width-helper invert-helper Analyzing the resulting circuit with :doc:`/cmd/eval`: @@ -442,7 +442,7 @@ if the circuit under investigation is encapsulated in a separate module. Recall the ``memdemo`` design from :ref:`advanced_logic_cones`: .. figure:: /_images/code_examples/selections/memdemo_00.* - :class: width-helper + :class: width-helper invert-helper ``memdemo`` @@ -463,18 +463,18 @@ name of the new cell in the current module. The resulting circuits are shown below. .. figure:: /_images/code_examples/selections/submod_02.* - :class: width-helper + :class: width-helper invert-helper ``outstage`` .. figure:: /_images/code_examples/selections/submod_03.* - :class: width-helper + :class: width-helper invert-helper :name: selstage ``selstage`` .. figure:: /_images/code_examples/selections/submod_01.* - :class: width-helper + :class: width-helper invert-helper ``scramble`` diff --git a/docs/source/using_yosys/more_scripting/selections.rst b/docs/source/using_yosys/more_scripting/selections.rst index 6aa3465cc99..b0028347499 100644 --- a/docs/source/using_yosys/more_scripting/selections.rst +++ b/docs/source/using_yosys/more_scripting/selections.rst @@ -160,7 +160,7 @@ Selecting ``a:sumstuff`` in this module will yield the following circuit diagram: .. figure:: /_images/code_examples/selections/sumprod_00.* - :class: width-helper + :class: width-helper invert-helper :name: sumprod_00 Output of ``show a:sumstuff`` on :numref:`sumprod` @@ -177,7 +177,7 @@ selected wire it selects all cells connected to the wire and vice versa. So :yoscrypt:`show a:sumstuff %x` yields the diagram shown in :numref:`sumprod_01`: .. figure:: /_images/code_examples/selections/sumprod_01.* - :class: width-helper + :class: width-helper invert-helper :name: sumprod_01 Output of ``show a:sumstuff %x`` on :numref:`sumprod` @@ -200,22 +200,22 @@ input ports. The following sequence of diagrams demonstrates this step-wise expansion: .. figure:: /_images/code_examples/selections/sumprod_02.* - :class: width-helper + :class: width-helper invert-helper Output of :yoscrypt:`show prod` on :numref:`sumprod` .. figure:: /_images/code_examples/selections/sumprod_03.* - :class: width-helper + :class: width-helper invert-helper Output of :yoscrypt:`show prod %ci` on :numref:`sumprod` .. figure:: /_images/code_examples/selections/sumprod_04.* - :class: width-helper + :class: width-helper invert-helper Output of :yoscrypt:`show prod %ci %ci` on :numref:`sumprod` .. figure:: /_images/code_examples/selections/sumprod_05.* - :class: width-helper + :class: width-helper invert-helper Output of :yoscrypt:`show prod %ci %ci %ci` on :numref:`sumprod` @@ -280,7 +280,7 @@ provided :file:`memdemo.v` is in the same directory. We can now change to the diagram in :numref:`memdemo_00`. .. figure:: /_images/code_examples/selections/memdemo_00.* - :class: width-helper + :class: width-helper invert-helper :name: memdemo_00 Complete circuit diagram for the design shown in :numref:`memdemo_src` @@ -291,7 +291,7 @@ output signal, ``y``, and its immediate predecessors. Remember `Selecting logic cones`_ from above, we can use :yoscrypt:`show y %ci2`: .. figure:: /_images/code_examples/selections/memdemo_01.* - :class: width-helper + :class: width-helper invert-helper :name: memdemo_01 Output of :yoscrypt:`show y %ci2` @@ -303,7 +303,7 @@ wire into the input ``D`` of the flip-flop cell (indicated by the ``$`` at the start of the name). Let's go a bit further now and try :yoscrypt:`show y %ci5`: .. figure:: /_images/code_examples/selections/memdemo_02.* - :class: width-helper + :class: width-helper invert-helper :name: memdemo_02 Output of :yoscrypt:`show y %ci5` @@ -317,7 +317,7 @@ brackets. In this case, we want to exclude the ``S`` port of the ``$mux`` cell type with :yoscrypt:`show y %ci5:-$mux[S]`: .. figure:: /_images/code_examples/selections/memdemo_03.* - :class: width-helper + :class: width-helper invert-helper :name: memdemo_03 Output of :yoscrypt:`show y %ci5:-$mux[S]` @@ -328,7 +328,7 @@ flip-flop and the 2nd action selects the entire input cone without going over multiplexer select inputs and flip-flop cells: .. figure:: /_images/code_examples/selections/memdemo_05.* - :class: width-helper + :class: width-helper invert-helper :name: memdemo_05 Output of ``show y %ci2:+$dff[Q,D] %ci*:-$mux[S]:-$dff`` @@ -340,7 +340,7 @@ ignoring any ports named ``CLK`` or ``S``: .. TODO:: pending discussion on whether rule ordering is a bug or a feature .. figure:: /_images/code_examples/selections/memdemo_04.* - :class: width-helper + :class: width-helper invert-helper :name: memdemo_04 Output of :yoscrypt:`show y %ci*:-[CLK,S]:+$dff,$mux` @@ -417,6 +417,6 @@ Example code from |code_examples/selections|_: :name: select_ys .. figure:: /_images/code_examples/selections/select.* - :class: width-helper + :class: width-helper invert-helper Circuit diagram produced by :numref:`select_ys` diff --git a/docs/source/using_yosys/synthesis/cell_libs.rst b/docs/source/using_yosys/synthesis/cell_libs.rst index 476269abfc9..92b6dab3f58 100644 --- a/docs/source/using_yosys/synthesis/cell_libs.rst +++ b/docs/source/using_yosys/synthesis/cell_libs.rst @@ -51,7 +51,7 @@ Loading the design Our circuit now looks like this: .. figure:: /_images/code_examples/intro/counter_00.* - :class: width-helper + :class: width-helper invert-helper :name: counter-hierarchy ``counter`` after :cmd:ref:`hierarchy` @@ -66,7 +66,7 @@ Coarse-grain representation :caption: :file:`counter.ys` - the high-level stuff .. figure:: /_images/code_examples/intro/counter_01.* - :class: width-helper + :class: width-helper invert-helper Coarse-grain representation of the ``counter`` module @@ -80,7 +80,7 @@ Logic gate mapping :caption: :file:`counter.ys` - mapping to internal cell library .. figure:: /_images/code_examples/intro/counter_02.* - :class: width-helper + :class: width-helper invert-helper ``counter`` after :cmd:ref:`techmap` @@ -111,7 +111,7 @@ Recall that the Yosys built-in logic gate types are ``$_NOT_``, ``$_AND_``, The final version of our ``counter`` module looks like this: .. figure:: /_images/code_examples/intro/counter_03.* - :class: width-helper + :class: width-helper invert-helper ``counter`` after hardware cell mapping diff --git a/docs/source/using_yosys/synthesis/extract.rst b/docs/source/using_yosys/synthesis/extract.rst index bbe1870dfb3..c9b76840e3b 100644 --- a/docs/source/using_yosys/synthesis/extract.rst +++ b/docs/source/using_yosys/synthesis/extract.rst @@ -23,7 +23,7 @@ Example code can be found in |code_examples/macc|_. :lines: 1-2 .. figure:: /_images/code_examples/macc/macc_simple_test_00a.* - :class: width-helper + :class: width-helper invert-helper before :cmd:ref:`extract` @@ -32,7 +32,7 @@ Example code can be found in |code_examples/macc|_. :lines: 6 .. figure:: /_images/code_examples/macc/macc_simple_test_00b.* - :class: width-helper + :class: width-helper invert-helper after :cmd:ref:`extract` @@ -49,20 +49,20 @@ Example code can be found in |code_examples/macc|_. :caption: :file:`macc_simple_test_01.v` .. figure:: /_images/code_examples/macc/macc_simple_test_01a.* - :class: width-helper + :class: width-helper invert-helper .. figure:: /_images/code_examples/macc/macc_simple_test_01b.* - :class: width-helper + :class: width-helper invert-helper .. literalinclude:: /code_examples/macc/macc_simple_test_02.v :language: verilog :caption: :file:`macc_simple_test_02.v` .. figure:: /_images/code_examples/macc/macc_simple_test_02a.* - :class: width-helper + :class: width-helper invert-helper .. figure:: /_images/code_examples/macc/macc_simple_test_02b.* - :class: width-helper + :class: width-helper invert-helper The wrap-extract-unwrap method ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -149,10 +149,10 @@ Unwrapping adders: :file:`macc_xilinx_unwrap_map.v` :caption: ``test1`` of :file:`macc_xilinx_test.v` .. figure:: /_images/code_examples/macc/macc_xilinx_test1a.* - :class: width-helper + :class: width-helper invert-helper .. figure:: /_images/code_examples/macc/macc_xilinx_test1b.* - :class: width-helper + :class: width-helper invert-helper .. literalinclude:: /code_examples/macc/macc_xilinx_test.v :language: verilog @@ -160,15 +160,15 @@ Unwrapping adders: :file:`macc_xilinx_unwrap_map.v` :caption: ``test2`` of :file:`macc_xilinx_test.v` .. figure:: /_images/code_examples/macc/macc_xilinx_test2a.* - :class: width-helper + :class: width-helper invert-helper .. figure:: /_images/code_examples/macc/macc_xilinx_test2b.* - :class: width-helper + :class: width-helper invert-helper Wrapping in ``test1``: .. figure:: /_images/code_examples/macc/macc_xilinx_test1b.* - :class: width-helper + :class: width-helper invert-helper .. literalinclude:: /code_examples/macc/macc_xilinx_test.ys :language: yoscrypt @@ -176,12 +176,12 @@ Wrapping in ``test1``: :end-before: end part c .. figure:: /_images/code_examples/macc/macc_xilinx_test1c.* - :class: width-helper + :class: width-helper invert-helper Wrapping in ``test2``: .. figure:: /_images/code_examples/macc/macc_xilinx_test2b.* - :class: width-helper + :class: width-helper invert-helper .. literalinclude:: /code_examples/macc/macc_xilinx_test.ys :language: yoscrypt @@ -189,12 +189,12 @@ Wrapping in ``test2``: :end-before: end part c .. figure:: /_images/code_examples/macc/macc_xilinx_test2c.* - :class: width-helper + :class: width-helper invert-helper Extract in ``test1``: .. figure:: /_images/code_examples/macc/macc_xilinx_test1c.* - :class: width-helper + :class: width-helper invert-helper .. literalinclude:: /code_examples/macc/macc_xilinx_test.ys :language: yoscrypt @@ -202,12 +202,12 @@ Extract in ``test1``: :end-before: end part d .. figure:: /_images/code_examples/macc/macc_xilinx_test1d.* - :class: width-helper + :class: width-helper invert-helper Extract in ``test2``: .. figure:: /_images/code_examples/macc/macc_xilinx_test2c.* - :class: width-helper + :class: width-helper invert-helper .. literalinclude:: /code_examples/macc/macc_xilinx_test.ys :language: yoscrypt @@ -215,12 +215,12 @@ Extract in ``test2``: :end-before: end part d .. figure:: /_images/code_examples/macc/macc_xilinx_test2d.* - :class: width-helper + :class: width-helper invert-helper Unwrap in ``test2``: .. figure:: /_images/code_examples/macc/macc_xilinx_test2d.* - :class: width-helper + :class: width-helper invert-helper .. literalinclude:: /code_examples/macc/macc_xilinx_test.ys :language: yoscrypt @@ -228,4 +228,4 @@ Unwrap in ``test2``: :end-before: end part e .. figure:: /_images/code_examples/macc/macc_xilinx_test2e.* - :class: width-helper \ No newline at end of file + :class: width-helper invert-helper \ No newline at end of file diff --git a/docs/source/using_yosys/synthesis/memory.rst b/docs/source/using_yosys/synthesis/memory.rst index 3dbafeaab7e..0f5e1bd3010 100644 --- a/docs/source/using_yosys/synthesis/memory.rst +++ b/docs/source/using_yosys/synthesis/memory.rst @@ -39,7 +39,7 @@ Example .. _code_examples/synth_flow: https://github.com/YosysHQ/yosys/tree/main/docs/source/code_examples/synth_flow .. figure:: /_images/code_examples/synth_flow/memory_01.* - :class: width-helper + :class: width-helper invert-helper .. literalinclude:: /code_examples/synth_flow/memory_01.ys :language: yoscrypt @@ -50,7 +50,7 @@ Example :caption: :file:`memory_01.v` .. figure:: /_images/code_examples/synth_flow/memory_02.* - :class: width-helper + :class: width-helper invert-helper .. literalinclude:: /code_examples/synth_flow/memory_02.v :language: verilog diff --git a/docs/source/using_yosys/synthesis/opt.rst b/docs/source/using_yosys/synthesis/opt.rst index 7861f66d4cd..2a06aadd118 100644 --- a/docs/source/using_yosys/synthesis/opt.rst +++ b/docs/source/using_yosys/synthesis/opt.rst @@ -88,7 +88,7 @@ trees can interfere with other optimizations. :caption: example verilog for demonstrating :cmd:ref:`opt_expr` .. figure:: /_images/code_examples/opt/opt_expr.* - :class: width-helper + :class: width-helper invert-helper Before and after :cmd:ref:`opt_expr` @@ -111,7 +111,7 @@ possible optimizations. :caption: example verilog for demonstrating :cmd:ref:`opt_merge` .. figure:: /_images/code_examples/opt/opt_merge.* - :class: width-helper + :class: width-helper invert-helper Before and after :cmd:ref:`opt_merge` @@ -133,7 +133,7 @@ detects this contradiction and replaces the inner multiplexer with a constant 1, yielding the logic for ``y = a ? b : d``. .. figure:: /_images/code_examples/opt/opt_muxtree.* - :class: width-helper + :class: width-helper invert-helper Before and after :cmd:ref:`opt_muxtree` @@ -172,7 +172,7 @@ multiplexing its output to multiplexing the non-shared input signals. :caption: example verilog for demonstrating :cmd:ref:`opt_share` .. figure:: /_images/code_examples/opt/opt_share.* - :class: width-helper + :class: width-helper invert-helper Before and after :cmd:ref:`opt_share` diff --git a/docs/source/using_yosys/synthesis/proc.rst b/docs/source/using_yosys/synthesis/proc.rst index b4983438021..d90aa087dc7 100644 --- a/docs/source/using_yosys/synthesis/proc.rst +++ b/docs/source/using_yosys/synthesis/proc.rst @@ -42,10 +42,10 @@ Example :caption: :file:`proc_01.ys` .. figure:: /_images/code_examples/synth_flow/proc_01.* - :class: width-helper + :class: width-helper invert-helper .. figure:: /_images/code_examples/synth_flow/proc_02.* - :class: width-helper + :class: width-helper invert-helper .. literalinclude:: /code_examples/synth_flow/proc_02.v :language: verilog @@ -56,7 +56,7 @@ Example :caption: :file:`proc_02.ys` .. figure:: /_images/code_examples/synth_flow/proc_03.* - :class: width-helper + :class: width-helper invert-helper .. literalinclude:: /code_examples/synth_flow/proc_03.ys :language: yoscrypt diff --git a/docs/source/yosys_internals/extending_yosys/extensions.rst b/docs/source/yosys_internals/extending_yosys/extensions.rst index 68e1740be4a..f10c634b015 100644 --- a/docs/source/yosys_internals/extending_yosys/extensions.rst +++ b/docs/source/yosys_internals/extending_yosys/extensions.rst @@ -38,7 +38,7 @@ This document will focus on the much simpler version of RTLIL left after the commands :cmd:ref:`proc` and :cmd:ref:`memory` (or :yoscrypt:`memory -nomap`): .. figure:: /_images/internals/simplified_rtlil.* - :class: width-helper + :class: width-helper invert-helper :name: fig:Simplified_RTLIL Simplified RTLIL entity-relationship diagram without memories and processes @@ -140,7 +140,7 @@ We'll do the same as before and format it as a a ``Yosys::Pass``. And if we look at the schematic for this new module we see the following: .. figure:: /_images/code_examples/extensions/test1.* - :class: width-helper + :class: width-helper invert-helper Output of ``yosys -m ./my_cmd.so -p 'test1; show'`` diff --git a/docs/source/yosys_internals/flow/control_and_data.rst b/docs/source/yosys_internals/flow/control_and_data.rst index 5dcbe073025..70a84747f9e 100644 --- a/docs/source/yosys_internals/flow/control_and_data.rst +++ b/docs/source/yosys_internals/flow/control_and_data.rst @@ -10,7 +10,7 @@ and generating the data for the next subsystem (see :numref:`Fig. %s `). .. figure:: /_images/internals/approach_flow.* - :class: width-helper + :class: width-helper invert-helper :name: fig:approach_flow General data- and control-flow of a synthesis tool diff --git a/docs/source/yosys_internals/flow/overview.rst b/docs/source/yosys_internals/flow/overview.rst index f7589df031f..b357e5b50ea 100644 --- a/docs/source/yosys_internals/flow/overview.rst +++ b/docs/source/yosys_internals/flow/overview.rst @@ -42,7 +42,7 @@ possible it is key that (1) all passes operate on the same data structure design in different stages of the synthesis. .. figure:: /_images/internals/overview_flow.* - :class: width-helper + :class: width-helper invert-helper :name: fig:Overview_flow Yosys simplified data flow (ellipses: data structures, rectangles: diff --git a/docs/source/yosys_internals/flow/verilog_frontend.rst b/docs/source/yosys_internals/flow/verilog_frontend.rst index 127fa7be388..f2eaeae97b3 100644 --- a/docs/source/yosys_internals/flow/verilog_frontend.rst +++ b/docs/source/yosys_internals/flow/verilog_frontend.rst @@ -10,7 +10,7 @@ is then passed to the AST frontend that converts it to RTLIL data, as illustrated in :numref:`Fig. %s `. .. figure:: /_images/internals/verilog_flow.* - :class: width-helper + :class: width-helper invert-helper :name: fig:Verilog_flow Simplified Verilog to RTLIL data flow diff --git a/docs/source/yosys_internals/formats/rtlil_rep.rst b/docs/source/yosys_internals/formats/rtlil_rep.rst index 5de3430f228..2737cd4bd46 100644 --- a/docs/source/yosys_internals/formats/rtlil_rep.rst +++ b/docs/source/yosys_internals/formats/rtlil_rep.rst @@ -24,7 +24,7 @@ create an additional ``RTLIL::Design`` object and call the Verilog frontend with this other object to parse the cell library. .. figure:: /_images/internals/overview_rtlil.* - :class: width-helper + :class: width-helper invert-helper :name: fig:Overview_RTLIL Simplified RTLIL Entity-Relationship Diagram diff --git a/docs/source/yosys_internals/techmap.rst b/docs/source/yosys_internals/techmap.rst index ab161ed92d3..00fce26bd4f 100644 --- a/docs/source/yosys_internals/techmap.rst +++ b/docs/source/yosys_internals/techmap.rst @@ -34,7 +34,7 @@ Mapping OR3X1 :caption: :file:`red_or3x1_map.v` .. figure:: /_images/code_examples/techmap/red_or3x1.* - :class: width-helper + :class: width-helper invert-helper .. literalinclude:: /code_examples/techmap/red_or3x1_test.ys :language: yoscrypt @@ -61,7 +61,7 @@ Conditional techmap Example: .. figure:: /_images/code_examples/techmap/sym_mul.* - :class: width-helper + :class: width-helper invert-helper .. literalinclude:: /code_examples/techmap/sym_mul_map.v :language: verilog @@ -100,7 +100,7 @@ Scripting in map modules Example: .. figure:: /_images/code_examples/techmap/mymul.* - :class: width-helper + :class: width-helper invert-helper .. literalinclude:: /code_examples/techmap/mymul_map.v :language: verilog @@ -130,7 +130,7 @@ Handling constant inputs Example: .. figure:: /_images/code_examples/techmap/mulshift.* - :class: width-helper + :class: width-helper invert-helper .. literalinclude:: /code_examples/techmap/mulshift_map.v :language: verilog @@ -162,7 +162,7 @@ Handling shorted inputs Example: .. figure:: /_images/code_examples/techmap/addshift.* - :class: width-helper + :class: width-helper invert-helper .. literalinclude:: /code_examples/techmap/addshift_map.v :language: verilog From a8bad3060ca362c07e37734aac55d58fa5e64c9d Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Sat, 11 May 2024 10:51:08 +1200 Subject: [PATCH 56/92] test-build.yml: test-docs should not ignore docs changes --- .github/workflows/test-build.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 5966ec3afdf..1cc068c1e5d 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -16,12 +16,23 @@ jobs: cancel_others: 'true' # only run on push *or* pull_request, not both concurrent_skipping: 'same_content_newer' + pre_docs_job: + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v5 + with: + paths_ignore: '["**/README.md"]' + # cancel previous builds if a new commit is pushed + cancel_others: 'true' + # only run on push *or* pull_request, not both + concurrent_skipping: 'same_content_newer' build-yosys: name: Reusable build runs-on: ${{ matrix.os }} - needs: pre_job - if: needs.pre_job.outputs.should_skip != 'true' env: CC: clang strategy: @@ -137,8 +148,8 @@ jobs: test-docs: name: Run docs tests runs-on: ${{ matrix.os }} - needs: [build-yosys, pre_job] - if: needs.pre_job.outputs.should_skip != 'true' + needs: [build-yosys, pre_docs_job] + if: needs.pre_docs_job.outputs.should_skip != 'true' env: CC: clang strategy: From 95bd7c9b0803f072f2e1b4780b8b7fdbce5042ea Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Sat, 11 May 2024 11:00:58 +1200 Subject: [PATCH 57/92] test-build.yml Use pre_docs_job for build-yosys pre_job will never skip something that is not skipped by pre_docs_job, so we can gate the build step by pre_docs_job to skip it when the two later jobs are both being skipped. --- .github/workflows/test-build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 1cc068c1e5d..20a00639533 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -33,6 +33,8 @@ jobs: build-yosys: name: Reusable build runs-on: ${{ matrix.os }} + needs: pre_docs_job + if: needs.pre_docs_job.outputs.should_skip != 'true' env: CC: clang strategy: From 26b148f455fab2c820402c5f011fb2dab7587091 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Sat, 11 May 2024 11:28:16 +1200 Subject: [PATCH 58/92] test-build.yml: Remove duplicated yosys-config --- .github/workflows/test-build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 20a00639533..bf95688a15c 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -62,10 +62,6 @@ jobs: run: | ./yosys-config || true - - name: Log yosys-config output - run: | - ./yosys-config || true - - name: Compress build shell: bash run: | From 07ac4c2faecb9e72b53988f4a3b87642dfaa0465 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 11 May 2024 00:16:25 +0000 Subject: [PATCH 59/92] Bump version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 120214ced04..b6e0e91e4dd 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ LIBS += -lrt endif endif -YOSYS_VER := 0.41+24 +YOSYS_VER := 0.41+69 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo From 1f9f2518fc51246a1e91975f927b50d171b2c801 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Sat, 11 May 2024 00:42:53 +0200 Subject: [PATCH 60/92] nix: fix abc --- flake.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index d97be4ef671..26c21cc8996 100644 --- a/flake.nix +++ b/flake.nix @@ -12,19 +12,23 @@ pkgs = import nixpkgs { inherit system; }; + # TODO: don't override src when ./abc is empty + # which happens when the command used is `nix build` and not `nix build ?submodules=1` + abc-verifier = pkgs.abc-verifier.overrideAttrs(x: y: {src = ./abc;}); customYosys = pkgs.clangStdenv.mkDerivation { name = "yosys"; src = ./. ; buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git pkg-configUpstream ]; checkInputs = with pkgs; [ gtest ]; - propagatedBuildInputs = with pkgs; [ abc-verifier ]; + propagatedBuildInputs = [ abc-verifier ]; preConfigure = "make config-clang"; checkTarget = "test"; installPhase = '' - make install PREFIX=$out + make install PREFIX=$out ABCEXTERNAL=yosys-abc + ln -s ${abc-verifier}/bin/abc $out/bin/yosys-abc ''; buildPhase = '' - make -j$(nproc) + make -j$(nproc) ABCEXTERNAL=yosys-abc ''; meta = with pkgs.lib; { description = "Yosys Open SYnthesis Suite"; From c40d43e3a9f7ac5ca01c26f0471245d69e6028ce Mon Sep 17 00:00:00 2001 From: Roland Coeurjoly Date: Mon, 13 May 2024 13:45:06 +0200 Subject: [PATCH 61/92] Ignore result dir, generated by nix --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 6f3e521d62e..e82343e8947 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,4 @@ __pycache__ /tests/unit/bintest/ /tests/unit/objtest/ /tests/ystests +/result \ No newline at end of file From 8c8fb1399cb45058803a72bdf8e7219b9e3891fb Mon Sep 17 00:00:00 2001 From: Roland Coeurjoly Date: Mon, 13 May 2024 13:53:53 +0200 Subject: [PATCH 62/92] Update github action --- .github/workflows/nix-github-actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nix-github-actions.yml b/.github/workflows/nix-github-actions.yml index a11584bc641..256f2043eae 100644 --- a/.github/workflows/nix-github-actions.yml +++ b/.github/workflows/nix-github-actions.yml @@ -9,5 +9,5 @@ jobs: - uses: actions/checkout@v4 with: submodules: true - - uses: cachix/install-nix-action@v25 + - uses: cachix/install-nix-action@v26 - run: nix build '.?submodules=1' From dd6178c74b5b7928f43037808ae60c6fce7e09fe Mon Sep 17 00:00:00 2001 From: Roland Coeurjoly Date: Mon, 13 May 2024 14:21:35 +0200 Subject: [PATCH 63/92] Fix nix version to 2.18.1, known working version --- .github/workflows/nix-github-actions.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nix-github-actions.yml b/.github/workflows/nix-github-actions.yml index 256f2043eae..6d5c5b4b2dd 100644 --- a/.github/workflows/nix-github-actions.yml +++ b/.github/workflows/nix-github-actions.yml @@ -10,4 +10,6 @@ jobs: with: submodules: true - uses: cachix/install-nix-action@v26 - - run: nix build '.?submodules=1' + with: + install_url: https://releases.nixos.org/nix/nix-2.18.1/install + - run: nix build .?submodules=1 From 9884bb57a10dd32e9ed73ecae91266c394567c1f Mon Sep 17 00:00:00 2001 From: Roland Coeurjoly Date: Mon, 13 May 2024 14:28:32 +0200 Subject: [PATCH 64/92] Add update flake lock github action --- .github/workflows/update-flake-lock.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/update-flake-lock.yml diff --git a/.github/workflows/update-flake-lock.yml b/.github/workflows/update-flake-lock.yml new file mode 100644 index 00000000000..1d4741c8c22 --- /dev/null +++ b/.github/workflows/update-flake-lock.yml @@ -0,0 +1,21 @@ +name: update-flake-lock +on: + workflow_dispatch: # allows manual triggering + schedule: + - cron: '0 0 * * 0' # runs weekly on Sunday at 00:00 + +jobs: + lockfile: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + - name: Update flake.lock + uses: DeterminateSystems/update-flake-lock@main + with: + pr-title: "Update flake.lock" # Title of PR to be created + pr-labels: | # Labels to be set on the PR + dependencies + automated \ No newline at end of file From fa19abad98c7d57dc958141ff2997eca41fd5746 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 13 May 2024 16:44:42 +0200 Subject: [PATCH 65/92] Fix rst syntax error --- docs/source/yosys_internals/formats/cell_library.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/yosys_internals/formats/cell_library.rst b/docs/source/yosys_internals/formats/cell_library.rst index 69e82774c1f..70c36e6e747 100644 --- a/docs/source/yosys_internals/formats/cell_library.rst +++ b/docs/source/yosys_internals/formats/cell_library.rst @@ -688,6 +688,7 @@ Let ``\WIDTH`` be 3. We would like to represent ``\Y =~\A[0] + \A[1]~\A[2]``. There are 2 products to be summed, so ``\DEPTH`` shall be 2. .. code-block:: + ~A[2]-----┐ A[2]----┐| ~A[1]---┐|| From 229300bb4a244fccb110d467045d830af83aec86 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Mon, 13 May 2024 17:37:24 +0200 Subject: [PATCH 66/92] replace unicode chars in rst to make pdf work --- .../yosys_internals/formats/cell_library.rst | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/source/yosys_internals/formats/cell_library.rst b/docs/source/yosys_internals/formats/cell_library.rst index 70c36e6e747..7a19255a3d0 100644 --- a/docs/source/yosys_internals/formats/cell_library.rst +++ b/docs/source/yosys_internals/formats/cell_library.rst @@ -689,14 +689,15 @@ There are 2 products to be summed, so ``\DEPTH`` shall be 2. .. code-block:: - ~A[2]-----┐ - A[2]----┐| - ~A[1]---┐|| - A[1]--┐||| - ~A[0]-┐|||| - A[0]┐||||| product formula - 010000 ~\A[0] - 001001 \A[1]~\A[2] + ~A[2]-----+ + A[2]----+| + ~A[1]---+|| + A[1]--+||| + ~A[0]-+|||| + A[0]+||||| + |||||| product formula + 010000 ~\A[0] + 001001 \A[1]~\A[2] So the value of ``\TABLE`` will become ``010000001001``. From 7045cf509e1d95cbc973746674cf2d7c73c02e50 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 14 May 2024 00:16:31 +0000 Subject: [PATCH 67/92] Bump version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b6e0e91e4dd..9e3fd1a20ff 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ LIBS += -lrt endif endif -YOSYS_VER := 0.41+69 +YOSYS_VER := 0.41+83 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo From 13a6920491a01b492e35c8981a856b14ca83f3e7 Mon Sep 17 00:00:00 2001 From: Roland Coeurjoly Date: Tue, 21 May 2024 12:50:23 +0200 Subject: [PATCH 68/92] Change customYosys to yosys --- flake.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 26c21cc8996..1e202324647 100644 --- a/flake.nix +++ b/flake.nix @@ -15,7 +15,7 @@ # TODO: don't override src when ./abc is empty # which happens when the command used is `nix build` and not `nix build ?submodules=1` abc-verifier = pkgs.abc-verifier.overrideAttrs(x: y: {src = ./abc;}); - customYosys = pkgs.clangStdenv.mkDerivation { + yosys = pkgs.clangStdenv.mkDerivation { name = "yosys"; src = ./. ; buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git pkg-configUpstream ]; @@ -38,8 +38,8 @@ }; }; in { - packages.default = customYosys; - defaultPackage = customYosys; + packages.default = yosys; + defaultPackage = yosys; devShell = pkgs.mkShell { buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git gtest abc-verifier ]; }; From 88af059fad92631537c94b319ed2123224798351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Tue, 21 May 2024 14:56:15 +0200 Subject: [PATCH 69/92] bbox_derive: Fix `done` base type confusion --- passes/cmds/bbox_derive.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/passes/cmds/bbox_derive.cc b/passes/cmds/bbox_derive.cc index a35e9629058..e4fcb79637b 100644 --- a/passes/cmds/bbox_derive.cc +++ b/passes/cmds/bbox_derive.cc @@ -54,7 +54,7 @@ struct BboxDerivePass : Pass { log_cmd_error("Base module %s not found.\n", log_id(base_name)); } - dict, Module*> done; + dict>, Module*> done; for (auto module : d->selected_modules()) { for (auto cell : module->selected_cells()) { @@ -62,13 +62,15 @@ struct BboxDerivePass : Pass { if (!inst_module || !inst_module->get_blackbox_attribute()) continue; - if (cell->parameters.empty() || done.count(cell->parameters)) - continue; - Module *base = inst_module; if (base_override) base = base_override; + auto index = std::make_pair(base->name, cell->parameters); + + if (cell->parameters.empty() || done.count(index)) + continue; + IdString derived_type = base->derive(d, cell->parameters); Module *derived = d->module(derived_type); log_assert(derived && "Failed to derive module\n"); @@ -83,7 +85,7 @@ struct BboxDerivePass : Pass { d->rename(derived, new_name); } - done[cell->parameters] = derived; + done[index] = derived; } } } From 5c929a91c26920b50d4887e0058c895d1a91b280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Tue, 21 May 2024 14:57:37 +0200 Subject: [PATCH 70/92] bbox_derive: Write help --- passes/cmds/bbox_derive.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/passes/cmds/bbox_derive.cc b/passes/cmds/bbox_derive.cc index e4fcb79637b..90ce2ac4908 100644 --- a/passes/cmds/bbox_derive.cc +++ b/passes/cmds/bbox_derive.cc @@ -29,6 +29,28 @@ struct BboxDerivePass : Pass { log("\n"); log(" bbox_derive [-base ] [-naming_attr ] [selection]\n"); log("\n"); + log("As part of the assembly of the design hierarchy done by the 'hierarchy' command,\n"); + log("specializations of parametric modules are derived on demand: for each choice of\n"); + log("parameter values appearing in the design, a copy of the parametric module is\n"); + log("derived which is specialized to that choice.\n"); + log("\n"); + log("This derivation process ignores blackboxes and whiteboxes. To supplement, this\n"); + log("'bbox_derive' command can be used to request the derivation of modules based on\n"); + log("blackbox or whitebox instances appearing in the design, which is desirable in\n"); + log("certain use cases. Only the selected cells are considered as the instances that\n"); + log("steer the derivation process.\n"); + log("\n"); + log(" -base \n"); + log(" instead of deriving the module that directly corresponds to each blackbox\n"); + log(" instance, derive a specialization of (this option applies\n"); + log(" to all selected blackbox cells)\n"); + log("\n"); + log(" -naming_attr \n"); + log(" once a specialization is derived, use the value of the module attribute\n"); + log(" for a name which should be used for the derived module (this\n"); + log(" replaces the internal Yosys naming scheme in which the names of derived\n"); + log(" modules start with '$paramod$')\n"); + log("\n"); } void execute(std::vector args, RTLIL::Design *d) override { From 557db4ea46517658431f4674de41b887413307eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Tue, 21 May 2024 14:57:49 +0200 Subject: [PATCH 71/92] bbox_drive: Add an incomplete test --- tests/various/bbox_derive.ys | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/various/bbox_derive.ys diff --git a/tests/various/bbox_derive.ys b/tests/various/bbox_derive.ys new file mode 100644 index 00000000000..26312fb53cf --- /dev/null +++ b/tests/various/bbox_derive.ys @@ -0,0 +1,37 @@ +read_verilog < Date: Tue, 21 May 2024 16:14:34 +0200 Subject: [PATCH 72/92] Rename `bbox_derive` to `box_derive` --- passes/cmds/Makefile.inc | 2 +- passes/cmds/{bbox_derive.cc => box_derive.cc} | 24 +++++++++---------- .../various/{bbox_derive.ys => box_derive.ys} | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) rename passes/cmds/{bbox_derive.cc => box_derive.cc} (84%) rename tests/various/{bbox_derive.ys => box_derive.ys} (94%) diff --git a/passes/cmds/Makefile.inc b/passes/cmds/Makefile.inc index b1c9c67f0d0..33e3ae1bc5a 100644 --- a/passes/cmds/Makefile.inc +++ b/passes/cmds/Makefile.inc @@ -48,4 +48,4 @@ OBJS += passes/cmds/clean_zerowidth.o OBJS += passes/cmds/xprop.o OBJS += passes/cmds/dft_tag.o OBJS += passes/cmds/future.o -OBJS += passes/cmds/bbox_derive.o +OBJS += passes/cmds/box_derive.o diff --git a/passes/cmds/bbox_derive.cc b/passes/cmds/box_derive.cc similarity index 84% rename from passes/cmds/bbox_derive.cc rename to passes/cmds/box_derive.cc index 90ce2ac4908..da698b04d37 100644 --- a/passes/cmds/bbox_derive.cc +++ b/passes/cmds/box_derive.cc @@ -21,29 +21,29 @@ USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN -struct BboxDerivePass : Pass { - BboxDerivePass() : Pass("bbox_derive", "derive blackbox modules") {} +struct BoxDerivePass : Pass { + BoxDerivePass() : Pass("box_derive", "derive box modules") {} void help() override { // |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---| log("\n"); - log(" bbox_derive [-base ] [-naming_attr ] [selection]\n"); + log(" box_derive [-base ] [-naming_attr ] [selection]\n"); log("\n"); log("As part of the assembly of the design hierarchy done by the 'hierarchy' command,\n"); log("specializations of parametric modules are derived on demand: for each choice of\n"); log("parameter values appearing in the design, a copy of the parametric module is\n"); log("derived which is specialized to that choice.\n"); log("\n"); - log("This derivation process ignores blackboxes and whiteboxes. To supplement, this\n"); - log("'bbox_derive' command can be used to request the derivation of modules based on\n"); - log("blackbox or whitebox instances appearing in the design, which is desirable in\n"); - log("certain use cases. Only the selected cells are considered as the instances that\n"); - log("steer the derivation process.\n"); + log("This derivation process ignores blackboxes and whiteboxes (boxes). To supplement,\n"); + log("this 'box_derive' command can be used to request the derivation of modules based\n"); + log("on box instances appearing in the design, which is desirable in certain use\n"); + log("cases. Only the selected cells are considered as the instances that steer the\n"); + log("derivation process.\n"); log("\n"); log(" -base \n"); - log(" instead of deriving the module that directly corresponds to each blackbox\n"); + log(" instead of deriving the module that directly corresponds to each box\n"); log(" instance, derive a specialization of (this option applies\n"); - log(" to all selected blackbox cells)\n"); + log(" to all selected box cells)\n"); log("\n"); log(" -naming_attr \n"); log(" once a specialization is derived, use the value of the module attribute\n"); @@ -54,7 +54,7 @@ struct BboxDerivePass : Pass { } void execute(std::vector args, RTLIL::Design *d) override { - log_header(d, "Executing BBOX_DERIVE pass. (derive modules for blackboxes)\n"); + log_header(d, "Executing BOX_DERIVE pass. (derive modules for boxes)\n"); size_t argidx; IdString naming_attr; @@ -111,6 +111,6 @@ struct BboxDerivePass : Pass { } } } -} BboxDerivePass; +} BoxDerivePass; PRIVATE_NAMESPACE_END diff --git a/tests/various/bbox_derive.ys b/tests/various/box_derive.ys similarity index 94% rename from tests/various/bbox_derive.ys rename to tests/various/box_derive.ys index 26312fb53cf..a76a79cdc1f 100644 --- a/tests/various/bbox_derive.ys +++ b/tests/various/box_derive.ys @@ -34,4 +34,4 @@ module top; endmodule EOF -bbox_derive -naming_attr final_name top +box_derive -naming_attr final_name top From adc1a01490850f294bb6229029799e91e3360d41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Tue, 21 May 2024 16:28:40 +0200 Subject: [PATCH 73/92] select: Refactor some flag validation --- passes/cmds/select.cc | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/passes/cmds/select.cc b/passes/cmds/select.cc index 03d00816e1b..2b68a921d09 100644 --- a/passes/cmds/select.cc +++ b/passes/cmds/select.cc @@ -1385,17 +1385,20 @@ struct SelectPass : public Pass { if (none_mode && args.size() != 2) log_cmd_error("Option -none can not be combined with any other options.\n"); - if (add_mode + del_mode + assert_none + assert_any + (assert_count >= 0) + (assert_max >= 0) + (assert_min >= 0) > 1) - log_cmd_error("Options -add, -del, -assert-none, -assert-any, assert-count, -assert-max or -assert-min can not be combined.\n"); + int common_flagset_tally = add_mode + del_mode + assert_none + assert_any + (assert_count >= 0) + (assert_max >= 0) + (assert_min >= 0); + const char *common_flagset = "-add, -del, -assert-none, -assert-any, -assert-count, -assert-max, or -assert-min"; - if ((list_mode || !write_file.empty() || count_mode) && (add_mode || del_mode || assert_none || assert_any || assert_count >= 0 || assert_max >= 0 || assert_min >= 0)) - log_cmd_error("Options -list, -write and -count can not be combined with -add, -del, -assert-none, -assert-any, assert-count, -assert-max, or -assert-min.\n"); + if (common_flagset_tally > 1) + log_cmd_error("Options %s can not be combined.\n", common_flagset); - if (!set_name.empty() && (list_mode || !write_file.empty() || count_mode || add_mode || !unset_name.empty() || del_mode || assert_none || assert_any || assert_count >= 0 || assert_max >= 0 || assert_min >= 0)) - log_cmd_error("Option -set can not be combined with -list, -write, -count, -add, -del, -unset, -assert-none, -assert-any, -assert-count, -assert-max, or -assert-min.\n"); + if ((list_mode || !write_file.empty() || count_mode) && common_flagset_tally) + log_cmd_error("Options -list, -write and -count can not be combined with %s.\n", common_flagset); - if (!unset_name.empty() && (list_mode || !write_file.empty() || count_mode || add_mode || !set_name.empty() || del_mode || assert_none || assert_any || assert_count >= 0 || assert_max >= 0 || assert_min >= 0)) - log_cmd_error("Option -unset can not be combined with -list, -write, -count, -add, -del, -set, -assert-none, -assert-any, -assert-count, -assert-max, or -assert-min.\n"); + if (!set_name.empty() && (list_mode || !write_file.empty() || count_mode || !unset_name.empty() || common_flagset_tally)) + log_cmd_error("Option -set can not be combined with -list, -write, -count, -unset, %s.\n", common_flagset); + + if (!unset_name.empty() && (list_mode || !write_file.empty() || count_mode || !set_name.empty() || common_flagset_tally)) + log_cmd_error("Option -unset can not be combined with -list, -write, -count, -set, %s.\n", common_flagset); if (work_stack.size() == 0 && got_module) { RTLIL::Selection sel; From 49906be776552b62ff2c8c954bd0c80fa215e0f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Tue, 21 May 2024 16:34:38 +0200 Subject: [PATCH 74/92] select: Introduce `-assert-mod-count` --- passes/cmds/select.cc | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/passes/cmds/select.cc b/passes/cmds/select.cc index 2b68a921d09..2b7a37013cd 100644 --- a/passes/cmds/select.cc +++ b/passes/cmds/select.cc @@ -1065,6 +1065,10 @@ struct SelectPass : public Pass { log(" selection is non-empty. i.e. produce an error if no object or module\n"); log(" matching the selection is found.\n"); log("\n"); + log(" -assert-mod-count N\n"); + log(" do not modify the current selection. instead assert that the given\n"); + log(" selection contains exactly N modules.\n"); + log("\n"); log(" -assert-count N\n"); log(" do not modify the current selection. instead assert that the given\n"); log(" selection contains exactly N objects.\n"); @@ -1263,6 +1267,7 @@ struct SelectPass : public Pass { bool got_module = false; bool assert_none = false; bool assert_any = false; + int assert_modcount = -1; int assert_count = -1; int assert_max = -1; int assert_min = -1; @@ -1291,6 +1296,10 @@ struct SelectPass : public Pass { assert_any = true; continue; } + if (arg == "-assert-mod-count" && argidx+1 < args.size()) { + assert_modcount = atoi(args[++argidx].c_str()); + continue; + } if (arg == "-assert-count" && argidx+1 < args.size()) { assert_count = atoi(args[++argidx].c_str()); continue; @@ -1345,7 +1354,8 @@ struct SelectPass : public Pass { } if (arg.size() > 0 && arg[0] == '-') log_cmd_error("Unknown option %s.\n", arg.c_str()); - bool disable_empty_warning = count_mode || assert_none || assert_any || (assert_count != -1) || (assert_max != -1) || (assert_min != -1); + bool disable_empty_warning = count_mode || assert_none || assert_any || (assert_modcount != -1) || + (assert_count != -1) || (assert_max != -1) || (assert_min != -1); select_stmt(design, arg, disable_empty_warning); sel_str += " " + arg; } @@ -1385,8 +1395,8 @@ struct SelectPass : public Pass { if (none_mode && args.size() != 2) log_cmd_error("Option -none can not be combined with any other options.\n"); - int common_flagset_tally = add_mode + del_mode + assert_none + assert_any + (assert_count >= 0) + (assert_max >= 0) + (assert_min >= 0); - const char *common_flagset = "-add, -del, -assert-none, -assert-any, -assert-count, -assert-max, or -assert-min"; + int common_flagset_tally = add_mode + del_mode + assert_none + assert_any + (assert_modcount >= 0) + (assert_count >= 0) + (assert_max >= 0) + (assert_min >= 0); + const char *common_flagset = "-add, -del, -assert-none, -assert-any, -assert-mod-count, -assert-count, -assert-max, or -assert-min"; if (common_flagset_tally > 1) log_cmd_error("Options %s can not be combined.\n", common_flagset); @@ -1517,15 +1527,16 @@ struct SelectPass : public Pass { return; } - if (assert_count >= 0 || assert_max >= 0 || assert_min >= 0) + if (assert_modcount >= 0 || assert_count >= 0 || assert_max >= 0 || assert_min >= 0) { - int total_count = 0; + int module_count = 0, total_count = 0; if (work_stack.size() == 0) log_cmd_error("No selection to check.\n"); RTLIL::Selection *sel = &work_stack.back(); sel->optimize(design); for (auto mod : design->modules()) if (sel->selected_module(mod->name)) { + module_count++; for (auto wire : mod->wires()) if (sel->selected_member(mod->name, wire->name)) total_count++; @@ -1539,6 +1550,11 @@ struct SelectPass : public Pass { if (sel->selected_member(mod->name, it.first)) total_count++; } + if (assert_modcount >= 0 && assert_modcount != module_count) + { + log_error("Assertion failed: selection contains %d modules instead of the asserted %d:%s\n", + module_count, assert_modcount, sel_str.c_str()); + } if (assert_count >= 0 && assert_count != total_count) { std::string desc = describe_selection_for_assert(design, sel); From bff2443af842e41134bbd348dbd6885ab8206e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Tue, 21 May 2024 16:34:49 +0200 Subject: [PATCH 75/92] box_derive: Finish the test --- tests/various/box_derive.ys | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/various/box_derive.ys b/tests/various/box_derive.ys index a76a79cdc1f..72db48e4fed 100644 --- a/tests/various/box_derive.ys +++ b/tests/various/box_derive.ys @@ -35,3 +35,13 @@ endmodule EOF box_derive -naming_attr final_name top +select -assert-mod-count 1 =bb1 +select -assert-mod-count 0 =bb2 +select -assert-mod-count 1 =bb3 + +select -assert-mod-count 1 =cc1 +select -assert-mod-count 0 =cc2 +select -assert-mod-count 0 =cc3 + +# the original aa, bb, cc, and 5 specializations +select -assert-mod-count 8 =A:whitebox From c71262f66b7f428289f6ef0980bb4fc5b9173693 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 22 May 2024 00:16:29 +0000 Subject: [PATCH 76/92] Bump version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 93f09dee49e..cbf834007fc 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ LIBS += -lrt endif endif -YOSYS_VER := 0.41+83 +YOSYS_VER := 0.41+101 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo From db3f8103044131c0603ec0c05c74dd6f0b06e31b Mon Sep 17 00:00:00 2001 From: Mary Guillemard Date: Wed, 22 May 2024 23:40:02 +0200 Subject: [PATCH 77/92] Only build yosys-abc usage docs when ABCEXTERNAL is not set Since 0.41, when building docs with ABCEXTERNAL set, the rule for yosys-abc docs usage would attempt to build in-tree ABC. This fix this regression by only including yosys-abc in DOCS_USAGE_STDERR when ABCEXTERNAL is not set. Signed-off-by: Mary Guillemard --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cbf834007fc..55866259c0f 100644 --- a/Makefile +++ b/Makefile @@ -946,7 +946,13 @@ define DOC_USAGE_STDERR docs/source/generated/$(1): $(PROGRAM_PREFIX)$(1) docs/source/generated -$(Q) ./$$< --help 2> $$@ endef -DOCS_USAGE_STDERR := yosys-config yosys-filterlib yosys-abc +DOCS_USAGE_STDERR := yosys-config yosys-filterlib + +# The in-tree ABC (yosys-abc) is only built when ABCEXTERNAL is not set. +ifeq ($(ABCEXTERNAL),) +DOCS_USAGE_STDERR += yosys-abc +endif + $(foreach usage,$(DOCS_USAGE_STDERR),$(eval $(call DOC_USAGE_STDERR,$(usage)))) # others print to stdout From 1aae0bcd40accc760e30d5c1bab09c1303bca2bf Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 24 May 2024 09:09:48 +1200 Subject: [PATCH 78/92] ci: Move nix build to extra-builds.yml Skip duplicate actions on nix build. --- .github/workflows/extra-builds.yml | 14 ++++++++++++++ .github/workflows/nix-github-actions.yml | 15 --------------- 2 files changed, 14 insertions(+), 15 deletions(-) delete mode 100644 .github/workflows/nix-github-actions.yml diff --git a/.github/workflows/extra-builds.yml b/.github/workflows/extra-builds.yml index 260394a3ffe..031f696537a 100644 --- a/.github/workflows/extra-builds.yml +++ b/.github/workflows/extra-builds.yml @@ -81,3 +81,17 @@ jobs: END make -C build -f ../Makefile CXX=clang -j$(nproc) + + nix-build: + name: "Build nix flake" + needs: pre_job + if: needs.pre_job.outputs.should_skip != 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - uses: cachix/install-nix-action@v26 + with: + install_url: https://releases.nixos.org/nix/nix-2.18.1/install + - run: nix build .?submodules=1 diff --git a/.github/workflows/nix-github-actions.yml b/.github/workflows/nix-github-actions.yml deleted file mode 100644 index 6d5c5b4b2dd..00000000000 --- a/.github/workflows/nix-github-actions.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: "build nix flake" -on: - pull_request: - push: -jobs: - tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - uses: cachix/install-nix-action@v26 - with: - install_url: https://releases.nixos.org/nix/nix-2.18.1/install - - run: nix build .?submodules=1 From d135c0bf87b0054cffd77ff6dbc030b194d5ef12 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 24 May 2024 09:41:31 +1200 Subject: [PATCH 79/92] extra-builds.yml: Fix indentation --- .github/workflows/extra-builds.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/extra-builds.yml b/.github/workflows/extra-builds.yml index 031f696537a..d7c6e13ff06 100644 --- a/.github/workflows/extra-builds.yml +++ b/.github/workflows/extra-builds.yml @@ -90,8 +90,8 @@ jobs: steps: - uses: actions/checkout@v4 with: - submodules: true + submodules: true - uses: cachix/install-nix-action@v26 with: - install_url: https://releases.nixos.org/nix/nix-2.18.1/install + install_url: https://releases.nixos.org/nix/nix-2.18.1/install - run: nix build .?submodules=1 From c7580eb18ed2a8ba313b5120dfc1dba36cef485e Mon Sep 17 00:00:00 2001 From: Amiot Noe Date: Tue, 21 May 2024 21:47:00 +0200 Subject: [PATCH 80/92] cxxrtl: Prevent wires with input or output ports from being aliased --- backends/cxxrtl/cxxrtl_backend.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/backends/cxxrtl/cxxrtl_backend.cc b/backends/cxxrtl/cxxrtl_backend.cc index 703494682a8..9ddbd33b0a3 100644 --- a/backends/cxxrtl/cxxrtl_backend.cc +++ b/backends/cxxrtl/cxxrtl_backend.cc @@ -3263,6 +3263,7 @@ struct CxxrtlWorker { debug_wire_type = wire_type; // wire is a member if (!debug_alias) continue; + if (wire->port_input || wire->port_output) continue; // preserve input/output metadata in flags const RTLIL::Wire *it = wire; while (flow.is_inlinable(it)) { log_assert(flow.wire_comb_defs[it].size() == 1); From 557968567360026ae8dc75341564209868171296 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 25 May 2024 00:16:20 +0000 Subject: [PATCH 81/92] Bump version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 55866259c0f..15ab4766c48 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ LIBS += -lrt endif endif -YOSYS_VER := 0.41+101 +YOSYS_VER := 0.41+108 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo From 02ad56a132d1faf24ff7efb2178c6bc8c034a9dc Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Mon, 27 May 2024 22:39:42 +0200 Subject: [PATCH 82/92] docs: add todo for $demux --- docs/source/yosys_internals/formats/cell_library.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/source/yosys_internals/formats/cell_library.rst b/docs/source/yosys_internals/formats/cell_library.rst index 2b8dc300154..ad2dd93712a 100644 --- a/docs/source/yosys_internals/formats/cell_library.rst +++ b/docs/source/yosys_internals/formats/cell_library.rst @@ -1195,3 +1195,5 @@ file via ABC using the abc pass. .. todo:: Add information about ``$lut`` and ``$sop`` cells. .. todo:: Add information about ``$alu``, ``$fa``, and ``$lcu`` cells. + +.. todo:: Add information about ``$demux`` cell. \ No newline at end of file From b230c95cc4ad14b7024db47f18169045b13230ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Wed, 29 May 2024 20:41:56 +0200 Subject: [PATCH 83/92] select: Adjust help --- passes/cmds/select.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/passes/cmds/select.cc b/passes/cmds/select.cc index 2b7a37013cd..e455baf7c7f 100644 --- a/passes/cmds/select.cc +++ b/passes/cmds/select.cc @@ -1067,7 +1067,7 @@ struct SelectPass : public Pass { log("\n"); log(" -assert-mod-count N\n"); log(" do not modify the current selection. instead assert that the given\n"); - log(" selection contains exactly N modules.\n"); + log(" selection contains exactly N modules (partially or fully selected).\n"); log("\n"); log(" -assert-count N\n"); log(" do not modify the current selection. instead assert that the given\n"); From 97fedff383bb253eca5ab9d6827057e1fae9dd1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Wed, 29 May 2024 20:42:11 +0200 Subject: [PATCH 84/92] box_derive: Tune the test --- tests/various/box_derive.ys | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/various/box_derive.ys b/tests/various/box_derive.ys index 72db48e4fed..f02e133603d 100644 --- a/tests/various/box_derive.ys +++ b/tests/various/box_derive.ys @@ -35,6 +35,11 @@ endmodule EOF box_derive -naming_attr final_name top + +select -assert-mod-count 1 =aa1 +select -assert-mod-count 1 =aa2 +select -assert-mod-count 0 =aa3 + select -assert-mod-count 1 =bb1 select -assert-mod-count 0 =bb2 select -assert-mod-count 1 =bb3 @@ -43,5 +48,6 @@ select -assert-mod-count 1 =cc1 select -assert-mod-count 0 =cc2 select -assert-mod-count 0 =cc3 -# the original aa, bb, cc, and 5 specializations +# we are expecting the original aa, bb, cc modules +# and 5 specializations generated by box_derive select -assert-mod-count 8 =A:whitebox From a84e4f44fe5fdd234f80c4b55803f27ec8eb03d6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 31 May 2024 00:16:34 +0000 Subject: [PATCH 85/92] Bump version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 15ab4766c48..a15a3971065 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ LIBS += -lrt endif endif -YOSYS_VER := 0.41+108 +YOSYS_VER := 0.41+111 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo From 803703a83328ef4535960212f6eb11ca77465f6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miodrag=20Milanovi=C4=87?= Date: Sun, 2 Jun 2024 19:25:05 +0200 Subject: [PATCH 86/92] Update flake lock workflow Update workflow so it creates trigger as user so GitHub Action is triggering actual build --- .github/workflows/update-flake-lock.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-flake-lock.yml b/.github/workflows/update-flake-lock.yml index 1d4741c8c22..c7aa6ecab70 100644 --- a/.github/workflows/update-flake-lock.yml +++ b/.github/workflows/update-flake-lock.yml @@ -15,7 +15,8 @@ jobs: - name: Update flake.lock uses: DeterminateSystems/update-flake-lock@main with: + token: ${{CI_CREATE_PR_TOKEN}} pr-title: "Update flake.lock" # Title of PR to be created pr-labels: | # Labels to be set on the PR dependencies - automated \ No newline at end of file + automated From 855ac285f49277ba9007f5808f5350ec656db852 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 00:17:36 +0000 Subject: [PATCH 87/92] Bump version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a15a3971065..9a263c2f2dc 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ LIBS += -lrt endif endif -YOSYS_VER := 0.41+111 +YOSYS_VER := 0.41+126 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo From 094fa8cabaafd1cc0ed8e7d485e86cf1651078bf Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Thu, 6 Jun 2024 17:35:31 +0200 Subject: [PATCH 88/92] smtbmc: Fix two .yw handling related crashes These came up when using the experimental incremental interface and are also in code that was recently refactored to support that interface. --- backends/smt2/smtbmc.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backends/smt2/smtbmc.py b/backends/smt2/smtbmc.py index 995a714c926..c3bdcebbe96 100644 --- a/backends/smt2/smtbmc.py +++ b/backends/smt2/smtbmc.py @@ -719,6 +719,8 @@ def smt_extract_mask(smt_expr, mask): return combined_chunks, ''.join(mask_index_order[start:end] for start, end in chunks)[::-1] def smt_concat(exprs): + if not isinstance(exprs, (tuple, list)): + exprs = tuple(exprs) if not exprs: return "" if len(exprs) == 1: @@ -818,6 +820,9 @@ def ywfile_constraints(inywfile, constr_assumes, map_steps=None, skip_x=False): if not bits_re.match(bits): raise ValueError("unsupported bit value in Yosys witness file") + if bits.count('?') == len(bits): + continue + smt_expr = ywfile_signal(sig, map_steps.get(t, t)) smt_expr, bits = smt_extract_mask(smt_expr, bits) From bd28d26021c4bd2c3bcc9d60b0e6e7e93fbebc86 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 7 Jun 2024 00:17:23 +0000 Subject: [PATCH 89/92] Bump version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9a263c2f2dc..594e740a9b3 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ LIBS += -lrt endif endif -YOSYS_VER := 0.41+126 +YOSYS_VER := 0.41+129 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo From 9b82a44d254d8db663e7b7b1b9db330faa2118fa Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 7 Jun 2024 08:26:59 +0200 Subject: [PATCH 90/92] Fix help message typo --- passes/cmds/logcmd.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/passes/cmds/logcmd.cc b/passes/cmds/logcmd.cc index 8e51af4b3b7..3b82ac48c0c 100644 --- a/passes/cmds/logcmd.cc +++ b/passes/cmds/logcmd.cc @@ -59,7 +59,7 @@ struct LogPass : public Pass { log(" -push\n"); log(" push a new level on the pass counter\n"); log("\n"); - log(" -push\n"); + log(" -pop\n"); log(" pop from the pass counter\n"); log("\n"); } From 9b6afcf3f83fea413b57c3790c25ba43b9914ce2 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 7 Jun 2024 08:29:48 +0200 Subject: [PATCH 91/92] Release version 0.42 --- CHANGELOG | 8 +++++++- Makefile | 4 ++-- docs/source/conf.py | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7c3ad481e9e..0f80a9f5e0e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,8 +2,14 @@ List of major changes and improvements between releases ======================================================= -Yosys 0.41 .. Yosys 0.42-dev +Yosys 0.41 .. Yosys 0.42 -------------------------- + * New commands and options + - Added "box_derive" pass to derive box modules. + - Added option "assert-mod-count" to "select" pass. + - Added option "-header","-push" and "-pop" to "log" pass. + * Intel support + - Dropped Quartus support in "synth_intel_alm" pass. Yosys 0.40 .. Yosys 0.41 -------------------------- diff --git a/Makefile b/Makefile index 594e740a9b3..7bfd6010cc6 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ LIBS += -lrt endif endif -YOSYS_VER := 0.41+129 +YOSYS_VER := 0.42 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo @@ -157,7 +157,7 @@ endif OBJS = kernel/version_$(GIT_REV).o bumpversion: - sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline c1ad377.. | wc -l`/;" Makefile +# sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline c1ad377.. | wc -l`/;" Makefile ABCMKARGS = CC="$(CXX)" CXX="$(CXX)" ABC_USE_LIBSTDCXX=1 ABC_USE_NAMESPACE=abc VERBOSE=$(Q) diff --git a/docs/source/conf.py b/docs/source/conf.py index fcd6adce863..c9c923e8231 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -5,7 +5,7 @@ project = 'YosysHQ Yosys' author = 'YosysHQ GmbH' copyright ='2024 YosysHQ GmbH' -yosys_ver = "0.41" +yosys_ver = "0.42" # select HTML theme html_theme = 'furo' From b056e8c0ba2b6f7c94d9102a42a03feb66e8d452 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 7 Jun 2024 08:34:06 +0200 Subject: [PATCH 92/92] Next dev cycle --- CHANGELOG | 3 +++ Makefile | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 0f80a9f5e0e..d8e13b041e5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,9 @@ List of major changes and improvements between releases ======================================================= +Yosys 0.42 .. Yosys 0.43-dev +-------------------------- + Yosys 0.41 .. Yosys 0.42 -------------------------- * New commands and options diff --git a/Makefile b/Makefile index 7bfd6010cc6..0c2e11953bb 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,7 @@ LIBS += -lrt endif endif -YOSYS_VER := 0.42 +YOSYS_VER := 0.42+0 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo @@ -157,7 +157,7 @@ endif OBJS = kernel/version_$(GIT_REV).o bumpversion: -# sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline c1ad377.. | wc -l`/;" Makefile + sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline 9b6afcf.. | wc -l`/;" Makefile ABCMKARGS = CC="$(CXX)" CXX="$(CXX)" ABC_USE_LIBSTDCXX=1 ABC_USE_NAMESPACE=abc VERBOSE=$(Q)