Skip to content

Commit b47b93e

Browse files
committed
Merge branch 'master' of https://github.com/verilog-to-routing/vtr-verilog-to-routing into CI_SV_FAILURE
2 parents 4d6c982 + 6531416 commit b47b93e

File tree

111 files changed

+8536
-8002
lines changed

Some content is hidden

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

111 files changed

+8536
-8002
lines changed

.gitignore

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

109+
#
110+
#ArchFPGA exec dir
111+
#
112+
ArchFPGA
113+
109114
#
110115
#Python
111116
#

ODIN_II/SRC/adders.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ void remove_list_node(t_linked_vptr* pre, t_linked_vptr* next) {
10641064
pre->next = next->next;
10651065
else
10661066
pre->next = NULL;
1067-
vtr::free(next);
1067+
delete next;
10681068
}
10691069

10701070
/*---------------------------------------------------------------------------
@@ -1434,4 +1434,4 @@ nnode_t* check_missing_ports(nnode_t* node, uintptr_t traverse_mark_number, netl
14341434
}
14351435

14361436
return new_node;
1437-
}
1437+
}

doc/src/yosys+odin/dev_guide/contributing.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ If no architecture is passed in, Odin-II will create the soft logic and use LUTs
156156
However, if an architecture is passed, Odin-II will map accordingly to the available hard blocks and LUTs.
157157
It uses a combination of soft logic and hard logic.
158158

159+
.. note::
160+
161+
Please visit the Yosys's `Developers Guide <https://docs.verilogtorouting.org/en/latest/yosys/dev_guide/#working-with-complex-blocks-and-how-to-instantiate-them?>`_ for more information about how Yosys deals with the complex blocks defined in the VTR architecture file.
162+
159163
With the integration of Yosys+Odin-II, the Odin-II partial mapping features such as hard/soft logic trade-offs become available for a Yosys elaborated circuit.
160164
For instance, using optimization command arguments, a user can force the partial mapper to infer at least a user-defined percentage of multipliers in soft logic.
161165

doc/src/yosys/dev_guide.rst

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Changes applied to the VTB files are outlined as follows:
2828
The LUT size is considered the one defined in the architecture file as the same as the regular VTR flow
2929

3030

31-
How to add new changes?
32-
-----------------------
31+
Working with Complex Blocks and How to Instantiate them?
32+
-------------------------------------------------------
3333

3434
The Yosys synthesis commands, including the generic synthesis and additional VTR specific configurations, are provided
3535
in `synthesis.tcl <https://github.com/verilog-to-routing/vtr-verilog-to-routing/blob/master/vtr_flow/misc/yosyslib/synthesis.tcl>`_. To make changes in the overall Yosys synthesis flow, the `synthesis.tcl <https://github.com/verilog-to-routing/vtr-verilog-to-routing/blob/master/vtr_flow/misc/yosyslib/synthesis.tcl>`_
@@ -42,10 +42,31 @@ the `yosys_models.v <https://github.com/verilog-to-routing/vtr-verilog-to-routin
4242

4343
Except for `single_port_ram.v <https://github.com/verilog-to-routing/vtr-verilog-to-routing/blob/master/vtr_flow/misc/yosyslib/single_port_ram.v>`_ and `dual_port_ram.v <https://github.com/verilog-to-routing/vtr-verilog-to-routing/blob/master/vtr_flow/misc/yosyslib/dual_port_ram.v>`_ Verilog files that perform the depth splitting
4444
process, the other files are defined as black-box, i.e., their declarations are required while no definition is needed. To add new black-box
45-
components, developers should first provide the corresponding Verilog files similar to the `adder.v <https://github.com/verilog-to-routing/vtr-verilog-to-routing/blob/master/vtr_flow/misc/yosyslib/adder.v>`_. Then, a new `read_verilog -lib TTT/NEW_BB.v`
45+
components manually, developers should first provide the corresponding Verilog files similar to the `adder.v <https://github.com/verilog-to-routing/vtr-verilog-to-routing/blob/master/vtr_flow/misc/yosyslib/adder.v>`_. Then, a new `read_verilog -lib TTT/NEW_BB.v`
4646
command should be added to the Yosys synthesis script. If there is an implicit inference of the new black-box component, the `yosys_models.v <https://github.com/verilog-to-routing/vtr-verilog-to-routing/blob/master/vtr_flow/misc/yosyslib/yosys_models.v>`_
4747
Verilog file must also be modified, as mentioned earlier.
4848

49+
It is worth noting that the VTR flow scripts for running Yosys standalone as the VTR frontend are designed to automatically provide the black box declaration of complex blocks defined in the architecture XML file for Yosys.
50+
Technically, by running the ``run_vtr_flow.py`` script with the Yosys frontend, the ``write_arch_bb`` routine, defined in the ``libarchfpga``, is executed initially to extract the information of complex blocks defined in the architecture file.
51+
Then, the routine generates a file, including the black box declaration of the complex blocks in the Verilog format.
52+
The output file is named ``arch_dsps.v`` by default, found in the project destination directory.
53+
54+
Instantiation of complex blocks is similar to the explicit instantiation of VTR primitives in HDL format.
55+
The ``write_arch_bb`` generates a Verilog module with the same name as the complex block model.
56+
Module ports are also defined according to the port declaration provided in the architecture file.
57+
For instance, the HDL instantiation of the ``multiply_fp_clk`` complex block defined in the ``COFFE_22nm/k6FracN10LB_mem20K_complexDSP_customSB_22nm.xml`` architecture file is as follows:
58+
59+
.. code-block:: verilog
60+
...
61+
multiply_fp_clk instance_name(
62+
.b(i_b), // input [31:0] b
63+
.a(i_a), // input [31:0] a
64+
.clk(i_clk), // input [0:0] clk
65+
.out(i_out) // output [31:0] out
66+
);
67+
...
68+
69+
**Algorithm 1** - Custom Complex Blocks HDL Instantiation
4970

5071
Yosys Synthesis Script File
5172
---------------------------
@@ -135,4 +156,4 @@ Yosys Synthesis Script File
135156
# ZZZ will be replaced by run_vtr_flow.pl
136157
write_blif -true + vcc -false + gnd -undef + unconn -blackbox ZZZ
137158
138-
**Algorithm 1** - The Yosys Tcl Script File
159+
**Algorithm 2** - The Yosys Tcl Script File

libs/EXTERNAL/libyosys/CMakeLists.txt

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

3737
# create an library target out of the library compilation result
3838
add_library(libyosys SHARED IMPORTED GLOBAL)
39-
add_dependencies(libyosys yosys)
39+
40+
# adding dependency to libarchfpga, as it is required
41+
# by VTR scripts for Yosys standalone frontend
42+
add_dependencies(libyosys yosys libarchfpga)
4043

4144
# specify where the library is and where to find the headers
4245
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
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "device_grid.h"
2-
#include "vpr_utils.h"
32

43
DeviceGrid::DeviceGrid(std::string grid_name, vtr::Matrix<t_grid_tile> grid)
54
: name_(grid_name)

0 commit comments

Comments
 (0)