From 5b4949601e83691935ca7d0d9ebd0505db042f73 Mon Sep 17 00:00:00 2001 From: AlexandreSinger Date: Thu, 27 Nov 2025 22:54:28 -0500 Subject: [PATCH] [Libs] Removed LibSDCParse LibSDCParse was made a sub-tree; however, I have been reviving the LibSDCParse repo. Since updates will be happening on that repo, this should be a submodule. --- .gitmodules | 3 + libs/EXTERNAL/libsdcparse | 1 + libs/EXTERNAL/libsdcparse/.gitignore | 9 - libs/EXTERNAL/libsdcparse/.travis.yml | 23 - libs/EXTERNAL/libsdcparse/CMakeLists.txt | 69 -- libs/EXTERNAL/libsdcparse/LICENSE.txt | 21 - libs/EXTERNAL/libsdcparse/README.md | 7 - .../cmake/modules/HeadersToIncludeDirs.cmake | 16 - libs/EXTERNAL/libsdcparse/golden.log | 84 --- libs/EXTERNAL/libsdcparse/src/main.cpp | 256 ------- libs/EXTERNAL/libsdcparse/src/sdc_common.cpp | 686 ------------------ libs/EXTERNAL/libsdcparse/src/sdc_common.hpp | 92 --- libs/EXTERNAL/libsdcparse/src/sdc_error.cpp | 46 -- libs/EXTERNAL/libsdcparse/src/sdc_error.hpp | 8 - libs/EXTERNAL/libsdcparse/src/sdc_lexer.cpp | 35 - libs/EXTERNAL/libsdcparse/src/sdc_lexer.hpp | 32 - libs/EXTERNAL/libsdcparse/src/sdc_lexer.l | 170 ----- .../libsdcparse/src/sdc_lexer_fwd.hpp | 9 - libs/EXTERNAL/libsdcparse/src/sdc_parser.hpp | 13 - libs/EXTERNAL/libsdcparse/src/sdc_parser.y | 392 ---------- libs/EXTERNAL/libsdcparse/src/sdcparse.cpp | 51 -- libs/EXTERNAL/libsdcparse/src/sdcparse.hpp | 314 -------- libs/EXTERNAL/libsdcparse/test_sdcs/test.sdc | 53 -- .../EXTERNAL/libsdcparse/test_sdcs/test10.sdc | 9 - .../EXTERNAL/libsdcparse/test_sdcs/test11.sdc | 3 - .../EXTERNAL/libsdcparse/test_sdcs/test12.sdc | 4 - .../EXTERNAL/libsdcparse/test_sdcs/test13.sdc | 4 - .../EXTERNAL/libsdcparse/test_sdcs/test14.sdc | 23 - libs/EXTERNAL/libsdcparse/test_sdcs/test2.sdc | 34 - libs/EXTERNAL/libsdcparse/test_sdcs/test3.sdc | 40 - libs/EXTERNAL/libsdcparse/test_sdcs/test4.sdc | 33 - libs/EXTERNAL/libsdcparse/test_sdcs/test5.sdc | 1 - libs/EXTERNAL/libsdcparse/test_sdcs/test6.sdc | 5 - libs/EXTERNAL/libsdcparse/test_sdcs/test7.sdc | 13 - libs/EXTERNAL/libsdcparse/test_sdcs/test8.sdc | 1 - libs/EXTERNAL/libsdcparse/test_sdcs/test9.sdc | 10 - .../libsdcparse/test_sdcs/test_early_late.sdc | 7 - .../libsdcparse/test_sdcs/test_escape.sdc | 19 - .../libsdcparse/test_sdcs/test_invalid.sdc | 2 - .../libsdcparse/test_sdcs/test_io_min_max.sdc | 5 - .../libsdcparse/test_sdcs/test_parser.sh | 41 -- 41 files changed, 4 insertions(+), 2640 deletions(-) create mode 160000 libs/EXTERNAL/libsdcparse delete mode 100644 libs/EXTERNAL/libsdcparse/.gitignore delete mode 100644 libs/EXTERNAL/libsdcparse/.travis.yml delete mode 100644 libs/EXTERNAL/libsdcparse/CMakeLists.txt delete mode 100644 libs/EXTERNAL/libsdcparse/LICENSE.txt delete mode 100644 libs/EXTERNAL/libsdcparse/README.md delete mode 100644 libs/EXTERNAL/libsdcparse/cmake/modules/HeadersToIncludeDirs.cmake delete mode 100644 libs/EXTERNAL/libsdcparse/golden.log delete mode 100644 libs/EXTERNAL/libsdcparse/src/main.cpp delete mode 100644 libs/EXTERNAL/libsdcparse/src/sdc_common.cpp delete mode 100644 libs/EXTERNAL/libsdcparse/src/sdc_common.hpp delete mode 100644 libs/EXTERNAL/libsdcparse/src/sdc_error.cpp delete mode 100644 libs/EXTERNAL/libsdcparse/src/sdc_error.hpp delete mode 100644 libs/EXTERNAL/libsdcparse/src/sdc_lexer.cpp delete mode 100644 libs/EXTERNAL/libsdcparse/src/sdc_lexer.hpp delete mode 100644 libs/EXTERNAL/libsdcparse/src/sdc_lexer.l delete mode 100644 libs/EXTERNAL/libsdcparse/src/sdc_lexer_fwd.hpp delete mode 100644 libs/EXTERNAL/libsdcparse/src/sdc_parser.hpp delete mode 100644 libs/EXTERNAL/libsdcparse/src/sdc_parser.y delete mode 100644 libs/EXTERNAL/libsdcparse/src/sdcparse.cpp delete mode 100644 libs/EXTERNAL/libsdcparse/src/sdcparse.hpp delete mode 100644 libs/EXTERNAL/libsdcparse/test_sdcs/test.sdc delete mode 100644 libs/EXTERNAL/libsdcparse/test_sdcs/test10.sdc delete mode 100644 libs/EXTERNAL/libsdcparse/test_sdcs/test11.sdc delete mode 100644 libs/EXTERNAL/libsdcparse/test_sdcs/test12.sdc delete mode 100644 libs/EXTERNAL/libsdcparse/test_sdcs/test13.sdc delete mode 100644 libs/EXTERNAL/libsdcparse/test_sdcs/test14.sdc delete mode 100644 libs/EXTERNAL/libsdcparse/test_sdcs/test2.sdc delete mode 100644 libs/EXTERNAL/libsdcparse/test_sdcs/test3.sdc delete mode 100644 libs/EXTERNAL/libsdcparse/test_sdcs/test4.sdc delete mode 100644 libs/EXTERNAL/libsdcparse/test_sdcs/test5.sdc delete mode 100644 libs/EXTERNAL/libsdcparse/test_sdcs/test6.sdc delete mode 100644 libs/EXTERNAL/libsdcparse/test_sdcs/test7.sdc delete mode 100644 libs/EXTERNAL/libsdcparse/test_sdcs/test8.sdc delete mode 100644 libs/EXTERNAL/libsdcparse/test_sdcs/test9.sdc delete mode 100644 libs/EXTERNAL/libsdcparse/test_sdcs/test_early_late.sdc delete mode 100644 libs/EXTERNAL/libsdcparse/test_sdcs/test_escape.sdc delete mode 100644 libs/EXTERNAL/libsdcparse/test_sdcs/test_invalid.sdc delete mode 100644 libs/EXTERNAL/libsdcparse/test_sdcs/test_io_min_max.sdc delete mode 100755 libs/EXTERNAL/libsdcparse/test_sdcs/test_parser.sh diff --git a/.gitmodules b/.gitmodules index b2b3b51feef..3f0d561525d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,6 @@ [submodule "libs/EXTERNAL/yosys-slang"] path = libs/EXTERNAL/yosys-slang url = https://github.com/povik/yosys-slang.git +[submodule "libs/EXTERNAL/libsdcparse"] + path = libs/EXTERNAL/libsdcparse + url = https://github.com/verilog-to-routing/libsdcparse.git diff --git a/libs/EXTERNAL/libsdcparse b/libs/EXTERNAL/libsdcparse new file mode 160000 index 00000000000..219021e663a --- /dev/null +++ b/libs/EXTERNAL/libsdcparse @@ -0,0 +1 @@ +Subproject commit 219021e663a5cb4d3231c669eabd4a2ab561d524 diff --git a/libs/EXTERNAL/libsdcparse/.gitignore b/libs/EXTERNAL/libsdcparse/.gitignore deleted file mode 100644 index e34ac1fa19d..00000000000 --- a/libs/EXTERNAL/libsdcparse/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -build -sdcparse_test -libsdcparse.a -obj/ -src/sdc_lexer.gen.c -src/sdc_lexer.gen.h -src/sdc_parser.gen.c -src/sdc_parser.gen.h -src/stack.hh diff --git a/libs/EXTERNAL/libsdcparse/.travis.yml b/libs/EXTERNAL/libsdcparse/.travis.yml deleted file mode 100644 index 6754e671e2c..00000000000 --- a/libs/EXTERNAL/libsdcparse/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: cpp -dist: trusty #Ubuntu 14.04 by default -sudo: false #Use container based infrastructure - -matrix: - include: - #Extensive testing for base compiler - - env: MATRIX_EVAL="CC=gcc-5 CXX=g++-5" - addons: { apt: { packages: ["cmake", "g++-5", "libtbb-dev", "flex", "bison"], sources: ["ubuntu-toolchain-r-test"] } } -before_install: - - eval "${MATRIX_EVAL}" #Set compiler versions - - echo $CC - - echo $CXX - -script: - #Build - - mkdir -p build - - pushd build - - cmake .. - - make -j2 - - #Test - - ../test_sdcs/test_parser.sh ../test_sdcs/ diff --git a/libs/EXTERNAL/libsdcparse/CMakeLists.txt b/libs/EXTERNAL/libsdcparse/CMakeLists.txt deleted file mode 100644 index 5afc97f3117..00000000000 --- a/libs/EXTERNAL/libsdcparse/CMakeLists.txt +++ /dev/null @@ -1,69 +0,0 @@ -cmake_minimum_required(VERSION 3.16) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) -include(HeadersToIncludeDirs) - -project("libsdcparse") - -if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) - #Only set compiler settings if we are not a sub-project - set(WARN_FLAGS "-Wall -Wextra -Wpedantic -Wcast-qual -Wcast-align -Wshadow -Wformat=2 -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wredundant-decls -Wswitch-default -Wundef -Wunused-variable -Wdisabled-optimization -Wnoexcept -Woverloaded-virtual -Wctor-dtor-privacy -Wnon-virtual-dtor") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++14 ${WARN_FLAGS}") - #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=leak -fsanitize=undefined") - set(FLEX_BISON_WARN_SUPPRESS_FLAGS "-Wno-switch-default -Wno-unused-parameter -Wno-missing-declarations") -endif() - -#Flex and Bison are used to generate the parser -find_package(BISON REQUIRED 3.3) -find_package(FLEX REQUIRED) - -file(GLOB_RECURSE LIB_SOURCES src/sdc*.cpp) -file(GLOB_RECURSE LIB_HEADERS src/sdc*.hpp) -headers_to_include_dirs(LIB_HEADERS LIB_INCLUDE_DIRS) - -#Find the flex and bison input files -file(GLOB_RECURSE LEXER_SOURCES src/sdc*.l) -file(GLOB_RECURSE PARSER_SOURCES src/sdc*.y) - -#Make the flex and bison targets -flex_target(SdcLexer ${LEXER_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/sdc_lexer.gen.cpp - COMPILE_FLAGS --header-file=${CMAKE_CURRENT_BINARY_DIR}/sdc_lexer.gen.hpp) -bison_target(SdcParser ${PARSER_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/sdc_parser.gen.cpp) -add_flex_bison_dependency(SdcLexer SdcParser) - - -#Treat .c as CXX -set_source_files_properties(${LIB_SOURCES} ${FLEX_SdcLexer_OUTPUTS} ${BISON_SdcParser_OUTPUT_SOURCE} PROPERTIES LANGUAGE CXX) - -#Suppress warnings in Flex/Bison generated files -if(FLEX_BISON_WARN_SUPPRESS_FLAGS) - set_source_files_properties(${FLEX_SdcLexer_OUTPUTS} ${BISON_SdcParser_OUTPUT_SOURCE} - PROPERTIES COMPILE_FLAGS ${FLEX_BISON_WARN_SUPPRESS_FLAGS}) -endif() - -#Create the library -add_library(libsdcparse STATIC - ${LIB_HEADERS} - ${LIB_SOURCES} - ${FLEX_SdcLexer_OUTPUTS} - ${BISON_SdcParser_OUTPUT_SOURCE}) -target_include_directories(libsdcparse PUBLIC ${LIB_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}) -set_target_properties(libsdcparse PROPERTIES PREFIX "") #Avoid extra 'lib' prefix - -#Create the test executable -add_executable(sdcparse_test src/main.cpp) -target_link_libraries(sdcparse_test libsdcparse) - -#Suppress IPO link warnings -get_target_property(USES_IPO sdcparse_test INTERPROCEDURAL_OPTIMIZATION) -if (USES_IPO) - set(IPO_LINK_WARN_FLAGS_TO_CHECK "-Wno-null-dereference") - foreach(flag ${IPO_LINK_WARN_FLAGS_TO_CHECK}) - CHECK_CXX_COMPILER_FLAG(${flag} CXX_COMPILER_SUPPORTS_${flag}) - if(CXX_COMPILER_SUPPORTS_${flag}) - #Flag supported, so enable it - set_property(TARGET sdcparse_test APPEND PROPERTY LINK_FLAGS ${flag}) - endif() - endforeach() -endif() - -install(TARGETS libsdcparse DESTINATION bin) diff --git a/libs/EXTERNAL/libsdcparse/LICENSE.txt b/libs/EXTERNAL/libsdcparse/LICENSE.txt deleted file mode 100644 index 3fcb3c18e34..00000000000 --- a/libs/EXTERNAL/libsdcparse/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Kevin E. Murray - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/libs/EXTERNAL/libsdcparse/README.md b/libs/EXTERNAL/libsdcparse/README.md deleted file mode 100644 index d58a3b492aa..00000000000 --- a/libs/EXTERNAL/libsdcparse/README.md +++ /dev/null @@ -1,7 +0,0 @@ -libsdcparse ----------------------------------- - -This library provides a parser for a subset of the Synopsys Design Constriant (SDC) -language. See comments at the top of 'src/sdc.hpp' for more detailed information and -usage. - diff --git a/libs/EXTERNAL/libsdcparse/cmake/modules/HeadersToIncludeDirs.cmake b/libs/EXTERNAL/libsdcparse/cmake/modules/HeadersToIncludeDirs.cmake deleted file mode 100644 index 6967cad1850..00000000000 --- a/libs/EXTERNAL/libsdcparse/cmake/modules/HeadersToIncludeDirs.cmake +++ /dev/null @@ -1,16 +0,0 @@ -function(headers_to_include_dirs header_file_list include_directory_list) - #Extract the directories for each header file - foreach(header ${${header_file_list}}) - get_filename_component(incl_dir ${header} DIRECTORY) - list(APPEND dir_list ${incl_dir}) - endforeach() - - #Remove any duplicates - list(LENGTH "${dir_list}" length) - if(${length} GREATER 1) #Avoid error with zero-length lists - list(REMOVE_DUPLICATES ${dir_list}) - endif() - - #Set the second argument in the caller's scope - set(${include_directory_list} ${dir_list} PARENT_SCOPE) -endfunction(headers_to_include_dirs) diff --git a/libs/EXTERNAL/libsdcparse/golden.log b/libs/EXTERNAL/libsdcparse/golden.log deleted file mode 100644 index f6b66d21020..00000000000 --- a/libs/EXTERNAL/libsdcparse/golden.log +++ /dev/null @@ -1,84 +0,0 @@ - -File: ../test_sdcs/test.sdc -Line 3: create_clock -period 3.000000 -waveform {1.250000 2.750000} {clk0} -Line 4: create_clock -period 3.000000 -waveform {1.000000 2.000000} {clk1} -Line 5: create_clock -period 2.300000 -waveform {0.000000 1.150000} {clk2} -Line 7: create_clock -period 2.000000 -waveform {0.000000 1.000000} {clk3 clk4} -Line 9: create_clock -period 1.000000 -waveform {0.000000 0.500000} -name input_clk -Line 11: create_clock -period 0.000000 -waveform {0.000000 0.000000} -name output_clk -Line 35: set_input_delay -clock input_clk -max 0.500000 [get_ports {in1 in2 in3}] -Line 37: set_output_delay -clock output_clk -max 1.000000 [get_ports {out*}] -Line 41: set_output_delay -clock eof_test -max 1.729300 [get_ports {eof_test_port*}] -Line 13: set_clock_groups -exclusive -group {input_clk} -group {clk2} -group [get_clocks {clk3}] -Line 15: set_clock_groups -exclusive -group {input_clk input_clock2} -group {clk2} -group [get_clocks {asdf qwerty}] -Line 17: set_false_path -from [get_clocks {clk}] -to [get_clocks {output_clk}] -Line 18: set_false_path -from {asdf~/ff} -to {wer/234/ff3 xcw/32|ff2} -Line 19: set_false_path -from {asdf/ff qwert/asd/ff} -to [get_clocks {output_clk}] -Line 21: set_false_path -from [get_clocks {output_clk}] -to {asdf/ff2} -Line 23: set_max_delay 2.000000 -from [get_clocks {clk}] -to [get_clocks {output_clk}] -Line 24: set_max_delay 3.600000 -from {asdf~/ff} -to {wer/234/ff3 xcw/32|ff2} -Line 25: set_max_delay 0.300000 -from {asdf/ff qwert/asd/ff} -to [get_clocks {output_clk}] -Line 27: set_max_delay 0.000000 -from [get_clocks {output_clk}] -to {asdf/ff2} -Line 29: set_multicycle_path 2 -setup -from [get_clocks {clk}] -to [get_clocks {output_clk}] -Line 30: set_multicycle_path 3 -setup -from {asdf~/ff} -to {wer/234/ff3 xcw/32|ff2} -Line 31: set_multicycle_path 3 -setup -from {asdf/ff qwert/asd/ff} -to [get_clocks {output_clk}] -Line 33: set_multicycle_path 0 -setup -from [get_clocks {output_clk}] -to {asdf/ff2} - -File: ../test_sdcs/test5.sdc -Line 1: create_clock -period 0.000000 -waveform {0.000000 0.000000} {*} - -File: ../test_sdcs/test2.sdc -Line 12: create_clock -period 1.000000 -waveform {0.000000 0.500000} -name virtual_io_clock -Line 13: create_clock -period 1.000000 -waveform {0.000000 0.500000} {clk0} -Line 14: create_clock -period 1.000000 -waveform {0.000000 0.500000} {a[0]} -Line 16: create_clock -period 1.000000 -waveform {0.000000 0.500000} {pll_minres:inst_pll_minres|altpll:altpll_component|pll_minres_altpll:auto_generated|wire_pll1_clk[0]} -Line 26: set_input_delay -clock virtual_io_clock -max 0.000000 [get_ports {*}] -Line 31: set_output_delay -clock virtual_io_clock -max 0.000000 [get_ports {*}] -Line 35: set_clock_groups -exclusive -group {clk0} -group {pll_minres:inst_pll_minres|altpll:altpll_component|pll_minres_altpll:auto_generated|wire_pll1_clk[0]} - -File: ../test_sdcs/test3.sdc -Line 12: create_clock -period 1.000000 -waveform {0.000000 0.500000} -name virtual_io_clock -Line 13: create_clock -period 1.000000 -waveform {0.000000 0.500000} {clk} -Line 14: create_clock -period 1.000000 -waveform {0.000000 0.500000} {pll_noc_type0:\using_pll:separate_clk:noc_pll_0|altpll:altpll_component|pll_noc_type0_altpll:auto_generated|wire_pll1_clk[0]} -Line 15: create_clock -period 1.000000 -waveform {0.000000 0.500000} {pll_noc_type1:\using_pll:use_noc_pll_1:noc_pll_1|altpll:altpll_component|pll_noc_type1_altpll:auto_generated|wire_pll1_clk[0]} -Line 16: create_clock -period 1.000000 -waveform {0.000000 0.500000} {pll_noc_type2:\using_pll:use_noc_pll_2:noc_pll_2|altpll:altpll_component|pll_noc_type2_altpll:auto_generated|wire_pll1_clk[0]} -Line 17: create_clock -period 1.000000 -waveform {0.000000 0.500000} {pll_noc_type5:\using_pll:use_noc_pll_5:noc_pll_5|altpll:altpll_component|pll_noc_type5_altpll:auto_generated|wire_pll1_clk[0]} -Line 18: create_clock -period 1.000000 -waveform {0.000000 0.500000} {pll_noc_type4:\using_pll:use_noc_pll_4:noc_pll_4|altpll:altpll_component|pll_noc_type4_altpll:auto_generated|wire_pll1_clk[0]} -Line 19: create_clock -period 1.000000 -waveform {0.000000 0.500000} {pll_noc_type3:\using_pll:use_noc_pll_3:noc_pll_3|altpll:altpll_component|pll_noc_type3_altpll:auto_generated|wire_pll1_clk[0]} -Line 20: create_clock -period 1.000000 -waveform {0.000000 0.500000} {pll_noc_type6:\using_pll:use_noc_pll_6:noc_pll_6|altpll:altpll_component|pll_noc_type6_altpll:auto_generated|wire_pll1_clk[0]} -Line 22: create_clock -period 1.000000 -waveform {0.000000 0.500000} {pll_noc_type7:\using_pll:use_noc_pll_7:noc_pll_7|altpll:altpll_component|pll_noc_type7_altpll:auto_generated|wire_pll1_clk[0]} -Line 32: set_input_delay -clock virtual_io_clock -max 0.000000 [get_ports {*}] -Line 37: set_output_delay -clock virtual_io_clock -max 0.000000 [get_ports {*}] -Line 41: set_clock_groups -exclusive -group {clk} -group {pll_noc_type0:\using_pll:separate_clk:noc_pll_0|altpll:altpll_component|pll_noc_type0_altpll:auto_generated|wire_pll1_clk[0]} -group {pll_noc_type1:\using_pll:use_noc_pll_1:noc_pll_1|altpll:altpll_component|pll_noc_type1_altpll:auto_generated|wire_pll1_clk[0]} -group {pll_noc_type2:\using_pll:use_noc_pll_2:noc_pll_2|altpll:altpll_component|pll_noc_type2_altpll:auto_generated|wire_pll1_clk[0]} -group {pll_noc_type5:\using_pll:use_noc_pll_5:noc_pll_5|altpll:altpll_component|pll_noc_type5_altpll:auto_generated|wire_pll1_clk[0]} -group {pll_noc_type4:\using_pll:use_noc_pll_4:noc_pll_4|altpll:altpll_component|pll_noc_type4_altpll:auto_generated|wire_pll1_clk[0]} -group {pll_noc_type3:\using_pll:use_noc_pll_3:noc_pll_3|altpll:altpll_component|pll_noc_type3_altpll:auto_generated|wire_pll1_clk[0]} -group {pll_noc_type6:\using_pll:use_noc_pll_6:noc_pll_6|altpll:altpll_component|pll_noc_type6_altpll:auto_generated|wire_pll1_clk[0]} -group {pll_noc_type7:\using_pll:use_noc_pll_7:noc_pll_7|altpll:altpll_component|pll_noc_type7_altpll:auto_generated|wire_pll1_clk[0]} - -File: ../test_sdcs/test4.sdc -Line 12: create_clock -period 1.000000 -waveform {0.000000 0.500000} -name virtual_io_clock -Line 13: create_clock -period 1.000000 -waveform {0.000000 0.500000} {pll:pll_inst|altpll:altpll_component|pll_altpll:auto_generated|wire_pll1_clk[0]} -Line 15: create_clock -period 1.000000 -waveform {0.000000 0.500000} {OSC_CLK} -Line 25: set_input_delay -clock virtual_io_clock -max 0.000000 [get_ports {*}] -Line 30: set_output_delay -clock virtual_io_clock -max 0.000000 [get_ports {*}] -Line 34: set_clock_groups -exclusive -group {pll:pll_inst|altpll:altpll_component|pll_altpll:auto_generated|wire_pll1_clk[0]} -group {OSC_CLK} - -File: ../test_sdcs/test7.sdc -Line 2: create_clock -period 3.000000 -waveform {1.250000 2.750000} {clk} -Line 3: create_clock -period 2.000000 -waveform {0.000000 1.000000} {clk2 clk_extra} -Line 4: create_clock -period 1.000000 -waveform {0.000000 0.500000} -name input_clk -Line 5: create_clock -period 0.000000 -waveform {0.000000 0.000000} -name output_clk -Line 10: set_input_delay -clock input_clk -max 0.500000 [get_ports {in1 in2 in3}] -Line 12: set_output_delay -clock output_clk -max 1.000000 [get_ports {out*}] -Line 6: set_clock_groups -exclusive -group {input_clk} -group {clk2} -Line 7: set_false_path -from [get_clocks {clk}] -to [get_clocks {output_clk}] -Line 8: set_max_delay 17.000000 -from [get_clocks {input_clk}] -to [get_clocks {output_clk}] -Line 9: set_multicycle_path 5 -setup -from [get_clocks {clk}] -to [get_clocks {clk2}] - -File: ../test_sdcs/test_invalid.sdc -Custom Error at line 2 near '-max': syntax error, unexpected -max, expecting -from or -to or end-of-line -Custom Error at line 0 near '': SDC Error: file failed to parse! - - -File: ../test_sdcs/test6.sdc -Line 2: create_clock -period 3.000000 -waveform {1.250000 2.750000} {clk} -Line 3: create_clock -period 2.000000 -waveform {0.000000 1.000000} {clk2} -Line 4: create_clock -period 2.500000 -waveform {0.000000 1.250000} -name virtual_io_clock -Line 5: set_input_delay -clock virtual_io_clock -max 1.000000 [get_ports {*}] -Line 6: set_output_delay -clock virtual_io_clock -max 0.500000 [get_ports {*}] diff --git a/libs/EXTERNAL/libsdcparse/src/main.cpp b/libs/EXTERNAL/libsdcparse/src/main.cpp deleted file mode 100644 index c8c56f3b20f..00000000000 --- a/libs/EXTERNAL/libsdcparse/src/main.cpp +++ /dev/null @@ -1,256 +0,0 @@ -#include -#include -#include -#include "sdcparse.hpp" - -using namespace sdcparse; - -void print_string_group(const StringGroup& group); -void print_from_to_group(const StringGroup& from, const StringGroup& to); - -class PrintCallback : public Callback { -public: - //Start of parsing - void start_parse() override { } - - //Sets current filename - void filename(std::string fname) override { filename_ = fname; } - - //Sets current line number - void lineno(int line_num) override { lineno_ = line_num; } - - void create_clock(const CreateClock& cmd) override { - printf("#%s:%d\n", filename_.c_str(), lineno_); - printf("create_clock -period %f -waveform {%f %f} ", - cmd.period, - cmd.rise_edge, - cmd.fall_edge); - if(cmd.is_virtual) { - printf("-name %s", - cmd.name.c_str()); - } else { - print_string_group(cmd.targets); - } - printf("\n"); - } - - void set_io_delay(const SetIoDelay& cmd) override { - printf("#%s:%d\n", filename_.c_str(), lineno_); - if(cmd.type == IoDelayType::INPUT) { - printf("set_input_delay"); - } else { - printf("set_output_delay"); - } - printf(" -clock %s", cmd.clock_name.c_str()); - - if (cmd.is_max) { - printf(" -max"); - } - if (cmd.is_min) { - printf(" -min"); - } - printf(" %f ", cmd.delay); - print_string_group(cmd.target_ports); - printf("\n"); - - } - void set_clock_groups(const SetClockGroups& cmd) override { - printf("#%s:%d\n", filename_.c_str(), lineno_); - printf("set_clock_groups"); - if(cmd.type == ClockGroupsType::EXCLUSIVE) { - printf(" -exclusive"); - } - for(const auto& clk_grp : cmd.clock_groups) { - printf(" -group "); - print_string_group(clk_grp); - } - printf("\n"); - - } - - void set_false_path(const SetFalsePath& cmd) override { - printf("#%s:%d\n", filename_.c_str(), lineno_); - printf("set_false_path "); - print_from_to_group(cmd.from, cmd.to); - printf("\n"); - } - void set_min_max_delay(const SetMinMaxDelay& cmd) override { - printf("#%s:%d\n", filename_.c_str(), lineno_); - if(cmd.type == MinMaxType::MAX) { - printf("set_max_delay"); - } else { - printf("set_min_delay"); - } - printf(" %f ", cmd.value); - print_from_to_group(cmd.from, cmd.to); - printf("\n"); - } - void set_multicycle_path(const SetMulticyclePath& cmd) override { - printf("#%s:%d\n", filename_.c_str(), lineno_); - printf("set_multicycle_path %d ", cmd.mcp_value); - if(cmd.is_setup) { - printf("-setup "); - } - if(cmd.is_hold) { - printf("-hold "); - } - print_from_to_group(cmd.from, cmd.to); - printf("\n"); - } - void set_clock_uncertainty(const SetClockUncertainty& cmd) override { - printf("#%s:%d\n", filename_.c_str(), lineno_); - printf("set_clock_uncertainty "); - if(cmd.is_setup) { - printf("-setup "); - } - if(cmd.is_hold) { - printf("-hold "); - } - print_from_to_group(cmd.from, cmd.to); - printf(" %f ", cmd.value); - printf("\n"); - } - void set_clock_latency(const SetClockLatency& cmd) override { - printf("#%s:%d\n", filename_.c_str(), lineno_); - printf("set_clock_latency "); - if(cmd.type == ClockLatencyType::SOURCE) { - printf("-source "); - } - if(cmd.is_early) { - printf("-early "); - } - if(cmd.is_late) { - printf("-late "); - } - printf("%f ", cmd.value); - print_string_group(cmd.target_clocks); - printf("\n"); - } - void set_disable_timing(const SetDisableTiming& cmd) override { - printf("#%s:%d\n", filename_.c_str(), lineno_); - printf("set_disable_timing "); - print_from_to_group(cmd.from, cmd.to); - printf("\n"); - - } - void set_timing_derate(const SetTimingDerate& cmd) override { - printf("#%s:%d\n", filename_.c_str(), lineno_); - printf("set_timing_derate "); - if(cmd.is_early) { - printf("-early "); - } - if(cmd.is_late) { - printf("-late "); - } - - if(cmd.derate_nets) { - printf("-net_delay "); - } - if(cmd.derate_cells) { - printf("-cell_delay "); - } - printf("%f ", cmd.value); - print_string_group(cmd.cell_targets); - printf("\n"); - } - - //End of parsing - void finish_parse() override { } - - //Error during parsing - void parse_error(const int curr_lineno, const std::string& near_text, const std::string& msg) override { - fprintf(stderr, "Custom Error"); - if(curr_lineno > 0) { - fprintf(stderr, " at line %d", curr_lineno); - } - if(near_text != "") { - if(near_text == "\n") { - fprintf(stderr, " near '\\n'"); - } else if(near_text == "\n\r") { - fprintf(stderr, " near '\\n\\r'"); - } else { - fprintf(stderr, " near '%s'", near_text.c_str()); - } - } - fprintf(stderr, ": %s\n", msg.c_str()); - error_ = true; - } - - bool error() { return error_; } - -private: - std::string filename_ = ""; - int lineno_ = 0; - bool error_ = false; - -}; - -int main(int argc, char **argv) { - if(argc != 2) { - fprintf(stderr, "Usage: %s filename.sdc\n", argv[0]); - fprintf(stderr, "\n"); - fprintf(stderr, "Reads in an SDC file into internal data structures\n"); - fprintf(stderr, "and then prints it out\n"); - exit(1); - } - - PrintCallback callback; - sdc_parse_filename(argv[1], callback); - - if(callback.error()) { - return 1; - } - return 0; -} - -void print_string_group(const StringGroup& group) { - const char *start_token, *end_token; - if(group.type == StringGroupType::STRING) { - start_token = "{"; - end_token = "}"; - - } else if (group.type == StringGroupType::CLOCK) { - start_token = "[get_clocks {"; - end_token = "}]"; - - } else if (group.type == StringGroupType::PORT) { - start_token = "[get_ports {"; - end_token = "}]"; - - } else if (group.type == StringGroupType::CELL) { - start_token = "[get_cells {"; - end_token = "}]"; - } else if (group.type == StringGroupType::PIN) { - start_token = "[get_pins {"; - end_token = "}]"; - - } else { - printf("Unsupported sdc string group type\n"); - exit(1); - } - - if(!group.strings.empty()) { - printf("%s", start_token); - for(size_t i = 0; i < group.strings.size(); ++i) { - printf("%s", group.strings[i].c_str()); - - if(i != group.strings.size() - 1) { - printf(" "); - } - } - printf("%s", end_token); - } -} - -void print_from_to_group(const StringGroup& from, const StringGroup& to) { - if(!from.strings.empty()) { - printf("-from "); - print_string_group(from); - } - - if(!to.strings.empty()) { - printf(" -to "); - print_string_group(to); - } -} - diff --git a/libs/EXTERNAL/libsdcparse/src/sdc_common.cpp b/libs/EXTERNAL/libsdcparse/src/sdc_common.cpp deleted file mode 100644 index 4080d4bd81c..00000000000 --- a/libs/EXTERNAL/libsdcparse/src/sdc_common.cpp +++ /dev/null @@ -1,686 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "sdc_common.hpp" -#include "sdc_error.hpp" - -namespace sdcparse { - -/* - * Functions for create_clock - */ -void sdc_create_clock_set_period(Callback& callback, const Lexer& lexer, CreateClock& sdc_create_clock, double period) { - if(!std::isnan(sdc_create_clock.period)) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Can only define a single clock period.\n"); - } else { - sdc_create_clock.period = period; - } -} - -void sdc_create_clock_set_name(Callback& callback, const Lexer& lexer, CreateClock& sdc_create_clock, const std::string& name) { - if(!sdc_create_clock.name.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Can only define a single clock name.\n"); - } else { - sdc_create_clock.name = name; - } -} - -void sdc_create_clock_set_waveform(Callback& callback, const Lexer& lexer, CreateClock& sdc_create_clock, double rise_edge, double fall_edge) { - if(!std::isnan(sdc_create_clock.rise_edge) || !std::isnan(sdc_create_clock.fall_edge)) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Can only define a single waveform.\n"); - } else { - sdc_create_clock.rise_edge = rise_edge; - sdc_create_clock.fall_edge = fall_edge; - } -} - -void sdc_create_clock_add_targets(Callback& callback, const Lexer& lexer, CreateClock& sdc_create_clock, StringGroup target_group) { - assert(target_group.type == StringGroupType::STRING); - - if(!sdc_create_clock.targets.strings.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Can only define a single set of targets for clock creation. " - "If you want to define multiple targets specify them as a list (e.g. \"{target1 target2}\").\n"); - } - - sdc_create_clock.targets = target_group; -} - -void add_sdc_create_clock(Callback& callback, const Lexer& lexer, CreateClock& sdc_create_clock) { - /* - * Error Checking - */ - - //Must have a clock period - if(std::isnan(sdc_create_clock.period)) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Must define clock period.\n"); - } - - //Must have either a target (if a netlist clock), or a name (if a virtual clock) - if(sdc_create_clock.targets.strings.size() == 0 && sdc_create_clock.name.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Must define either a target (for netlist clock) or a name (for virtual clock).\n"); - } - - //Currently we do not support defining clock names that differ from the netlist target name - if(sdc_create_clock.targets.strings.size() != 0 && !sdc_create_clock.name.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Currently custom names for netlist clocks are unsupported, remove '-name' option or create a virtual clock.\n"); - } - - /* - * Set defaults - */ - //Determine default rise/fall time for waveform - if(std::isnan(sdc_create_clock.rise_edge) && std::isnan(sdc_create_clock.fall_edge)) { - sdc_create_clock.rise_edge = 0.0; - sdc_create_clock.fall_edge = sdc_create_clock.period / 2; - } - assert(!std::isnan(sdc_create_clock.rise_edge)); - assert(!std::isnan(sdc_create_clock.fall_edge)); - - //Determine if clock is virtual or not - if(sdc_create_clock.targets.strings.size() == 0 && !sdc_create_clock.name.empty()) { - //Have a virtual target if there is a name AND no target strings - sdc_create_clock.is_virtual = true; - } else { - assert(sdc_create_clock.targets.strings.size() > 0); - //Have a real target so this is not a virtual clock - sdc_create_clock.is_virtual = false; - } - - /* - * Add command - */ - callback.create_clock(sdc_create_clock); - -} - -/* - * Functions for set_input_delay/set_output_delay - */ -void sdc_set_io_delay_set_clock(Callback& callback, const Lexer& lexer, SetIoDelay& sdc_set_io_delay, const std::string& clock_name) { - if(!sdc_set_io_delay.clock_name.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Can only specify a single clock\n"); - } - - sdc_set_io_delay.clock_name = clock_name; -} - -void sdc_set_io_delay_set_value(Callback& callback, const Lexer& lexer, SetIoDelay& sdc_set_io_delay, double value) { - if(!std::isnan(sdc_set_io_delay.delay)) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Delay value can only specified once.\n"); - } - - sdc_set_io_delay.delay = value; -} - -void sdc_set_io_delay_set_max(Callback& callback, const Lexer& lexer, SetIoDelay& sdc_set_io_delay) { - if (sdc_set_io_delay.is_max) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "-max can only be specified once.\n"); - } - - sdc_set_io_delay.is_max = true; -} - -void sdc_set_io_delay_set_min(Callback& callback, const Lexer& lexer, SetIoDelay& sdc_set_io_delay) { - if (sdc_set_io_delay.is_min) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "-min can only be specified once.\n"); - } - - sdc_set_io_delay.is_min = true; -} - -void sdc_set_io_delay_set_ports(Callback& callback, const Lexer& lexer, SetIoDelay& sdc_set_io_delay, StringGroup ports) { - assert(ports.type == StringGroupType::PORT); - - if(!sdc_set_io_delay.target_ports.strings.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Currently only a single get_ports command is supported.\n"); - } - - sdc_set_io_delay.target_ports = ports; -} - -void add_sdc_set_io_delay(Callback& callback, const Lexer& lexer, SetIoDelay& sdc_set_io_delay) { - /* - * Error checks - */ - if(sdc_set_io_delay.clock_name.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Must specify clock name.\n"); - } - - if(std::isnan(sdc_set_io_delay.delay)) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Must specify delay value.\n"); - } - - if(sdc_set_io_delay.target_ports.strings.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Must specify target ports using get_ports.\n"); - } - - /* - * Add command - */ - callback.set_io_delay(sdc_set_io_delay); -} - -/* - * Functions for set_clock_groups - */ -void sdc_set_clock_groups_set_type(Callback& callback, const Lexer& lexer, SetClockGroups& sdc_set_clock_groups, ClockGroupsType type) { - if(sdc_set_clock_groups.type != ClockGroupsType::NONE) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Can only specify a single clock groups relation type (e.g. '-exclusive')\n"); - } - - sdc_set_clock_groups.type = type; -} - -void sdc_set_clock_groups_add_group(Callback& /*callback*/, const Lexer& /*lexer*/, SetClockGroups& sdc_set_clock_groups, StringGroup clock_group) { - assert(clock_group.type == StringGroupType::CLOCK || clock_group.type == StringGroupType::STRING); - - //Duplicate and insert the clock group - sdc_set_clock_groups.clock_groups.push_back(clock_group); -} - -void add_sdc_set_clock_groups(Callback& callback, const Lexer& lexer, SetClockGroups& sdc_set_clock_groups) { - /* - * Error checks - */ - if(sdc_set_clock_groups.type == ClockGroupsType::NONE) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Must specify clock relation type as '-exclusive'.\n"); - } - - if(sdc_set_clock_groups.clock_groups.size() < 2) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Must specify at least 2 clock groups.\n"); - } - - /* - * Add command - */ - callback.set_clock_groups(sdc_set_clock_groups); -} - -/* - * Functions for set_false_path - */ -void sdc_set_false_path_add_to_from_group(Callback& callback, const Lexer& lexer, - SetFalsePath& sdc_set_false_path, - StringGroup group, - FromToType to_from_dir) { - assert(group.type == StringGroupType::CLOCK || group.type == StringGroupType::STRING); - - //Error checking - if(to_from_dir == FromToType::FROM) { - //Check that we haven't already defined the from path - if(!sdc_set_false_path.from.strings.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Only a single '-from' option is supported.\n"); - } - } else { - assert(to_from_dir == FromToType::TO); - //Check that we haven't already defined the from path - if(!sdc_set_false_path.to.strings.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Only a single '-to' option is supported.\n"); - } - } - - //Add the clock group - if(to_from_dir == FromToType::FROM) { - sdc_set_false_path.from = group; - } else { - assert(to_from_dir == FromToType::TO); - sdc_set_false_path.to = group; - } -} - -void add_sdc_set_false_path(Callback& callback, const Lexer& /*lexer*/, SetFalsePath& sdc_set_false_path) { - /* - * Error checks - */ - - /* - * Add command - */ - callback.set_false_path(sdc_set_false_path); - -} - -/* - * Functions for set_max_delay/set_min_delay - */ -void sdc_set_min_max_delay_set_value(Callback& callback, const Lexer& lexer, SetMinMaxDelay& sdc_set_min_max_delay, double min_max_delay) { - if(!std::isnan(sdc_set_min_max_delay.value)) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Must specify max delay value only once.\n"); - } - sdc_set_min_max_delay.value = min_max_delay; -} - -void sdc_set_min_max_delay_add_to_from_group(Callback& callback, const Lexer& lexer, SetMinMaxDelay& sdc_set_min_max_delay, StringGroup group, FromToType to_from_dir) { - assert(group.type == StringGroupType::CLOCK || group.type == StringGroupType::STRING); - - //Error checking - if(to_from_dir == FromToType::FROM) { - //Check that we haven't already defined the from path - if(!sdc_set_min_max_delay.from.strings.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Only a single '-from' option is supported.\n"); - } - } else { - assert(to_from_dir == FromToType::TO); - //Check that we haven't already defined the from path - if(!sdc_set_min_max_delay.to.strings.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Only a single '-to' option is supported.\n"); - } - } - - //Add the clock group - if(to_from_dir == FromToType::FROM) { - sdc_set_min_max_delay.from = group; - } else { - assert(to_from_dir == FromToType::TO); - sdc_set_min_max_delay.to = group; - } -} - -void add_sdc_set_min_max_delay(Callback& callback, const Lexer& lexer, SetMinMaxDelay& sdc_set_min_max_delay) { - /* - * Error checks - */ - if(std::isnan(sdc_set_min_max_delay.value)) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Must specify the max delay value.\n"); - } - - /* - * Add command - */ - callback.set_min_max_delay(sdc_set_min_max_delay); - -} - -/* - * Functions for set_multicycle_path - */ -void sdc_set_multicycle_path_set_setup(Callback& callback, const Lexer& lexer, SetMulticyclePath& sdc_set_multicycle_path) { - if(sdc_set_multicycle_path.is_setup) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "'-setup' should only be specified once.\n"); - } - sdc_set_multicycle_path.is_setup = true; -} - -void sdc_set_multicycle_path_set_hold(Callback& callback, const Lexer& lexer, SetMulticyclePath& sdc_set_multicycle_path) { - if(sdc_set_multicycle_path.is_hold) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "'-hold' should only be specified once.\n"); - } - sdc_set_multicycle_path.is_hold = true; -} - -void sdc_set_multicycle_path_set_mcp_value(Callback& callback, const Lexer& lexer, SetMulticyclePath& sdc_set_multicycle_path, int mcp_value) { - if(sdc_set_multicycle_path.mcp_value != UNINITIALIZED_INT) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Must specify multicycle path value only once.\n"); - } - sdc_set_multicycle_path.mcp_value = mcp_value; -} - -void sdc_set_multicycle_path_add_to_from_group(Callback& callback, const Lexer& lexer, SetMulticyclePath& sdc_set_multicycle_path, - StringGroup group, - FromToType to_from_dir) { - assert(group.type == StringGroupType::CLOCK || group.type == StringGroupType::STRING || group.type == StringGroupType::PIN); - - //Error checking - if(to_from_dir == FromToType::FROM) { - //Check that we haven't already defined the from path - if(!sdc_set_multicycle_path.from.strings.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Only a single '-from' option is supported.\n"); - } - } else { - assert(to_from_dir == FromToType::TO); - //Check that we haven't already defined the from path - if(!sdc_set_multicycle_path.to.strings.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Only a single '-to' option is supported.\n"); - } - } - - //Add the clock group - if(to_from_dir == FromToType::FROM) { - sdc_set_multicycle_path.from = group; - } else { - assert(to_from_dir == FromToType::TO); - sdc_set_multicycle_path.to = group; - } -} - -void add_sdc_set_multicycle_path(Callback& callback, const Lexer& lexer, SetMulticyclePath& sdc_set_multicycle_path) { - /* - * Error checks - */ - if(sdc_set_multicycle_path.mcp_value == UNINITIALIZED_INT) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Must specify the multicycle path value.\n"); - } - - /* - * Add command - */ - callback.set_multicycle_path(sdc_set_multicycle_path); - -} - -/* - * Functions for set_clock_uncertainty - */ -void sdc_set_clock_uncertainty_set_setup(Callback& callback, const Lexer& lexer, SetClockUncertainty& sdc_set_clock_uncertainty) { - if(sdc_set_clock_uncertainty.is_setup) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "'-setup' should only be specified once.\n"); - } - sdc_set_clock_uncertainty.is_setup = true; -} - -void sdc_set_clock_uncertainty_set_hold(Callback& callback, const Lexer& lexer, SetClockUncertainty& sdc_set_clock_uncertainty) { - if(sdc_set_clock_uncertainty.is_hold) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "'-hold' should only be specified once.\n"); - } - sdc_set_clock_uncertainty.is_hold = true; -} - -void sdc_set_clock_uncertainty_set_value(Callback& callback, const Lexer& lexer, SetClockUncertainty& sdc_set_clock_uncertainty, float value) { - if(!std::isnan(sdc_set_clock_uncertainty.value)) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Must specify clock uncertainty value only once.\n"); - } - sdc_set_clock_uncertainty.value = value; -} - -void sdc_set_clock_uncertainty_add_to_from_group(Callback& callback, const Lexer& lexer, SetClockUncertainty& sdc_set_clock_uncertainty, - StringGroup group, - FromToType to_from_dir) { - assert(group.type == StringGroupType::CLOCK || group.type == StringGroupType::STRING); - - //Error checking - if(to_from_dir == FromToType::FROM) { - //Check that we haven't already defined the from path - if(!sdc_set_clock_uncertainty.from.strings.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Only a single '-from' option is supported.\n"); - } - } else { - assert(to_from_dir == FromToType::TO); - //Check that we haven't already defined the from path - if(!sdc_set_clock_uncertainty.to.strings.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Only a single '-to' option is supported.\n"); - } - } - - //Add the clock group - if(to_from_dir == FromToType::FROM) { - sdc_set_clock_uncertainty.from = group; - } else { - assert(to_from_dir == FromToType::TO); - sdc_set_clock_uncertainty.to = group; - } -} - -void add_sdc_set_clock_uncertainty(Callback& callback, const Lexer& lexer, SetClockUncertainty& sdc_set_clock_uncertainty) { - /* - * Error checks - */ - if(std::isnan(sdc_set_clock_uncertainty.value)) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Must specify the clock uncertainty value.\n"); - } - - /* - * Add command - */ - callback.set_clock_uncertainty(sdc_set_clock_uncertainty); - -} - -/* - * Functions for set_clock_latency - */ -void sdc_set_clock_latency_set_type(Callback& callback, const Lexer& lexer, SetClockLatency& sdc_set_clock_latency, ClockLatencyType type) { - //Error checking - if(sdc_set_clock_latency.type != ClockLatencyType::NONE) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "The latency type (e.g. '-source') can only be specified once.\n"); - } - - sdc_set_clock_latency.type = type; -} - -void sdc_set_clock_latency_early(Callback& callback, const Lexer& lexer, SetClockLatency& sdc_set_clock_latency) { - //Error checking - if(sdc_set_clock_latency.is_early) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "The '-early' option can only be specified once.\n"); - } - - sdc_set_clock_latency.is_early = true; -} - -void sdc_set_clock_latency_late(Callback& callback, const Lexer& lexer, SetClockLatency& sdc_set_clock_latency) { - //Error checking - if(sdc_set_clock_latency.is_late) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "The '-late' option can only be specified once.\n"); - } - - sdc_set_clock_latency.is_late = true; -} - -void sdc_set_clock_latency_set_value(Callback& callback, const Lexer& lexer, SetClockLatency& sdc_set_clock_latency, float value) { - if(!std::isnan(sdc_set_clock_latency.value)) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "The clock latency value can only be specified once.\n"); - } - - sdc_set_clock_latency.value = value; -} - -void sdc_set_clock_latency_set_clocks(Callback& callback, const Lexer& lexer, SetClockLatency& sdc_set_clock_latency, StringGroup target_clocks) { - if(target_clocks.type != StringGroupType::CLOCK) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Target clocks must be specified with 'get_clocks'.\n"); - } - - sdc_set_clock_latency.target_clocks = target_clocks; -} - -void add_sdc_set_clock_latency(Callback& callback, const Lexer& lexer, SetClockLatency& sdc_set_clock_latency) { - /* - * Error checks - */ - if(sdc_set_clock_latency.type != ClockLatencyType::SOURCE) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Must specify the clock latency type (e.g. '-source').\n"); - } - - if(std::isnan(sdc_set_clock_latency.value)) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Must specify the clock latency value.\n"); - } - - if(sdc_set_clock_latency.target_clocks.strings.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Must specify target clocks.\n"); - } - - /* - * Add command - */ - callback.set_clock_latency(sdc_set_clock_latency); -} - -/* - * Functions for set_disable_timing - */ -void sdc_set_disable_timing_add_to_from_group(Callback& callback, const Lexer& lexer, - SetDisableTiming& sdc_set_disable_timing, - StringGroup group, - FromToType to_from_dir) { - - //Error checking - if (group.type != StringGroupType::PIN && group.type != StringGroupType::STRING) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Only get_pins supported with set_disable_timing.\n"); - } - - if(to_from_dir == FromToType::FROM) { - //Check that we haven't already defined the from path - if(!sdc_set_disable_timing.from.strings.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Only a single '-from' option is supported.\n"); - } - } else { - assert(to_from_dir == FromToType::TO); - //Check that we haven't already defined the from path - if(!sdc_set_disable_timing.to.strings.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Only a single '-to' option is supported.\n"); - } - } - - //Add the clock group - if(to_from_dir == FromToType::FROM) { - sdc_set_disable_timing.from = group; - } else { - assert(to_from_dir == FromToType::TO); - sdc_set_disable_timing.to = group; - } -} - -void add_sdc_set_disable_timing(Callback& callback, const Lexer& /*lexer*/, SetDisableTiming& sdc_set_disable_timing) { - /* - * Error checks - */ - - /* - * Add command - */ - callback.set_disable_timing(sdc_set_disable_timing); -} - -/* - * Functions for set_timing_derate - */ -void sdc_set_timing_derate_early(Callback& callback, const Lexer& lexer, SetTimingDerate& sdc_set_timing_derate) { - if(sdc_set_timing_derate.is_early) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "-early should only be specified once.\n"); - } - - sdc_set_timing_derate.is_early = true; -} - -void sdc_set_timing_derate_late(Callback& callback, const Lexer& lexer, SetTimingDerate& sdc_set_timing_derate) { - if(sdc_set_timing_derate.is_late) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "-late should only be specified once.\n"); - } - - sdc_set_timing_derate.is_late = true; -} - -void sdc_set_timing_derate_target_type(Callback& callback, const Lexer& lexer, SetTimingDerate& sdc_set_timing_derate, TimingDerateTargetType target_type) { - if(target_type == TimingDerateTargetType::NET) { - if(sdc_set_timing_derate.derate_nets) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "-net_delay should only be specified once.\n"); - } else { - sdc_set_timing_derate.derate_nets = true; - } - } else if (target_type == TimingDerateTargetType::CELL) { - if(sdc_set_timing_derate.derate_cells) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "-cell_delay should only be specified once.\n"); - } else { - sdc_set_timing_derate.derate_cells = true; - } - } -} - -void sdc_set_timing_derate_value(Callback& callback, const Lexer& lexer, SetTimingDerate& sdc_set_timing_derate, float value) { - if(!std::isnan(sdc_set_timing_derate.value)) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Only a single derate value per set_timing_derate command is allowed.\n"); - } - - if(sdc_set_timing_derate.value < 0) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Timing derate values must be positive.\n"); - } - - sdc_set_timing_derate.value = value; -} - -void sdc_set_timing_derate_targets(Callback& callback, const Lexer& lexer, SetTimingDerate& sdc_set_timing_derate, StringGroup targets) { - if(targets.type != StringGroupType::CELL) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Only get_cells is supported with set_timing_derate.\n"); - } - - if(!sdc_set_timing_derate.cell_targets.strings.empty()) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Only a single get_cells call is supported with set_timing_derate.\n"); - } - - sdc_set_timing_derate.cell_targets = targets; -} - -void add_sdc_set_timing_derate(Callback& callback, const Lexer& lexer, SetTimingDerate& sdc_set_timing_derate) { - /* - * Error checks - */ - if(std::isnan(sdc_set_timing_derate.value)) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), "Must specify timing derate value\n"); - } - - /* - * Defaults - */ - if(!sdc_set_timing_derate.derate_nets && !sdc_set_timing_derate.derate_cells) { - //If unspecified, both cells and nets are derated - sdc_set_timing_derate.derate_nets = true; - sdc_set_timing_derate.derate_cells = true; - } - - /* - * Add command - */ - callback.set_timing_derate(sdc_set_timing_derate); -} - -/* - * Functions for string_group - */ -StringGroup make_sdc_string_group(StringGroupType type, const std::string& string) { - //Convenience function for converting a single string into a group - StringGroup sdc_string_group(type); - sdc_string_group.strings.push_back(string); - - return sdc_string_group; -} - -void sdc_string_group_add_string(StringGroup& sdc_string_group, const std::string& string) { - //Insert the new string - sdc_string_group.strings.push_back(string); -} - -void sdc_string_group_add_strings(StringGroup& sdc_string_group, const StringGroup& string_group_to_add) { - for(const auto& string : string_group_to_add.strings) { - sdc_string_group_add_string(sdc_string_group, string); - } -} - -char* strdup(const char* src) { - if(src == NULL) { - return NULL; - } - - size_t len = std::strlen(src); //Number of char's excluding null terminator - - //Space for [0..len] chars - char* new_str = (char*) std::malloc((len+1)*sizeof(*src)); - assert(new_str != NULL); - - //Copy chars from [0..len], i.e. src[len] should be null terminator - std::memcpy(new_str, src, len+1); - - return new_str; -} - -char* strndup(const char* src, size_t len) { - if(src == NULL) { - return NULL; - } - - //Space for [0..len] chars - char* new_str = (char*) std::malloc((len+1)*sizeof(*src)); - assert(new_str != NULL); - - //Copy chars from [0..len-1] - std::memcpy(new_str, src, len); - - //Add the null terminator - new_str[len] = '\0'; - - return new_str; -} - -} //namespace diff --git a/libs/EXTERNAL/libsdcparse/src/sdc_common.hpp b/libs/EXTERNAL/libsdcparse/src/sdc_common.hpp deleted file mode 100644 index f9f23614488..00000000000 --- a/libs/EXTERNAL/libsdcparse/src/sdc_common.hpp +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef SDC_COMMON_HPP -#define SDC_COMMON_HPP - -#include "sdcparse.hpp" -#include "sdc_lexer.hpp" - -namespace sdcparse { - -enum class TimingDerateTargetType { - NET, - CELL -}; - -/* - * Function Declarations - */ - -//create_clock -void sdc_create_clock_set_period(Callback& callback, const Lexer& lexer, CreateClock& sdc_create_clock, double period); -void sdc_create_clock_set_name(Callback& callback, const Lexer& lexer, CreateClock& sdc_create_clock, const std::string& name); -void sdc_create_clock_set_waveform(Callback& callback, const Lexer& lexer, CreateClock& sdc_create_clock, double rise_time, double fall_time); -void sdc_create_clock_add_targets(Callback& callback, const Lexer& lexer, CreateClock& sdc_create_clock, StringGroup target_group); -void add_sdc_create_clock(Callback& callback, const Lexer& lexer, CreateClock& sdc_create_clock); - -//set_input_delay & set_output_delay -void sdc_set_io_delay_set_clock(Callback& callback, const Lexer& lexer, SetIoDelay& sdc_set_io_delay, const std::string& clock_name); -void sdc_set_io_delay_set_value(Callback& callback, const Lexer& lexer, SetIoDelay& sdc_set_io_delay, double value); -void sdc_set_io_delay_set_max(Callback& callback, const Lexer& lexer, SetIoDelay& sdc_set_io_delay); -void sdc_set_io_delay_set_min(Callback& callback, const Lexer& lexer, SetIoDelay& sdc_set_io_delay); -void sdc_set_io_delay_set_ports(Callback& callback, const Lexer& lexer, SetIoDelay& sdc_set_io_delay, StringGroup ports); -void add_sdc_set_io_delay(Callback& callback, const Lexer& lexer, SetIoDelay& sdc_set_io_delay); - -//set_clock_groups -void sdc_set_clock_groups_set_type(Callback& callback, const Lexer& lexer, SetClockGroups& sdc_set_clock_groups, ClockGroupsType type); -void sdc_set_clock_groups_add_group(Callback& callback, const Lexer& lexer, SetClockGroups& sdc_set_clock_groups, StringGroup clock_group); -void add_sdc_set_clock_groups(Callback& callback, const Lexer& lexer, SetClockGroups& sdc_set_clock_groups); - -//set_false_path -void sdc_set_false_path_add_to_from_group(Callback& callback, const Lexer& lexer, SetFalsePath& sdc_set_false_path, StringGroup group, FromToType to_from_dir); -void add_sdc_set_false_path(Callback& callback, const Lexer& lexer, SetFalsePath& sdc_set_false_path); - -//set_max_delay -void sdc_set_min_max_delay_set_type(Callback& callback, const Lexer& lexer, SetMinMaxDelay& sdc_set_max_delay, MinMaxType type); -void sdc_set_min_max_delay_set_value(Callback& callback, const Lexer& lexer, SetMinMaxDelay& sdc_set_max_delay, double max_delay); -void sdc_set_min_max_delay_add_to_from_group(Callback& callback, const Lexer& lexer, SetMinMaxDelay& sdc_set_max_delay, StringGroup group, FromToType to_from_dir); -void add_sdc_set_min_max_delay(Callback& callback, const Lexer& lexer, SetMinMaxDelay& sdc_set_max_delay); - -//set_multicycle_path -void sdc_set_multicycle_path_set_setup(Callback& callback, const Lexer& lexer, SetMulticyclePath& sdc_set_multicycle_path); -void sdc_set_multicycle_path_set_hold(Callback& callback, const Lexer& lexer, SetMulticyclePath& sdc_set_multicycle_path); -void sdc_set_multicycle_path_set_mcp_value(Callback& callback, const Lexer& lexer, SetMulticyclePath& sdc_set_multicycle_path, int mcp_value); -void sdc_set_multicycle_path_add_to_from_group(Callback& callback, const Lexer& lexer, SetMulticyclePath& sdc_set_multicycle_path, StringGroup group, FromToType to_from_dir); -void add_sdc_set_multicycle_path(Callback& callback, const Lexer& lexer, SetMulticyclePath& sdc_set_multicycle_path); - -//set_clock_uncertainty -void sdc_set_clock_uncertainty_set_setup(Callback& callback, const Lexer& lexer, SetClockUncertainty& sdc_set_clock_uncertainty); -void sdc_set_clock_uncertainty_set_hold(Callback& callback, const Lexer& lexer, SetClockUncertainty& sdc_set_clock_uncertainty); -void sdc_set_clock_uncertainty_set_value(Callback& callback, const Lexer& lexer, SetClockUncertainty& sdc_set_clock_uncertainty, float value); -void sdc_set_clock_uncertainty_add_to_from_group(Callback& callback, const Lexer& lexer, SetClockUncertainty& sdc_set_clock_uncertainty, StringGroup group, FromToType to_from_dir); -void add_sdc_set_clock_uncertainty(Callback& callback, const Lexer& lexer, SetClockUncertainty& sdc_set_clock_uncertainty); - -//set_clock_latency -void sdc_set_clock_latency_set_type(Callback& callback, const Lexer& lexer, SetClockLatency& sdc_set_clock_latency, ClockLatencyType type); -void sdc_set_clock_latency_early(Callback& callback, const Lexer& lexer, SetClockLatency& sdc_set_clock_latency); -void sdc_set_clock_latency_late(Callback& callback, const Lexer& lexer, SetClockLatency& sdc_set_clock_latency); -void sdc_set_clock_latency_set_value(Callback& callback, const Lexer& lexer, SetClockLatency& sdc_set_clock_latency, float value); -void sdc_set_clock_latency_set_clocks(Callback& callback, const Lexer& lexer, SetClockLatency& sdc_set_clock_latency, StringGroup clock_targets); -void add_sdc_set_clock_latency(Callback& callback, const Lexer& lexer, SetClockLatency& sdc_set_clock_latency); - -//set_disable_timing -void sdc_set_disable_timing_add_to_from_group(Callback& callback, const Lexer& lexer, SetDisableTiming& sdc_set_disable_timing, StringGroup group, FromToType to_from_dir); -void add_sdc_set_disable_timing(Callback& callback, const Lexer& lexer, SetDisableTiming& sdc_set_disable_timing); - -//set_timing_derate -void sdc_set_timing_derate_early(Callback& callback, const Lexer& lexer, SetTimingDerate& sdc_set_timing_derate); -void sdc_set_timing_derate_late(Callback& callback, const Lexer& lexer, SetTimingDerate& sdc_set_timing_derate); -void sdc_set_timing_derate_target_type(Callback& callback, const Lexer& lexer, SetTimingDerate& sdc_set_timing_derate, TimingDerateTargetType target_type); -void sdc_set_timing_derate_value(Callback& callback, const Lexer& lexer, SetTimingDerate& sdc_set_timing_derate, float value); -void sdc_set_timing_derate_targets(Callback& callback, const Lexer& lexer, SetTimingDerate& sdc_set_timing_derate, StringGroup targets); -void add_sdc_set_timing_derate(Callback& callback, const Lexer& lexer, SetTimingDerate& sdc_set_multicycle_path); - -//string_group -StringGroup make_sdc_string_group(StringGroupType type, const std::string& string); -void sdc_string_group_add_string(StringGroup& sdc_string_group, const std::string& string); -void sdc_string_group_add_strings(StringGroup& sdc_string_group, const StringGroup& string_group_to_add); - -//utility -char* strdup(const char* src); -char* strndup(const char* src, size_t len); - -} //namespace -#endif diff --git a/libs/EXTERNAL/libsdcparse/src/sdc_error.cpp b/libs/EXTERNAL/libsdcparse/src/sdc_error.cpp deleted file mode 100644 index 9e7644b3e8d..00000000000 --- a/libs/EXTERNAL/libsdcparse/src/sdc_error.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include -#include "sdc_error.hpp" -#include "sdcparse.hpp" - -namespace sdcparse { - -//We wrap the actual sdc_error to issolate custom handlers from vaargs -void sdc_error_wrap(Callback& callback, const int line_no, const std::string& near_text, const char* fmt, ...) { - va_list args; - va_start(args, fmt); - - //We need to copy the args so we don't change them before the true formating - va_list args_copy; - va_copy(args_copy, args); - - //Determine the formatted length using a copy of the args - int len = std::vsnprintf(nullptr, 0, fmt, args_copy); - - va_end(args_copy); //Clean-up - - //Negative if there is a problem with the format string - assert(len >= 0 && "Problem decoding format string"); - - size_t buf_size = len + 1; //For terminator - - //Allocate a buffer - // unique_ptr will free buffer automatically - std::unique_ptr buf(new char[buf_size]); - - //Format into the buffer using the original args - len = std::vsnprintf(buf.get(), buf_size, fmt, args); - - va_end(args); //Clean-up - - assert(len >= 0 && "Problem decoding format string"); - assert(static_cast(len) == buf_size - 1); - - //Build the string from the buffer - std::string msg(buf.get(), len); - - //Call the error handler - callback.parse_error(line_no, near_text, msg); -} - -} diff --git a/libs/EXTERNAL/libsdcparse/src/sdc_error.hpp b/libs/EXTERNAL/libsdcparse/src/sdc_error.hpp deleted file mode 100644 index 7f554625ea5..00000000000 --- a/libs/EXTERNAL/libsdcparse/src/sdc_error.hpp +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef SDC_ERROR_H -#define SDC_ERROR_H -#include "sdcparse.hpp" - -namespace sdcparse { - void sdc_error_wrap(Callback& callback, const int line_no, const std::string& near_text, const char* fmt, ...); -} -#endif diff --git a/libs/EXTERNAL/libsdcparse/src/sdc_lexer.cpp b/libs/EXTERNAL/libsdcparse/src/sdc_lexer.cpp deleted file mode 100644 index f8ec08d20b5..00000000000 --- a/libs/EXTERNAL/libsdcparse/src/sdc_lexer.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "sdc_lexer.hpp" - -//Windows doesn't have unistd.h, so we set '%option nounistd' -//in sdc_lexer.l, but flex still includes it in the generated -//header unless YY_NO_UNISTD_H is defined to 1 -#define YY_NO_UNISTD_H 1 -#include "sdc_lexer.gen.hpp" //For sdcparse_lex_*() - -extern YY_DECL; //For sdcparse_lex() - -namespace sdcparse { - -Lexer::Lexer(FILE* file, Callback& callback) - : callback_(callback) { - sdcparse_lex_init(&state_); - sdcparse_set_in(file, state_); -} - -Lexer::~Lexer() { - sdcparse_lex_destroy(state_); -} - -Parser::symbol_type Lexer::next_token() { - return sdcparse_lex(state_, callback_); -} - -const char* Lexer::text() const { - return sdcparse_get_text(state_); -} - -int Lexer::lineno() const { - return sdcparse_get_lineno(state_); -} - -} diff --git a/libs/EXTERNAL/libsdcparse/src/sdc_lexer.hpp b/libs/EXTERNAL/libsdcparse/src/sdc_lexer.hpp deleted file mode 100644 index 56a485a657f..00000000000 --- a/libs/EXTERNAL/libsdcparse/src/sdc_lexer.hpp +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef SDC_LEXER_HPP -#define SDC_LEXER_HPP - -#include "sdc_parser.hpp" //For Parser::symbol_type - -namespace sdcparse { - -typedef void* yyscan_t; - -class Lexer { - public: - Lexer(FILE* file, Callback& callback); - ~Lexer(); - Parser::symbol_type next_token(); - const char* text() const; - int lineno() const; - private: - yyscan_t state_; - Callback& callback_; -}; - -/* - * The YY_DECL is used by flex to specify the signature of the main - * lexer function. - * - * We re-define it to something reasonable - */ -#undef YY_DECL -#define YY_DECL sdcparse::Parser::symbol_type sdcparse_lex(yyscan_t yyscanner, sdcparse::Callback& callback) - -} //namespace -#endif diff --git a/libs/EXTERNAL/libsdcparse/src/sdc_lexer.l b/libs/EXTERNAL/libsdcparse/src/sdc_lexer.l deleted file mode 100644 index 43b8eac5301..00000000000 --- a/libs/EXTERNAL/libsdcparse/src/sdc_lexer.l +++ /dev/null @@ -1,170 +0,0 @@ -%{ - /* - * Include Files - */ - #include "sdcparse.hpp" - #include "sdc_common.hpp" - #include "sdc_error.hpp" - - #include "sdc_lexer.hpp" - -%} - -/* - * Options - */ - -/* track line numbers*/ -%option yylineno - -/* No lexing accross files */ -%option noyywrap - -/* unistd.h doesn't exist on windows */ -%option nounistd - -/* Avoid unused yyunput function warning */ -%option nounput - -/* Avoid unused yyinput function warning */ -%option noinput - -/* isatty() doesn't exist on windows */ -%option never-interactive - -/* no default rule to echo unrecongaized tokens to output */ -%option nodefault - -/*%option bison-bridge*/ -%option reentrant - -/* - * Use a prefix to avoid name clashes with other - * flex lexers - */ -%option prefix="sdcparse_" - -/* Common character classes */ -BACK_SLASH [\\] -WS [ \t] -ENDL (\n|\n\r|\r\n) -DIGIT10 [0-9] -NAN ((?i:nan)(\([^{WS}]*\))?) -INF (?i:inf|infinity) -FLOAT_BASE (({DIGIT10}*\.?{DIGIT10}+)|({DIGIT10}+\.)) -FLOAT_EXP ([eE][-+]?{DIGIT10}+) -FLOAT_NUMBER ({NAN}|([-+]?({INF}|({FLOAT_BASE}{FLOAT_EXP}?)))) -INT_NUMBER ([-+]?{DIGIT10}+) -ALPHA [a-zA-Z_] -SYMBOL [-~|:*\\/^\.\$] -ID_FIRST ({ALPHA}|{SYMBOL}) -ID_MID ({ALPHA}|{DIGIT10}|{SYMBOL}) -ID_INDEX (\[{DIGIT10}+\]) -ID ({ID_FIRST}{ID_MID}*{ID_INDEX}?) -STR ({ID}|\*{ID}?) -ESCAPED_STR (\{{WS}*[^ \t]*{WS}*\}) - -/* - * Symbol Definitions - */ -%% -#.* { /* skip comments */ } -{BACK_SLASH}{WS}*{ENDL} { /* line continuation don't send EOL to parser */ } -{ENDL} { return sdcparse::Parser::make_EOL(); } -{WS}+ { /* skip white space */ } - -"create_clock" { return sdcparse::Parser::make_CMD_CREATE_CLOCK(); } -"set_input_delay" { return sdcparse::Parser::make_CMD_SET_INPUT_DELAY(); } -"set_output_delay" { return sdcparse::Parser::make_CMD_SET_OUTPUT_DELAY(); } -"set_clock_groups" { return sdcparse::Parser::make_CMD_SET_CLOCK_GROUPS(); } -"set_false_path" { return sdcparse::Parser::make_CMD_SET_FALSE_PATH(); } -"set_max_delay" { return sdcparse::Parser::make_CMD_SET_MAX_DELAY(); } -"set_min_delay" { return sdcparse::Parser::make_CMD_SET_MIN_DELAY(); } -"set_multicycle_path" { return sdcparse::Parser::make_CMD_SET_MULTICYCLE_PATH(); } -"set_clock_uncertainty" { return sdcparse::Parser::make_CMD_SET_CLOCK_UNCERTAINTY(); } -"set_clock_latency" { return sdcparse::Parser::make_CMD_SET_CLOCK_LATENCY(); } -"set_disable_timing" { return sdcparse::Parser::make_CMD_SET_DISABLE_TIMING(); } -"set_timing_derate" { return sdcparse::Parser::make_CMD_SET_TIMING_DERATE(); } - -"get_ports" { return sdcparse::Parser::make_CMD_GET_PORTS(); } -"get_clocks" { return sdcparse::Parser::make_CMD_GET_CLOCKS(); } -"get_cells" { return sdcparse::Parser::make_CMD_GET_CELLS(); } -"get_pins" { return sdcparse::Parser::make_CMD_GET_PINS(); } - -"-period" { return sdcparse::Parser::make_ARG_PERIOD(); } -"-name" { return sdcparse::Parser::make_ARG_NAME(); } -"-waveform" { return sdcparse::Parser::make_ARG_WAVEFORM(); } -"-clock" { return sdcparse::Parser::make_ARG_CLOCK(); } -"-max" { return sdcparse::Parser::make_ARG_MAX(); } -"-min" { return sdcparse::Parser::make_ARG_MIN(); } -"-exclusive" { return sdcparse::Parser::make_ARG_EXCLUSIVE(); } -"-group" { return sdcparse::Parser::make_ARG_GROUP(); } -"-from" { return sdcparse::Parser::make_ARG_FROM(); } -"-to" { return sdcparse::Parser::make_ARG_TO(); } -"-setup" { return sdcparse::Parser::make_ARG_SETUP(); } -"-hold" { return sdcparse::Parser::make_ARG_HOLD(); } -"-early" { return sdcparse::Parser::make_ARG_EARLY(); } -"-late" { return sdcparse::Parser::make_ARG_LATE(); } -"-cell_delay" { return sdcparse::Parser::make_ARG_CELL_DELAY(); } -"-net_delay" { return sdcparse::Parser::make_ARG_NET_DELAY(); } -"-source" { return sdcparse::Parser::make_ARG_SOURCE(); } - -{INT_NUMBER} { return sdcparse::Parser::make_INT_NUMBER(atoi(sdcparse_get_text(yyscanner))); } -{FLOAT_NUMBER} { return sdcparse::Parser::make_FLOAT_NUMBER(atof(sdcparse_get_text(yyscanner))); } -{STR} { - return sdcparse::Parser::make_STRING(sdcparse_get_text(yyscanner)); - } -{ESCAPED_STR} { - /* - * Any continguous sequence of non-white space characters, - * with optional leading and/or trailing whitespace that falls - * insde curly braces is interpreted as an escaped string. - * However when we set the yylval, we need to be careful - * to avoid including the curly braces and the leading/trailing - * white-space. - */ - size_t len = strlen(sdcparse_get_text(yyscanner)); - char* tmp_str = sdcparse::strndup(sdcparse_get_text(yyscanner)+1, len-2); //Duplicate and trim braces - - char* modified_str = tmp_str; //Save the original tmp_str for freeing - - //Remove leading whitespace - while(isspace(*modified_str)) modified_str++; - - //Find trailing whitespace - char* tmp_ptr = modified_str; - while(!isspace(*tmp_ptr) && *tmp_ptr != '\0') { - tmp_ptr++; - } - - //Remove trailing white space - // - //tmp_ptr is now at the first trailing white space character - //(or the existing null terminator), so we can write a '\0' - //to terminate the string here. - *tmp_ptr = '\0'; - - auto ret = sdcparse::Parser::make_ESCAPED_STRING(modified_str); - - //Clean-up the temporary string - free(tmp_str); - - return ret; - } -\[ { return sdcparse::Parser::make_LSPAR(); } -\] { return sdcparse::Parser::make_RSPAR(); } -\{ { return sdcparse::Parser::make_LCPAR(); } -\} { return sdcparse::Parser::make_RCPAR(); } -<> { /* If the file has no blank line at the end there will - not be the expected EOL following the last command. - So first time through, return EOL, and subsequently - return 0 (which indicated end of file). This ensures - there will always be an EOL provided to the parser. - However it may also generate a stray EOL if the last - line IS blank - so the parse must handle those correctly. */ - static bool once; return (once = !once) ? sdcparse::Parser::make_EOL() : sdcparse::Parser::make_EOF(); - } -. { - sdc_error_wrap(callback, sdcparse_get_lineno(yyscanner), sdcparse_get_text(yyscanner), "Unrecognized character"); - } -%% diff --git a/libs/EXTERNAL/libsdcparse/src/sdc_lexer_fwd.hpp b/libs/EXTERNAL/libsdcparse/src/sdc_lexer_fwd.hpp deleted file mode 100644 index 02459b705b7..00000000000 --- a/libs/EXTERNAL/libsdcparse/src/sdc_lexer_fwd.hpp +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef SDC_LEXER_FWD_H -#define SDC_LEXER_FWD_H - -//Forward declaration used by parser definition -namespace sdcparse { - class Lexer; -} - -#endif diff --git a/libs/EXTERNAL/libsdcparse/src/sdc_parser.hpp b/libs/EXTERNAL/libsdcparse/src/sdc_parser.hpp deleted file mode 100644 index 9ee32597131..00000000000 --- a/libs/EXTERNAL/libsdcparse/src/sdc_parser.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef SDC_PARSER_HPP -#define SDC_PARSER_HPP - -#include "sdc_lexer_fwd.hpp" //Lexer class required for Parser param - -//Required by parser generated header -#ifndef YY_NULLPTR -#define YY_NULLPTR nullptr -#endif - -#include "sdc_parser.gen.hpp" //For the generated Parser class - -#endif diff --git a/libs/EXTERNAL/libsdcparse/src/sdc_parser.y b/libs/EXTERNAL/libsdcparse/src/sdc_parser.y deleted file mode 100644 index 686173392bf..00000000000 --- a/libs/EXTERNAL/libsdcparse/src/sdc_parser.y +++ /dev/null @@ -1,392 +0,0 @@ -/* C++ parsers require Bison 3.3 */ -%require "3.3" -%language "C++" - -/* Write-out tokens header file */ -%defines - -/* Use Bison's 'variant' to store values. - * This allows us to use non POD types (e.g. - * with constructors/destrictors), which is - * not possible with the default mode which - * uses unions. - */ -%define api.value.type variant - -/* - * Use the 'complete' symbol type (i.e. variant) - * in the lexer - */ -%define api.token.constructor - -/* - * Add a prefix the make_* functions used to - * create the symbols - */ -%define api.token.prefix {TOKEN_} - -/* - * Use a re-entrant (no global vars) parser - */ -/*%define api.pure full*/ - -/* Wrap everything in our namespace */ -%define api.namespace {sdcparse} - -/* Name the parser class */ -%define api.parser.class {Parser} - -/* Match the flex prefix */ -%define api.prefix {sdcparse_} - -/* Extra checks for correct usage */ -%define parse.assert - -/* Enable debugging info */ -%define parse.trace - -/* Better error reporting */ -%define parse.error verbose - -/* - * Fixes inaccuracy in verbose error reporting. - * May be slow for some grammars. - */ -/*%define parse.lac full*/ - -/* Track locations */ -/*%locations*/ - -/* Generate a table of token names */ -%token-table - -%lex-param {Lexer& lexer} -%parse-param {Lexer& lexer} -%parse-param {Callback& callback} - - -%code requires { - #include - #include "sdcparse.hpp" - #include "sdc_lexer_fwd.hpp" -} - -%code top { - #include "sdc_lexer.hpp" - //Bison calls sdcparse_lex() to get the next token. - //We use the Lexer class as the interface to the lexer, so we - //re-defined the function to tell Bison how to get the next token. - static sdcparse::Parser::symbol_type sdcparse_lex(sdcparse::Lexer& lexer) { - return lexer.next_token(); - } -} - -%{ - -#include -#include "assert.h" - -#include "sdcparse.hpp" -#include "sdc_common.hpp" -#include "sdc_error.hpp" - -using namespace sdcparse; - -%} - -/* declare constant */ -%token CMD_CREATE_CLOCK "create_clock" -%token CMD_SET_CLOCK_GROUPS "set_clock_groups" -%token CMD_SET_FALSE_PATH "set_false_path" -%token CMD_SET_MAX_DELAY "set_max_delay" -%token CMD_SET_MIN_DELAY "set_min_delay" -%token CMD_SET_MULTICYCLE_PATH "set_multicycle_path" -%token CMD_SET_INPUT_DELAY "set_input_delay" -%token CMD_SET_OUTPUT_DELAY "set_output_delay" -%token CMD_SET_CLOCK_UNCERTAINTY "set_clock_uncertainty" -%token CMD_SET_CLOCK_LATENCY "set_clock_latency" -%token CMD_SET_DISABLE_TIMING "set_disable_timing" -%token CMD_SET_TIMING_DERATE "set_timing_derate" - -%token CMD_GET_PORTS "get_ports" -%token CMD_GET_CLOCKS "get_clocks" -%token CMD_GET_CELLS "get_cells" -%token CMD_GET_PINS "get_pins" - -%token ARG_PERIOD "-period" -%token ARG_WAVEFORM "-waveform" -%token ARG_NAME "-name" -%token ARG_EXCLUSIVE "-exclusive" -%token ARG_GROUP "-group" -%token ARG_FROM "-from" -%token ARG_TO "-to" -%token ARG_SETUP "-setup" -%token ARG_HOLD "-hold" -%token ARG_CLOCK "-clock" -%token ARG_MAX "-max" -%token ARG_MIN "-min" -%token ARG_EARLY "-early" -%token ARG_LATE "-late" -%token ARG_CELL_DELAY "-cell_delay" -%token ARG_NET_DELAY "-net_delay" -%token ARG_SOURCE "-source" - -%token LSPAR "[" -%token RSPAR "]" -%token LCPAR "{" -%token RCPAR "}" - -%token EOL "end-of-line" -%token EOF 0 "end-of-file" - -/* declare variable tokens */ -%token STRING -%token ESCAPED_STRING -%token CHAR -%token FLOAT_NUMBER -%token INT_NUMBER - -/* declare types */ -%type string -%type number -%type float_number -%type int_number - -%type cmd_create_clock -%type cmd_set_input_delay cmd_set_output_delay -%type cmd_set_clock_groups -%type cmd_set_false_path -%type cmd_set_max_delay cmd_set_min_delay -%type cmd_set_multicycle_path -%type cmd_set_clock_uncertainty -%type cmd_set_clock_latency -%type cmd_set_disable_timing -%type cmd_set_timing_derate - -%type stringGroup cmd_get_ports cmd_get_clocks cmd_get_cells cmd_get_pins - -/* Top level rule */ -%start sdc_commands - -%% - -sdc_commands: { } - | sdc_commands cmd_create_clock EOL { callback.lineno(lexer.lineno()-1); add_sdc_create_clock(callback, lexer, $2); } - | sdc_commands cmd_set_input_delay EOL { callback.lineno(lexer.lineno()-1); add_sdc_set_io_delay(callback, lexer, $2); } - | sdc_commands cmd_set_output_delay EOL { callback.lineno(lexer.lineno()-1); add_sdc_set_io_delay(callback, lexer, $2); } - | sdc_commands cmd_set_clock_groups EOL { callback.lineno(lexer.lineno()-1); add_sdc_set_clock_groups(callback, lexer, $2); } - | sdc_commands cmd_set_false_path EOL { callback.lineno(lexer.lineno()-1); add_sdc_set_false_path(callback, lexer, $2); } - | sdc_commands cmd_set_max_delay EOL { callback.lineno(lexer.lineno()-1); add_sdc_set_min_max_delay(callback, lexer, $2); } - | sdc_commands cmd_set_min_delay EOL { callback.lineno(lexer.lineno()-1); add_sdc_set_min_max_delay(callback, lexer, $2); } - | sdc_commands cmd_set_multicycle_path EOL { callback.lineno(lexer.lineno()-1); add_sdc_set_multicycle_path(callback, lexer, $2); } - | sdc_commands cmd_set_clock_uncertainty EOL { callback.lineno(lexer.lineno()-1); add_sdc_set_clock_uncertainty(callback, lexer, $2); } - | sdc_commands cmd_set_clock_latency EOL { callback.lineno(lexer.lineno()-1); add_sdc_set_clock_latency(callback, lexer, $2); } - | sdc_commands cmd_set_disable_timing EOL { callback.lineno(lexer.lineno()-1); add_sdc_set_disable_timing(callback, lexer, $2); } - | sdc_commands cmd_set_timing_derate EOL { callback.lineno(lexer.lineno()-1); add_sdc_set_timing_derate(callback, lexer, $2); } - | sdc_commands EOL { /* Eat stray EOL symbols */ } - ; - -cmd_create_clock: CMD_CREATE_CLOCK { $$ = CreateClock(); } - | cmd_create_clock ARG_PERIOD number { $$ = $1; sdc_create_clock_set_period(callback, lexer, $$, $3); } - | cmd_create_clock ARG_NAME string { $$ = $1; sdc_create_clock_set_name(callback, lexer, $$, $3); } - | cmd_create_clock ARG_WAVEFORM LCPAR number number RCPAR { $$ = $1; sdc_create_clock_set_waveform(callback, lexer, $$, $4, $5); } - | cmd_create_clock LCPAR stringGroup RCPAR { $$ = $1; sdc_create_clock_add_targets(callback, lexer, $$, $3); - } - | cmd_create_clock string { $$ = $1; sdc_create_clock_add_targets(callback, lexer, $$, - make_sdc_string_group(sdcparse::StringGroupType::STRING, $2)); - } - ; - -cmd_set_input_delay: CMD_SET_INPUT_DELAY { $$ = SetIoDelay(IoDelayType::INPUT); } - | cmd_set_input_delay ARG_CLOCK string { $$ = $1; sdc_set_io_delay_set_clock(callback, lexer, $$, $3); } - | cmd_set_input_delay ARG_MAX { $$ = $1; sdc_set_io_delay_set_max(callback, lexer, $$); } - | cmd_set_input_delay ARG_MIN { $$ = $1; sdc_set_io_delay_set_min(callback, lexer, $$); } - | cmd_set_input_delay number { $$ = $1; sdc_set_io_delay_set_value(callback, lexer, $$, $2); } - | cmd_set_input_delay LSPAR cmd_get_ports RSPAR { $$ = $1; sdc_set_io_delay_set_ports(callback, lexer, $$, $3); } - ; - -cmd_set_output_delay: CMD_SET_OUTPUT_DELAY { $$ = SetIoDelay(IoDelayType::OUTPUT); } - | cmd_set_output_delay ARG_CLOCK string { $$ = $1; sdc_set_io_delay_set_clock(callback, lexer, $$, $3); } - | cmd_set_output_delay ARG_MAX { $$ = $1; sdc_set_io_delay_set_max(callback, lexer, $$); } - | cmd_set_output_delay ARG_MIN { $$ = $1; sdc_set_io_delay_set_min(callback, lexer, $$); } - | cmd_set_output_delay number { $$ = $1; sdc_set_io_delay_set_value(callback, lexer, $$, $2); } - | cmd_set_output_delay LSPAR cmd_get_ports RSPAR { $$ = $1; sdc_set_io_delay_set_ports(callback, lexer, $$, $3); } - ; - -cmd_set_clock_groups: CMD_SET_CLOCK_GROUPS { $$ = SetClockGroups(); } - | cmd_set_clock_groups ARG_EXCLUSIVE { $$ = $1; sdc_set_clock_groups_set_type(callback, lexer, $$, ClockGroupsType::EXCLUSIVE); } - | cmd_set_clock_groups ARG_GROUP LSPAR cmd_get_clocks RSPAR { $$ = $1; sdc_set_clock_groups_add_group(callback, lexer, $$, $4); } - | cmd_set_clock_groups ARG_GROUP LCPAR stringGroup RCPAR { $$ = $1; sdc_set_clock_groups_add_group(callback, lexer, $$, $4); } - | cmd_set_clock_groups ARG_GROUP string { $$ = $1; sdc_set_clock_groups_add_group(callback, lexer, $$, - make_sdc_string_group(sdcparse::StringGroupType::STRING, $3)); - } - ; - -cmd_set_false_path: CMD_SET_FALSE_PATH { $$ = SetFalsePath(); } - | cmd_set_false_path ARG_FROM LSPAR cmd_get_clocks RSPAR { $$ = $1; sdc_set_false_path_add_to_from_group(callback, lexer, $$, $4, FromToType::FROM); } - | cmd_set_false_path ARG_TO LSPAR cmd_get_clocks RSPAR { $$ = $1; sdc_set_false_path_add_to_from_group(callback, lexer, $$, $4, FromToType::TO ); } - | cmd_set_false_path ARG_FROM LCPAR stringGroup RCPAR { $$ = $1; sdc_set_false_path_add_to_from_group(callback, lexer, $$, $4, FromToType::FROM); } - | cmd_set_false_path ARG_TO LCPAR stringGroup RCPAR { $$ = $1; sdc_set_false_path_add_to_from_group(callback, lexer, $$, $4, FromToType::TO ); } - | cmd_set_false_path ARG_FROM string { $$ = $1; sdc_set_false_path_add_to_from_group(callback, lexer, $$, - make_sdc_string_group(sdcparse::StringGroupType::STRING, $3), - FromToType::FROM); - } - | cmd_set_false_path ARG_TO string { $$ = $1; sdc_set_false_path_add_to_from_group(callback, lexer, $$, - make_sdc_string_group(sdcparse::StringGroupType::STRING, $3), - FromToType::TO ); - } - ; - -cmd_set_max_delay: CMD_SET_MAX_DELAY { $$ = SetMinMaxDelay(MinMaxType::MAX); } - | cmd_set_max_delay number { $$ = $1; sdc_set_min_max_delay_set_value(callback, lexer, $$, $2); } - | cmd_set_max_delay ARG_FROM LSPAR cmd_get_clocks RSPAR { $$ = $1; sdc_set_min_max_delay_add_to_from_group(callback, lexer, $$, $4, FromToType::FROM); } - | cmd_set_max_delay ARG_TO LSPAR cmd_get_clocks RSPAR { $$ = $1; sdc_set_min_max_delay_add_to_from_group(callback, lexer, $$, $4, FromToType::TO ); } - | cmd_set_max_delay ARG_FROM LCPAR stringGroup RCPAR { $$ = $1; sdc_set_min_max_delay_add_to_from_group(callback, lexer, $$, $4, FromToType::FROM); } - | cmd_set_max_delay ARG_TO LCPAR stringGroup RCPAR { $$ = $1; sdc_set_min_max_delay_add_to_from_group(callback, lexer, $$, $4, FromToType::TO ); } - | cmd_set_max_delay ARG_FROM string { $$ = $1; sdc_set_min_max_delay_add_to_from_group(callback, lexer, $$, - make_sdc_string_group(sdcparse::StringGroupType::STRING, $3), - FromToType::FROM); - } - | cmd_set_max_delay ARG_TO string { $$ = $1; sdc_set_min_max_delay_add_to_from_group(callback, lexer, $$, - make_sdc_string_group(sdcparse::StringGroupType::STRING, $3), - FromToType::TO); - } - ; - -cmd_set_min_delay: CMD_SET_MIN_DELAY { $$ = SetMinMaxDelay(MinMaxType::MIN); } - | cmd_set_min_delay number { $$ = $1; sdc_set_min_max_delay_set_value(callback, lexer, $$, $2); } - | cmd_set_min_delay ARG_FROM LSPAR cmd_get_clocks RSPAR { $$ = $1; sdc_set_min_max_delay_add_to_from_group(callback, lexer, $$, $4, FromToType::FROM); } - | cmd_set_min_delay ARG_TO LSPAR cmd_get_clocks RSPAR { $$ = $1; sdc_set_min_max_delay_add_to_from_group(callback, lexer, $$, $4, FromToType::TO ); } - | cmd_set_min_delay ARG_FROM LCPAR stringGroup RCPAR { $$ = $1; sdc_set_min_max_delay_add_to_from_group(callback, lexer, $$, $4, FromToType::FROM); } - | cmd_set_min_delay ARG_TO LCPAR stringGroup RCPAR { $$ = $1; sdc_set_min_max_delay_add_to_from_group(callback, lexer, $$, $4, FromToType::TO ); } - | cmd_set_min_delay ARG_FROM string { $$ = $1; - sdc_set_min_max_delay_add_to_from_group(callback, lexer, $$, - make_sdc_string_group(sdcparse::StringGroupType::STRING, $3), - FromToType::FROM); - } - | cmd_set_min_delay ARG_TO string { $$ = $1; - sdc_set_min_max_delay_add_to_from_group(callback, lexer, $$, - make_sdc_string_group(sdcparse::StringGroupType::STRING, $3), - FromToType::TO); - } - ; - -cmd_set_multicycle_path: CMD_SET_MULTICYCLE_PATH { $$ = SetMulticyclePath(); } - | cmd_set_multicycle_path int_number { $$ = $1; sdc_set_multicycle_path_set_mcp_value(callback, lexer, $$, $2); } - | cmd_set_multicycle_path ARG_SETUP { $$ = $1; sdc_set_multicycle_path_set_setup(callback, lexer, $$); } - | cmd_set_multicycle_path ARG_HOLD { $$ = $1; sdc_set_multicycle_path_set_hold(callback, lexer, $$); } - | cmd_set_multicycle_path ARG_FROM LSPAR cmd_get_clocks RSPAR { $$ = $1; sdc_set_multicycle_path_add_to_from_group(callback, lexer, $$, $4, FromToType::FROM); } - | cmd_set_multicycle_path ARG_TO LSPAR cmd_get_clocks RSPAR { $$ = $1; sdc_set_multicycle_path_add_to_from_group(callback, lexer, $$, $4, FromToType::TO); } - | cmd_set_multicycle_path ARG_FROM LCPAR stringGroup RCPAR { $$ = $1; sdc_set_multicycle_path_add_to_from_group(callback, lexer, $$, $4, FromToType::FROM); } - | cmd_set_multicycle_path ARG_TO LCPAR stringGroup RCPAR { $$ = $1; sdc_set_multicycle_path_add_to_from_group(callback, lexer, $$, $4, FromToType::TO); } - | cmd_set_multicycle_path ARG_FROM LSPAR cmd_get_pins RSPAR { $$ = $1; sdc_set_multicycle_path_add_to_from_group(callback, lexer, $$, $4, FromToType::FROM); } - | cmd_set_multicycle_path ARG_TO LSPAR cmd_get_pins RSPAR { $$ = $1; sdc_set_multicycle_path_add_to_from_group(callback, lexer, $$, $4, FromToType::TO); } - | cmd_set_multicycle_path ARG_FROM string { $$ = $1; sdc_set_multicycle_path_add_to_from_group(callback, lexer, $$, - make_sdc_string_group(sdcparse::StringGroupType::STRING, $3), - FromToType::FROM); - } - | cmd_set_multicycle_path ARG_TO string { $$ = $1; sdc_set_multicycle_path_add_to_from_group(callback, lexer, $$, - make_sdc_string_group(sdcparse::StringGroupType::STRING, $3), - FromToType::TO); - } - ; - -cmd_set_clock_uncertainty: CMD_SET_CLOCK_UNCERTAINTY { $$ = SetClockUncertainty(); } - | cmd_set_clock_uncertainty ARG_SETUP { $$ = $1; sdc_set_clock_uncertainty_set_setup(callback, lexer, $$); } - | cmd_set_clock_uncertainty ARG_HOLD { $$ = $1; sdc_set_clock_uncertainty_set_hold(callback, lexer, $$); } - | cmd_set_clock_uncertainty number { $$ = $1; sdc_set_clock_uncertainty_set_value(callback, lexer, $$, $2); } - | cmd_set_clock_uncertainty ARG_FROM LSPAR cmd_get_clocks RSPAR { $$ = $1; sdc_set_clock_uncertainty_add_to_from_group(callback, lexer, $$, $4, FromToType::FROM); } - | cmd_set_clock_uncertainty ARG_TO LSPAR cmd_get_clocks RSPAR { $$ = $1; sdc_set_clock_uncertainty_add_to_from_group(callback, lexer, $$, $4, FromToType::TO); } - | cmd_set_clock_uncertainty ARG_FROM LCPAR stringGroup RCPAR { $$ = $1; sdc_set_clock_uncertainty_add_to_from_group(callback, lexer, $$, $4, FromToType::FROM); } - | cmd_set_clock_uncertainty ARG_TO LCPAR stringGroup RCPAR { $$ = $1; sdc_set_clock_uncertainty_add_to_from_group(callback, lexer, $$, $4, FromToType::TO); } - | cmd_set_clock_uncertainty ARG_FROM string { $$ = $1; - sdc_set_clock_uncertainty_add_to_from_group(callback, lexer, $$, - make_sdc_string_group(sdcparse::StringGroupType::STRING, $3), - FromToType::FROM); - } - | cmd_set_clock_uncertainty ARG_TO string { $$ = $1; - sdc_set_clock_uncertainty_add_to_from_group(callback, lexer, $$, - make_sdc_string_group(sdcparse::StringGroupType::STRING, $3), - FromToType::TO); - } - ; - -cmd_set_clock_latency: CMD_SET_CLOCK_LATENCY { $$ = SetClockLatency(); } - | cmd_set_clock_latency ARG_SOURCE { $$ = $1; sdc_set_clock_latency_set_type(callback, lexer, $$, ClockLatencyType::SOURCE); } - | cmd_set_clock_latency ARG_EARLY { $$ = $1; sdc_set_clock_latency_early(callback, lexer, $$); } - | cmd_set_clock_latency ARG_LATE { $$ = $1; sdc_set_clock_latency_late(callback, lexer, $$); } - | cmd_set_clock_latency number { $$ = $1; sdc_set_clock_latency_set_value(callback, lexer, $$, $2); } - | cmd_set_clock_latency LSPAR cmd_get_clocks RSPAR { $$ = $1; sdc_set_clock_latency_set_clocks(callback, lexer, $$, $3); } - ; - - -cmd_set_disable_timing: CMD_SET_DISABLE_TIMING { $$ = SetDisableTiming(); } - | cmd_set_disable_timing ARG_FROM LSPAR cmd_get_pins RSPAR { $$ = $1; sdc_set_disable_timing_add_to_from_group(callback, lexer, $$, $4, FromToType::FROM); } - | cmd_set_disable_timing ARG_TO LSPAR cmd_get_pins RSPAR { $$ = $1; sdc_set_disable_timing_add_to_from_group(callback, lexer, $$, $4, FromToType::TO ); } - | cmd_set_disable_timing ARG_FROM LCPAR stringGroup RCPAR { $$ = $1; sdc_set_disable_timing_add_to_from_group(callback, lexer, $$, $4, FromToType::FROM); } - | cmd_set_disable_timing ARG_TO LCPAR stringGroup RCPAR { $$ = $1; sdc_set_disable_timing_add_to_from_group(callback, lexer, $$, $4, FromToType::TO ); } - | cmd_set_disable_timing ARG_FROM string { $$ = $1; - sdc_set_disable_timing_add_to_from_group(callback, lexer, $$, - make_sdc_string_group(sdcparse::StringGroupType::STRING, $3), - FromToType::FROM); - } - | cmd_set_disable_timing ARG_TO string { $$ = $1; - sdc_set_disable_timing_add_to_from_group(callback, lexer, $$, - make_sdc_string_group(sdcparse::StringGroupType::STRING, $3), - FromToType::TO ); - } - ; - -cmd_set_timing_derate: CMD_SET_TIMING_DERATE { $$ = SetTimingDerate(); } - | cmd_set_timing_derate ARG_EARLY { $$ = $1; sdc_set_timing_derate_early(callback, lexer, $$); } - | cmd_set_timing_derate ARG_LATE { $$ = $1; sdc_set_timing_derate_late(callback, lexer, $$); } - | cmd_set_timing_derate ARG_CELL_DELAY { $$ = $1; sdc_set_timing_derate_target_type(callback, lexer, $$, TimingDerateTargetType::NET); } - | cmd_set_timing_derate ARG_NET_DELAY { $$ = $1; sdc_set_timing_derate_target_type(callback, lexer, $$, TimingDerateTargetType::CELL); } - | cmd_set_timing_derate number { $$ = $1; sdc_set_timing_derate_value(callback, lexer, $$, $2); } - | cmd_set_timing_derate LSPAR cmd_get_cells RSPAR { $$ = $1; sdc_set_timing_derate_targets(callback, lexer, $$, $3); } - ; - -cmd_get_ports: CMD_GET_PORTS { $$ = StringGroup(StringGroupType::PORT); } - | cmd_get_ports LCPAR stringGroup RCPAR { $$ = $1; sdc_string_group_add_strings($$, $3); } - | cmd_get_ports string { $$ = $1; sdc_string_group_add_string($$, $2); } - ; - -cmd_get_clocks: CMD_GET_CLOCKS { $$ = StringGroup(StringGroupType::CLOCK); } - | cmd_get_clocks LCPAR stringGroup RCPAR { $$ = $1; sdc_string_group_add_strings($$, $3); } - | cmd_get_clocks string { $$ = $1; sdc_string_group_add_string($$, $2); } - ; - -cmd_get_cells: CMD_GET_CELLS { $$ = StringGroup(StringGroupType::CELL); } - | cmd_get_cells LCPAR stringGroup RCPAR { $$ = $1; sdc_string_group_add_strings($$, $3); } - | cmd_get_cells string { $$ = $1; sdc_string_group_add_string($$, $2); } - ; - -cmd_get_pins: CMD_GET_PINS { $$ = StringGroup(StringGroupType::PIN); } - | cmd_get_pins LCPAR stringGroup RCPAR { $$ = $1; sdc_string_group_add_strings($$, $3); } - | cmd_get_pins string { $$ = $1; sdc_string_group_add_string($$, $2); } - ; - - -stringGroup: /*empty*/ { $$ = StringGroup(StringGroupType::STRING); } - | stringGroup string { $$ = $1; sdc_string_group_add_string($$, $2); } - -string: STRING { $$ = $1; } - | ESCAPED_STRING { $$ = $1; } - ; - -number: float_number { $$ = $1; } - | int_number { $$ = $1; } - ; - -float_number: FLOAT_NUMBER { $$ = $1; } - ; - -int_number: INT_NUMBER { $$ = $1; } - ; - -%% - - -void sdcparse::Parser::error(const std::string& msg) { - sdc_error_wrap(callback, lexer.lineno(), lexer.text(), msg.c_str()); -} diff --git a/libs/EXTERNAL/libsdcparse/src/sdcparse.cpp b/libs/EXTERNAL/libsdcparse/src/sdcparse.cpp deleted file mode 100644 index 73a83220f77..00000000000 --- a/libs/EXTERNAL/libsdcparse/src/sdcparse.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include - -#include "sdcparse.hpp" -#include "sdc_common.hpp" - -#include "sdc_lexer.hpp" -#include "sdc_error.hpp" - -namespace sdcparse { - -void sdc_parse_filename(std::string filename, Callback& callback) { - sdc_parse_filename(filename.c_str(), callback); -} - -void sdc_parse_filename(const char* filename, Callback& callback) { - FILE* infile = std::fopen(filename, "r"); - if(infile != NULL) { - //Parse the file - sdc_parse_file(infile, callback, filename); - - std::fclose(infile); - } else { - sdc_error_wrap(callback, 0, "", "Could not open file '%s'.\n", filename); - } -} - -void sdc_parse_file(FILE* sdc_file, Callback& callback, const char* filename) { - - //Initialize the lexer - Lexer lexer(sdc_file, callback); - - //Setup the parser + lexer - Parser parser(lexer, callback); - - //Just before parsing starts - callback.start_parse(); - - //Tell the caller the file name - callback.filename(filename); - - //Do the actual parse - int error = parser.parse(); - if(error) { - sdc_error_wrap(callback, 0, "", "File '%s' failed to parse.\n", filename); - } - - //Finished parsing - callback.finish_parse(); -} - -} diff --git a/libs/EXTERNAL/libsdcparse/src/sdcparse.hpp b/libs/EXTERNAL/libsdcparse/src/sdcparse.hpp deleted file mode 100644 index c9333241cd5..00000000000 --- a/libs/EXTERNAL/libsdcparse/src/sdcparse.hpp +++ /dev/null @@ -1,314 +0,0 @@ -#ifndef SDC_H -#define SDC_H -/* - * libsdcparse - Kevin E. Murray 2014 - * - * Released under MIT License see LICENSE.txt for details. - * - * OVERVIEW - * -------------------------- - * This library provides basic parsing capabilities for a subset of commands in - * Synopsys Design Constraint (SDC) files. SDC files are typically used to - * set timing constraints on digital circuits. - * - * USING THIS LIBRARY - * -------------------------- - * Since this is NOT a full TCL interpreter, 'function calls' to get_ports or - * get_clocks, are converted to string_group, with the group_type field set - * to either StringType::CLOCK or StringType::SDC_PORT respectively. That is, - * they are represented as the sets of the strings passed to those functions. - * It is left up to the application to interpret them. - * - * After parsing, each SDC command is represented as a C struct. Typically each - * command is parsed into a unique type of struct, however some closely related commands - * (such as set_input_delay and set_output_delay) may share a struct and be identified - * by a 'type' field in the struct. - * - * All supported SDC commands are collected into a commands struct which - * represents the entire SDC file. - * - * See the associated main.c for example usage. - * - * EXTENDING THE LIBRARY - * -------------------------- - * The parser uses a lexer generated by 'flex' (see sdc_parse.l), and a parser - * generated by 'bison' (see sdc_parse.y). - * - * While the parser currently supports only a subset of the full SDC specification, - * it should be relatively straightforward to extend it as follows: - * - * 1) To add a new option to an existing command - * a) Add the new token definition to sdc_parse.y (e.g. ARG_HOLD) - * b) Add a pattern to sdc_parse.l which returns the token (e.g. '-hold') - * c) Add a new (optional) rule to the appropriate command in sdc_parse.y - * d) Add an action for the added rule which makes the appropriate - * modifications to the command's struct. It likely that you will - * want to do this as a function call and put the function definition - * in sdc_common.c. If the option may conflict with others it is - * typically checked at this point, with errors reported using sdc_error(). - * e) Command is automatically added using the appropriate add_sdc*() - * function, which also verifies the options. Command level consistency - * checks (e.g. option required) typically go here. - * - * 2) To add a new command - * a) Add the new token definition to sdc_parse.y (e.g. CMD_SET_TIME_FORMAT) - * b) Add a pattern to sdc_parse.l which returns the token (e.g. 'set_time_format') - * c) Add a new rule for the command to sdc_parse.y e.g.: - * cmd_set_time_format: CMD_SET_TIME_FORMAT - * d) Create a new C struct to represent the command, and write an alloc function - * (in sdc_common.c) that is called by the first rule e.g.: - * cmd_set_time_format: CMD_SET_TIME_FORMAT {$$ = alloc_sdc_set_time_units();} - * c) Add options to the command as outlined in (1) - * d) Create an add_sdc*() command and extend the s_sdc_commands struct to include - * the new command. Call it in the top level sdc_commands rule e.g.: - * - * sdc_commands: ... - * | ... //Other commands - * | sdc_commands cmd_set_time_format EOL {$$ = add_sdc_set_time_format($1, $2); } - * - */ -#include -#include -#include -#include -#include - -namespace sdcparse { -/* - * Forward declarations - */ -enum class IoDelayType; -enum class ClockGroupsType; -enum class FromToType; -enum class McpType; -enum class StringGroupType; - -struct CreateClock; -struct SetIoDelay; -struct SetClockGroups; -struct SetFalsePath; -struct SetMinMaxDelay; -struct SetMulticyclePath; -struct SetClockUncertainty; -struct SetClockLatency; -struct SetDisableTiming; -struct SetTimingDerate; - -struct StringGroup; - - -class Callback { - - public: - virtual ~Callback() {} - - //Start of parsing - virtual void start_parse() = 0; - - //Sets current filename - virtual void filename(std::string fname) = 0; - - //Sets current line number - virtual void lineno(int line_num) = 0; - - virtual void create_clock(const CreateClock& cmd) = 0; - virtual void set_io_delay(const SetIoDelay& cmd) = 0; - virtual void set_clock_groups(const SetClockGroups& cmd) = 0; - virtual void set_false_path(const SetFalsePath& cmd) = 0; - virtual void set_min_max_delay(const SetMinMaxDelay& cmd) = 0; - virtual void set_multicycle_path(const SetMulticyclePath& cmd) = 0; - virtual void set_clock_uncertainty(const SetClockUncertainty& cmd) = 0; - virtual void set_clock_latency(const SetClockLatency& cmd) = 0; - virtual void set_disable_timing(const SetDisableTiming& cmd) = 0; - virtual void set_timing_derate(const SetTimingDerate& cmd) = 0; - - //End of parsing - virtual void finish_parse() = 0; - - //Error during parsing - virtual void parse_error(const int curr_lineno, const std::string& near_text, const std::string& msg) = 0; -}; - -/* - * External functions for loading an SDC file - */ -void sdc_parse_filename(std::string filename, Callback& callback); -void sdc_parse_filename(const char* filename, Callback& callback); - -//Loads from 'sdc'. 'filename' only used to pass a filename to callback and can be left unspecified -void sdc_parse_file(FILE* sdc, Callback& callback, const char* filename=""); - -/* - * Sentinal values - */ -constexpr double UNINITIALIZED_FLOAT = std::numeric_limits::quiet_NaN(); -constexpr int UNINITIALIZED_INT = -1; - -/* - * Enumerations to describe specific SDC command types and attributes - */ -enum class IoDelayType { - INPUT, - OUTPUT -}; - -enum class MinMaxType { - MIN, - MAX, - NONE -}; - -enum class ClockGroupsType { - NONE, - EXCLUSIVE -}; - -enum class FromToType { - FROM, - TO -}; - -enum class ClockLatencyType { - SOURCE, - NONE -}; - -enum class StringGroupType { - STRING, - PORT, - CLOCK, - CELL, - PIN -}; - -/* - * Common SDC data structures - */ - -struct StringGroup { - StringGroup() = default; - StringGroup(StringGroupType group_type) - : type(group_type) {} - - StringGroupType type = StringGroupType::STRING; //The type of the string group, default is STRING. - // Groups derived from 'calls' to [get_clocks {...}] - // and [get_ports {...}] will have types SDC_CLOCK - // and SDC_PORT respectively. - std::vector strings; //The strings in the group -}; - -/* - * Structures defining different SDC commands - */ -struct CreateClock { - std::string name = ""; //Name of the clock - double period = UNINITIALIZED_FLOAT; //Clock period - double rise_edge = UNINITIALIZED_FLOAT; //Rise time from waveform definition - double fall_edge = UNINITIALIZED_FLOAT; //Fall time from waveform definition - StringGroup targets; //The set of strings indicating clock sources. - // May be explicit strings or regexs. - bool is_virtual = false; //Identifies this as a virtual (non-netlist) clock -}; - -struct SetIoDelay { - SetIoDelay() = default; - SetIoDelay(IoDelayType io_type) - : type(io_type) {} - - IoDelayType type = IoDelayType::INPUT; //Identifies whether this represents a - // set_input_delay or set_output delay - // command. - bool is_min = false; //Does delay apply for maximum delays? - bool is_max = false; //Does delay apply for minimum delays? - // Note: is_min/is_max correspond to whether the option was - // provided, it is up to the application to handle the case - // where both are left unspecified (which SDC treats as - // implicitly specifying both) - std::string clock_name = ""; //Name of the clock this constraint is associated with - double delay = UNINITIALIZED_FLOAT; //The maximum input delay allowed on the target ports - StringGroup target_ports; //The target ports -}; - -struct SetClockGroups { - ClockGroupsType type = ClockGroupsType::NONE; //The type of clock group relation being specified - std::vector clock_groups; //The groups of clocks -}; - -struct SetFalsePath { - StringGroup from; //The source list of startpoints or clocks - StringGroup to; //The target list of endpoints or clocks -}; - -struct SetMinMaxDelay { - SetMinMaxDelay() = default; - SetMinMaxDelay(MinMaxType delay_type) - : type(delay_type) {} - MinMaxType type = MinMaxType::NONE; //Whether this is a min or max delay - double value = UNINITIALIZED_FLOAT; //The maximum/minimum allowed delay between the from - // and to clocks - StringGroup from; //The source list of startpoints or clocks - StringGroup to; //The target list of endpoints or clocks -}; - -struct SetMulticyclePath { - bool is_setup = false; //Does mcp_value apply for setup? - bool is_hold = false; //Does mcp_value apply for hold? - // Note: is_setup/is_hold correspond to whether the option was - // provided, it is up to the application to handle the case - // where both are left unspecified (which SDC treats as - // applying mcp_value for the setup mcp, and 0 for the hold - // mcp) - int mcp_value = UNINITIALIZED_INT; //The number of cycles specifed - StringGroup from; //The source list of startpoints or clocks - StringGroup to; //The target list of endpoints or clocks -}; - -struct SetClockUncertainty { - bool is_setup = false; //Does value apply for setup? - bool is_hold = false; //Does value apply for hold? - // Note: is_setup/is_hold correspond to whether the option was - // provided, it is up to the application to handle the case - // where both are left unspecified (which SDC treats as - // implicitly specifying both) - float value = UNINITIALIZED_FLOAT; //The uncertainty value - - StringGroup from; //Launch clock domain(s) - StringGroup to; //Capture clock domain(s) -}; - -struct SetClockLatency { - ClockLatencyType type = ClockLatencyType::NONE;//Latency type - bool is_early = false; //Does value apply for early transitions? - bool is_late = false; //Does value apply for late transitions? - // Note: is_early/is_late correspond to whether the option was - // provided, it is up to the application to handle the case - // where both are left unspecified (which SDC treats as - // implicitly specifying both) - float value = UNINITIALIZED_FLOAT; //The latency value - - StringGroup target_clocks; //The target clocks -}; - -struct SetDisableTiming { - StringGroup from; //The source pins - StringGroup to; //The sink pins -}; - -struct SetTimingDerate { - bool is_early = false; //Does value apply for early transitions? - bool is_late = false; //Does value apply for late transitions? - // Note: is_early/is_late correspond to whether the option was - // provided, it is up to the application to handle the case - // where both are left unspecified (which SDC treats as - // implicitly specifying both) - bool derate_nets = false; //Should nets be derated? - bool derate_cells = false; //Should cells be derated? - - float value = UNINITIALIZED_FLOAT; //The derate value - - StringGroup cell_targets; //The (possibly empty) set of target cells -}; - -} //namespace - -#endif diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test.sdc b/libs/EXTERNAL/libsdcparse/test_sdcs/test.sdc deleted file mode 100644 index 2c826fa137f..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test.sdc +++ /dev/null @@ -1,53 +0,0 @@ -#Netlist Clocks -create_clock -period 3 -waveform {1.25 2.75} clk0 #Integer period, float waveform -create_clock -period 3 -waveform {1 2} clk1 #Integer period, integer waveform -create_clock -period 2.3 clk2 #Float period -create_clock -period 2 {clk3 clk4} #Multiple targets -create_clock -period 0 {top^clk} - - -#Virtual Clocks -create_clock -period 1 -name input_clk -create_clock -period 0 -name output_clk #Zero period - -#Clock Groups -set_clock_groups -exclusive -group input_clk -group {clk2} -group [get_clocks {clk3}] #Single element -set_clock_groups -exclusive -group {input_clk input_clock2} -group {clk2} -group [get_clocks {asdf qwerty}] #Multiple string elements - -#False Path -set_false_path -from [get_clocks{clk}] -to [get_clocks{output_clk}] #Clocks -set_false_path -from {asdf~/ff} -to {wer/234/ff3 xcw/32|ff2} #Objects -set_false_path -from {asdf/ff qwert/asd/ff} -to [get_clocks{output_clk}] #Mixed Clocks/Objects -set_false_path -from [get_clocks{output_clk}] -to {asdf/ff2} #Mixed Clocks/Objects - -#Max Delay -set_max_delay 2 -from [get_clocks{clk}] -to [get_clocks{output_clk}] #Clocks -set_max_delay 3.6 -from {asdf~/ff} -to {wer/234/ff3 xcw/32|ff2} #Objects -set_max_delay .3 -from {asdf/ff qwert/asd/ff} -to [get_clocks{output_clk}] #Mixed Clocks/Objects -set_max_delay 0. -from [get_clocks{output_clk}] -to {asdf/ff2} #Mixed Clocks/Objects - -#MCP -set_multicycle_path 2 -setup -from [get_clocks{clk}] -to [get_clocks{output_clk}] #Clocks -set_multicycle_path 3 -setup -from {asdf~/ff} -to {wer/234/ff3 xcw/32|ff2} #Objects -set_multicycle_path 3 -setup -from {asdf/ff qwert/asd/ff} -to [get_clocks{output_clk}] #Mixed Clocks/Objects -set_multicycle_path 0 -setup -from [get_clocks{output_clk}] -to {asdf/ff2} #Mixed Clocks/Objects -set_multicycle_path 3 -hold -from {asdf/ff qwert/asd/ff} -to [get_clocks{output_clk}] #hold -set_multicycle_path 2 -from [get_clocks{clk}] -to [get_clocks{output_clk}] #Clocks -set_multicycle_path 2 -to [get_pins{my_inst/in[0]}] #Pin targets -set_multicycle_path 2 -from [get_pins{my_inst/in[0]}] #Pin targets -set_multicycle_path 2 -to [get_pins{myinst2/out[3]}] -from [get_pins{my_inst/in[0]}] #Pin targets - -#I/O Delay -set_input_delay -clock input_clk -max 0.5 [get_ports{in1 in2 in3}] -set_output_delay -clock output_clk -max 1 [get_ports{out*}] - -#Line continuation -create_clock -period \ -2 {clk3 \ -clk4} \ -#asdf - -#Spaced Comments - -#Non-empty line at end of file -set_output_delay -clock eof_test -max 1.7293 [ get_ports {eof_test_port*} ] diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test10.sdc b/libs/EXTERNAL/libsdcparse/test_sdcs/test10.sdc deleted file mode 100644 index b7b01a6e063..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test10.sdc +++ /dev/null @@ -1,9 +0,0 @@ -set_clock_uncertainty -setup -from clka -to clkb 0.3 - -set_clock_uncertainty -hold -from clka -to clkb 0.2 - -set_clock_uncertainty -hold -from {clka clkc} -to clkb 0.2 - -set_clock_uncertainty -hold -from {clka clkc} -to {clkb clkd} 0.2 - -set_clock_uncertainty -setup -from [get_clocks {clka clkc}] -to {clkb clkd} 0.2 diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test11.sdc b/libs/EXTERNAL/libsdcparse/test_sdcs/test11.sdc deleted file mode 100644 index c3f4baffad6..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test11.sdc +++ /dev/null @@ -1,3 +0,0 @@ -set_disable_timing -from {asdf/qwer/cin} -to {awer/zxc/guy3w} -set_disable_timing -from asdf/qwer/cin -to awer/zxc/guy3w -set_disable_timing -from [get_pins {asdf/qwer/cin}] -to awer/zxc/guy3w diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test12.sdc b/libs/EXTERNAL/libsdcparse/test_sdcs/test12.sdc deleted file mode 100644 index 1a003d6af8a..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test12.sdc +++ /dev/null @@ -1,4 +0,0 @@ -set_min_delay 2 -from [get_clocks{clk}] -to [get_clocks{output_clk}] #Clocks -set_min_delay 3.6 -from {asdf~/ff} -to {wer/234/ff3 xcw/32|ff2} #Objects -set_min_delay .3 -from {asdf/ff qwert/asd/ff} -to [get_clocks{output_clk}] #Mixed Clocks/Objects -set_min_delay 0. -from [get_clocks{output_clk}] -to {asdf/ff2} #Mixed Clocks/Objects diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test13.sdc b/libs/EXTERNAL/libsdcparse/test_sdcs/test13.sdc deleted file mode 100644 index b2c1cd9f6c2..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test13.sdc +++ /dev/null @@ -1,4 +0,0 @@ -set_clock_latency -source -late 3.4 [get_clocks clk1] -set_clock_latency -source -late 3.4 [get_clocks clk*] -set_clock_latency -source -early 3.4 [get_clocks {clk2}] -set_clock_latency -source 3.4 [get_clocks {clk3}] diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test14.sdc b/libs/EXTERNAL/libsdcparse/test_sdcs/test14.sdc deleted file mode 100644 index 791777f0d38..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test14.sdc +++ /dev/null @@ -1,23 +0,0 @@ -create_clock -period 0.5 -name VIRTUAL_INPUT_CLOCK -create_clock -period 0.4 -name VIRTUAL_OUTPUT_CLOCK -create_clock -period 0.7 clk - -set_input_delay -clock VIRTUAL_INPUT_CLOCK -max 0.1 [get_ports{*}] -set_output_delay -clock VIRTUAL_OUTPUT_CLOCK -max 0.2 [get_ports{*}] - -set_clock_groups -exclusive -group [get_clocks {VIRTUAL_INPUT_CLOCK}] -group [get_clocks {VIRTUAL_OUTPUT_CLOCK}] - -set_multicycle_path -from [get_clocks {VIRTUAL_INPUT_CLOCK}] -to [get_clocks {clk}] -setup 2 -set_multicycle_path -from [get_clocks {VIRTUAL_INPUT_CLOCK}] 2 -set_multicycle_path -from [get_clocks {VIRTUAL_INPUT_CLOCK}] -to [get_clocks {clk}] -hold 1 -set_multicycle_path -from [get_clocks {VIRTUAL_INPUT_CLOCK}] -hold 1 -set_multicycle_path -to [get_clocks {VIRTUAL_INPUT_CLOCK}] -hold 1 - -set_clock_uncertainty 0.05 -set_clock_uncertainty -hold 0.05 -from [get_clocks {clk}] -set_clock_uncertainty -setup 0.05 -from [get_clocks {clk}] -to [get_clocks {VIRTUAL_OUTPUT_CLOCK}] -set_clock_uncertainty -hold -setup 0.05 -from [get_clocks {clk}] -to [get_clocks {VIRTUAL_OUTPUT_CLOCK}] -set_clock_uncertainty 5 -from [get_clocks {clk}] -to [get_clocks {VIRTUAL_OUTPUT_CLOCK}] - -set_clock_latency -source 1 [get_clocks {clk}] - diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test2.sdc b/libs/EXTERNAL/libsdcparse/test_sdcs/test2.sdc deleted file mode 100644 index 83804d36154..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test2.sdc +++ /dev/null @@ -1,34 +0,0 @@ -#VPR compatible SDC file for benchmark 'minres' - -#******************************* -# set_time_format -#******************************* -# Unsuported by VPR - -#******************************* -# create_clock -#******************************* -create_clock -period 1.0 -name virtual_io_clock -create_clock -period 1.0 clk0 -create_clock -period 1.0 { a[0] } -create_clock -period 1.0 {pll_minres:inst_pll_minres|altpll:altpll_component|pll_minres_altpll:auto_generated|wire_pll1_clk[0]} - -#******************************* -# set_clock_uncertainty -#******************************* -# Unsupported by VPR. VPR does not model clock uncertainty. - -#******************************* -# set_input_delay -#******************************* -set_input_delay -clock virtual_io_clock -max 0.0 [get_ports *] - -#******************************* -# set_output_delay -#******************************* -set_output_delay -clock virtual_io_clock -max 0.0 [get_ports *] - -#******************************* -# set_clock_groups -#******************************* -set_clock_groups -exclusive -group { clk0 } -group { pll_minres:inst_pll_minres|altpll:altpll_component|pll_minres_altpll:auto_generated|wire_pll1_clk[0] } diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test3.sdc b/libs/EXTERNAL/libsdcparse/test_sdcs/test3.sdc deleted file mode 100644 index 8709ac891db..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test3.sdc +++ /dev/null @@ -1,40 +0,0 @@ -#VPR compatible SDC file for benchmark 'mes_noc' - -#******************************* -# set_time_format -#******************************* -# Unsuported by VPR - -#******************************* -# create_clock -#******************************* -create_clock -period 1.0 -name virtual_io_clock -create_clock -period 1.0 clk -create_clock -period 1.0 {pll_noc_type0:\using_pll:separate_clk:noc_pll_0|altpll:altpll_component|pll_noc_type0_altpll:auto_generated|wire_pll1_clk[0]} -create_clock -period 1.0 {pll_noc_type1:\using_pll:use_noc_pll_1:noc_pll_1|altpll:altpll_component|pll_noc_type1_altpll:auto_generated|wire_pll1_clk[0]} -create_clock -period 1.0 {pll_noc_type2:\using_pll:use_noc_pll_2:noc_pll_2|altpll:altpll_component|pll_noc_type2_altpll:auto_generated|wire_pll1_clk[0]} -create_clock -period 1.0 {pll_noc_type5:\using_pll:use_noc_pll_5:noc_pll_5|altpll:altpll_component|pll_noc_type5_altpll:auto_generated|wire_pll1_clk[0]} -create_clock -period 1.0 {pll_noc_type4:\using_pll:use_noc_pll_4:noc_pll_4|altpll:altpll_component|pll_noc_type4_altpll:auto_generated|wire_pll1_clk[0]} -create_clock -period 1.0 {pll_noc_type3:\using_pll:use_noc_pll_3:noc_pll_3|altpll:altpll_component|pll_noc_type3_altpll:auto_generated|wire_pll1_clk[0]} -create_clock -period 1.0 {pll_noc_type6:\using_pll:use_noc_pll_6:noc_pll_6|altpll:altpll_component|pll_noc_type6_altpll:auto_generated|wire_pll1_clk[0]} -create_clock -period 1.0 {pll_noc_type7:\using_pll:use_noc_pll_7:noc_pll_7|altpll:altpll_component|pll_noc_type7_altpll:auto_generated|wire_pll1_clk[0]} - -#******************************* -# set_clock_uncertainty -#******************************* -# Unsupported by VPR. VPR does not model clock uncertainty. - -#******************************* -# set_input_delay -#******************************* -set_input_delay -clock virtual_io_clock -max 0.0 [get_ports *] - -#******************************* -# set_output_delay -#******************************* -set_output_delay -clock virtual_io_clock -max 0.0 [get_ports *] - -#******************************* -# set_clock_groups -#******************************* -set_clock_groups -exclusive -group { clk } -group { pll_noc_type0:\using_pll:separate_clk:noc_pll_0|altpll:altpll_component|pll_noc_type0_altpll:auto_generated|wire_pll1_clk[0] } -group { pll_noc_type1:\using_pll:use_noc_pll_1:noc_pll_1|altpll:altpll_component|pll_noc_type1_altpll:auto_generated|wire_pll1_clk[0] } -group { pll_noc_type2:\using_pll:use_noc_pll_2:noc_pll_2|altpll:altpll_component|pll_noc_type2_altpll:auto_generated|wire_pll1_clk[0] } -group { pll_noc_type5:\using_pll:use_noc_pll_5:noc_pll_5|altpll:altpll_component|pll_noc_type5_altpll:auto_generated|wire_pll1_clk[0] } -group { pll_noc_type4:\using_pll:use_noc_pll_4:noc_pll_4|altpll:altpll_component|pll_noc_type4_altpll:auto_generated|wire_pll1_clk[0] } -group { pll_noc_type3:\using_pll:use_noc_pll_3:noc_pll_3|altpll:altpll_component|pll_noc_type3_altpll:auto_generated|wire_pll1_clk[0] } -group { pll_noc_type6:\using_pll:use_noc_pll_6:noc_pll_6|altpll:altpll_component|pll_noc_type6_altpll:auto_generated|wire_pll1_clk[0] } -group { pll_noc_type7:\using_pll:use_noc_pll_7:noc_pll_7|altpll:altpll_component|pll_noc_type7_altpll:auto_generated|wire_pll1_clk[0] } diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test4.sdc b/libs/EXTERNAL/libsdcparse/test_sdcs/test4.sdc deleted file mode 100644 index c8c73f78f13..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test4.sdc +++ /dev/null @@ -1,33 +0,0 @@ -#VPR compatible SDC file for benchmark 'bitcoin_miner' - -#******************************* -# set_time_format -#******************************* -# Unsuported by VPR - -#******************************* -# create_clock -#******************************* -create_clock -period 1.0 -name virtual_io_clock -create_clock -period 1.0 {pll:pll_inst|altpll:altpll_component|pll_altpll:auto_generated|wire_pll1_clk[0]} -create_clock -period 1.0 OSC_CLK - -#******************************* -# set_clock_uncertainty -#******************************* -# Unsupported by VPR. VPR does not model clock uncertainty. - -#******************************* -# set_input_delay -#******************************* -set_input_delay -clock virtual_io_clock -max 0.0 [get_ports *] - -#******************************* -# set_output_delay -#******************************* -set_output_delay -clock virtual_io_clock -max 0.0 [get_ports *] - -#******************************* -# set_clock_groups -#******************************* -set_clock_groups -exclusive -group { pll:pll_inst|altpll:altpll_component|pll_altpll:auto_generated|wire_pll1_clk[0] } -group { OSC_CLK } diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test5.sdc b/libs/EXTERNAL/libsdcparse/test_sdcs/test5.sdc deleted file mode 100644 index 10f237a171b..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test5.sdc +++ /dev/null @@ -1 +0,0 @@ -create_clock -period 0 * \ No newline at end of file diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test6.sdc b/libs/EXTERNAL/libsdcparse/test_sdcs/test6.sdc deleted file mode 100644 index 510e3014911..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test6.sdc +++ /dev/null @@ -1,5 +0,0 @@ -create_clock -period 3 -waveform {1.25 2.75} clk # rising edge at 1.25, falling at 2.75 -create_clock -period 2 clk2 -create_clock -period 2.5 -name virtual_io_clock -set_input_delay -clock virtual_io_clock -max 1 [get_ports{*}] -set_output_delay -clock virtual_io_clock -max 0.5 [get_ports{*}] diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test7.sdc b/libs/EXTERNAL/libsdcparse/test_sdcs/test7.sdc deleted file mode 100644 index 300062b4bee..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test7.sdc +++ /dev/null @@ -1,13 +0,0 @@ -create_clock -period 3 -waveform {1.25 2.75} clk -create_clock -period 2 {clk2 clk_extra} -create_clock -period 1 -name input_clk -create_clock -period 0 -name output_clk -set_clock_groups -exclusive -group input_clk -group clk2 -set_false_path -from [get_clocks{clk}] -to [get_clocks{output_clk}] -set_max_delay 17 -from [get_clocks{input_clk}] -to [get_clocks{output_clk}] -set_multicycle_path 5 -setup -from [get_clocks{clk}] -to [get_clocks{clk2}] -set_input_delay -clock input_clk -max 0.5 [get_ports{in1 in2 in3}] -set_output_delay -clock output_clk -max 1 [get_ports{out*}] - -#asdf - diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test8.sdc b/libs/EXTERNAL/libsdcparse/test_sdcs/test8.sdc deleted file mode 100644 index 8cad4e8c9f3..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test8.sdc +++ /dev/null @@ -1 +0,0 @@ -create_clock -period 1.0 *_pll diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test9.sdc b/libs/EXTERNAL/libsdcparse/test_sdcs/test9.sdc deleted file mode 100644 index f281fbd671e..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test9.sdc +++ /dev/null @@ -1,10 +0,0 @@ -set_timing_derate -early 0.9 -set_timing_derate -late 1.1 - -set_timing_derate -early 0.9 -cell_delay -set_timing_derate -late 1.1 -cell_delay - -set_timing_derate -early 0.9 -net_delay -set_timing_derate -late 1.1 -net_delay - -set_timing_derate -late 1.1 -cell_delay [get_cells werty/asdr/q ] diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test_early_late.sdc b/libs/EXTERNAL/libsdcparse/test_sdcs/test_early_late.sdc deleted file mode 100644 index 99a9717420f..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test_early_late.sdc +++ /dev/null @@ -1,7 +0,0 @@ -#Latency -set_clock_latency -source -early -late 3.4 [get_clocks clk*] -set_clock_latency -source 3.4 [get_clocks clk*] - -#Derate -set_timing_derate 0.9 -set_timing_derate -early -late 0.9 diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test_escape.sdc b/libs/EXTERNAL/libsdcparse/test_sdcs/test_escape.sdc deleted file mode 100644 index 2110d74fe01..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test_escape.sdc +++ /dev/null @@ -1,19 +0,0 @@ -#VPR compatible SDC file for benchmark circuit 'radar20' - -# Creates an external virtual clock 'virtual_io_clock', and non-virtual clocks for each netlist clock (each with 1ns target clock period). -# Paths between netlist clock domains are not analyzed, but paths to/from the 'virtual_io_clock' and netlist clocks are analyzed. - -#************************************************************** -# Unit Information -#************************************************************** -#VPR assumes time unit is nanoseconds - -#************************************************************** -# Create Clock -#************************************************************** -create_clock -period 1.000 -name virtual_io_clock -create_clock -period 1.000 {n101} -create_clock -period 1.000 {clock} -create_clock -period 1.000 {clk[0]} -create_clock -period 1.000 {clk\[0\]} -create_clock -period 1.000 {obj_q:obj_q\|altclklock0_wrap:b2v_inst10\|altclklock0:component1\|altpll:altpll_component\|altpll_bnf2:auto_generated\|clk\[0\]} diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test_invalid.sdc b/libs/EXTERNAL/libsdcparse/test_sdcs/test_invalid.sdc deleted file mode 100644 index 2568e524410..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test_invalid.sdc +++ /dev/null @@ -1,2 +0,0 @@ -#False Path -set_false_path -from [get_clocks{clk}] -max diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test_io_min_max.sdc b/libs/EXTERNAL/libsdcparse/test_sdcs/test_io_min_max.sdc deleted file mode 100644 index 3640400c268..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test_io_min_max.sdc +++ /dev/null @@ -1,5 +0,0 @@ -#I/O Delay -set_input_delay -clock input_clk -max -min 0.5 [get_ports{in1 in2 in3}] -set_output_delay -clock output_clk -max -min 1 [get_ports{out*}] -set_input_delay -clock input_clk 0.5 [get_ports{in1 in2 in3}] -set_output_delay -clock output_clk 1 [get_ports{out*}] diff --git a/libs/EXTERNAL/libsdcparse/test_sdcs/test_parser.sh b/libs/EXTERNAL/libsdcparse/test_sdcs/test_parser.sh deleted file mode 100755 index 015d8e07828..00000000000 --- a/libs/EXTERNAL/libsdcparse/test_sdcs/test_parser.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -if [ -x ./sdcparse_test ]; then - echo "Found test executable" -else - echo "Failed to find test executabe" - exit 1 -fi - -test_cnt=0 -for path in "$@" -do - sdc_files=`find $path -name '*.sdc' | sort -V` - for sdc_file in ${sdc_files[@]} - do - test_cnt=$((test_cnt + 1)) - echo - echo "File: $sdc_file" - #valgrind --leak-check=full --track-origins=yes ./sdcparse_test $sdc_file - ./sdcparse_test $sdc_file - exit_code=$? - if [[ $sdc_file != *"invalid"* ]]; then - if [ $exit_code -ne 0 ]; then - #Should have parsed ok - echo "Error: $sdc_file should have parsed correctly!" - exit 1 - fi - else - if [ $exit_code -eq 0 ]; then - echo "Error: $sdc_file should have failed to parse!" - exit 1 - else - echo "PASS: invalid sdc $sdc_file did not parse (as expected)" - fi - fi - done - -done - -echo "ALL $test_cnt TESTS PASSED" -exit 0