Remove release.tcl, replace with cmake
Signed-off-by: Alain <alainmarcel@yahoo.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fafa1ea..d361ffd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,8 +2,8 @@
cmake_minimum_required (VERSION 2.8)
# 2.8 needed because of ExternalProject
-add_subdirectory(third_party/flatbuffers)
-add_subdirectory(third_party/antlr4/runtime/Cpp)
+add_subdirectory(third_party/flatbuffers EXCLUDE_FROM_ALL)
+add_subdirectory(third_party/antlr4/runtime/Cpp EXCLUDE_FROM_ALL)
FIND_PACKAGE(SWIG REQUIRED)
@@ -47,6 +47,11 @@
message(STATUS "PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}")
message(STATUS "PYTHON_INCLUDE_DIRS = ${PYTHON_INCLUDE_DIRS}")
+# Directories
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE}/)
+set(CMAKE_BUILD_FILES_DIRECTORY ${dir})
+set(CMAKE_BUILD_DIRECTORY ${dir})
+
# C++
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_CXX_WARNING_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g ${MY_CXX_WARNING_FLAGS}")
@@ -78,7 +83,6 @@
endif ()
# Flatbuffer
-
set(flatbuffer-GENERATED_SRC
${PROJECT_SOURCE_DIR}/src/Cache/header_generated.h
${PROJECT_SOURCE_DIR}/src/Cache/parser_generated.h
@@ -106,11 +110,11 @@
find_package(Java)
find_package(Java COMPONENTS Runtime)
set(ANTLR_JAR_LOCATION ${PROJECT_SOURCE_DIR}/third_party/antlr4/antlr4-4.7.2-complete.jar)
-#
enable_testing()
#add_test(NAME GenerateFromGrammar COMMAND ${Java_JAVA_EXECUTABLE} org.antlr.v4.Tool -Dlanguage=Cpp *.g4)
+add_custom_target(CreateDirectories)
add_custom_target(GenerateParser DEPENDS ${PROJECT_SOURCE_DIR}/src/SourceCompile/VObjectTypes.cpp)
add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/src/SourceCompile/VObjectTypes.cpp
@@ -122,12 +126,7 @@
COMMAND API/embed_python_api.tcl
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/src/"
DEPENDS ${PROJECT_SOURCE_DIR}/grammar/SV3_1aPpLexer.g4 ${PROJECT_SOURCE_DIR}/grammar/SV3_1aSplitterLexer.g4 ${PROJECT_SOURCE_DIR}/grammar/SV3_1aPpParser.g4 ${PROJECT_SOURCE_DIR}/grammar/SV3_1aSplitterParser.g4 ${PROJECT_SOURCE_DIR}/src/API/slapi.i
- )
-
-set(CMAKE_BUILD_FILES_DIRECTORY ${dir})
-set(CMAKE_BUILD_DIRECTORY ${dir})
-
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../dist/${CMAKE_BUILD_TYPE}/GNU-Linux/ )
+ )
include_directories(
${PROJECT_SOURCE_DIR}/src/API
@@ -148,7 +147,6 @@
)
file(GLOB surelog_SRC
-
${PROJECT_SOURCE_DIR}/src/parser/SV3_1aLexer.cpp
${PROJECT_SOURCE_DIR}/src/parser/SV3_1aParserBaseListener.cpp
${PROJECT_SOURCE_DIR}/src/parser/SV3_1aParser.cpp
@@ -195,21 +193,43 @@
)
add_executable(surelog ${surelog_SRC})
+
add_dependencies(surelog flatc)
add_dependencies(surelog antlr4_static)
add_dependencies(surelog flatbuffers)
-
add_dependencies(surelog GenerateParser)
add_dependencies(surelog GenerateSerializer)
target_link_libraries(
surelog ${PYTHON_LIBRARIES}
- )
-
-#target_link_libraries(
-# surelog ${ANTLR_LIB}
-#)
+ )
target_link_libraries(
surelog -L${PROJECT_SOURCE_DIR}/dist/ libantlr4-runtime.a -L${PROJECT_SOURCE_DIR}/build/third_party/flatbuffers libflatbuffers.a dl util m rt pthread
)
+
+add_custom_command(TARGET surelog POST_BUILD
+ COMMAND echo " Creating staging for precompiled packages"
+ COMMAND mkdir -p ${CMAKE_BINARY_DIR}/dist/pkg/work/
+ COMMAND mkdir -p ${CMAKE_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE}/sv
+ COMMAND cp -f ${CMAKE_BINARY_DIR}/../src/API/builtin.sv ${CMAKE_BINARY_DIR}/dist/${CMAKE_BUILD_TYPE}/sv
+ COMMAND ln -fs ${CMAKE_BINARY_DIR}/../third_party/UVM/ovm-2.1.2 ovm-2.1.2
+ COMMAND ln -fs ${CMAKE_BINARY_DIR}/../third_party/UVM/uvm-1.2 uvm-1.2
+ COMMAND ln -fs ${CMAKE_BINARY_DIR}/../third_party/UVM/vmm-1.1.1a vmm-1.1.1a
+ COMMAND rm -rf slpp_all slpp_unit
+ COMMAND echo " Creating OVM precompiled package..."
+ COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/surelog -nobuiltin -createcache +incdir+ovm-2.1.2/src/ +incdir+vmm-1.1.1a/sv ovm-2.1.2/src/ovm_pkg.sv -writepp -mt 0 -parse -nocomp -noelab -nostdout
+ COMMAND echo " Creating UVM precompiled package..."
+ COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/surelog -nobuiltin -createcache +incdir+.+uvm-1.2/src/ uvm-1.2/src/uvm_pkg.sv -writepp -mt 0 -parse -nocomp -noelab -nostdout
+ COMMAND echo " Packages created"
+
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+ )
+
+
+
+
+INSTALL(
+ TARGETS surelog
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+)
diff --git a/Makefile b/Makefile
index bb2621c..1dfd2ae 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,7 @@
release:
mkdir -p build/tests;
mkdir -p dist;
- cd build; cmake ../ -DCMAKE_BUILD_TYPE=Release; make -j 4
- cd build; ../src/release.tcl release
+ cd build; cmake ../ -DCMAKE_BUILD_TYPE=Release; make -j 4
cd build; ../tests/regression.tcl mt=0 show_diff
test:
@@ -12,3 +11,7 @@
clean:
rm -rf build;
chmod -fR u+rwx dist; rm -rf dist;
+
+install:
+ cd build; make install
+
diff --git a/README.md b/README.md
index 90efabe..ff19cb8 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@
# Contributing to this project
-This project is open to contributions from any user! From the commercial vendor to the Verilog enthousiast are welcome.
+This project is open to contributions from any users! From the commercial vendor to the Verilog enthousiast, all are welcome.
# Features
@@ -21,6 +21,11 @@
* Surelog accepts IEEE Simulator-compliant project specification.
* Surelog issues Errors/Warning/Info/Notes about language compliance.
* Surelog allows for pre-compiled packages (UVM,...).
+ * A comprehensive Python API allows to:
+ * listen or visit the Parser grammar and create custom linting rules
+ * Visit the design data model and create custom linting rules
+ * Customize the message formats
+ * Waive messages
# Build instructions and test:
@@ -41,7 +46,7 @@
* -f <file> Accepts a file containing command line arguments
* -v <file> Library file
* -y <path> Library directory
- * +incdir+<dir>+... Specifies include paths
+ * +incdir+<dir>[+<dir>...] Specifies include paths
* -Idir Specifies include paths
* +libext+<extname>+... Specifies the library extensions
* <file>.v Verilog File
@@ -50,7 +55,7 @@
* +librescan Lib Rescan option (ignored)
* +libverbose Lib Verbose option (ignored)
* +nolibcell No Lib Cell option (ignored)
- * +define+macro_name=definition+...
+ * +define+name=value[+name=value...]
* Defines a macro and optionally its value
* -L <libName> Defines library compilation order
* -map <mapFile> Specifies a library mapping file (multiple -map options supported)
@@ -105,5 +110,6 @@
* -nonote Filters out NOTE messages
* -nowarning Filters out WARNING messages
* -o <path> Turns on all compilation stages, produces all outputs under that path
-
+ * --help This help
+ * --version Surelog version and build date
diff --git a/src/release.tcl b/src/release.tcl
deleted file mode 100755
index 4a6537f..0000000
--- a/src/release.tcl
+++ /dev/null
@@ -1,175 +0,0 @@
-#!/usr/bin/tclsh
-
-# Copyright 2019 Alain Dargelas
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Either creates all releases, or just the one passed as argument:
-#
-# ./release.tcl
-#
-# Or
-#
-# ./release.tcl "<build_type> <lib_type>"
-#
-# Ex.: ./release.tcl release
-
-# build_type: release, debug
-
-set RELEASES { "release" "debug" }
-
-if {$argv != ""} {
- set RELEASES $argv
-}
-
-proc precompilePackages { } {
- set source_file "../src/parser/SV3_1aParser.cpp"
- set compiled_file "Release/GNU-Linux/pkg/work/uvm_pkg.sv.slpa"
- set source_time 0
- if [file exist $source_file] {
- set source_time [file mtime $source_file]
- }
- set compiled_time 0
- if [file exist $compiled_file] {
- set compiled_time [file mtime $compiled_file]
- }
- exec sh -c "rm -rf Release/sv"
- exec sh -c "mkdir -p Release/sv; cp ../src/API/builtin.sv Release/sv"
- if {($compiled_time == 0) || ($source_time >= $compiled_time)} {
- exec sh -c "rm -rf slpp_all"
- exec sh -c "rm -rf slpp_unit"
- exec sh -c "rm -rf dist/slpp_all"
- exec sh -c "rm -rf dist/slpp_unit"
- exec sh -c "rm -rf Release/GNU-Linux/pkg/work/"
- exec sh -c "rm -f ovm-2.1.2 uvm-1.2 vmm-1.1.1a"
- exec sh -c "ln -s ../third_party/UVM/ovm-2.1.2 ovm-2.1.2"
- exec sh -c "ln -s ../third_party/UVM/uvm-1.2 uvm-1.2"
- exec sh -c "ln -s ../third_party/UVM/vmm-1.1.1a vmm-1.1.1a"
- puts "Precompiling ovm_pkg..."
- puts "Begin: The time is: [clock format [clock seconds] -format %H:%M:%S]"
- exec sh -c "Release/GNU-Linux/surelog -profile -createcache +incdir+ovm-2.1.2/src/ +incdir+vmm-1.1.1a/sv ovm-2.1.2/src/ovm_pkg.sv -writepp -verbose -mt 0 -parse; cp slpp_all/surelog.log ovm_pkg.log"
- puts "End: The time is: [clock format [clock seconds] -format %H:%M:%S]"
- puts "Precompiling uvm_pkg..."
- puts "Begin: The time is: [clock format [clock seconds] -format %H:%M:%S]"
- exec sh -c "Release/GNU-Linux/surelog -profile -createcache +incdir+.+uvm-1.2/src/ uvm-1.2/src/uvm_pkg.sv -writepp -verbose -mt 0 -parse; cp slpp_all/surelog.log uvm_pkg.log"
- puts "End: The time is: [clock format [clock seconds] -format %H:%M:%S]"
-
- } else {
- puts "Skipping ovm_pkg..."
- puts "Skipping uvm_pkg..."
-
- }
-
- catch {exec sh -c "cp -R -f Release/GNU-Linux/pkg/work Debug/GNU-Linux/pkg"} dummy
-}
-
-proc createReleases { } {
- global RELEASES
- foreach release $RELEASES {
- set build_type [lindex $release 0]
- set tar_filename "surelog_${build_type}"
- catch {exec sh -c "chmod 777 -R surelog/"} dummy
- exec sh -c "rm -rf surelog"
- file mkdir surelog
- file mkdir surelog/bin
- file mkdir surelog/bin/pkg
- file mkdir surelog/bin/pkg/work
- file mkdir surelog/lib
- file mkdir surelog/python
- file mkdir surelog/sv
- file copy Release/GNU-Linux/pkg/work/uvm_pkg.sv.slpp surelog/bin/pkg/work
- file copy Release/GNU-Linux/pkg/work/uvm_pkg.sv.slpa surelog/bin/pkg/work
- file copy Release/GNU-Linux/pkg/work/ovm_pkg.sv.slpp surelog/bin/pkg/work
- file copy Release/GNU-Linux/pkg/work/ovm_pkg.sv.slpa surelog/bin/pkg/work
- if {($build_type == "release")} {
- file copy Release/GNU-Linux/surelog surelog/bin/surelog.exe
- catch {exec sh -c "mkdir -p Release/python; cp ../src/API/slSV3_1aPythonListener.py Release/python"} dummy
- catch {exec sh -c "mkdir -p Release/sv; cp ../src/API/builtin.sv Release/sv"} dummy
- } elseif {$build_type == "debug"} {
- file copy Debug/GNU-Linux/surelog surelog/bin/surelog.exe
- catch {exec sh -c "mkdir -p Debug/python; cp ../src/API/slSV3_1aPythonListener.py Debug/python"} dummy
- catch {exec sh -c "mkdir -p Debug/sv; cp ../src/API/builtin.sv Debug/sv"} dummy
- } else {
- puts "ERROR!!! UNSUPPORTED BUILD TYPE: $build_type"
- exit
- }
-
- catch {file copy /usr/lib/x86_64-linux-gnu/libtcmalloc.so.4 surelog/lib/} dummy
- catch {file copy /usr/lib/x86_64-linux-gnu/libtcmalloc.so.4.2.6 surelog/lib/} dummy
- catch {file copy /usr/lib/libtcmalloc.so.4 surelog/lib/} dummy
- catch {file copy /usr/lib/libtcmalloc.so.4.2.6 surelog/lib/} dummy
-
- file copy ../src/API/slSV3_1aPythonListener.py surelog/python/
- file copy ../src/API/slformatmsg.py surelog/python/slformatmsg.py
- file copy ../src/API/slwaivers.py surelog/python/
- file copy ../src/API/surelog.bash surelog/surelog
- file copy ../src/API/yosys.tcl surelog/yosys.tcl
- file copy ../src/API/builtin.sv surelog/sv
- catch {set copy_result [file copy /usr/local/lib64/libstdc++.so.6.0.21 surelog/lib/libstdc++.so.6]} copy_result
- catch {set copy_result [file copy /usr/local/lib64/libgcc_s.so.1 surelog/lib/]} copy_result
- exec sh -c "chmod 555 -R surelog/"
-
- exec sh -c "tar cvzf ${tar_filename}.tar.gz surelog/"
- puts "Created dist/${tar_filename}.tar.gz"
- }
-
-}
-
-proc testReleases { } {
- global RELEASES
- foreach release $RELEASES {
- set build_type [lindex $release 0]
- set tar_filename "surelog_${build_type}"
-
- exec sh -c "chmod 777 -R surelog/"
- exec sh -c "rm -rf surelog"
-
- exec sh -c "tar xvzf ${tar_filename}.tar.gz"
-
- catch {exec sh -c "chmod 777 -R surelog_test/"} dummy
- exec sh -c "rm -rf surelog_test"
- file mkdir surelog_test
- file copy "../src/API/python_listener.py" "surelog_test/slSV3_1aPythonListener.py"
- cd surelog_test
-
- set fid [open "test.v" "w"]
- puts $fid "module toto();\
- `TOTO \
- endmodule"
- close $fid
-
- catch {set result [exec sh -c "../surelog/surelog test.v -parse -pythonlistener"]} result
- if {[regexp {PY0403} $result] && [regexp {module toto} $result]} {
- puts "PASS: $tar_filename"
- } else {
- puts "FAIL: $tar_filename"
- puts "$result"
- }
-
- cd ..
-
- }
-
-}
-
-cd ../dist
-
-precompilePackages
-
-createReleases
-
-testReleases
-
-cd ../build
-
-
diff --git a/tests/regression.tcl b/tests/regression.tcl
index d539de1..a603f2c 100755
--- a/tests/regression.tcl
+++ b/tests/regression.tcl
@@ -20,8 +20,7 @@
puts "regression.tcl tests=<testname> (Tests matching regular expression)"
puts " test=<testname> (Just that test)"
puts " debug=<none, valgrind, ddd>"
- puts " build=<debug, advanced, release, notcmalloc, undertow>"
- puts " commit=\"commit text\""
+ puts " build=<Debug, Release>"
puts " mt=<nbThreads>"
puts " large (large tests too)"
puts " show_diff (Shows text diff)"
@@ -144,7 +143,7 @@
set ONETEST $TESTTARGET
}
-set BUILD "release"
+set BUILD "Release"
if [regexp {build=([A-Za-z0-9_]+)} $argv tmp BUILD] {
}
@@ -161,20 +160,11 @@
if [regexp {commit=([A-Za-z0-9_ \.]+)} $argv tmp COMMIT_TEXT] {
}
-set env(LD_LIBRARY_PATH) "[pwd]/../../python3.6/python/lib/"
-
-set SURELOG_VERSION "[pwd]/../dist/surelog/surelog"
+set SURELOG_VERSION "[pwd]/dist/Release/surelog"
set REGRESSION_PATH [pwd]
set SURELOG_COMMAND "$TIME $DEBUG_TOOL $SURELOG_VERSION"
-proc init_regression { } {
- global BUILD
- log "Creating release for regression..."
- log [exec sh -c "../src/release.tcl \"$BUILD tcmalloc\""]
- cd tests
-}
-
proc findFiles { basedir pattern } {
# Fix the directory name, this ensures the directory name is in the
@@ -205,7 +195,7 @@
proc load_tests { } {
global TESTS TESTS_DIR LONGESTTESTNAME TESTTARGET ONETEST LARGE_TESTS LONG_TESTS MT_MAX
- set dirs "../../tests/ ../../third_party/tests/"
+ set dirs "../tests/ ../third_party/tests/"
set fileLists ""
foreach dir $dirs {
append fileList "[findFiles $dir *.sl] "
@@ -583,7 +573,6 @@
log "$date"
log "COMMAND: $SURELOG_COMMAND"
-init_regression
load_tests
set result [run_regression]