Skip to content

Commit 0cb04be

Browse files
Merge remote-tracking branch 'origin/master' into temp_net_cost_ref
2 parents 59c2c71 + 33a82f1 commit 0cb04be

File tree

105 files changed

+4157
-4058
lines changed

Some content is hidden

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

105 files changed

+4157
-4058
lines changed

CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,6 @@ endif()
130130
# Build type flags
131131
#
132132

133-
set(EXTRA_FLAGS "")
134-
if(VPR_ENABLE_INTERCHANGE)
135-
set(EXTRA_FLAGS "-lz")
136-
endif()
137-
138133
if(NOT MSVC)
139134
# for GCC and Clang
140135
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g3")
@@ -298,6 +293,7 @@ endif()
298293
#
299294
# Increased debugging vebosity
300295
#
296+
set(EXTRA_FLAGS "")
301297
if(VTR_ENABLE_VERBOSE)
302298
set(EXTRA_FLAGS "${EXTRA_FLAGS} -DVTR_ENABLE_DEBUG_LOGGING")
303299
message(STATUS "Enabling increased debugging verbosity")

doc/src/arch/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FPGA Architecture Description
44
=============================
55

66
VTR uses an XML-based architecture description language to describe the targeted FPGA architecture.
7-
This flexible description langauge allows the user to describe a large number of hypothetical and commercial-like FPGA architectures.
7+
This flexible description language allows the user to describe a large number of hypothetical and commercial-like FPGA architectures.
88

99
See the :ref:`arch_tutorial` for an introduction to the architecture description langauge.
1010
For a detailed reference on the supported options see the :ref:`arch_reference`.

doc/src/arch/reference.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2036,6 +2036,12 @@ The ``<segment>`` tag and its contents are described below.
20362036
20372037
Tag must be included and ``name`` must be the same as the name you give in ``<switch type="mux" name="...``
20382038
2039+
.. arch:tag:: <mux_inter_die name="string"/>
2040+
2041+
:req_param name: Name of the mux switch type used to drive this segment type when the driver (block outputs and other wires) is located on a different die than the segment. This information is utilized during rr-graph construction.
2042+
2043+
Tag must be included and ``name`` must be the same as the name you give in ``<switch type="mux" name="...``
2044+
20392045
.. arch:tag:: <wire_switch name="string"/>
20402046
20412047
:req_param name: Name of the switch type used by other wires to drive this type of segment by default. This information is used during rr-graph construction, and a custom switch block can override this switch type for specific connections if desired.

doc/src/quickstart/index.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
VTR Quick Start
33
###############
44

5-
This is a quick introduction to VTR which covers how to run VTR and some if its associated tools (:ref:`VPR`, :ref:`odin_ii`, :ref:`ABC`).
5+
This is a quick introduction to VTR which covers how to run VTR and some of its associated tools (:ref:`VPR`, :ref:`odin_ii`, :ref:`ABC`).
66

77
Setting Up VTR
88
==============
99

1010
Download VTR
1111
------------
1212

13-
The first step is to `download VTR <https://verilogtorouting.org/download/>`_ and extract VTR on your local machine.
13+
The first step is to `download VTR <https://verilogtorouting.org/download/>`_ and extract it on your local machine.
1414

1515
.. note:: Developers planning to modify VTR should clone the `VTR git repository <https://github.com/verilog-to-routing/vtr-verilog-to-routing/>`_.
1616

1717

1818
Environment Setup
1919
-----------------
20-
If you cloned the repository you will need to set up the git submodules (if you downloaded and extracted a release, you can skip this step):
20+
If you cloned the repository, you will need to set up the git submodules (if you downloaded and extracted a release, you can skip this step):
2121

2222
.. code-block:: bash
2323
@@ -77,12 +77,12 @@ For more details on building VTR on various operating systems/platforms see :doc
7777
Running VPR
7878
===========
7979

80-
Lets now try taking a simple pre-synthesized circuit (consisting of LUTs and Flip-Flops) and use the VPR tool to implement it on a specific FPGA architecture.
80+
Let's now try taking a simple pre-synthesized circuit (consisting of LUTs and Flip-Flops) and use the VPR tool to implement it on a specific FPGA architecture.
8181

8282
Running VPR on a Pre-Synthesized Circuit
8383
----------------------------------------
8484

85-
First, lets make a directory in our home directory where we can work:
85+
First, let's make a directory in our home directory where we can work:
8686

