fix bugs in CMakeList on enable/disable VPR Graphics

This commit is contained in:
tangxifan 2019-06-12 22:48:00 -06:00
parent 1d00e3665b
commit 5ae4dec0af
5 changed files with 269 additions and 3 deletions

View File

@ -12,6 +12,7 @@ endif()
project("vpr7_x2p" C CXX)
# idenify if we need graphics
set(ENABLE_VPR_GRAPHIC_CXX_FLAG true)
if (ENABLE_VPR_GRAPHICS)
# check for dependencies
message(STATUS "VPR graphics is turned on, searching for dependencies")
@ -20,11 +21,11 @@ if (ENABLE_VPR_GRAPHICS)
if (NOT X11_FOUND)
message(WARNING "Failed to find required X11 library (on debian/ubuntu try 'sudo apt-get install libx11-dev' to install)")
#Disable
set(ENABLE_VPR_GRAPHICS false)
set(ENABLE_VPR_GRAPHIC_CXX_FLAG false)
endif()
endif()
if (NOT ENABLE_VPR_GRAPHICS)
if (NOT ENABLE_VPR_GRAPHIC_CXX_FLAG)
# Add a flag to notify compiler not to consider graphic-related source codes
set (DISABLE_GRAPHIC_FLAGS "-DNO_GRAPHICS")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DISABLE_GRAPHIC_FLAGS}")
@ -56,7 +57,7 @@ target_include_directories(libvpr PUBLIC ${LIB_INCLUDE_DIRS})
set_target_properties(libvpr PROPERTIES PREFIX "") #Avoid extra 'lib' prefix#Create the executable
#Specify link-time dependancies
if (ENABLE_VPR_GRAPHICS)
if (ENABLE_VPR_GRAPHIC_CXX_FLAG)
target_link_libraries(libvpr
libarchfpga
X11

View File

@ -0,0 +1,52 @@
/**********************************************************
* MIT License
*
* Copyright (c) 2018 LNIS - The University of Utah
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
***********************************************************************/
/************************************************************************
* Filename: rr_graph_gsb.c
* Created by: Xifan Tang
* Change history:
* +-------------------------------------+
* | Date | Author | Notes
* +-------------------------------------+
* | 2019/06/12 | Xifan Tang | Created
* +-------------------------------------+
***********************************************************************/
/************************************************************************
* This file constains the member functions for class GSBConn
************************************************************************/
#include "gsb_graph.h"
/************************************************************************
* Constructors for class GSBConn
************************************************************************/
/**/
GSBGraph::GSBGraph(const GSBGraph& gsb_graph) {
}
GSBGraph::GSBGraph() {
coordinator_.clear();
}

View File

@ -0,0 +1,138 @@
/**********************************************************
* MIT License
*
* Copyright (c) 2018 LNIS - The University of Utah
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
***********************************************************************/
/************************************************************************
* Filename: gsb_graph.h
* Created by: Xifan Tang
* Change history:
* +-------------------------------------+
* | Date | Author | Notes
* +-------------------------------------+
* | 2019/06/12 | Xifan Tang | Created
* +-------------------------------------+
***********************************************************************/
/************************************************************************
* This file constains a class to model the connection of a
* General Switch Block (GSB), which is a unified block of Connection Blocks
* and Switch Blocks.
* This block contains
* 1. A switch block
* 2. A X-direction Connection block locates at the left side of the switch block
* 2. A Y-direction Connection block locates at the top side of the switch block
*
* +---------------------------------+
* | Y-direction CB |
* | [x][y + 1] |
* +---------------------------------+
*
* TOP SIDE
* +-------------+ +---------------------------------+
* | | | OPIN_NODE CHAN_NODES OPIN_NODES |
* | | | |
* | | | OPIN_NODES OPIN_NODES |
* | X-direction | | |
* | CB | LEFT SIDE | Switch Block | RIGHT SIDE
* | [x][y] | | [x][y] |
* | | | |
* | | | CHAN_NODES CHAN_NODES |
* | | | |
* | | | OPIN_NODES OPIN_NODES |
* | | | |
* | | | OPIN_NODE CHAN_NODES OPIN_NODES |
* +-------------+ +---------------------------------+
* BOTTOM SIDE
*
***********************************************************************/
/* IMPORTANT:
* The following preprocessing flags are added to
* avoid compilation error when this headers are included in more than 1 times
*/
#ifndef GSB_GRAPH_H
#define GSB_GRAPH_H
/*
* Notes in include header files in a head file
* Only include the neccessary header files
* that is required by the data types in the function/class declarations!
*/
/* Header files should be included in a sequence */
/* Standard header files required go first */
#include <vector>
#include "device_coordinator.h"
#include "vpr_types.h"
/***********************************************************************
* This data structure focuses on modeling the internal pin-to-pin connections.
* It is basically a collection of nodes and edges.
* To make the data structure general, the nodes and edges are not linked to any another data
* structures.
*
* num_sides_: number of sides of this switch block
*
* node_id_: a collection of nodes (basically ids) modelling routing tracks
* which locate at each side of the GSB <0..num_sides-1><0..num_nodes_per_side-1>
*
* node_direction_: Indicate if this node is an input or an output of the GSB
* <0..num_sides-1><0..num_nodes_per_side-1>
*
* node_type_: specify the type of the node, CHANX|CHANY|IPIN|OPIN
*
* node_grid_side_: specify the side of the node on which side of a GRID
* for CHANX and CHANY, it is an invalid value
* <0..num_sides-1><0..num_nodes_per_side-1>
*
* edge_id_: a collection of indices of edges, <0..num_edges-1>, which connects the nodes
*
* in_edge_: indcies of input nodes of an edge (driving nodes for each edge)
* <0..num_edges-1><0..num_input_nodes-1>
*
* out_edge_: indices of output nodes of an edge (fan-out nodes for each edge)
* <0..num_edges-1><0..num_output_nodes-1>
*
***********************************************************************/
class GSBGraph {
public: /* Constructors */
GSBGraph(const GSBGraph&); /* A constructor to duplicate */
GSBGraph();
private: /* Internal Data */
/* Coordinator of this GSB */
DeviceCoordinator coordinator_;
/* nodes on each side */
std::vector< std::vector<size_t> > node_id_;
std::vector< std::vector<t_rr_type> > node_type_;
std::vector< std::vector<enum PORTS> > node_direction_;
std::vector< std::vector<enum e_side> > node_grid_side_;
/* edges */
std::vector<size_t> edge_id_;
std::vector< std::vector<size_t> > in_edge_; /* each element is a node_id */
std::vector< std::vector<size_t> > out_edge_; /* each element is a node_id */
};
#endif

View File

@ -44,6 +44,7 @@
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <vector>
#include "vpr_types.h"
#include "globals.h"
#include "vpr_utils.h"
@ -54,6 +55,24 @@
#include "fpga_x2p_types.h"
#include "rr_graph_tileable_builder.h"
/************************************************************************
* Local function in the file
***********************************************************************/
/************************************************************************
* Estimate the number of rr_nodes per category:
* CHANX, CHANY, IPIN, OPIN, SOURCE, SINK
***********************************************************************/
static
std::vector<size_t> estimate_num_rr_nodes_per_type() {
std::vector<size_t> num_rr_nodes_per_type;
return num_rr_nodes_per_type;
}
/************************************************************************
* Main function of this file
* Builder for a detailed uni-directional tileable rr_graph
@ -122,6 +141,9 @@ t_rr_graph build_tileable_unidir_rr_graph(INP int L_num_types,
* a. length of each type of segment
* b. frequency of each type of segment.
* c. routing channel width
* IMPORTANT: we should be aware that channel width maybe different
* in X-direction and Y-direction channels!!!
* So we will load segment details for different channels
***********************************************************************/
/* Check the channel width */
int nodes_per_chan = chan_width;
@ -132,6 +154,24 @@ t_rr_graph build_tileable_unidir_rr_graph(INP int L_num_types,
num_seg_types, segment_inf,
TRUE, FALSE, UNI_DIRECTIONAL);
/* Predict the track index of each channel,
* The track index, also called ptc_num of each CHANX and CHANY rr_node
* Will rotate by 2 in a uni-directional tileable routing architecture
* Vectors are built here to record the ptc_num sequence in each channel
*/
/************************************************************************
* 2. Estimate the number of nodes in the rr_graph
* This will estimate the number of
* a. IPINs, input pins of each grid
* b. OPINs, output pins of each grid
* c. SOURCE, virtual node which drives OPINs
* d. SINK, virtual node which is connected to IPINs
* e. CHANX and CHANY, routing segments of each channel
***********************************************************************/
std::vector<size_t> num_rr_nodes_per_type = estimate_num_rr_nodes_per_type();
/************************************************************************
* 3. Create the connectivity of OPINs
* a. Evenly assign connections to OPINs to routing tracks

View File

@ -1,3 +1,38 @@
/**********************************************************
* MIT License
*
* Copyright (c) 2018 LNIS - The University of Utah
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
***********************************************************************/
/************************************************************************
* Filename: rr_blocks.h
* Created by: Xifan Tang
* Change history:
* +-------------------------------------+
* | Date | Author | Notes
* +-------------------------------------+
* | 2019/06/12 | Xifan Tang | Created
* +-------------------------------------+
***********************************************************************/
/* IMPORTANT:
* The following preprocessing flags are added to
* avoid compilation error when this headers are included in more than 1 times