Skip to content

Commit 00eaad6

Browse files
committed
[Infra]: - Creating an executable of 'write_arch_bb' out of the libarchfpga
- Creating a directory in the VTR root, named ArchFPGA, holding the libarchfpga executable files so vtr scripts can have access to them Signed-off-by: Seyed Alireza Damghani <[email protected]>
1 parent 0ffe971 commit 00eaad6

File tree

3 files changed

+38
-5
lines changed

3 files changed

+38
-5
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ ODIN_II/usefull_tools/**/track_completed
105105
#
106106
Yosys
107107

108+
#
109+
#ArchFPGA exec dir
110+
#
111+
ArchFPGA
112+
108113
#
109114
#Python
110115
#

libs/EXTERNAL/libyosys/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ add_custom_target(yosys ALL DEPENDS ${LIB_FILE} ${BINARY_LIB_FILE})
3939

4040
# create an library target out of the library compilation result
4141
add_library(libyosys SHARED IMPORTED GLOBAL)
42-
add_dependencies(libyosys yosys)
42+
43+
# adding dependency to libarchfpga, as it is required
44+
# by VTR scripts for Yosys standalone frontend
45+
add_dependencies(libyosys yosys libarchfpga)
4346

4447
# specify where the library is and where to find the headers
4548
set_target_properties(libyosys

libs/libarchfpga/CMakeLists.txt

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ cmake_minimum_required(VERSION 3.9)
22

33
project("libarchfpga")
44

5-
file(GLOB_RECURSE EXEC_SOURCES src/main.cpp)
5+
file(GLOB_RECURSE READ_ARCH_EXEC_SRC src/main.cpp)
6+
file(GLOB_RECURSE WRITE_ARCH_BB_EXEC_SRC src/write_arch_bb.cpp)
67
file(GLOB_RECURSE LIB_SOURCES src/*.cpp)
78
file(GLOB_RECURSE LIB_HEADERS src/*.h)
89
files_to_dirs(LIB_HEADERS LIB_INCLUDE_DIRS)
910

1011
#Remove test executable from library
11-
list(REMOVE_ITEM LIB_SOURCES ${EXEC_SOURCES})
12+
list(REMOVE_ITEM LIB_SOURCES ${READ_ARCH_EXEC_SRC} ${WRITE_ARCH_BB_EXEC_SRC})
1213

1314
#Create the library
1415
add_library(libarchfpga STATIC
@@ -31,16 +32,40 @@ target_link_libraries(libarchfpga
3132
target_compile_definitions(libarchfpga PUBLIC ${INTERCHANGE_SCHEMA_HEADERS})
3233

3334
#Create the test executable
34-
add_executable(read_arch ${EXEC_SOURCES})
35+
add_executable(read_arch ${READ_ARCH_EXEC_SRC})
36+
add_executable(write_arch_bb ${WRITE_ARCH_BB_EXEC_SRC})
3537
target_link_libraries(read_arch libarchfpga)
38+
target_link_libraries(write_arch_bb libarchfpga)
3639

3740
#Supress IPO link warnings if IPO is enabled
3841
get_target_property(READ_ARCH_USES_IPO read_arch INTERPROCEDURAL_OPTIMIZATION)
42+
get_target_property(WRITE_ARCH_BB_USES_IPO write_arch_bb INTERPROCEDURAL_OPTIMIZATION)
3943
if (READ_ARCH_USES_IPO)
4044
set_property(TARGET read_arch APPEND PROPERTY LINK_FLAGS ${IPO_LINK_WARN_SUPRESS_FLAGS})
4145
endif()
46+
if (WRITE_ARCH_BB_USES_IPO)
47+
set_property(TARGET write_arch_bb APPEND PROPERTY LINK_FLAGS ${IPO_LINK_WARN_SUPRESS_FLAGS})
48+
endif()
49+
50+
install(TARGETS libarchfpga read_arch write_arch_bb DESTINATION bin)
4251

43-
install(TARGETS libarchfpga read_arch DESTINATION bin)
52+
#
53+
# install executables in the VTR source root directory
54+
# to utilize them for scripts running VTR flow
55+
#
56+
set(ARCHFPGA_DIR ${VTR_SOURCE_DIR}/ArchFPGA)
57+
# making a new custom target out of libarchfpga to automatically perform
58+
# the house keeping for end users by deleting the ArchFPGA dir in the
59+
# VTR root dir if it exists and holds expired execs
60+
add_custom_target(archfpga-execs ALL
61+
DEPENDS read_arch write_arch_bb
62+
COMMAND ${CMAKE_COMMAND} -E
63+
remove_directory ${ARCHFPGA_DIR}
64+
COMMAND ${CMAKE_COMMAND} -E
65+
make_directory ${ARCHFPGA_DIR}
66+
COMMAND ${CMAKE_COMMAND} -E
67+
copy_directory ${CMAKE_CURRENT_BINARY_DIR} ${ARCHFPGA_DIR}
68+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
4469

4570
#
4671
# Unit Tests

0 commit comments

Comments
 (0)