From dde9ef04496099d6a4007da230cb4b9fcdc07cc5 Mon Sep 17 00:00:00 2001 From: Kyle Chuang Date: Tue, 22 Aug 2023 15:46:49 +0800 Subject: [PATCH 1/4] [doc] format --- CMakeLists.txt | 146 +++++++++--------- Makefile | 2 +- docs/source/dev_manual/version_number.rst | 2 +- .../tutorials/arch_modeling/quick_start.rst | 2 +- .../getting_started/shell_shortcuts.rst | 2 +- openfpga.sh | 2 +- 6 files changed, 78 insertions(+), 78 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 100351184..ff5475321 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 2.8.12) find_program(CCACHE_FOUND ccache) if(CCACHE_FOUND) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) endif(CCACHE_FOUND) if (${CMAKE_VERSION} VERSION_GREATER "3.8") @@ -92,17 +92,17 @@ set(WITH_PARMYS OFF CACHE BOOL "Enable Yosys as elaborator and parmys-plugin as # TCL file/lib required to link with SWIG generated wrapper if (OPENFPGA_WITH_SWIG) -#Find Tcl - include(FindTCL) - message(STATUS "tcl.h path is : ${TCL_INCLUDE_PATH}") - message(STATUS "libtcl.so path is : ${TCL_LIBRARY}") - -#Find SWIG - find_package(SWIG 3.0 REQUIRED) - if (SWIG_VERSION VERSION_GREATER_EQUAL "4.1.0") - message(WARNING "Using SWIG >= ${SWIG_VERSION} -flatstaticmethod flag for python") - endif() - include(UseSWIG) + #Find Tcl + include(FindTCL) + message(STATUS "tcl.h path is : ${TCL_INCLUDE_PATH}") + message(STATUS "libtcl.so path is : ${TCL_LIBRARY}") + + #Find SWIG + find_package(SWIG 3.0 REQUIRED) + if (SWIG_VERSION VERSION_GREATER_EQUAL "4.1.0") + message(WARNING "Using SWIG >= ${SWIG_VERSION} -flatstaticmethod flag for python") + endif() + include(UseSWIG) endif() #Compiler flag configuration checks @@ -150,71 +150,71 @@ endif() set(WARN_FLAGS "") if (MSVC) - # Visual studio warnings - # Note that we do not use /Wall since it generates warnings about standard library headers - set(WARN_FLAGS_TO_CHECK # the flags to check if the compiler supports - "/W4" # Most warnings - ) + # Visual studio warnings + # Note that we do not use /Wall since it generates warnings about standard library headers + set(WARN_FLAGS_TO_CHECK # the flags to check if the compiler supports + "/W4" # Most warnings + ) else () - set(WARN_FLAGS_TO_CHECK # the flags to check if the compiler supports - #GCC-like - "-Wall" #Most warnings, typically good - "-Wextra" #Extra warning, usually good - "-Wpedantic" #Ensure ISO compliance (i.e. no non-standard extensions) - "-Wcast-qual" #Warn if cast removes qualifier (e.g. const char* -> char*) - "-Wcast-align" #Warn if a cast causes memory alignment changes - "-Wshadow" #Warn if local variable shadows another variable - "-Wformat=2" #Sanity checks for printf-like formatting - "-Wno-format-nonliteral" # But don't worry about non-literal formtting (i.e. run-time printf format strings) - "-Wlogical-op" #Checks for logical op when bit-wise expected - "-Wmissing-declarations" #Warn if a global function is defined with no declaration - "-Wmissing-include-dirs" #Warn if a user include directory is missing - "-Wredundant-decls" #Warn if there are overlapping declarations - "-Wswitch-default" #Warn if a switch has no default - "-Wundef" #Warn if #if() preprocessor refers to an undefined directive - "-Wunused" #Warn about unused variables/parameters - "-Wunused-variable" #Warn about variables that are not used - "-Wunused-parameter" #Warn about function parameters which are unused - "-Wdisabled-optimization" #Warn when optimizations are skipped (usually due to large/complex code) - "-Wnoexcept" #Warn when functions should be noexcept (i.e. compiler know it doesn't throw) - "-Woverloaded-virtual" #Warn when a function declaration overrides a virtual method - "-Wctor-dtor-privacy" #Warn about inaccessible constructors/destructors - "-Wnon-virtual-dtor" #Warn about missing virtual destructors - "-Wduplicated-cond" #Warn about identical conditions in if-else chains - "-Wduplicated-branches" #Warn when different branches of an if-else chain are equivalent - "-Wnull-dereference" #Warn about null pointer dereference execution paths - "-Wuninitialized" #Warn about unitialized values - "-Winit-self" #Warn about self-initialization - "-Wcatch-value=3" #Warn when catch statements don't catch by reference - "-Wextra-semi" #Warn about redudnant semicolons - "-Wimplicit-fallthrough=3" #Warn about case fallthroughs, but allow 'fallthrough' comments to suppress warnings - #GCC-like optional - #"-Wsuggest-final-types" #Suggest where 'final' would help if specified on a type methods - #"-Wsuggest-final-methods" #Suggest where 'final' would help if specified on methods - #"-Wsuggest-override" #Suggest where 'override' should be specified - #"-Wold-style-cast" #Warn about using c-style casts - #"-Wconversion" #Warn when type conversions may change value - #"-Wsign-conversion" #Warn if a conversion may change the sign - #"-Wpadded" #Will warn if additional padding is introduced to a struct/class. Turn on if optimizing class memory layouts - #"-Wstrict-overflow=2" #Warn if the compiler optimizes assuming signed overflow does not occur - #"-Wfloat-equal" #Warn about using direct floating point equality - #"-Wunsafe-loop-optimizations" #Warn when loops can't be optimized - #"-Wswitch-enum" #Warn about uncovered enumeration values in a switch (even if there is a default) - #"-Wsign-promo" #Warn when overload resolution converts an unsigned type to signed when an unsigned overload exists - #"-Wdouble-promotion" #Warn when float is implicitly propted to double - #"-Wuseless-cast" #Warn about casts to the same type - #"-Wzero-as-null-pointer-constant" #Warn about using '0' instead of nullptr - ) + set(WARN_FLAGS_TO_CHECK # the flags to check if the compiler supports + #GCC-like + "-Wall" #Most warnings, typically good + "-Wextra" #Extra warning, usually good + "-Wpedantic" #Ensure ISO compliance (i.e. no non-standard extensions) + "-Wcast-qual" #Warn if cast removes qualifier (e.g. const char* -> char*) + "-Wcast-align" #Warn if a cast causes memory alignment changes + "-Wshadow" #Warn if local variable shadows another variable + "-Wformat=2" #Sanity checks for printf-like formatting + "-Wno-format-nonliteral" # But don't worry about non-literal formatting (i.e. run-time printf format strings) + "-Wlogical-op" #Checks for logical op when bit-wise expected + "-Wmissing-declarations" #Warn if a global function is defined with no declaration + "-Wmissing-include-dirs" #Warn if a user include directory is missing + "-Wredundant-decls" #Warn if there are overlapping declarations + "-Wswitch-default" #Warn if a switch has no default + "-Wundef" #Warn if #if() preprocessor refers to an undefined directive + "-Wunused" #Warn about unused variables/parameters + "-Wunused-variable" #Warn about variables that are not used + "-Wunused-parameter" #Warn about function parameters which are unused + "-Wdisabled-optimization" #Warn when optimizations are skipped (usually due to large/complex code) + "-Wnoexcept" #Warn when functions should be noexcept (i.e. compiler know it doesn't throw) + "-Woverloaded-virtual" #Warn when a function declaration overrides a virtual method + "-Wctor-dtor-privacy" #Warn about inaccessible constructors/destructors + "-Wnon-virtual-dtor" #Warn about missing virtual destructors + "-Wduplicated-cond" #Warn about identical conditions in if-else chains + "-Wduplicated-branches" #Warn when different branches of an if-else chain are equivalent + "-Wnull-dereference" #Warn about null pointer dereference execution paths + "-Wuninitialized" #Warn about uninitialized values + "-Winit-self" #Warn about self-initialization + "-Wcatch-value=3" #Warn when catch statements don't catch by reference + "-Wextra-semi" #Warn about redundant semicolons + "-Wimplicit-fallthrough=3" #Warn about case fallthroughs, but allow 'fallthrough' comments to suppress warnings + #GCC-like optional + #"-Wsuggest-final-types" #Suggest where 'final' would help if specified on a type methods + #"-Wsuggest-final-methods" #Suggest where 'final' would help if specified on methods + #"-Wsuggest-override" #Suggest where 'override' should be specified + #"-Wold-style-cast" #Warn about using c-style casts + #"-Wconversion" #Warn when type conversions may change value + #"-Wsign-conversion" #Warn if a conversion may change the sign + #"-Wpadded" #Will warn if additional padding is introduced to a struct/class. Turn on if optimizing class memory layouts + #"-Wstrict-overflow=2" #Warn if the compiler optimizes assuming signed overflow does not occur + #"-Wfloat-equal" #Warn about using direct floating point equality + #"-Wunsafe-loop-optimizations" #Warn when loops can't be optimized + #"-Wswitch-enum" #Warn about uncovered enumeration values in a switch (even if there is a default) + #"-Wsign-promo" #Warn when overload resolution converts an unsigned type to signed when an unsigned overload exists + #"-Wdouble-promotion" #Warn when float is implicitly prompted to double + #"-Wuseless-cast" #Warn about casts to the same type + #"-Wzero-as-null-pointer-constant" #Warn about using '0' instead of nullptr + ) endif() # check and see if the compiler supports the various warning flags # and add valid flags foreach (flag ${WARN_FLAGS_TO_CHECK}) - CHECK_CXX_COMPILER_FLAG(${flag} CXX_COMPILER_SUPPORTS_${flag}) - if (CXX_COMPILER_SUPPORTS_${flag}) - # flag supported, so enable it - set (WARN_FLAGS "${WARN_FLAGS} ${flag}") - endif() + CHECK_CXX_COMPILER_FLAG(${flag} CXX_COMPILER_SUPPORTS_${flag}) + if (CXX_COMPILER_SUPPORTS_${flag}) + # flag supported, so enable it + set (WARN_FLAGS "${WARN_FLAGS} ${flag}") + endif() endforeach() #Suppress IPO link warnings @@ -301,7 +301,7 @@ option(YOSYS_ENABLE_NDEBUG, "Enable non-debugging feature in compiled yosys" OFF ## Search and link dependent packages ## We need readline to compile if (YOSYS_ENABLE_READLINE) - find_package(Readline REQUIRED) + find_package(Readline REQUIRED) endif() #PugiXml has some deliberate switch fallthrough cases (as indicated by comments), but they diff --git a/Makefile b/Makefile index abb6e0760..e3d23b82a 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ CMAKE_BUILD_TYPE := $(shell echo ${BUILD_TYPE} | sed 's/_\?pgo//' | sed 's/_\?st # e.g. make CMAKE_FLAGS="-DCMAKE_CXX_COMPILER=g++-9' override CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -G 'Unix Makefiles' ${CMAKE_FLAGS} -# -s : Suppresss makefile output (e.g. entering/leaving directories) +# -s : Suppress makefile output (e.g. entering/leaving directories) # --output-sync target : For parallel compilation ensure output for each target is synchronized (make version >= 4.0) MAKEFLAGS := -s diff --git a/docs/source/dev_manual/version_number.rst b/docs/source/dev_manual/version_number.rst index feabce41f..9e75fa9e8 100644 --- a/docs/source/dev_manual/version_number.rst +++ b/docs/source/dev_manual/version_number.rst @@ -42,6 +42,6 @@ Version updates are made in the following scenario - significant improvements on Quality-of-Results (QoR). - significant changes on user interface. - - a techical feature is developed and validated by the community, which can impact the complete design flow. + - a technical feature is developed and validated by the community, which can impact the complete design flow. diff --git a/docs/source/tutorials/arch_modeling/quick_start.rst b/docs/source/tutorials/arch_modeling/quick_start.rst index 1b31300d1..6f2d87f27 100644 --- a/docs/source/tutorials/arch_modeling/quick_start.rst +++ b/docs/source/tutorials/arch_modeling/quick_start.rst @@ -30,7 +30,7 @@ A summary of the architectural features is as follows: - K4N4 Configurable Logic Block (CLB), which consists of four Basic Logic Elements (BLEs) and a fully-connected crossbar. Each BLE contains a 4-input Look-Up Table (LUT), a Flip-Flop (FF) and a 2:1 routing multiplexer - Length-1 routing wires interconnected by Wilton-Style Switch Block (SB) -The VPR architecture description is designed for EDA needs mainly, which lacks the details physical modelingrequired by OpenFPGA. +The VPR architecture description is designed for EDA needs mainly, which lacks the details physical modeling required by OpenFPGA. Here, we show a step-by-step adaption on the architecture template. Physical I/O Modeling diff --git a/docs/source/tutorials/getting_started/shell_shortcuts.rst b/docs/source/tutorials/getting_started/shell_shortcuts.rst index cb5d01bdc..2079b48aa 100644 --- a/docs/source/tutorials/getting_started/shell_shortcuts.rst +++ b/docs/source/tutorials/getting_started/shell_shortcuts.rst @@ -46,7 +46,7 @@ Once the ``openfpga.sh`` script is sourced, you can run any following commands d .. option:: clear-task-run - Clears all run diretories of the given task + Clears all run directories of the given task .. option:: run-modelsim diff --git a/openfpga.sh b/openfpga.sh index 6d2900a11..aad70bea2 100755 --- a/openfpga.sh +++ b/openfpga.sh @@ -132,7 +132,7 @@ goto-task () { done } -# Clears enviroment variables and fucntions +# Clears environment variables and functions unset-openfpga (){ unset -v OPENFPGA_PATH unset -f list-tasks run-task run-flow goto-task goto-root >/dev/null 2>&1 From 972ccd2d83efb43e971050a3f597500cc9eb5fb0 Mon Sep 17 00:00:00 2001 From: Kyle Chuang Date: Tue, 22 Aug 2023 15:51:00 +0800 Subject: [PATCH 2/4] [doc] format --- docs/source/dev_manual/cicd_setup.rst | 18 +++++++++--------- .../manual/file_formats/fabric_bitstream.rst | 4 ++-- docs/source/manual/file_formats/index.rst | 2 +- docs/source/manual/fpga_verilog/testbench.rst | 9 ++++----- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/docs/source/dev_manual/cicd_setup.rst b/docs/source/dev_manual/cicd_setup.rst index 773e07efb..92609ccd3 100644 --- a/docs/source/dev_manual/cicd_setup.rst +++ b/docs/source/dev_manual/cicd_setup.rst @@ -44,7 +44,7 @@ in which case the docker image compiled for the latest master branch is used for ]; RunRegression [ - label = "Run functional regeression test" + label = "Run functional regression test" shape = box ]; @@ -69,7 +69,7 @@ in which case the docker image compiled for the latest master branch is used for .. option:: Build regression test - The OpenFPGA soure is compiled with the following set of compilers. + The OpenFPGA source is compiled with the following set of compilers. #. gcc-7 #. gcc-8 @@ -81,9 +81,9 @@ in which case the docker image compiled for the latest master branch is used for #. clang-8 #. clang-10 - The docker images for these build enviroment are available on `github packages `_. + The docker images for these build environment are available on `github packages `_. -.. option:: Functional regeression test +.. option:: Functional regression test OpenFPGA maintains a set of functional tests to validate the different functionality. The test are broadly catagories into ``basic_reg_test``, ``fpga_verilog_reg_test``, @@ -93,7 +93,7 @@ in which case the docker image compiled for the latest master branch is used for How to debug failed regression test ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -In case the ``funtional regression test`` fails, +In case the ``functional regression test`` fails, the actions script will collect all ``.log`` files from the task directory and upload as a artifacts on github storage. These artifacts can be downloaded from the github website actions tab, for more reference follow `this `_ article. @@ -113,11 +113,11 @@ Release Docker Images CI after cloning repository ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -If you clone the repository the CI setup will still function, except the based images are still pullled from "lnis-uofu" repsitory and the master branch +If you clone the repository the CI setup will still function, except the based images are still pulled from "lnis-uofu" repository and the master branch of cloned repo will not push final docker image to any repository . -**In case you want to host your own copies of OpenFPGA base images** and final release create a githib secret variable with name ``DOCKER_REPO`` and set it to ``true``. This will make ci script to download base images from your own repo pakcages, and upload final realse to the same. +**In case you want to host your own copies of OpenFPGA base images** and final release create a github secret variable with name ``DOCKER_REPO`` and set it to ``true``. This will make ci script to download base images from your own repo packages, and upload final release to the same. -**If you don not want to use docker images based regression test** and like to compile all the bianries for each CI run. You can set ``IGNORE_DOCKER_TEST`` secrete variable to ``true``. +**If you don not want to use docker images based regression test** and like to compile all the binaries for each CI run. You can set ``IGNORE_DOCKER_TEST`` secrete variable to ``true``. -.. note:: Once you add ``DOCKER_REPO`` variable, you need to genrerate base images. To do this trigger mannual workflow ``Build docker CI images`` +.. note:: Once you add ``DOCKER_REPO`` variable, you need to generate base images. To do this trigger manual workflow ``Build docker CI images`` diff --git a/docs/source/manual/file_formats/fabric_bitstream.rst b/docs/source/manual/file_formats/fabric_bitstream.rst index 6cd8085de..eb094d53b 100644 --- a/docs/source/manual/file_formats/fabric_bitstream.rst +++ b/docs/source/manual/file_formats/fabric_bitstream.rst @@ -11,7 +11,7 @@ Plain text (.bit) This file format is designed to be directly loaded to an FPGA fabric. It does not include any comments but only bitstream. -The information depends on the type of configuration procotol. +The information depends on the type of configuration protocol. .. option:: vanilla @@ -232,7 +232,7 @@ A quick example: -Other information may depend on the type of configuration procotol. +Other information may depend on the type of configuration protocol. .. option:: memory_bank diff --git a/docs/source/manual/file_formats/index.rst b/docs/source/manual/file_formats/index.rst index 0cd489293..6a30c2b8b 100644 --- a/docs/source/manual/file_formats/index.rst +++ b/docs/source/manual/file_formats/index.rst @@ -1,7 +1,7 @@ File Formats ------------ -OpenFPGA widely uses XML format for interchangable files +OpenFPGA widely uses XML format for interchangeable files .. _file_formats: diff --git a/docs/source/manual/fpga_verilog/testbench.rst b/docs/source/manual/fpga_verilog/testbench.rst index f4c084620..70e9b5f07 100644 --- a/docs/source/manual/fpga_verilog/testbench.rst +++ b/docs/source/manual/fpga_verilog/testbench.rst @@ -37,7 +37,7 @@ To enable self-testing, the FPGA and user's RTL design (simulate using an HDL si Full Testbench ~~~~~~~~~~~~~~ -Full testbench aims at simulating an entire FPGA operating period, consisting of two phases: +Full testbench aims at simulating an entire FPGA operating period, consisting of two phases: - the **Configuration Phase**, where the synthesized design bitstream is loaded to the programmable fabric, as highlighted by the green rectangle of :numref:`fig_verilog_full_testbench_waveform`; @@ -63,7 +63,7 @@ Inside the directory, the Verilog testbenches are organized as illustrated in :n Hierarchy of Verilog testbenches for a FPGA fabric implemented with an application -.. note:: ```` is the module name of users' RTL design. +.. note:: ```` is the module name of users' RTL design. .. option:: _include_netlist.v @@ -84,9 +84,9 @@ Inside the directory, the Verilog testbenches are organized as illustrated in :n .. option:: _top_formal_verification.v This netlist includes a Verilog module of a pre-configured FPGA fabric, which is a wrapper on top of the ``fpga_top.v`` netlist. - The wrapper module has the same port map as the top-level module of user's RTL design, which be directly def to formal verification tools to validate FPGA's functional equivalence. + The wrapper module has the same port map as the top-level module of user's RTL design, which be directly def to formal verification tools to validate FPGA's functional equivalence. :numref:`fig_preconfig_module` illustrates the organization of a pre-configured module, which consists of a FPGA fabric (see :ref:`fabric_netlists`) and a hard-coded bitstream. - Only used I/Os of FPGA fabric will appear in the port list of the pre-configured module. + Only used I/Os of FPGA fabric will appear in the port list of the pre-configured module. .. _fig_preconfig_module: @@ -94,4 +94,3 @@ Inside the directory, the Verilog testbenches are organized as illustrated in :n :width: 100% Internal structure of a pre-configured FPGA module - From 34f9067a2e68b84d2b0920c7d64ba343e2fffb28 Mon Sep 17 00:00:00 2001 From: Kyle Chuang Date: Tue, 22 Aug 2023 15:51:37 +0800 Subject: [PATCH 3/4] [doc] format --- .../manual/fpga_spice/command_line_usage.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/source/manual/fpga_spice/command_line_usage.rst b/docs/source/manual/fpga_spice/command_line_usage.rst index e7c261ab3..2592d2bb5 100644 --- a/docs/source/manual/fpga_spice/command_line_usage.rst +++ b/docs/source/manual/fpga_spice/command_line_usage.rst @@ -23,16 +23,16 @@ FPGA-SPICE Supported Options:: --fpga_spice_testbench_load_extraction_off --fpga_spice_sim_mt_num -.. note:: FPGA-SPICE requires the input of activity estimation results (\*.act file) from ACE2. - Remember to use the option --activity_file to read the activity file. +.. note:: FPGA-SPICE requires the input of activity estimation results (\*.act file) from ACE2. + Remember to use the option --activity_file to read the activity file. -.. note:: To dump full-chip-level testbenches, the option –-fpga_spice_print_top_testbench should be enabled. - -.. note:: To dump grid-level testbenches, the options -- fpga_spice_print_grid_testbench, -- fpga_spice_print_cb_testbench and -- fpga_spice_print_sb_testbench should be enabled. - -.. note:: To dump component-level testbenches, the options –fpga_spice_print_lut_testbench, --fpga_spice_print_hardlogic_testbench, --fpga_spice_print_pb_mux_testbench, --fpga_spice_print_cb_mux_testbench and --fpga_spice_print_sb_mux_testbench should be enabled. +.. note:: To dump full-chip-level testbenches, the option –-fpga_spice_print_top_testbench should be enabled. -.. csv-table:: Commmand-line Options of FPGA-SPICE +.. note:: To dump grid-level testbenches, the options -- fpga_spice_print_grid_testbench, -- fpga_spice_print_cb_testbench and -- fpga_spice_print_sb_testbench should be enabled. + +.. note:: To dump component-level testbenches, the options –fpga_spice_print_lut_testbench, --fpga_spice_print_hardlogic_testbench, --fpga_spice_print_pb_mux_testbench, --fpga_spice_print_cb_mux_testbench and --fpga_spice_print_sb_mux_testbench should be enabled. + +.. csv-table:: Command-line Options of FPGA-SPICE :header: "Command Options", "Description" :widths: 15, 20 From fe69bbf57f12fb1f2e4d5c9621e80fae6c484a05 Mon Sep 17 00:00:00 2001 From: Kyle Chuang Date: Wed, 23 Aug 2023 14:22:34 +0800 Subject: [PATCH 4/4] Revert CMakeLists.txt from tangxifan suggestion --- CMakeLists.txt | 146 ++++++++++++++++++++++++------------------------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ff5475321..100351184 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 2.8.12) find_program(CCACHE_FOUND ccache) if(CCACHE_FOUND) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) endif(CCACHE_FOUND) if (${CMAKE_VERSION} VERSION_GREATER "3.8") @@ -92,17 +92,17 @@ set(WITH_PARMYS OFF CACHE BOOL "Enable Yosys as elaborator and parmys-plugin as # TCL file/lib required to link with SWIG generated wrapper if (OPENFPGA_WITH_SWIG) - #Find Tcl - include(FindTCL) - message(STATUS "tcl.h path is : ${TCL_INCLUDE_PATH}") - message(STATUS "libtcl.so path is : ${TCL_LIBRARY}") - - #Find SWIG - find_package(SWIG 3.0 REQUIRED) - if (SWIG_VERSION VERSION_GREATER_EQUAL "4.1.0") - message(WARNING "Using SWIG >= ${SWIG_VERSION} -flatstaticmethod flag for python") - endif() - include(UseSWIG) +#Find Tcl + include(FindTCL) + message(STATUS "tcl.h path is : ${TCL_INCLUDE_PATH}") + message(STATUS "libtcl.so path is : ${TCL_LIBRARY}") + +#Find SWIG + find_package(SWIG 3.0 REQUIRED) + if (SWIG_VERSION VERSION_GREATER_EQUAL "4.1.0") + message(WARNING "Using SWIG >= ${SWIG_VERSION} -flatstaticmethod flag for python") + endif() + include(UseSWIG) endif() #Compiler flag configuration checks @@ -150,71 +150,71 @@ endif() set(WARN_FLAGS "") if (MSVC) - # Visual studio warnings - # Note that we do not use /Wall since it generates warnings about standard library headers - set(WARN_FLAGS_TO_CHECK # the flags to check if the compiler supports - "/W4" # Most warnings - ) + # Visual studio warnings + # Note that we do not use /Wall since it generates warnings about standard library headers + set(WARN_FLAGS_TO_CHECK # the flags to check if the compiler supports + "/W4" # Most warnings + ) else () - set(WARN_FLAGS_TO_CHECK # the flags to check if the compiler supports - #GCC-like - "-Wall" #Most warnings, typically good - "-Wextra" #Extra warning, usually good - "-Wpedantic" #Ensure ISO compliance (i.e. no non-standard extensions) - "-Wcast-qual" #Warn if cast removes qualifier (e.g. const char* -> char*) - "-Wcast-align" #Warn if a cast causes memory alignment changes - "-Wshadow" #Warn if local variable shadows another variable - "-Wformat=2" #Sanity checks for printf-like formatting - "-Wno-format-nonliteral" # But don't worry about non-literal formatting (i.e. run-time printf format strings) - "-Wlogical-op" #Checks for logical op when bit-wise expected - "-Wmissing-declarations" #Warn if a global function is defined with no declaration - "-Wmissing-include-dirs" #Warn if a user include directory is missing - "-Wredundant-decls" #Warn if there are overlapping declarations - "-Wswitch-default" #Warn if a switch has no default - "-Wundef" #Warn if #if() preprocessor refers to an undefined directive - "-Wunused" #Warn about unused variables/parameters - "-Wunused-variable" #Warn about variables that are not used - "-Wunused-parameter" #Warn about function parameters which are unused - "-Wdisabled-optimization" #Warn when optimizations are skipped (usually due to large/complex code) - "-Wnoexcept" #Warn when functions should be noexcept (i.e. compiler know it doesn't throw) - "-Woverloaded-virtual" #Warn when a function declaration overrides a virtual method - "-Wctor-dtor-privacy" #Warn about inaccessible constructors/destructors - "-Wnon-virtual-dtor" #Warn about missing virtual destructors - "-Wduplicated-cond" #Warn about identical conditions in if-else chains - "-Wduplicated-branches" #Warn when different branches of an if-else chain are equivalent - "-Wnull-dereference" #Warn about null pointer dereference execution paths - "-Wuninitialized" #Warn about uninitialized values - "-Winit-self" #Warn about self-initialization - "-Wcatch-value=3" #Warn when catch statements don't catch by reference - "-Wextra-semi" #Warn about redundant semicolons - "-Wimplicit-fallthrough=3" #Warn about case fallthroughs, but allow 'fallthrough' comments to suppress warnings - #GCC-like optional - #"-Wsuggest-final-types" #Suggest where 'final' would help if specified on a type methods - #"-Wsuggest-final-methods" #Suggest where 'final' would help if specified on methods - #"-Wsuggest-override" #Suggest where 'override' should be specified - #"-Wold-style-cast" #Warn about using c-style casts - #"-Wconversion" #Warn when type conversions may change value - #"-Wsign-conversion" #Warn if a conversion may change the sign - #"-Wpadded" #Will warn if additional padding is introduced to a struct/class. Turn on if optimizing class memory layouts - #"-Wstrict-overflow=2" #Warn if the compiler optimizes assuming signed overflow does not occur - #"-Wfloat-equal" #Warn about using direct floating point equality - #"-Wunsafe-loop-optimizations" #Warn when loops can't be optimized - #"-Wswitch-enum" #Warn about uncovered enumeration values in a switch (even if there is a default) - #"-Wsign-promo" #Warn when overload resolution converts an unsigned type to signed when an unsigned overload exists - #"-Wdouble-promotion" #Warn when float is implicitly prompted to double - #"-Wuseless-cast" #Warn about casts to the same type - #"-Wzero-as-null-pointer-constant" #Warn about using '0' instead of nullptr - ) + set(WARN_FLAGS_TO_CHECK # the flags to check if the compiler supports + #GCC-like + "-Wall" #Most warnings, typically good + "-Wextra" #Extra warning, usually good + "-Wpedantic" #Ensure ISO compliance (i.e. no non-standard extensions) + "-Wcast-qual" #Warn if cast removes qualifier (e.g. const char* -> char*) + "-Wcast-align" #Warn if a cast causes memory alignment changes + "-Wshadow" #Warn if local variable shadows another variable + "-Wformat=2" #Sanity checks for printf-like formatting + "-Wno-format-nonliteral" # But don't worry about non-literal formtting (i.e. run-time printf format strings) + "-Wlogical-op" #Checks for logical op when bit-wise expected + "-Wmissing-declarations" #Warn if a global function is defined with no declaration + "-Wmissing-include-dirs" #Warn if a user include directory is missing + "-Wredundant-decls" #Warn if there are overlapping declarations + "-Wswitch-default" #Warn if a switch has no default + "-Wundef" #Warn if #if() preprocessor refers to an undefined directive + "-Wunused" #Warn about unused variables/parameters + "-Wunused-variable" #Warn about variables that are not used + "-Wunused-parameter" #Warn about function parameters which are unused + "-Wdisabled-optimization" #Warn when optimizations are skipped (usually due to large/complex code) + "-Wnoexcept" #Warn when functions should be noexcept (i.e. compiler know it doesn't throw) + "-Woverloaded-virtual" #Warn when a function declaration overrides a virtual method + "-Wctor-dtor-privacy" #Warn about inaccessible constructors/destructors + "-Wnon-virtual-dtor" #Warn about missing virtual destructors + "-Wduplicated-cond" #Warn about identical conditions in if-else chains + "-Wduplicated-branches" #Warn when different branches of an if-else chain are equivalent + "-Wnull-dereference" #Warn about null pointer dereference execution paths + "-Wuninitialized" #Warn about unitialized values + "-Winit-self" #Warn about self-initialization + "-Wcatch-value=3" #Warn when catch statements don't catch by reference + "-Wextra-semi" #Warn about redudnant semicolons + "-Wimplicit-fallthrough=3" #Warn about case fallthroughs, but allow 'fallthrough' comments to suppress warnings + #GCC-like optional + #"-Wsuggest-final-types" #Suggest where 'final' would help if specified on a type methods + #"-Wsuggest-final-methods" #Suggest where 'final' would help if specified on methods + #"-Wsuggest-override" #Suggest where 'override' should be specified + #"-Wold-style-cast" #Warn about using c-style casts + #"-Wconversion" #Warn when type conversions may change value + #"-Wsign-conversion" #Warn if a conversion may change the sign + #"-Wpadded" #Will warn if additional padding is introduced to a struct/class. Turn on if optimizing class memory layouts + #"-Wstrict-overflow=2" #Warn if the compiler optimizes assuming signed overflow does not occur + #"-Wfloat-equal" #Warn about using direct floating point equality + #"-Wunsafe-loop-optimizations" #Warn when loops can't be optimized + #"-Wswitch-enum" #Warn about uncovered enumeration values in a switch (even if there is a default) + #"-Wsign-promo" #Warn when overload resolution converts an unsigned type to signed when an unsigned overload exists + #"-Wdouble-promotion" #Warn when float is implicitly propted to double + #"-Wuseless-cast" #Warn about casts to the same type + #"-Wzero-as-null-pointer-constant" #Warn about using '0' instead of nullptr + ) endif() # check and see if the compiler supports the various warning flags # and add valid flags foreach (flag ${WARN_FLAGS_TO_CHECK}) - CHECK_CXX_COMPILER_FLAG(${flag} CXX_COMPILER_SUPPORTS_${flag}) - if (CXX_COMPILER_SUPPORTS_${flag}) - # flag supported, so enable it - set (WARN_FLAGS "${WARN_FLAGS} ${flag}") - endif() + CHECK_CXX_COMPILER_FLAG(${flag} CXX_COMPILER_SUPPORTS_${flag}) + if (CXX_COMPILER_SUPPORTS_${flag}) + # flag supported, so enable it + set (WARN_FLAGS "${WARN_FLAGS} ${flag}") + endif() endforeach() #Suppress IPO link warnings @@ -301,7 +301,7 @@ option(YOSYS_ENABLE_NDEBUG, "Enable non-debugging feature in compiled yosys" OFF ## Search and link dependent packages ## We need readline to compile if (YOSYS_ENABLE_READLINE) - find_package(Readline REQUIRED) + find_package(Readline REQUIRED) endif() #PugiXml has some deliberate switch fallthrough cases (as indicated by comments), but they