Skip to content

Move rr_graph_reader & rr_graph_writer to librrgraph. #2101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e785f1c
Files moved to Librrgraph and Files added to Libarchfpga
oscarcheng105 Jul 18, 2022
377186b
Merge branch 'verilog-to-routing:master' into master
oscarcheng105 Jul 18, 2022
93a7dc6
Fix input parameters for load_rr_graph(), write_rr_graph(), check_rr_…
oscarcheng105 Jul 18, 2022
b42102a
Fix input parameters of add_rr_edge_metadata(), add_rr_node_metadata(…
oscarcheng105 Jul 18, 2022
5db7988
[vpr] move VTR_ENABLE_CAPNPROTO to librrgraph CMakeList.txt
oscarcheng105 Jul 19, 2022
0bb613f
[vpr] move cmake dependencies in vpr/src/route to librrgraph/src/base/
oscarcheng105 Jul 20, 2022
3cccda7
Merge branch 'verilog-to-routing:master' into librrgraph_vpr
oscarcheng105 Jul 20, 2022
e428f8a
[vpr] clean up dead code
oscarcheng105 Jul 20, 2022
a30ca69
[vpr] clean up dead code 2
oscarcheng105 Jul 21, 2022
7840120
[vpr] format fix
oscarcheng105 Jul 21, 2022
3200ba9
[vpr] move files to corresponding folder in librrgraph/src
oscarcheng105 Jul 23, 2022
916c6fe
[vpr] fix parameters of check_rr_graph, check_rr_node, RrGraphSeriali…
oscarcheng105 Jul 23, 2022
ff83a48
[vpr] move histogram to libarchfpga, merge rr_graph_util, add alloc_a…
oscarcheng105 Jul 25, 2022
77971b0
Merge branch 'verilog-to-routing:master' into librrgraph_vpr
oscarcheng105 Jul 25, 2022
bfcb7ec
[vpr] move describe_rr_node.cpp to librrgraph/src/utils
oscarcheng105 Jul 25, 2022
c3ff424
[vpr] add get_parallel_segs.cpp to librrgraph
oscarcheng105 Jul 26, 2022
ca391d3
[vpr] format fix
oscarcheng105 Jul 26, 2022
70cc0b4
[vpr] format
oscarcheng105 Jul 26, 2022
9682216
[vpr] format fix 2
oscarcheng105 Jul 26, 2022
2280445
[vpr] categorize files to rr_graph_type & rr_graph_cost in librrgraph
oscarcheng105 Jul 26, 2022
2aa7ce6
Merge branch 'verilog-to-routing:master' into librrgraph_vpr
oscarcheng105 Jul 29, 2022
4a4eb96
[vpr] code cleanup
oscarcheng105 Jul 29, 2022
783fa6b
Merge branch 'librrgraph_vpr' of github.com:oscarcheng105/vtr-verilog…
oscarcheng105 Jul 29, 2022
e900c68
[vpr] doc update
oscarcheng105 Aug 2, 2022
1b8d060
Merge branch 'verilog-to-routing:master' into librrgraph_vpr
oscarcheng105 Aug 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions libs/libarchfpga/src/base_cost_type.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef BASE_COST_TYPE_H
#define BASE_COST_TYPE_H

enum e_base_cost_type {
DELAY_NORMALIZED,
DELAY_NORMALIZED_LENGTH,
DELAY_NORMALIZED_FREQUENCY,
DELAY_NORMALIZED_LENGTH_FREQUENCY,
DELAY_NORMALIZED_LENGTH_BOUNDED,
DEMAND_ONLY,
DEMAND_ONLY_NORMALIZED_LENGTH
};

#endif
16 changes: 16 additions & 0 deletions libs/libarchfpga/src/chan_width.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef CHAN_WIDTH_H
#define CHAN_WIDTH_H

#include <vector>

struct t_chan_width {
int max = 0;
int x_max = 0;
int y_max = 0;
int x_min = 0;
int y_min = 0;
std::vector<int> x_list;
std::vector<int> y_list;
};

#endif
13 changes: 13 additions & 0 deletions libs/libarchfpga/src/cost_indices.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef COST_INDICES_H
#define COST_INDICES_H

///@brief Index of the SOURCE, SINK, OPIN, IPIN, etc. member of device_ctx.rr_indexed_data.
enum e_cost_indices {
SOURCE_COST_INDEX = 0,
SINK_COST_INDEX,
OPIN_COST_INDEX,
IPIN_COST_INDEX,
CHANX_COST_INDEX_START
};

#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "device_grid.h"
#include "vpr_utils.h"

DeviceGrid::DeviceGrid(std::string grid_name, vtr::Matrix<t_grid_tile> grid)
: name_(grid_name)
Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions libs/libarchfpga/src/graph_type.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef GRAPH_TYPE_H
#define GRAPH_TYPE_H

enum e_graph_type {
GRAPH_GLOBAL, /* One node per channel with wire capacity > 1 and full connectivity */
GRAPH_BIDIR, /* Detailed bidirectional graph */
GRAPH_UNIDIR, /* Detailed unidir graph, untilable */
/* RESEARCH TODO: Get this option debugged */
GRAPH_UNIDIR_TILEABLE /* Detail unidir graph with wire groups multiples of 2*L */
};
typedef enum e_graph_type t_graph_type;

#endif
9 changes: 9 additions & 0 deletions libs/libarchfpga/src/route_type.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef ROUTE_TYPE_H
#define ROUTE_TYPE_H

enum e_route_type {
GLOBAL,
DETAILED
};

#endif
11 changes: 11 additions & 0 deletions libs/libarchfpga/src/unified_to_parallel_seg_index.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef UNIFIED_TO_PARALLEL_SEG_INDEX_H
#define UNIFIED_TO_PARALLEL_SEG_INDEX_H

#include "physical_types.h"

/* This map is used to get indices w.r.t segment_inf_x or segment_inf_y based on parallel_axis of a segment,
* from indices w.r.t the **unified** segment vector, segment_inf in devices context which stores all segments
* regardless of their axis. (see get_parallel_segs for more details)*/
typedef std::unordered_multimap<size_t, std::pair<size_t, e_parallel_axis>> t_unified_to_parallel_seg_index;

#endif
26 changes: 26 additions & 0 deletions libs/librrgraph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ file(GLOB_RECURSE LIB_SOURCES src/*/*.cpp)
file(GLOB_RECURSE LIB_HEADERS src/*/*.h)
files_to_dirs(LIB_HEADERS LIB_INCLUDE_DIRS)

if(${VTR_ENABLE_CAPNPROTO})
add_definitions("-DVTR_ENABLE_CAPNPROTO")
endif()

#Create the library
add_library(librrgraph STATIC
${LIB_HEADERS}
Expand All @@ -23,6 +27,10 @@ target_link_libraries(librrgraph
libarchfpga
)

if(${VTR_ENABLE_CAPNPROTO})
target_link_libraries(librrgraph libvtrcapnproto)
endif()

target_compile_definitions(librrgraph PUBLIC ${INTERCHANGE_SCHEMA_HEADERS})

# Unit tests
Expand All @@ -33,3 +41,21 @@ target_compile_definitions(librrgraph PUBLIC ${INTERCHANGE_SCHEMA_HEADERS})

# Run unit tests: comment out for now
#add_test(NAME test_rr_graph COMMAND test_rr_graph --use-colour=yes)

add_custom_target(
generate_rr_graph_serializers
COMMAND ${CMAKE_COMMAND} -E remove_directory rr_graph_generate
COMMAND ${CMAKE_COMMAND} -E make_directory rr_graph_generate
COMMAND ${CMAKE_COMMAND} -E chdir rr_graph_generate git clone https://github.com/duck2/uxsdcxx
COMMAND python3 -mpip install --user -r rr_graph_generate/uxsdcxx/requirements.txt
COMMAND ${CMAKE_COMMAND} -E chdir rr_graph_generate python3 uxsdcxx/uxsdcxx.py ${CMAKE_CURRENT_SOURCE_DIR}/src/base/rr_graph.xsd
COMMAND ${CMAKE_COMMAND} -E chdir rr_graph_generate python3 uxsdcxx/uxsdcap.py ${CMAKE_CURRENT_SOURCE_DIR}/src/base/rr_graph.xsd
COMMAND ${CMAKE_COMMAND} -E copy
rr_graph_generate/rr_graph_uxsdcxx.h
rr_graph_generate/rr_graph_uxsdcxx_capnp.h
rr_graph_generate/rr_graph_uxsdcxx_interface.h
${CMAKE_CURRENT_SOURCE_DIR}/src/base/gen
COMMAND ${CMAKE_COMMAND} -E copy rr_graph_generate/rr_graph_uxsdcxx.capnp ${CMAKE_CURRENT_SOURCE_DIR}/../libvtrcapnproto/gen
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/base/rr_graph.xsd
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ mediated via RrGraphBase located in `rr_graph_uxsdcxx_interface.h`.

If `rr_graph.xsd` is modified, then the following files must be updated:

- `vpr/src/route/gen/rr_graph_uxsdcxx.h`
- `vpr/src/route/gen/rr_graph_uxsdcxx_capnp.h`
- `vpr/src/route/gen/rr_graph_uxsdcxx_interface.h`
- `libs/librrgraph/src/base/gen/rr_graph_uxsdcxx.h`
- `libs/librrgraph/src/base/gen/rr_graph_uxsdcxx_capnp.h`
- `libs/librrgraph/src/base/gen/rr_graph_uxsdcxx_interface.h`
- `libs/libvtrcapnproto/rr_graph_uxsdcxx.capnp`

### Instructions to update generated files (using CMake)

1. Run target `generate_rr_graph_serializers`, e.g. run `make generate_rr_graph_serializers`.
2. Run target `format`, e.g. run `make format`.
3. Update `vpr/src/route/rr_graph_uxsdcxx_interface_impl.h`, implement or
3. Update `libs/librrgraph/src/base/rr_graph_uxsdcxx_interface_impl.h`, implement or
update interfaces that are new or are changed. The compiler will complain
that virtual methods are missing if the schema has changed.

### Instructions to update generated files (manually)

1. Clone https://github.com/duck2/uxsdcxx/
2. Run `python3 -mpip install --user -r requirements.txt`
3. Run `python3 uxsdcxx.py vpr/src/route/rr_graph.xsd`
3. Run `python3 uxsdcap.py vpr/src/route/rr_graph.xsd`
3. Run `python3 uxsdcxx.py libs/librrgraph/src/base/rr_graph.xsd`
3. Run `python3 uxsdcap.py libs/librrgraph/src/base/rr_graph.xsd`
4. Copy `rr_graph_uxsdcxx.h`, `rr_graph_uxsdcxx_capnp.h`,
`rr_graph_uxsdcxx_interface.h` to `vpr/src/route/`
5. Copy `rr_graph_uxsdcxx.capnp` to `libs/libvtrcapnproto/`
`rr_graph_uxsdcxx_interface.h` to `libs/librrgraph/src/base/`
5. Copy `rr_graph_uxsdcxx.capnp` to `../libvtrcapnproto/`
6. Run `make format`
7. Update `vpr/src/route/rr_graph_uxsdcxx_interface_impl.h`, implement or
7. Update `libs/librrgraph/src/base/rr_graph_uxsdcxx_interface_impl.h`, implement or
update interfaces that are new or are changed. The compiler will complain
that virtual methods are missing if the schema has changed.

Expand Down
12 changes: 12 additions & 0 deletions libs/librrgraph/src/base/alloc_and_load_rr_indexed_data.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef ALLOC_AND_LOAD_RR_INDEXED_DATA_H
#define ALLOC_AND_LOAD_RR_INDEXED_DATA_H

#include "physical_types.h"

void alloc_and_load_rr_indexed_data(const std::vector<t_segment_inf>& segment_inf,
const std::vector<t_segment_inf>& segment_inf_x,
const std::vector<t_segment_inf>& segment_inf_y,
int wire_to_ipin_switch,
enum e_base_cost_type base_cost_type);

#endif
Loading