Skip to content

Commit a8034e2

Browse files
authored
Merge pull request #2562 from verilog-to-routing/temp_arch_read_
Support for link/router specific bandwidth/latency in architecture file
2 parents a1ed68f + 5fea296 commit a8034e2

32 files changed

+1910
-1227
lines changed

libs/libarchfpga/src/arch_check.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void warn_model_missing_timing(const t_model* model, const char* file, uint32_t
8686

8787
for (t_model_ports* port = model->outputs; port != nullptr; port = port->next) {
8888
if (port->clock.empty() //Not sequential
89-
&& !comb_connected_outputs.count(port->name) //Not combinationally drivven
89+
&& !comb_connected_outputs.count(port->name) //Not combinationally driven
9090
&& !port->is_clock //Not an output clock
9191
) {
9292
VTR_LOGF_WARN(file, line,

libs/libarchfpga/src/arch_types.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
/* Value for UNDEFINED data */
1919
constexpr int UNDEFINED = -1;
2020

21-
/* Maximum value for mininum channel width to avoid overflows of short data type. */
21+
/** The total number of predefined blif models */
22+
constexpr int NUM_MODELS_IN_LIBRARY = 4;
23+
24+
/* Maximum value for minimum channel width to avoid overflows of short data type. */
2225
constexpr int MAX_CHANNEL_WIDTH = 8000;
2326

2427
/* Built-in library models */

libs/libarchfpga/src/arch_util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ t_port* findPortByName(const char* name, t_pb_type* pb_type, int* high_index, in
520520
return port;
521521
}
522522

523-
t_physical_tile_type get_empty_physical_type(const char* name) {
523+
t_physical_tile_type get_empty_physical_type(const char* name /*= EMPTY_BLOCK_NAME*/) {
524524
t_physical_tile_type type;
525525
type.name = vtr::strdup(name);
526526
type.num_pins = 0;
@@ -538,7 +538,7 @@ t_physical_tile_type get_empty_physical_type(const char* name) {
538538
return type;
539539
}
540540

541-
t_logical_block_type get_empty_logical_type(const char* name) {
541+
t_logical_block_type get_empty_logical_type(const char* name /*=EMPTY_BLOCK_NAME*/) {
542542
t_logical_block_type type;
543543
type.name = vtr::strdup(name);
544544
type.pb_type = nullptr;

libs/libarchfpga/src/main.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
* Author: Jason Luu
66
*/
77

8-
#include <stdio.h>
9-
#include <stdlib.h>
8+
#include <cstdio>
9+
#include <cstdlib>
1010
#include <vector>
1111

1212
#include "vtr_error.h"
13-
#include "vtr_memory.h"
1413

1514
#include "arch_util.h"
1615
#include "read_xml_arch_file.h"

libs/libarchfpga/src/physical_types.h

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#define PHYSICAL_TYPES_H
2929

3030
#include <functional>
31+
#include <utility>
3132
#include <vector>
3233
#include <unordered_map>
3334
#include <string>
@@ -129,7 +130,7 @@ struct t_metadata_dict : vtr::flat_map<
129130

130131
// Get metadata values matching key.
131132
//
132-
// Returns nullptr if key is not found or if multiple values are prsent
133+
// Returns nullptr if key is not found or if multiple values are present
133134
// per key.
134135
inline const t_metadata_value* one(vtr::interned_string key) const {
135136
auto values = get(key);
@@ -146,7 +147,7 @@ struct t_metadata_dict : vtr::flat_map<
146147
void add(vtr::interned_string key, vtr::interned_string value) {
147148
// Get the iterator to the key, which may already have elements if
148149
// add was called with this key in the past.
149-
(*this)[key].emplace_back(t_metadata_value(value));
150+
(*this)[key].emplace_back(value);
150151
}
151152
};
152153

@@ -181,11 +182,11 @@ constexpr std::array<e_side, NUM_SIDES> SIDES = {{TOP, RIGHT, BOTTOM, LEFT}};
181182
constexpr std::array<const char*, NUM_SIDES> SIDE_STRING = {{"TOP", "RIGHT", "BOTTOM", "LEFT"}}; //String versions of side orientations
182183

183184
/* pin location distributions */
184-
enum e_pin_location_distr {
185-
E_SPREAD_PIN_DISTR,
186-
E_PERIMETER_PIN_DISTR,
187-
E_SPREAD_INPUTS_PERIMETER_OUTPUTS_PIN_DISTR,
188-
E_CUSTOM_PIN_DISTR
185+
enum class e_pin_location_distr {
186+
SPREAD,
187+
PERIMETER,
188+
SPREAD_INPUTS_PERIMETER_OUTPUTS,
189+
CUSTOM
189190
};
190191

191192
/* pb_type class */
@@ -263,10 +264,10 @@ enum e_sb_location {
263264
*/
264265
struct t_grid_loc_spec {
265266
t_grid_loc_spec(std::string start, std::string end, std::string repeat, std::string incr)
266-
: start_expr(start)
267-
, end_expr(end)
268-
, repeat_expr(repeat)
269-
, incr_expr(incr) {}
267+
: start_expr(std::move(start))
268+
, end_expr(std::move(end))
269+
, repeat_expr(std::move(repeat))
270+
, incr_expr(std::move(incr)) {}
270271

271272
std::string start_expr; //Starting position (inclusive)
272273
std::string end_expr; //Ending position (inclusive)
@@ -280,7 +281,7 @@ struct t_grid_loc_spec {
280281

281282
/* Definition of how to place physical logic block in the grid.
282283
* This defines a region of the grid to be set to a specific type
283-
* (provided it's priority is high enough to override other blocks).
284+
* (provided its priority is high enough to override other blocks).
284285
*
285286
* The diagram below illustrates the layout specification.
286287
*
@@ -345,7 +346,7 @@ struct t_grid_loc_spec {
345346
*/
346347
struct t_grid_loc_def {
347348
t_grid_loc_def(std::string block_type_val, int priority_val)
348-
: block_type(block_type_val)
349+
: block_type(std::move(block_type_val))
349350
, priority(priority_val)
350351
, x("0", "W-1", "max(w+1,W)", "w") //Fill in x direction, no repeat, incr by block width
351352
, y("0", "H-1", "max(h+1,H)", "h") //Fill in y direction, no repeat, incr by block height
@@ -358,7 +359,7 @@ struct t_grid_loc_def {
358359
// the largest priority wins.
359360

360361
t_grid_loc_spec x; //Horizontal location specification
361-
t_grid_loc_spec y; //Veritcal location specification
362+
t_grid_loc_spec y; //Vertical location specification
362363

363364
// When 1 metadata tag is split among multiple t_grid_loc_def, one
364365
// t_grid_loc_def is arbitrarily chosen to own the metadata, and the other
@@ -648,7 +649,7 @@ struct t_physical_tile_type {
648649

649650
std::vector<t_class> class_inf; /* [0..num_class-1] */
650651

651-
// Primitive class is refered to a classes that are in the primitive blocks. These classes are
652+
// Primitive class is referred to a classes that are in the primitive blocks. These classes are
652653
// used during flat-routing to route the nets.
653654
// The starting number of primitive classes
654655
int primitive_class_starting_idx = -1;
@@ -755,7 +756,7 @@ struct t_capacity_range {
755756
struct t_sub_tile {
756757
char* name = nullptr;
757758

758-
// Mapping between the sub tile's pins and the physical pins corresponding
759+
// Mapping between the subtile's pins and the physical pins corresponding
759760
// to the physical tile type.
760761
std::vector<int> sub_tile_to_tile_pin_indices;
761762

@@ -1601,7 +1602,7 @@ struct t_hash_segment_inf {
16011602
enum class SwitchType {
16021603
MUX = 0, //A configurable (buffered) mux (single-driver)
16031604
TRISTATE, //A configurable tristate-able buffer (multi-driver)
1604-
PASS_GATE, //A configurable pass transitor switch (multi-driver)
1605+
PASS_GATE, //A configurable pass transistor switch (multi-driver)
16051606
SHORT, //A non-configurable electrically shorted connection (multi-driver)
16061607
BUFFER, //A non-configurable non-tristate-able buffer (uni-driver)
16071608
INVALID, //Unspecified, usually an error
@@ -1946,13 +1947,25 @@ struct t_noc_inf {
19461947
/** A list of all routers in the NoC*/
19471948
std::vector<t_router> router_list;
19481949

1950+
/** Stores NoC routers that have a different latency than the NoC-wide router latency.
1951+
* (router_user_id, overridden router latency)*/
1952+
std::map<int, double> router_latency_overrides;
1953+
/** Stores NoC links that have a different latency than the NoC-wide link latency.
1954+
* ((source router id, destination router id), overridden link latency)*/
1955+
std::map<std::pair<int, int>, double> link_latency_overrides;
1956+
/** Stores NoC links that have a different bandwidth than the NoC-wide link bandwidth.
1957+
* ((source router id, destination router id), overridden link bandwidth)*/
1958+
std::map<std::pair<int, int>, double> link_bandwidth_overrides;
1959+
19491960
/** Represents the name of a router tile on the FPGA device. This should match the name used in the arch file when
19501961
* describing a NoC router tile within the FPGA device*/
19511962
std::string noc_router_tile_name;
19521963
};
19531964

19541965
/* Detailed routing architecture */
19551966
struct t_arch {
1967+
/** Stores unique strings used as key and values in <metadata> tags,
1968+
* i.e. implements a flyweight pattern to save memory.*/
19561969
mutable vtr::string_internment strings;
19571970
std::vector<vtr::interned_string> interned_strings;
19581971

@@ -1992,7 +2005,7 @@ struct t_arch {
19922005
// nets from the circuit netlist are belonging to the constant network,
19932006
// and assigned to it accordingly.
19942007
//
1995-
// NOTE: At the moment, the constant cells and nets are primarly used
2008+
// NOTE: At the moment, the constant cells and nets are primarily used
19962009
// for the interchange netlist format, to determine which are the constants
19972010
// net names and which virtual cell is responsible to generate them.
19982011
// The information is present in the device database.

0 commit comments

Comments
 (0)