8787
.. code-block:: bash
8888
@@ -211,13 +211,13 @@ Running the VTR Flow
211211
In the previous section we have implemented a pre-synthesized circuit onto a pre-existing FPGA architecture using VPR, and visualized the result.
212212
We now turn to how we can implement *our own circuit* on a pre-existing FPGA architecture.
213213

214-
To do this we begin by describing a circuit behaviourly using the Verilog Hardware Description Language (HDL).
214+
To do this, we begin by describing a circuit behaviourally using the Verilog Hardware Description Language (HDL).
215215
This allows us to quickly and consisely define the circuit's behaviour.
216216
We will then use the VTR Flow to synthesize the behavioural Verilog description it into a circuit netlist, and implement it onto an FPGA.
217217

218218
Example Circuit
219219
---------------
220-
We will use the following simple example circuit, which causes it's output to toggle on and off:
220+
We will use the following simple example circuit, which causes its output to toggle on and off:
221221

222222
.. literalinclude:: blink.v
223223
:language: verilog
@@ -230,7 +230,7 @@ If the count is below ``16`` it drives the output (``o_led``) high, otherwise it
230230

231231
Manually Running the VTR Flow
232232
-----------------------------
233-
Lets start by making a fresh directory for us to work in:
233+
Let's start by making a fresh directory for us to work in:
234234

235235
.. code-block:: bash
236236
@@ -241,15 +241,15 @@ Next we need to run the three main sets of tools:
241241

242242
* :ref:`odin_ii` performs 'synthesis' which converts our behavioural Verilog (``.v`` file) into a circuit netlist (``.blif`` file) consisting of logic equations and FPGA architecture primitives (Flip-Flops, adders etc.),
243243
* :ref:`ABC` performs 'logic optimization' which simplifies the circuit logic, and 'technology mapping' which converts logic equations into the Look-Up-Tables (LUTs) available on an FPGA, and
244-
* :ref:`VPR` which performs packing, placement and routing of the circuit to implement it on the targetted FPGA architecture.
244+
* :ref:`VPR` which performs packing, placement and routing of the circuit to implement it on the targeted FPGA architecture.
245245

246246
.. _synthesizing_with_odin_ii:
247247
Synthesizing with ODIN II
248248
~~~~~~~~~~~~~~~~~~~~~~~~~
249249

250250
First we'll run ODIN II on our Verilog file to synthesize it into a circuit netlist, providing the options:
251251

252-
* ``-a $VTR_ROOT/vtr_flow/arch/timing/EArch.xml`` which specifies what FPGA architecture we are targetting,
252+
* ``-a $VTR_ROOT/vtr_flow/arch/timing/EArch.xml`` which specifies what FPGA architecture we are targeting,
253253
* ``-V $VTR_ROOT/doc/src/quickstart/blink.v`` which specifies the verilog file we want to synthesize, and
254254
* ``-o blink.odin.blif`` which specifies the name of the generated ``.blif`` circuit netlist.
255255

@@ -400,7 +400,7 @@ Automatically Running the VTR Flow
400400
Running each stage of the flow manually is time consuming (and potentially error prone).
401401
For convenience, VTR provides a script (:ref:`run_vtr_flow`) which automates this process.
402402

403-
First, make sure you sure you have activated the Python virtual environment created at the beginning of this tutorial:
403+
First, make sure you have activated the Python virtual environment created at the beginning of this tutorial:
404404

405405
.. code-block:: bash
406406

doc/src/vpr/file_formats.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,11 @@ All the following lines have the format::
623623

624624
block_name x y subtile_number
625625

626-
The ``block_name`` is the name of this block, as given in the input .net formatted netlist.
626+
The ``block_name`` can refer to either:
627+
628+
- The name of a clustered block, as given in the input .net formatted netlist.
629+
- The name of a primitive within a clustered block.
630+
627631
``x`` and ``y`` are the row and column in which the block is placed, respectively.
628632

629633
.. note:: The blocks in a placement file can be listed in any order.

doc/src/vpr/vpr_constraints.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ VPR Constraints
22
=========================
33
.. _vpr_constraints:
44

5-
VPR allows users to run the flow with placement constraints that enable primitives to be locked down to a specific region on the chip and global routing constraints that facilitate the routing of global nets through clock networks.
6-
7-
Users can specify these constraints through a constraints file in XML format, as shown in the format below.
5+
Users can specify placement and/or global routing constraints on all or part of a design through a constraints file in XML format, as shown in the format below. These constraints are optional and allow detailed control of the region on the chip in which parts of the design are placed, and of the routing of global nets through dedicated (usually clock) networks.
86

