Skip to content

Commit 8871ea2

Browse files
authored
Merge pull request #30 from Minres/develop
Develop
2 parents b36c0e2 + 209217e commit 8871ea2

Some content is hidden

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

64 files changed

+1730
-1335
lines changed

.envrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ if [ $distro == "CentOS" ]; then
66
. /opt/rh/rh-python38/enable
77
elif [ $distro == "Rocky" ]; then
88
. /opt/rh/gcc-toolset-11/enable
9+
elif [ $distro == "RockyLinux" ]; then
10+
. /opt/rh/gcc-toolset-14/enable
911
fi
1012
layout python3
1113
[ -f .envrc.$USER ] && . .envrc.$USER

.github/workflows/ci-compile.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: CI C++ Std compliance
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.hpp'
7+
- '**.cpp'
8+
- '**.h'
9+
- '**.c'
10+
- '**CMakeLists.txt'
11+
- '.github/workflows/**'
12+
- 'conanfile.py'
13+
pull_request:
14+
paths:
15+
- '**.hpp'
16+
- '**.cpp'
17+
- '**.h'
18+
- '**.c'
19+
- '**CMakeLists.txt'
20+
- '.github/workflows/**'
21+
- 'conanfile.py'
22+
23+
jobs:
24+
build-and-test:
25+
runs-on: ubuntu-latest
26+
strategy:
27+
matrix:
28+
cpp_std: [17, 20]
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Update submodules
33+
run: git submodule update --init --recursive
34+
35+
- name: Cache Conan
36+
uses: actions/cache@v4
37+
with:
38+
path: ~/.conan2
39+
key: conan-${{ runner.os }}-unit-cpp${{ matrix.cpp_std }}-${{ hashFiles('conanfile.py') }}
40+
41+
- name: Cache Conan
42+
uses: actions/cache@v4
43+
with:
44+
path: ~/.conan2
45+
key: conan-${{ runner.os }}-unit-cpp${{ matrix.cpp_std }}-${{ hashFiles('conanfile.py') }}
46+
47+
- name: Install dependencies
48+
run: |
49+
sudo apt-get update
50+
sudo apt-get install -y g++ python3-pip cmake
51+
pip3 install conan
52+
cmake --version
53+
54+
- name: Configure
55+
run: WITH_LLVM=1 cmake --preset Release -B build -DCMAKE_CXX_STANDARD=${{ matrix.cpp_std }} -DWITH_LLVM=ON
56+
57+
- name: Build
58+
run: WITH_LLVM=1 cmake --build build -j
59+
60+
- name: Run smoke test
61+
run: ./build/riscv-sim -h

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@
3838
build
3939
contrib/instr/*_fast.yaml
4040
contrib/instr/*_slow.yaml
41+
.cache

.vscode/settings.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@
44
"workbench.action.tasks.runTask"
55
],
66
"clangd.arguments": [
7-
"--pretty",
8-
"--background-index",
9-
"--compile-commands-dir=${workspaceFolder}/build"
7+
"--pretty",
8+
"--background-index",
9+
"--compile-commands-dir=${workspaceFolder}/build"
1010
],
11-
"cmake.copyCompileCommands": "${workspaceFolder}/build/compile_commands.json"
11+
"cmake.copyCompileCommands": "${workspaceFolder}/build/compile_commands.json",
12+
"editor.rulers": [
13+
{
14+
"column": 140,
15+
"comment": "clang-format"
16+
}
17+
],
18+
"editor.formatOnSave": true
1219
}

CMakeLists.txt

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
44
###############################################################################
55
#
66
###############################################################################
7-
project(dbt-rise-riscv VERSION 2.0.0 LANGUAGES C CXX)
7+
project(dbt-rise-riscv VERSION 2.1.0 LANGUAGES C CXX)
88

99
option(UPDATE_EXTERNAL_PROJECT "Whether to pull changes in external projects" ON)
1010

@@ -20,7 +20,7 @@ if(NOT TARGET dbt-rise-core)
2020
dbt_rise_core_git
2121
GIT_REPOSITORY "https://github.com/Minres/DBT-RISE-Core.git"
2222
#GIT_TAG "origin/develop"
23-
GIT_TAG 0c7532f6
23+
GIT_TAG cc0de2d
2424
GIT_SHALLOW OFF
2525
UPDATE_DISCONNECTED NOT ${UPDATE_EXTERNAL_PROJECT} # When enabled, this option causes the update step to be skipped.
2626
)
@@ -49,7 +49,6 @@ add_subdirectory(softvector)
4949
set(LIB_SOURCES
5050
src/iss/plugin/instruction_count.cpp
5151
src/iss/arch/rv32i.cpp
52-
src/iss/arch/rv32imc.cpp
5352
src/iss/arch/rv32imac.cpp
5453
src/iss/arch/rv32gc.cpp
5554
src/iss/arch/rv32gcv.cpp
@@ -76,12 +75,6 @@ if(TARGET yaml-cpp::yaml-cpp)
7675
)
7776
endif()
7877

79-
if(WITH_TCC)
80-
list(APPEND LIB_SOURCES
81-
src/vm/tcc/vm_tgc5c.cpp
82-
)
83-
endif()
84-
8578
if(WITH_LLVM)
8679
list(APPEND LIB_SOURCES
8780
src/vm/llvm/vm_tgc5c.cpp
@@ -120,28 +113,20 @@ if(IS_DIRECTORY "${PROJECT_SOURCE_DIR}/../dbt-rise-custom")
120113
list(APPEND LIB_DEFINES CORE_${CORE})
121114
endforeach()
122115

123-
message(STATUS "Core defines are ${LIB_DEFINES}")
116+
#message(STATUS "Core defines are ${LIB_DEFINES}")
124117

125118
if(WITH_LLVM)
126119
FILE(GLOB LLVM_GEN_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../dbt-rise-custom/src/vm/llvm/vm_*.cpp)
127120
list(APPEND LIB_SOURCES ${LLVM_GEN_SOURCES})
128121
endif()
129122

130-
if(WITH_TCC)
131-
FILE(GLOB TCC_GEN_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../dbt-rise-custom/src/vm/tcc/vm_*.cpp)
132-
list(APPEND LIB_SOURCES ${TCC_GEN_SOURCES})
133-
endif()
134-
135123
if(WITH_ASMJIT)
136124
FILE(GLOB TCC_GEN_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../dbt-rise-custom/src/vm/asmjit/vm_*.cpp)
137125
list(APPEND LIB_SOURCES ${TCC_GEN_SOURCES})
138126
endif()
139127
endif()
140128
# Define the library
141129
add_library(${PROJECT_NAME} SHARED ${LIB_SOURCES})
142-
if(USE_SC_SIGNAL4IRQ)
143-
target_compile_definitions(${PROJECT_NAME} PUBLIC SC_SIGNAL_IF)
144-
endif()
145130
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
146131
target_compile_options(${PROJECT_NAME} PRIVATE -Wno-shift-count-overflow)
147132
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
@@ -238,11 +223,6 @@ if(BUILD_TESTING)
238223
add_test(NAME riscv-sim-interp
239224
COMMAND riscv-sim -f ${CMAKE_BINARY_DIR}/../../Firmwares/hello-world/hello --backend interp)
240225

241-
if(WITH_TCC)
242-
add_test(NAME riscv-sim-tcc
243-
COMMAND riscv-sim -f ${CMAKE_BINARY_DIR}/../../Firmwares/hello-world/hello --backend tcc)
244-
endif()
245-
246226
if(WITH_LLVM)
247227
add_test(NAME riscv-sim-llvm
248228
COMMAND riscv-sim -f ${CMAKE_BINARY_DIR}/../../Firmwares/hello-world/hello --backend llvm)
@@ -259,6 +239,8 @@ endif()
259239
###############################################################################
260240
if(TARGET scc-sysc)
261241
project(dbt-rise-riscv_sc VERSION 1.0.0)
242+
set(USE_SC_SIGNAL4IRQ OFF CACHE BOOL "Enable the use of ssc_signals for interrupt delivery")
243+
262244
set(LIB_SOURCES
263245
src/sysc/core_complex.cpp
264246
src/sysc/register_cores.cpp
@@ -270,20 +252,44 @@ if(TARGET scc-sysc)
270252
FILE(GLOB GEN_SC_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../dbt-rise-custom/src/sysc/register_*.cpp)
271253
list(APPEND LIB_SOURCES ${GEN_SC_SOURCES})
272254
endif()
273-
add_library(${PROJECT_NAME} ${LIB_SOURCES})
274-
target_compile_definitions(${PROJECT_NAME} PUBLIC WITH_SYSTEMC)
275-
target_link_libraries(${PROJECT_NAME} PUBLIC dbt-rise-riscv scc-sysc)
255+
set(LIB_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/sysc/core_complex.h)
256+
257+
add_library(${PROJECT_NAME}_sig ${LIB_SOURCES})
258+
target_compile_definitions(${PROJECT_NAME}_sig PUBLIC SC_SIGNAL_IF)
259+
target_compile_definitions(${PROJECT_NAME}_sig PUBLIC WITH_SYSTEMC SC_SIGNAL_IF)
260+
target_link_libraries(${PROJECT_NAME}_sig PUBLIC dbt-rise-riscv scc-sysc)
276261

277262
# if(WITH_LLVM)
278263
# target_link_libraries(${PROJECT_NAME} PUBLIC ${llvm_libs})
279264
# endif()
280-
set(LIB_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/sysc/core_complex.h)
281-
set_target_properties(${PROJECT_NAME} PROPERTIES
265+
set_target_properties(${PROJECT_NAME}_sig PROPERTIES
266+
VERSION ${PROJECT_VERSION}
267+
FRAMEWORK FALSE
268+
PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
269+
)
270+
install(TARGETS ${PROJECT_NAME}_sig COMPONENT ${PROJECT_NAME}
271+
EXPORT ${PROJECT_NAME}Targets # for downstream dependencies
272+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # static lib
273+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # binaries
274+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # shared lib
275+
FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR} # for mac
276+
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sysc # headers for mac (note the different component -> different package)
277+
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} # headers
278+
)
279+
280+
add_library(${PROJECT_NAME}_tlm ${LIB_SOURCES})
281+
target_compile_definitions(${PROJECT_NAME}_tlm PUBLIC WITH_SYSTEMC)
282+
target_link_libraries(${PROJECT_NAME}_tlm PUBLIC dbt-rise-riscv scc-sysc)
283+
284+
# if(WITH_LLVM)
285+
# target_link_libraries(${PROJECT_NAME} PUBLIC ${llvm_libs})
286+
# endif()
287+
set_target_properties(${PROJECT_NAME}_tlm PROPERTIES
282288
VERSION ${PROJECT_VERSION}
283289
FRAMEWORK FALSE
284290
PUBLIC_HEADER "${LIB_HEADERS}" # specify the public headers
285291
)
286-
install(TARGETS ${PROJECT_NAME} COMPONENT ${PROJECT_NAME}
292+
install(TARGETS ${PROJECT_NAME}_tlm COMPONENT ${PROJECT_NAME}
287293
EXPORT ${PROJECT_NAME}Targets # for downstream dependencies
288294
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # static lib
289295
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # binaries
@@ -292,6 +298,11 @@ if(TARGET scc-sysc)
292298
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sysc # headers for mac (note the different component -> different package)
293299
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} # headers
294300
)
301+
if(USE_SC_SIGNAL4IRQ)
302+
add_library(${PROJECT_NAME} ALIAS ${PROJECT_NAME}_sig)
303+
else()
304+
add_library(${PROJECT_NAME} ALIAS ${PROJECT_NAME}_tlm)
305+
endif()
295306
endif()
296307

297308
project(elfio-test)

CMakePresets.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}",
2121
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
2222
"CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "contrib/cmake/conan_provider.cmake",
23-
"CONAN_BUILD_PROFILE": "auto-cmake",
24-
"WITH_TCC": "OFF"
23+
"CONAN_HOST_PROFILE": "auto-cmake",
24+
"CONAN_BUILD_PROFILE": "conan_host_profile"
2525
}
2626
},
2727
{

conanfile.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,11 @@ def requirements(self):
3939
self.requires("fmt/8.0.1")
4040
self.requires("spdlog/1.9.2")
4141
self.requires("boost/1.85.0")
42-
self.requires("abseil/20250127.0")
4342
self.requires("elfio/3.11")
4443
self.requires("lz4/1.9.3")
4544
self.requires("yaml-cpp/0.7.0")
4645
self.requires("jsoncpp/1.9.5")
47-
self.requires("zlib/1.2.12")
46+
self.requires("zlib/1.3.1")
4847
self.requires("asmjit/cci.20240531")
4948
if "WITH_LLVM" in os.environ:
5049
self.requires("llvm-core/19.1.7")

contrib/fw/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bsp

contrib/fw/hello-world/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/*.elf
2+
/*.dis
3+
/*.map
4+
/*.a
5+
/*.o

contrib/fw/hello-world/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
TARGET = hello
3+
C_SRCS = $(wildcard *.c)
4+
HEADERS = $(wildcard *.h)
5+
CFLAGS += -Og -g
6+
7+
BOARD=iss
8+
LINK_TARGET=link
9+
RISCV_ARCH:=rv32imc
10+
RISCV_ABI:=ilp32
11+
#RISCV_ARCH:=rv64imc
12+
#RISCV_ABI:=lp64
13+
LDFLAGS := -g -march=$(RISCV_ARCH) -mabi=$(RISCV_ABI)
14+
15+
compiler := $(shell which riscv64-unknown-elf-gcc)
16+
TOOL_DIR=$(dir $(compiler))
17+
18+
BSP_BASE ?= ../bsp
19+
include $(BSP_BASE)/env/common-gcc.mk

0 commit comments

Comments
 (0)