Skip to content

Commit 17e5df1

Browse files
author
Navid Jafarof
committed
Merge branch 'develop' of https://github.com/QuickLogic-Corp/FOEDAG into nj_floorplanning_pcf_pins
2 parents 8625312 + d04caf6 commit 17e5df1

180 files changed

Lines changed: 18646 additions & 12473 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,14 @@ jobs:
245245
fail-fast: false
246246
matrix:
247247
include:
248-
- runner: ubuntu-20.04
249-
install_script: install_dependencies_build_ubuntu2004.sh
250-
os: linux
251-
arch: x86-64
252248
- runner: ubuntu-22.04
253249
install_script: install_dependencies_build_ubuntu2204.sh
254250
os: linux
255251
arch: x86-64
252+
- runner: ubuntu-24.04
253+
install_script: install_dependencies_build_ubuntu2404.sh
254+
os: linux
255+
arch: x86-64
256256

257257
runs-on: ${{ matrix.runner }}
258258
name: build ${{ matrix.os }}-${{ matrix.arch }} ${{ matrix.runner }}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
# The package list is designed for Ubuntu 24.04 LTS (Noble Numbat)
4+
apt-get update
5+
apt-get install -y \
6+
g++ gcc \
7+
tclsh \
8+
cmake \
9+
build-essential \
10+
google-perftools \
11+
libgoogle-perftools-dev \
12+
libunwind-dev \
13+
libtcmalloc-minimal4t64 \
14+
uuid-dev \
15+
lcov \
16+
valgrind \
17+
xorg \
18+
qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools \
19+
xvfb \
20+
yosys \
21+
automake \
22+
ninja-build

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ else(MSVC)
274274
message("MSYS MODE")
275275
set(TCL_STATIC_LIB libtcl86.dll.a)
276276
set(TCL_STUBB_LIB libtclstub86.a)
277-
set(ZLIB_STATIC_LIB libzlibstatic.a)
277+
set(ZLIB_STATIC_LIB libz.a)
278278

