From a3c3030230436c75a117ce923eae458a08aaa235 Mon Sep 17 00:00:00 2001 From: hchchiu Date: Fri, 4 Oct 2024 21:20:32 +0800 Subject: [PATCH 01/13] fix the gmp header file path --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d0905a69..d5082135 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,7 @@ set(CMAKE_CXX_FLAGS "") set(CMAKE_CXX_FLAGS_DEBUG "-g") set(CMAKE_CXX_FLAGS_RELEASE "-O3") + include(ExternalProject) include(FetchContent) @@ -199,6 +200,7 @@ target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${ABC_DIR}/src) target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE /usr/include/readline) # Include the gmp header files target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE /usr/local/include) +target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE /opt/homebrew/include) # Include the VCD parser header files target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${VCD_PARSER_DIR}/build) # Include the Glucose header files From fec9c3e9e8dacf0be0456d344228d9eeb9f258dc Mon Sep 17 00:00:00 2001 From: hchchiu Date: Fri, 4 Oct 2024 21:21:55 +0800 Subject: [PATCH 02/13] fix the bison path --- .github/workflows/build-macos.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index b060e844..2147ce45 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -28,19 +28,17 @@ jobs: ${{ runner.os }}-${{ env.cache-name }}- - name: Install Dependencies - shell: bash run: brew tap Homebrew/bundle && brew bundle - name: Export the brew path - shell: bash run: | brew install bison echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' >> $GITHUB_ENV + echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' >> /Users/runner/.bash_profile # export PATH="$(brew --prefix bison)/bin:$(brew --prefix)/bin:$PATH" - name: Verify the brew path - shell: bash - run: bison --version + run: which bison && echo $PATH # - name: Install GV # run: make From 4dbe5997edc59277239e4cc287e1c6d11612cf2f Mon Sep 17 00:00:00 2001 From: hchchiu Date: Fri, 4 Oct 2024 21:30:30 +0800 Subject: [PATCH 03/13] debug the action job --- .github/workflows/build-macos.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 2147ce45..c7692141 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -27,18 +27,20 @@ jobs: restore-keys: | ${{ runner.os }}-${{ env.cache-name }}- - - name: Install Dependencies - run: brew tap Homebrew/bundle && brew bundle + # - name: Install Dependencies + # run: brew tap Homebrew/bundle && brew bundle - name: Export the brew path run: | brew install bison + echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' >> $GITHUB_ENV + echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' >> /Users/runner/.bash_profile # export PATH="$(brew --prefix bison)/bin:$(brew --prefix)/bin:$PATH" - name: Verify the brew path - run: which bison && echo $PATH + run: which bison && echo $PATH && bison --version # - name: Install GV # run: make From 388ebd261a95d7e376a7089c9ac83e3fdc2cffef Mon Sep 17 00:00:00 2001 From: hchchiu Date: Fri, 4 Oct 2024 21:33:04 +0800 Subject: [PATCH 04/13] debug action job --- .github/workflows/build-macos.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index c7692141..26f7b9a3 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -37,6 +37,7 @@ jobs: echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' >> $GITHUB_ENV echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' >> /Users/runner/.bash_profile + echo 'export PATH="/opt/homebrew/opt/bison/bin:$PATH"' >> /Users/runner/.bash_profile # export PATH="$(brew --prefix bison)/bin:$(brew --prefix)/bin:$PATH" - name: Verify the brew path From a9a91b142928066d94ed42fb9d010eb6bd432f60 Mon Sep 17 00:00:00 2001 From: hchchiu Date: Fri, 4 Oct 2024 21:35:28 +0800 Subject: [PATCH 05/13] debug action job --- .github/workflows/build-macos.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 26f7b9a3..5335025f 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -27,12 +27,12 @@ jobs: restore-keys: | ${{ runner.os }}-${{ env.cache-name }}- - # - name: Install Dependencies - # run: brew tap Homebrew/bundle && brew bundle + - name: Install Dependencies + run: brew install bison + # run: brew tap Homebrew/bundle && brew bundle - name: Export the brew path run: | - brew install bison echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' >> $GITHUB_ENV echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' @@ -41,7 +41,7 @@ jobs: # export PATH="$(brew --prefix bison)/bin:$(brew --prefix)/bin:$PATH" - name: Verify the brew path - run: which bison && echo $PATH && bison --version + run: which bison && echo $PATH && bison --version && brew --prefix bison # - name: Install GV # run: make From 6d67187f620900c410e6706b2b601d47a125d980 Mon Sep 17 00:00:00 2001 From: hchchiu Date: Fri, 4 Oct 2024 21:38:50 +0800 Subject: [PATCH 06/13] debug action job --- .github/workflows/build-macos.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 5335025f..74811e8a 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -32,15 +32,15 @@ jobs: # run: brew tap Homebrew/bundle && brew bundle - name: Export the brew path + shell: bash run: | - echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' >> $GITHUB_ENV - echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' >> /Users/runner/.bash_profile echo 'export PATH="/opt/homebrew/opt/bison/bin:$PATH"' >> /Users/runner/.bash_profile - # export PATH="$(brew --prefix bison)/bin:$(brew --prefix)/bin:$PATH" + echo $PATH - name: Verify the brew path + shell: bash run: which bison && echo $PATH && bison --version && brew --prefix bison # - name: Install GV From 4f81d112a0b0e059ab84fe69339ad81d85f0c7bb Mon Sep 17 00:00:00 2001 From: hchchiu Date: Fri, 4 Oct 2024 21:42:03 +0800 Subject: [PATCH 07/13] debug the action job --- .github/workflows/build-macos.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 74811e8a..4600638e 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -32,15 +32,11 @@ jobs: # run: brew tap Homebrew/bundle && brew bundle - name: Export the brew path - shell: bash run: | echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' >> $GITHUB_ENV - echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' >> /Users/runner/.bash_profile - echo 'export PATH="/opt/homebrew/opt/bison/bin:$PATH"' >> /Users/runner/.bash_profile - echo $PATH + echo $PATH && brew --prefix bison - name: Verify the brew path - shell: bash run: which bison && echo $PATH && bison --version && brew --prefix bison # - name: Install GV From b1cf59f881940593555d64996cb9e3493ddc533c Mon Sep 17 00:00:00 2001 From: hchchiu Date: Fri, 4 Oct 2024 21:49:40 +0800 Subject: [PATCH 08/13] debug the action job --- .github/workflows/build-macos.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 4600638e..78a04b7e 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -34,6 +34,7 @@ jobs: - name: Export the brew path run: | echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' >> $GITHUB_ENV + export PATH="$(brew --prefix bison)/bin:$PATH" echo $PATH && brew --prefix bison - name: Verify the brew path From be7e3efa1de94b21d5f3f5b9d0185ed3aedf4b01 Mon Sep 17 00:00:00 2001 From: hchchiu Date: Fri, 4 Oct 2024 21:57:09 +0800 Subject: [PATCH 09/13] debug the action job --- .github/workflows/build-macos.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 78a04b7e..fb0c6b56 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -33,9 +33,10 @@ jobs: - name: Export the brew path run: | - echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' >> $GITHUB_ENV + echo "$(brew --prefix bison)/bin" >> $GITHUB_ENV export PATH="$(brew --prefix bison)/bin:$PATH" - echo $PATH && brew --prefix bison + echo $PATH && brew --prefix bison && echo $GITHUB_ENV + # echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' >> $GITHUB_ENV - name: Verify the brew path run: which bison && echo $PATH && bison --version && brew --prefix bison From 26dafa5b87e01f8d832dada4141434b459242682 Mon Sep 17 00:00:00 2001 From: hchchiu Date: Fri, 4 Oct 2024 21:59:48 +0800 Subject: [PATCH 10/13] debug the action job --- .github/workflows/build-macos.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index fb0c6b56..37b6ec84 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -33,9 +33,9 @@ jobs: - name: Export the brew path run: | - echo "$(brew --prefix bison)/bin" >> $GITHUB_ENV - export PATH="$(brew --prefix bison)/bin:$PATH" - echo $PATH && brew --prefix bison && echo $GITHUB_ENV + echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH + # export PATH="$(brew --prefix bison)/bin:$PATH" + echo $PATH && brew --prefix bison && echo $GITHUB_PATH # echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' >> $GITHUB_ENV - name: Verify the brew path From 2abb711287f2aa85c10ec50a1d8bf02819de530b Mon Sep 17 00:00:00 2001 From: hchchiu Date: Fri, 4 Oct 2024 22:01:07 +0800 Subject: [PATCH 11/13] debug the action job --- .github/workflows/build-macos.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 37b6ec84..7f72dd6f 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -34,7 +34,6 @@ jobs: - name: Export the brew path run: | echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH - # export PATH="$(brew --prefix bison)/bin:$PATH" echo $PATH && brew --prefix bison && echo $GITHUB_PATH # echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' >> $GITHUB_ENV From b34160ea2c9d42b0b0630a309866e82e3108a9e2 Mon Sep 17 00:00:00 2001 From: hchchiu Date: Fri, 4 Oct 2024 22:03:29 +0800 Subject: [PATCH 12/13] fix the exporting path issue --- .github/workflows/build-macos.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 7f72dd6f..bc7fddb5 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -28,21 +28,18 @@ jobs: ${{ runner.os }}-${{ env.cache-name }}- - name: Install Dependencies - run: brew install bison - # run: brew tap Homebrew/bundle && brew bundle + run: brew tap Homebrew/bundle && brew bundle - name: Export the brew path run: | echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH - echo $PATH && brew --prefix bison && echo $GITHUB_PATH - # echo 'export PATH="$(brew --prefix bison)/bin:$PATH"' >> $GITHUB_ENV - name: Verify the brew path run: which bison && echo $PATH && bison --version && brew --prefix bison - # - name: Install GV - # run: make - # - # - name: Run tests - # run: make test + - name: Install GV + run: make + + - name: Run tests + run: make test From 0cfb4c5d173be8b676a0d842c450f2e9729d1ccf Mon Sep 17 00:00:00 2001 From: hchchiu Date: Fri, 4 Oct 2024 22:43:08 +0800 Subject: [PATCH 13/13] fix the yosys executable file path --- CMakeLists.txt | 4 ++-- src/yosys/yosysMgr.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d5082135..1b4fbb67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,7 +87,7 @@ ExternalProject_Add( UPDATE_COMMAND "" UPDATE_DISCONNECTED TRUE PATCH_COMMAND ${CMAKE_COMMAND} -P ${PATCH_DIR}/${YOSYS_PATCH_CMAKE} - BUILD_COMMAND $(MAKE) ${LIBYOSYS_NAME} + BUILD_COMMAND $(MAKE) ${LIBYOSYS_NAME} && $(MAKE) LOG_CONFIGURE ON LOG_INSTALL ON # LOG_BUILD ON @@ -171,6 +171,7 @@ add_compile_definitions(GV_TEMPLATE_PATH="${CMAKE_SOURCE_DIR}/simulators/verilat add_compile_definitions(GV_VERILATOR_PATH="${CMAKE_SOURCE_DIR}/simulators/verilator/") add_compile_definitions(GV_VERILATOR_BUILD_PATH="${CMAKE_SOURCE_DIR}/simulators/verilator/build/") add_compile_definitions(GV_CXXRTL_PATH="${CMAKE_SOURCE_DIR}/simulators/cxxrtl/") +add_compile_definitions(GV_YOSYS_BIN_PATH="${YOSYS_DIR}/yosys") # target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE) # target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE -Wall -Wextra) target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE -w) @@ -193,7 +194,6 @@ foreach(DIR ${SRC_DIR}) endforeach() # Include all the header files under the engine Yosys target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${YOSYS_DIR}) -target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${YOSYS_DIR}) # Include all the header files under the engine ABC target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${ABC_DIR}/src) # Include the readline header files diff --git a/src/yosys/yosysMgr.cpp b/src/yosys/yosysMgr.cpp index 7f092cfd..87e39b28 100644 --- a/src/yosys/yosysMgr.cpp +++ b/src/yosys/yosysMgr.cpp @@ -119,9 +119,10 @@ void YosysMgr::resetDesign() { */ void YosysMgr::createMapping(const string& fileName) { // loadDesign(fileName); - string yosys = "yosys -qp "; - string readVerilog = "read_verilog -sv " + fileName + "; "; - string topModule = "hierarchy -auto-top; "; + /*string yosys = "yosys -qp ";*/ + string yosys = string(GV_YOSYS_BIN_PATH) + " -qp "; + string readVerilog = "read_verilog -sv " + fileName + "; "; + string topModule = "hierarchy -auto-top; "; /*string preProcess = "flatten; proc; techmap; setundef -zero; aigmap; ";*/ // Try to solve the unsupported type issue string preProcess = "flatten; proc; techmap; async2sync; dffunmap; setundef -zero; aigmap; ";