97
.. code-block:: xml
108
:caption: The overall format of a VPR constraints file

libs/EXTERNAL/libtatum/libtatum/tatum/tags/TimingTags.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class TimingTags {
113113
using value_type = T;
114114
using pointer = T*;
115115
using reference = T&;
116+
using const_reference = const T&;
116117

117118
Iterator(): p_(nullptr) {}
118119
Iterator(pointer p): p_(p) {}
@@ -123,7 +124,7 @@ class TimingTags {
123124
friend bool operator!=(Iterator a, Iterator b) { return a.p_ != b.p_; }
124125

125126
reference operator*() { return *p_; }
126-
const reference operator*() const { return *p_; } //Required for MSVC (gcc/clang are fine with only the non-cost version)
127+
const_reference operator*() const { return *p_; } //Required for MSVC (gcc/clang are fine with only the non-cost version)
127128
pointer operator->() { return p_; }
128129
reference operator[](size_t n) { return *(p_ + n); }
129130

libs/libvqm/vqm_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ void add_node(char* type, char *name, t_array_ref **ports, t_parse_info* parse_i
559559
new_assoc->associated_net = net;
560560
new_assoc->port_index = counter;
561561
new_assoc->port_name = (char *) malloc(strlen(association->port_name)+1);
562-
strcpy(new_assoc->port_name, (char*)malloc(strlen(association->port_name)));
562+
strcpy(new_assoc->port_name, association->port_name);
563563
new_assoc->wire_index = wire_index;
564564
wire_index += change;
565565
m_ports->array_size = insert_element_at_index((intptr_t) new_assoc, m_ports, counter);

vpr/CMakeLists.txt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,22 @@ endif ()
109109
set_target_properties(libvpr PROPERTIES PREFIX "") #Avoid extra 'lib' prefix
110110

111111
#Specify link-time dependencies
112+
find_package(ZLIB)
112113
target_link_libraries(libvpr
113-
libvtrutil
114-
libarchfpga
115-
libsdcparse
116-
libblifparse
117-
libtatum
118-
libargparse
119-
libpugixml
120-
librrgraph
114+
libvtrutil
115+
libarchfpga
116+
libsdcparse
117+
libblifparse
118+
libtatum
119+
libargparse
120+
libpugixml
121+
librrgraph
122+
ZLIB::ZLIB
121123
)
122124

123125
if(VPR_USE_SERVER)
124126
target_link_libraries(libvpr
125127
sockpp-static
126-
-lz
127128
)
128129
endif()
129130

vpr/src/base/ShowSetup.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
#ifndef SHOWSETUP_H
22
#define SHOWSETUP_H
33

4+
#include <ostream>
5+
#include <string>
6+
#include <vector>
7+
8+
class t_logical_block_type;
9+
class t_vpr_setup;
10+
411
struct ClusteredNetlistStats {
512
private:
613
void writeHuman(std::ostream& output) const;

vpr/src/base/blk_loc_registry.cpp

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
2+
#include "blk_loc_registry.h"
3+
#include "globals.h"
4+
5+
const vtr::vector_map<ClusterBlockId, t_block_loc>& BlkLocRegistry::block_locs() const {
6+
return block_locs_;
7+
}
8+
9+
vtr::vector_map<ClusterBlockId, t_block_loc>& BlkLocRegistry::mutable_block_locs() {
10+
return block_locs_;
11+
}
12+
13+
const GridBlock& BlkLocRegistry::grid_blocks() const {
14+
return grid_blocks_;
15+
}
16+
17+
GridBlock& BlkLocRegistry::mutable_grid_blocks() {
18+
return grid_blocks_;
19+
}
20+
21+
const vtr::vector_map<ClusterPinId, int>& BlkLocRegistry::physical_pins() const {
22+
return physical_pins_;
23+
}
24+
25+
vtr::vector_map<ClusterPinId, int>& BlkLocRegistry::mutable_physical_pins() {
26+
return physical_pins_;
27+
}
28+
29+
int BlkLocRegistry::tile_pin_index(const ClusterPinId pin) const {
30+
return physical_pins_[pin];
31+
}
32+
33+
int BlkLocRegistry::net_pin_to_tile_pin_index(const ClusterNetId net_id, int net_pin_index) const {
34+
auto& cluster_ctx = g_vpr_ctx.clustering();
35+
36+
// Get the logical pin index of pin within its logical block type
37+
ClusterPinId pin_id = cluster_ctx.clb_nlist.net_pin(net_id, net_pin_index);
38+
39+
return this->tile_pin_index(pin_id);
40+
}
41+
42+
void BlkLocRegistry::set_block_location(ClusterBlockId blk_id, const t_pl_loc& location) {
43+
auto& device_ctx = g_vpr_ctx.device();
44+
auto& cluster_ctx = g_vpr_ctx.clustering();
45+
46+
const std::string& block_name = cluster_ctx.clb_nlist.block_name(blk_id);
47+
48+
//Check if block location is out of range of grid dimensions
49+
if (location.x < 0 || location.x > int(device_ctx.grid.width() - 1)
50+
|| location.y < 0 || location.y > int(device_ctx.grid.height() - 1)) {
51+
VPR_THROW(VPR_ERROR_PLACE, "Block %s with ID %d is out of range at location (%d, %d). \n",
52+
block_name.c_str(), blk_id, location.x, location.y);
53+
}
54+
55+
//Set the location of the block
56+
block_locs_[blk_id].loc = location;
57+
58+
//Check if block is at an illegal location
59+
auto physical_tile = device_ctx.grid.get_physical_type({location.x, location.y, location.layer});
60+
auto logical_block = cluster_ctx.clb_nlist.block_type(blk_id);
61+
62+
if (location.sub_tile >= physical_tile->capacity || location.sub_tile < 0) {
63+
VPR_THROW(VPR_ERROR_PLACE, "Block %s subtile number (%d) is out of range. \n", block_name.c_str(), location.sub_tile);
64+
}
65+
66+
if (!is_sub_tile_compatible(physical_tile, logical_block, block_locs_[blk_id].loc.sub_tile)) {
67+
VPR_THROW(VPR_ERROR_PLACE, "Attempt to place block %s with ID %d at illegal location (%d,%d,%d). \n",
68+
block_name.c_str(),
69+
blk_id,
70+
location.x,
71+
location.y,
72+
location.layer);
73+
}
74+
75+
//Mark the grid location and usage of the block
76+
grid_blocks_.set_block_at_location(location, blk_id);
77+
grid_blocks_.increment_usage({location.x, location.y, location.layer});
78+
79+
place_sync_external_block_connections(blk_id);
80+
}
81+
82+
void BlkLocRegistry::place_sync_external_block_connections(ClusterBlockId iblk) {
83+
const auto& cluster_ctx = g_vpr_ctx.clustering();
84+
const auto& clb_nlist = cluster_ctx.clb_nlist;
85+
86+
t_pl_loc block_loc = block_locs_[iblk].loc;
87+
88+
auto physical_tile = physical_tile_type(block_loc);
89+
auto logical_block = clb_nlist.block_type(iblk);
90+
91+
int sub_tile_index = get_sub_tile_index(iblk, block_locs_);
92+
auto sub_tile = physical_tile->sub_tiles[sub_tile_index];
93+
94+
VTR_ASSERT(sub_tile.num_phy_pins % sub_tile.capacity.total() == 0);
95+
96+
int max_num_block_pins = sub_tile.num_phy_pins / sub_tile.capacity.total();
97+
/* Logical location and physical location is offset by z * max_num_block_pins */
98+
99+
int rel_capacity = block_loc.sub_tile - sub_tile.capacity.low;
100+
101+
for (ClusterPinId pin : clb_nlist.block_pins(iblk)) {
102+
int logical_pin_index = clb_nlist.pin_logical_index(pin);
103+
int sub_tile_pin_index = get_sub_tile_physical_pin(sub_tile_index, physical_tile, logical_block, logical_pin_index);
104+
105+
int new_physical_pin_index = sub_tile.sub_tile_to_tile_pin_indices[sub_tile_pin_index + rel_capacity * max_num_block_pins];
106+
107+
auto result = physical_pins_.find(pin);
108+
if (result != physical_pins_.end()) {
109+
physical_pins_[pin] = new_physical_pin_index;
110+
} else {
111+
physical_pins_.insert(pin, new_physical_pin_index);
112+
}
113+
}
114+
}

0 commit comments

Comments
 (0)