279279
add_library(tcl_static STATIC IMPORTED )
280280
set_target_properties(tcl_static PROPERTIES

Makefile.au

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ SUPPORTED_BUILD_PLATFORMS += WIN32_MSYS2_CLANG64
7171
SUPPORTED_BUILD_PLATFORMS += WIN32_MSVC
7272
SUPPORTED_BUILD_PLATFORMS += UBUNTU_2004
7373
SUPPORTED_BUILD_PLATFORMS += UBUNTU_2204
74+
SUPPORTED_BUILD_PLATFORMS += UBUNTU_2404
7475

7576
ifeq ($(OS),Windows_NT)
7677
ifneq ($(filter $(MSYSTEM),MINGW64),)
@@ -115,7 +116,7 @@ endif
115116
prepare:
116117
ifeq ($(BUILD_PLATFORM),$(filter $(BUILD_PLATFORM),WIN32_MSYS2_MINGW64 WIN32_MSYS2_UCRT64 WIN32_MSYS2_CLANG64))
117118
else ifeq ($(BUILD_PLATFORM),$(filter $(BUILD_PLATFORM),WIN32_MSVC))
118-
else ifeq ($(BUILD_PLATFORM),$(filter $(BUILD_PLATFORM),UBUNTU_2004 UBUNTU_2204))
119+
else ifeq ($(BUILD_PLATFORM),$(filter $(BUILD_PLATFORM),UBUNTU_2004 UBUNTU_2204 UBUNTU_2404))
119120
endif
120121

121122

@@ -141,7 +142,7 @@ else ifeq ($(BUILD_PLATFORM),$(filter $(BUILD_PLATFORM),WIN32_MSVC))
141142
-DAURORA_USE_TABBYCAD=$(USE_TABBYCAD) \
142143
-DAURORA_YOSYS_SYNTH_PASS_NAME=$(AURORA_YOSYS_SYNTH_PASS_NAME) \
143144
-S $(SOURCE_DIR) -B $(BUILD_DIR)
144-
else ifeq ($(BUILD_PLATFORM),$(filter $(BUILD_PLATFORM),UBUNTU_2004 UBUNTU_2204))
145+
else ifeq ($(BUILD_PLATFORM),$(filter $(BUILD_PLATFORM),UBUNTU_2004 UBUNTU_2204 UBUNTU_2404))
145146
@cmake \
146147
-DCMAKE_INSTALL_PREFIX=$(PREFIX) \
147148
-DAURORA_VERSION=$(AURORA_VERSION) \
@@ -189,7 +190,7 @@ ifeq ($(BUILD_PLATFORM),$(filter $(BUILD_PLATFORM),WIN32_MSYS2_MINGW64 WIN32_MSY
189190
cd - &> /dev/null
190191
ls aurora-$(COMMIT_SHA1)-$(MSYSTEM_LC).sfx.exe
191192
ls aurora-$(COMMIT_SHA1)-$(MSYSTEM_LC).7z
192-
else ifeq ($(BUILD_PLATFORM),$(filter $(BUILD_PLATFORM),UBUNTU_2004 UBUNTU_2204))
193+
else ifeq ($(BUILD_PLATFORM),$(filter $(BUILD_PLATFORM),UBUNTU_2004 UBUNTU_2204 UBUNTU_2404))
193194
endif
194195

195196

@@ -213,7 +214,7 @@ ifeq ($(BUILD_PLATFORM),$(filter $(BUILD_PLATFORM),WIN32_MSYS2_MINGW64 WIN32_MSY
213214
wget --quiet https://www.7-zip.org/a/7z2301-x64.exe --directory-prefix=$(SEVENZIP_DIR_PATH)
214215
cd $(SEVENZIP_DIR_PATH) && \
215216
$(SEVENZIP_DIR_PATH)/7zr.exe x $(SEVENZIP_DIR_PATH)/7z2301-x64.exe -y > /dev/null
216-
else ifeq ($(BUILD_PLATFORM),$(filter $(BUILD_PLATFORM),UBUNTU_2004 UBUNTU_2204))
217+
else ifeq ($(BUILD_PLATFORM),$(filter $(BUILD_PLATFORM),UBUNTU_2004 UBUNTU_2204 UBUNTU_2404))
217218
endif
218219

219220

cmake/cmake_tcl.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ else()
6161
if (DEFINED ENV{MSYSTEM})
6262
set(TCL_STATIC_LIB libtcl86.dll.a)
6363
set(TCL_STUBB_LIB libtclstub86.a)
64-
set(ZLIB_STATIC_LIB libzlibstatic.a)
64+
set(ZLIB_STATIC_LIB libz.a)
6565

6666
add_library(tcl_static STATIC IMPORTED )
6767
set_target_properties(tcl_static PROPERTIES

src/Compiler/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,16 @@ set (res_LIST
135135
compiler_resources.qrc
136136
)
137137

138+
# Conditionally embed power calculator xlsx when built from Aurora2.
139+
# Aurora2 sets POWER_CALCULATOR_XLSX to the path of the built xlsx file.
140+
if(POWER_CALCULATOR_XLSX AND EXISTS "${POWER_CALCULATOR_XLSX}")
141+
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/compiler_power_calc_resources.qrc"
142+
"<RCC>\n <qresource prefix=\"/\">\n <file alias=\"build/power_calculator/power_calculator.xlsx\">${POWER_CALCULATOR_XLSX}</file>\n </qresource>\n</RCC>\n"
143+
)
144+
list(APPEND res_LIST "${CMAKE_CURRENT_BINARY_DIR}/compiler_power_calc_resources.qrc")
145+
set(HAS_POWER_CALC_RESOURCE TRUE)
146+
endif()
147+
138148
add_library(compiler STATIC
139149
${SRC_CPP_LIST}
140150
${SRC_H_LIST}
@@ -143,6 +153,9 @@ add_library(compiler STATIC
143153

144154
target_link_libraries(compiler PUBLIC Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Xml cryptor)
145155
target_compile_definitions(compiler PRIVATE COMPILER_LIBRARY)
156+
if(HAS_POWER_CALC_RESOURCE)
157+
target_compile_definitions(compiler PUBLIC HAS_POWER_CALC_RESOURCE)
158+
endif()
146159

147160
install (
148161
FILES ${CMAKE_CURRENT_BINARY_DIR}/../../lib/$<TARGET_FILE_NAME:compiler>

src/Compiler/CompilerOpenFPGA_ql.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ using json = nlohmann::ordered_json;
8787

8888
using namespace FOEDAG;
8989

90+
#ifdef HAS_POWER_CALC_RESOURCE
91+
static inline void initPowerCalcResource() {
92+
Q_INIT_RESOURCE(compiler_power_calc_resources);
93+
}
94+
#endif
95+
9096
#define USE_INCREMENTAL_COMPILATION
9197
#define GENERATE_NEW_DEVICE_FPGA_AUTO 1
9298
#define GENERATE_RR_GRAPH_FPGA_AUTO 0
@@ -5274,6 +5280,9 @@ bool CompilerOpenFPGA_ql::PowerAnalysis() {
52745280
#endif // _WIN32
52755281

52765282
// unpack embedded in qrc xlsx file to a temprorary location
5283+
#ifdef HAS_POWER_CALC_RESOURCE
5284+
initPowerCalcResource();
5285+
#endif
52775286
QFile qrc_xlsx_filepath(":/build/power_calculator/power_calculator.xlsx");
52785287
if (!qrc_xlsx_filepath.open(QIODevice::ReadOnly)) {
52795288
ErrorMessage("Cannot open power calculator data file");

src/Compiler/compiler_resources.qrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@
99
<file>search.png</file>
1010
<file>loading.gif</file>
1111
<file>warning.png</file>
12-
<file>../../../../build/power_calculator/power_calculator.xlsx</file>
1312
</qresource>
1413
</RCC>

src/IPGenerate/IPCatalog.cpp

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
3030
#include <chrono>
3131
#include <ctime>
3232
#include <filesystem>
33+
#include <fstream>
3334
#include <sstream>
3435
#include <thread>
3536

@@ -120,7 +121,31 @@ std::filesystem::path IPCatalog::getPythonPath(const std::filesystem::path& envs
120121
std::filesystem::path searchPath = envsPath / "litex";
121122
#endif
122123
searchPath = FileUtils::GetFullPath(searchPath);
123-
s_pythonPath = FileUtils::LocateFileRecursive(searchPath, pythonExecName);
124+
auto candidate = FileUtils::LocateFileRecursive(searchPath, pythonExecName);
125+
if (!candidate.empty()) {
126+
std::error_code ec;
127+
auto perms = std::filesystem::status(candidate, ec).permissions();
128+
bool isUsable = !ec &&
129+
(perms & std::filesystem::perms::owner_exec) !=
130+
std::filesystem::perms::none;
131+
#ifdef __APPLE__
132+
// Reject Linux ELF binaries that cannot run on macOS.
133+
// The bundled envs/litex/ Python is built for Linux x86-64; on macOS
134+
// QProcess would fail with "execve: Exec format error".
135+
if (isUsable) {
136+
std::ifstream f(candidate, std::ios::binary);
137+
char magic[4]{};
138+
f.read(magic, 4);
139+
if (magic[0] == 0x7f && magic[1] == 'E' &&
140+
magic[2] == 'L' && magic[3] == 'F') {
141+
isUsable = false;
142+
}
143+
}
144+
#endif
145+
if (isUsable) {
146+
s_pythonPath = candidate;
147+
}
148+
}
124149
}
125150
return s_pythonPath;
126151
}

src/IPGenerate/IPGenerator.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,20 @@ void IPGenerator::setIpOutputLocation(const std::string& moduleName, const std::
6666
}
6767

6868
IPGenerator::IPGenerator(const std::filesystem::path& installDir, IPCatalog* catalog, Compiler* compiler): m_installDir(installDir), m_catalog(catalog), m_compiler(compiler) {
69-
m_environment["PYTHONHOME"] = (EnvsPath() / "python3.8").string();
69+
// Only set PYTHONHOME and LD_LIBRARY_PATH when the bundled envs directory
70+
// actually exists. When it doesn't (e.g. macOS builds without the litex
71+
// environment), setting PYTHONHOME to a non-existent path poisons the
72+
// fallback to system python3, causing "Failed to import encodings module".
73+
auto pythonHome = EnvsPath() / "python3.8";
74+
if (std::filesystem::is_directory(pythonHome)) {
75+
m_environment["PYTHONHOME"] = pythonHome.string();
7076
#ifndef __WIN32
71-
// IP Generator requires libffi.so.6 which is absent on ubuntu>=20.04
72-
std::string ldLibraryPath = qgetenv("LD_LIBRARY_PATH").toStdString();
73-
std::string newLdLibraryPath = (EnvsPath() / "python3.8" / "lib" / "os_libs").string();
74-
m_environment["LD_LIBRARY_PATH"] = newLdLibraryPath + ":" + ldLibraryPath;
77+
// IP Generator requires libffi.so.6 which is absent on ubuntu>=20.04
78+
std::string ldLibraryPath = qgetenv("LD_LIBRARY_PATH").toStdString();
79+
std::string newLdLibraryPath = (pythonHome / "lib" / "os_libs").string();
80+
m_environment["LD_LIBRARY_PATH"] = newLdLibraryPath + ":" + ldLibraryPath;
7581
#endif
82+
}
7683
}
7784

7885
void IPGenerator::shareContext()

0 commit comments

Comments
 (0)