From 8167859821fca7fba5857ec195450578edd0bd11 Mon Sep 17 00:00:00 2001 From: Rodrigo Alejandro Melo Date: Sun, 30 Aug 2026 22:45:11 -0300 Subject: [PATCH 1/5] Add svlint into the langutils container Closes #8 --- README.md | 1 + recipes/langutils | 12 ++++++++++++ tests/langutils.sh | 2 ++ 3 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 67ae49e..d5b153e 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ Below is a list of the available containers and their included tools. * [vhd2vl](https://github.com/ldoolitt/vhd2vl) * [Slang](https://github.com/MikePopoloski/slang) * [sv2v](https://github.com/zachjs/sv2v) + * [svlint](https://github.com/dalance/svlint) * [Verible](https://github.com/chipsalliance/verible) * [Surelog](https://github.com/chipsalliance/Surelog) * `synthesis`: tools for logic synthesis diff --git a/recipes/langutils b/recipes/langutils index 1e13c63..cc7c648 100644 --- a/recipes/langutils +++ b/recipes/langutils @@ -22,6 +22,8 @@ RUN apt-get update -qq \ cmake \ default-jre \ python3-orderedmultidict \ + # svlint + unzip \ && curl -sSL https://get.haskellstack.org/ | sh \ && curl -sSL https://github.com/bazelbuild/bazel/releases/download/6.5.0/bazel-6.5.0-linux-x86_64 \ -o /usr/bin/bazel && chmod +x /usr/bin/bazel \ @@ -66,6 +68,16 @@ RUN git clone --depth 1 https://github.com/chipsalliance/verible.git \ && cd verible && bazel build -c opt :install-binaries \ && .github/bin/simple-install.sh /usr/local/bin +# +# svlint +# + +RUN LATEST_URL=$(curl -s https://api.github.com/repos/dalance/svlint/releases/latest | grep -o "https://[^\"]*x86_64-lnx.zip") \ + && curl -sL "$LATEST_URL" -o /tmp/svlint.zip \ + && unzip /tmp/svlint.zip -d /tmp/svlint \ + && mv /tmp/svlint/bin/svlint /usr/local/bin/ \ + && rm -rf /tmp/svlint /tmp/svlint.zip + # # Clean-up # diff --git a/tests/langutils.sh b/tests/langutils.sh index 45da66a..4de5f44 100644 --- a/tests/langutils.sh +++ b/tests/langutils.sh @@ -11,11 +11,13 @@ $DOCKER slang --version $DOCKER surelog --version $DOCKER sv2v --version $DOCKER verible-verilog-syntax --version +$DOCKER svlint --version $DOCKER vhd2vl --quiet hdl/counter.vhdl results/vhd2vl.v $DOCKER slang hdl/counter.sv --lint-only $DOCKER surelog -parse hdl/counter.sv $DOCKER sv2v hdl/counter.sv --write=results/sv2v.v $DOCKER verible-verilog-lint hdl/counter.sv +$DOCKER svlint hdl/counter.sv rm -fr slpp_all From a7d39ee9ebe469caf38f7ee7ef482c9c82f099df Mon Sep 17 00:00:00 2001 From: Rodrigo Alejandro Melo Date: Mon, 7 Sep 2026 18:01:28 -0300 Subject: [PATCH 2/5] langutils rewritten, to fix surelog compilation and reduce final weight --- recipes/langutils | 85 ++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 45 deletions(-) diff --git a/recipes/langutils b/recipes/langutils index cc7c648..8213ac4 100644 --- a/recipes/langutils +++ b/recipes/langutils @@ -1,35 +1,29 @@ -FROM ubuntu:latest AS build +FROM ubuntu:latest AS builder -WORKDIR /root +ENV DEBIAN_FRONTEND=noninteractive -# -# Dependencies -# - -RUN apt-get update -qq \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - # Common +RUN apt-get update -qq && apt-get install -y --no-install-recommends \ + bison \ build-essential \ ca-certificates \ + cargo \ + cmake \ curl \ + default-jre \ + flex \ git \ python3 \ - zlib1g-dev \ - # vhd2vl - flex \ - bison \ - # Surelog - cmake \ - default-jre \ python3-orderedmultidict \ - # svlint - unzip \ + # sv2v && curl -sSL https://get.haskellstack.org/ | sh \ - && curl -sSL https://github.com/bazelbuild/bazel/releases/download/6.5.0/bazel-6.5.0-linux-x86_64 \ - -o /usr/bin/bazel && chmod +x /usr/bin/bazel \ - && apt-get autoclean && apt-get clean && apt-get -y autoremove \ + # verible + && curl -fsSL https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64 \ + -o /usr/local/bin/bazel && chmod +x /usr/local/bin/bazel \ + # clean-up && rm -rf /var/lib/apt/lists/* +WORKDIR /tmp + # # vhd2vl # @@ -37,12 +31,19 @@ RUN apt-get update -qq \ RUN git clone --depth 1 https://github.com/ldoolitt/vhd2vl \ && cd vhd2vl && make -j$(nproc) && make install +# +# sv2v +# + +RUN git clone --depth 1 https://github.com/zachjs/sv2v.git \ + && cd sv2v && make -j$(nproc) && cp bin/sv2v /usr/local/bin + # # Slang # RUN git clone --depth 1 https://github.com/MikePopoloski/slang.git \ - && cd slang && cmake -B build && cmake --build build -j8 \ + && cd slang && cmake -B build && cmake --build build -j$(nproc) \ && cmake --install build --strip # @@ -51,14 +52,12 @@ RUN git clone --depth 1 https://github.com/MikePopoloski/slang.git \ RUN git clone --depth 1 https://github.com/alainmarcel/Surelog.git \ && cd Surelog && git submodule update --init --recursive \ - && make -j$(nproc) && make install - -# -# sv2v -# - -RUN git clone --depth 1 https://github.com/zachjs/sv2v.git \ - && cd sv2v && make -j$(nproc) && cp bin/sv2v /usr/local/bin + && cmake -B build \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr/local \ + && cmake --build build -j$(nproc) \ + && cmake --install build --strip # # Verible @@ -72,25 +71,21 @@ RUN git clone --depth 1 https://github.com/chipsalliance/verible.git \ # svlint # -RUN LATEST_URL=$(curl -s https://api.github.com/repos/dalance/svlint/releases/latest | grep -o "https://[^\"]*x86_64-lnx.zip") \ - && curl -sL "$LATEST_URL" -o /tmp/svlint.zip \ - && unzip /tmp/svlint.zip -d /tmp/svlint \ - && mv /tmp/svlint/bin/svlint /usr/local/bin/ \ - && rm -rf /tmp/svlint /tmp/svlint.zip +RUN cargo install --root /usr/local --git https://github.com/dalance/svlint.git svlint # -# Clean-up +# clean-up # -RUN cd /usr/local/bin && rm stack +RUN rm -f /usr/local/bin/stack /usr/local/bin/bazel -############################################################################### +# ----------------------------------------------------------------------------- -FROM ubuntu:latest +FROM ubuntu:latest AS runtime -COPY --from=build /usr/local/bin /usr/local/bin -COPY --from=build /usr/local/lib /usr/local/lib -COPY --from=build /usr/local/include /usr/local/include -COPY --from=build /usr/local/share/pkgconfig /usr/local/share/pkgconfig -COPY --from=build /usr/local/share/surelog /usr/local/share/surelog -COPY --from=build /usr/local/share/uhdm /usr/local/share/uhdm +COPY --from=builder /usr/local/bin /usr/local/bin +COPY --from=builder /usr/local/lib /usr/local/lib +COPY --from=builder /usr/local/include /usr/local/include +COPY --from=builder /usr/local/share/pkgconfig /usr/local/share/pkgconfig +COPY --from=builder /usr/local/share/surelog /usr/local/share/surelog +COPY --from=builder /usr/local/share/uhdm /usr/local/share/uhdm From beb775166b3abd35a9e40d80051039003cb747e9 Mon Sep 17 00:00:00 2001 From: Rodrigo Alejandro Melo Date: Mon, 7 Sep 2026 18:02:06 -0300 Subject: [PATCH 3/5] Add langutils tests --- tests/.svlint.toml | 244 +++++++++++++++++++++++++++++++++++++++++++++ tests/langutils.sh | 20 ++-- 2 files changed, 258 insertions(+), 6 deletions(-) create mode 100644 tests/.svlint.toml diff --git a/tests/.svlint.toml b/tests/.svlint.toml new file mode 100644 index 0000000..0430690 --- /dev/null +++ b/tests/.svlint.toml @@ -0,0 +1,244 @@ +[option] +exclude_paths = [] +textwidth = 80 +copyright_linenum = 1 +copyright_year = "1234" +copyright_holder = "HOLDER" +indent = 2 +prefix_inout = "b_" +prefix_input = "i_" +prefix_output = "o_" +prefix_label = "l_" +prefix_instance = "u_" +prefix_module = "mod_" +prefix_package = "pkg_" +prefix_interface = "ifc_" +re_required_assert = "^[a-z]+[a-z0-9_]*$" +re_required_assert_property = "^[a-z]+[a-z0-9_]*$" +re_required_checker = "^[a-z]+[a-z0-9_]*$" +re_required_class = "^[a-z]+[a-z0-9_]*$" +re_required_function = "^[a-z]+[a-z0-9_]*$" +re_required_generateblock = "^[a-z]+[a-z0-9_]*$" +re_required_genvar = "^[a-z]+[a-z0-9_]*$" +re_required_instance = "^[a-z]+[a-z0-9_]*$" +re_required_interface = "^[a-z]+[a-z0-9_]*$" +re_required_localparam = "^[A-Z]+[A-Z0-9_]*$" +re_required_modport = "^[a-z]+[a-z0-9_]*$" +re_required_module_ansi = "^[a-z]+[a-zA-Z0-9_]*$" +re_required_module_nonansi = "^[A-Z]+[A-Z0-9_]*$" +re_required_package = "^[a-z]+[a-z0-9_]*$" +re_required_parameter = "^[A-Z]+[A-Z0-9_]*$" +re_required_port_inout = "^[a-z]+[a-z0-9_]*$" +re_required_port_input = "^[a-z]+[a-z0-9_]*$" +re_required_port_output = "^[a-z]+[a-z0-9_]*$" +re_required_port_ref = "^[a-z]+[a-z0-9_]*$" +re_required_port_interface = "^[a-z]+[a-z0-9_]*$" +re_required_program = "^[a-z]+[a-z0-9_]*$" +re_required_property = "^[a-z]+[a-z0-9_]*$" +re_required_sequence = "^[a-z]+[a-z0-9_]*$" +re_required_task = "^[a-z]+[a-z0-9_]*$" +re_required_var_class = "^[a-z]+[a-z0-9_]*$" +re_required_var_classmethod = "^[a-z]+[a-z0-9_]*$" +re_forbidden_assert = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_assert_property = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_checker = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_class = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_function = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_generateblock = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_genvar = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_instance = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_interface = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_localparam = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_modport = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_module_ansi = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_module_nonansi = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_package = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_parameter = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_port_inout = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_port_input = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_port_output = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_port_ref = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_port_interface = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_program = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_property = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_sequence = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_task = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_var_class = "^[^X](UNCONFIGURED|.*)$" +re_forbidden_var_classmethod = "^[^X](UNCONFIGURED|.*)$" + +[option.unpacked_array] +localparam_declaration = false +param_declaration = false +specparam_declaration = false +inout_declaration = false +ansi_port_declaration = false +input_declaration = false +output_declaration = false +interface_port_declaration = false +ref_declaration = false +data_declaration = true +net_declaration = false + +[textrules] +header_copyright = false +style_directives = false +style_semicolon = false +style_textwidth = false + +[syntaxrules] +action_block_with_side_effect = false +blocking_assignment_in_always_at_edge = false +blocking_assignment_in_always_ff = false +blocking_assignment_in_always_latch = false +case_default = false +default_nettype_none = false +default_nettype_wire_at_end = false +enum_with_type = false +eventlist_comma_always_ff = false +eventlist_or = false +explicit_brackets_for_confusing_precedence = false +explicit_case_default = false +explicit_if_else = false +function_same_as_system_function = false +function_with_automatic = false +general_always_level_sensitive = false +general_always_no_edge = false +generate_case_with_label = false +generate_for_with_label = false +generate_if_with_label = false +genvar_declaration_in_loop = false +genvar_declaration_out_loop = false +implicit_case_default = false +inout_with_tri = false +input_with_var = false +interface_identifier_matches_filename = false +interface_port_with_modport = false +keyword_forbidden_always = false +keyword_forbidden_always_comb = false +keyword_forbidden_always_ff = false +keyword_forbidden_always_latch = false +keyword_forbidden_generate = false +keyword_forbidden_logic = false +keyword_forbidden_priority = false +keyword_forbidden_unique = false +keyword_forbidden_unique0 = false +keyword_forbidden_wire_reg = false +keyword_required_generate = false +localparam_explicit_type = false +localparam_type_twostate = false +loop_statement_in_always_comb = false +loop_statement_in_always_ff = false +loop_statement_in_always_latch = false +loop_variable_declaration = false +lowercamelcase_interface = false +lowercamelcase_module = false +lowercamelcase_package = false +module_ansi_forbidden = false +module_identifier_matches_filename = false +module_nonansi_forbidden = false +multiline_for_begin = false +multiline_if_begin = false +non_blocking_assignment_in_always_comb = false +non_blocking_assignment_in_always_no_edge = false +operator_case_equality = false +operator_incdec = false +operator_self_assignment = false +output_with_var = false +package_identifier_matches_filename = false +package_item_not_in_package = false +parameter_default_value = false +parameter_explicit_type = false +parameter_in_generate = false +parameter_in_package = false +parameter_type_twostate = false +prefix_inout = false +prefix_input = false +prefix_instance = false +prefix_interface = false +prefix_module = false +prefix_output = false +prefix_package = false +procedural_continuous_assignment = false +program_identifier_matches_filename = false +re_forbidden_assert = false +re_forbidden_assert_property = false +re_forbidden_checker = false +re_forbidden_class = false +re_forbidden_function = false +re_forbidden_generateblock = false +re_forbidden_genvar = false +re_forbidden_instance = false +re_forbidden_interface = false +re_forbidden_localparam = false +re_forbidden_modport = false +re_forbidden_module_ansi = false +re_forbidden_module_nonansi = false +re_forbidden_package = false +re_forbidden_parameter = false +re_forbidden_port_inout = false +re_forbidden_port_input = false +re_forbidden_port_interface = false +re_forbidden_port_output = false +re_forbidden_port_ref = false +re_forbidden_program = false +re_forbidden_property = false +re_forbidden_sequence = false +re_forbidden_task = false +re_forbidden_var_class = false +re_forbidden_var_classmethod = false +re_required_assert = false +re_required_assert_property = false +re_required_checker = false +re_required_class = false +re_required_function = false +re_required_generateblock = false +re_required_genvar = false +re_required_instance = false +re_required_interface = false +re_required_localparam = false +re_required_modport = false +re_required_module_ansi = false +re_required_module_nonansi = false +re_required_package = false +re_required_parameter = false +re_required_port_inout = false +re_required_port_input = false +re_required_port_interface = false +re_required_port_output = false +re_required_port_ref = false +re_required_program = false +re_required_property = false +re_required_sequence = false +re_required_task = false +re_required_var_class = false +re_required_var_classmethod = false +sequential_block_in_always_comb = false +sequential_block_in_always_ff = false +sequential_block_in_always_latch = false +style_commaleading = false +style_indent = false +style_keyword_0or1space = false +style_keyword_0space = false +style_keyword_1or2space = false +style_keyword_1space = false +style_keyword_1spaceornewline = false +style_keyword_construct = false +style_keyword_datatype = false +style_keyword_end = false +style_keyword_maybelabel = false +style_keyword_new = false +style_keyword_newline = false +style_operator_arithmetic = false +style_operator_arithmetic_leading_space = false +style_operator_boolean = false +style_operator_boolean_leading_space = false +style_operator_integer = false +style_operator_integer_leading_space = false +style_operator_unary = false +style_trailingwhitespace = false +tab_character = false +unpacked_array = false +uppercamelcase_interface = false +uppercamelcase_module = false +uppercamelcase_package = false + diff --git a/tests/langutils.sh b/tests/langutils.sh index 4de5f44..0bd1e98 100644 --- a/tests/langutils.sh +++ b/tests/langutils.sh @@ -7,17 +7,25 @@ DOCKER="docker run --rm -v $HOME:$HOME -w $PWD --user $(id -u):$(id -g) ghcr.io/ mkdir -p results $DOCKER vhd2vl --version -$DOCKER slang --version -$DOCKER surelog --version +$DOCKER vhd2vl --quiet hdl/counter.vhdl results/vhd2vl.v +test -f results/vhd2vl.v + $DOCKER sv2v --version -$DOCKER verible-verilog-syntax --version -$DOCKER svlint --version +$DOCKER sv2v hdl/counter.sv --write=results/sv2v.v +test -f results/sv2v.v -$DOCKER vhd2vl --quiet hdl/counter.vhdl results/vhd2vl.v +$DOCKER slang --version $DOCKER slang hdl/counter.sv --lint-only + +$DOCKER surelog --version $DOCKER surelog -parse hdl/counter.sv -$DOCKER sv2v hdl/counter.sv --write=results/sv2v.v + +$DOCKER verible-verilog-syntax --version $DOCKER verible-verilog-lint hdl/counter.sv + +$DOCKER svlint --version $DOCKER svlint hdl/counter.sv rm -fr slpp_all + +echo "Test passed" From 662bf70950b87f102ef84526b1e2caa6dc6523e1 Mon Sep 17 00:00:00 2001 From: Rodrigo Alejandro Melo Date: Mon, 7 Sep 2026 18:02:46 -0300 Subject: [PATCH 4/5] Add purge script, to remove Docker containers related things --- purge.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 purge.sh diff --git a/purge.sh b/purge.sh new file mode 100644 index 0000000..a611ee1 --- /dev/null +++ b/purge.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -e +docker rmi -f $(docker images -q) +docker system prune -a --volumes -f From 339ba9d1fd7a19a8258e962a80cc8a9f8073b8da Mon Sep 17 00:00:00 2001 From: Rodrigo Alejandro Melo Date: Mon, 7 Sep 2026 18:03:22 -0300 Subject: [PATCH 5/5] Modify build script to use host network and avoid VPN errors --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 669fdb4..c384abb 100644 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ #!/bin/bash set -e IMAGE=$1 -docker build -f recipes/$IMAGE -t ghcr.io/pyfpga/$IMAGE . +docker build -f recipes/$IMAGE --network=host -t ghcr.io/pyfpga/$IMAGE .