Skip to content

Commit

Permalink
Merge pull request verilog-to-routing#2562 from verilog-to-routing/te…
Browse files Browse the repository at this point in the history
…mp_arch_read_

Support for link/router specific bandwidth/latency in architecture file
  • Loading branch information
vaughnbetz authored May 31, 2024
2 parents a1ed68f + 5fea296 commit a8034e2
Show file tree
Hide file tree
Showing 32 changed files with 1,910 additions and 1,227 deletions.
2 changes: 1 addition & 1 deletion libs/libarchfpga/src/arch_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void warn_model_missing_timing(const t_model* model, const char* file, uint32_t

for (t_model_ports* port = model->outputs; port != nullptr; port = port->next) {
if (port->clock.empty() //Not sequential
&& !comb_connected_outputs.count(port->name) //Not combinationally drivven
&& !comb_connected_outputs.count(port->name) //Not combinationally driven
&& !port->is_clock //Not an output clock
) {
VTR_LOGF_WARN(file, line,
Expand Down
5 changes: 4 additions & 1 deletion libs/libarchfpga/src/arch_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
/* Value for UNDEFINED data */
constexpr int UNDEFINED = -1;

/* Maximum value for mininum channel width to avoid overflows of short data type. */
/** The total number of predefined blif models */
constexpr int NUM_MODELS_IN_LIBRARY = 4;

/* Maximum value for minimum channel width to avoid overflows of short data type. */
constexpr int MAX_CHANNEL_WIDTH = 8000;

/* Built-in library models */
Expand Down
4 changes: 2 additions & 2 deletions libs/libarchfpga/src/arch_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ t_port* findPortByName(const char* name, t_pb_type* pb_type, int* high_index, in
return port;
}

t_physical_tile_type get_empty_physical_type(const char* name) {
t_physical_tile_type get_empty_physical_type(const char* name /*= EMPTY_BLOCK_NAME*/) {
t_physical_tile_type type;
type.name = vtr::strdup(name);
type.num_pins = 0;
Expand All @@ -538,7 +538,7 @@ t_physical_tile_type get_empty_physical_type(const char* name) {
return type;
}

t_logical_block_type get_empty_logical_type(const char* name) {
t_logical_block_type get_empty_logical_type(const char* name /*=EMPTY_BLOCK_NAME*/) {
t_logical_block_type type;
type.name = vtr::strdup(name);
type.pb_type = nullptr;
Expand Down
5 changes: 2 additions & 3 deletions libs/libarchfpga/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
* Author: Jason Luu
*/

#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include <vector>

#include "vtr_error.h"
#include "vtr_memory.h"

#include "arch_util.h"
#include "read_xml_arch_file.h"
Expand Down
49 changes: 31 additions & 18 deletions libs/libarchfpga/src/physical_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#define PHYSICAL_TYPES_H

#include <functional>
#include <utility>
#include <vector>
#include <unordered_map>
#include <string>
Expand Down Expand Up @@ -129,7 +130,7 @@ struct t_metadata_dict : vtr::flat_map<

// Get metadata values matching key.
//
// Returns nullptr if key is not found or if multiple values are prsent
// Returns nullptr if key is not found or if multiple values are present
// per key.
inline const t_metadata_value* one(vtr::interned_string key) const {
auto values = get(key);
Expand All @@ -146,7 +147,7 @@ struct t_metadata_dict : vtr::flat_map<
void add(vtr::interned_string key, vtr::interned_string value) {
// Get the iterator to the key, which may already have elements if
// add was called with this key in the past.
(*this)[key].emplace_back(t_metadata_value(value));
(*this)[key].emplace_back(value);
}
};

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

/* pin location distributions */
enum e_pin_location_distr {
E_SPREAD_PIN_DISTR,
E_PERIMETER_PIN_DISTR,
E_SPREAD_INPUTS_PERIMETER_OUTPUTS_PIN_DISTR,
E_CUSTOM_PIN_DISTR
enum class e_pin_location_distr {
SPREAD,
PERIMETER,
SPREAD_INPUTS_PERIMETER_OUTPUTS,
CUSTOM
};

/* pb_type class */
Expand Down Expand Up @@ -263,10 +264,10 @@ enum e_sb_location {
*/
struct t_grid_loc_spec {
t_grid_loc_spec(std::string start, std::string end, std::string repeat, std::string incr)
: start_expr(start)
, end_expr(end)
, repeat_expr(repeat)
, incr_expr(incr) {}
: start_expr(std::move(start))
, end_expr(std::move(end))
, repeat_expr(std::move(repeat))
, incr_expr(std::move(incr)) {}

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

/* Definition of how to place physical logic block in the grid.
* This defines a region of the grid to be set to a specific type
* (provided it's priority is high enough to override other blocks).
* (provided its priority is high enough to override other blocks).
*
* The diagram below illustrates the layout specification.
*
Expand Down Expand Up @@ -345,7 +346,7 @@ struct t_grid_loc_spec {
*/
struct t_grid_loc_def {
t_grid_loc_def(std::string block_type_val, int priority_val)
: block_type(block_type_val)
: block_type(std::move(block_type_val))
, priority(priority_val)
, x("0", "W-1", "max(w+1,W)", "w") //Fill in x direction, no repeat, incr by block width
, y("0", "H-1", "max(h+1,H)", "h") //Fill in y direction, no repeat, incr by block height
Expand All @@ -358,7 +359,7 @@ struct t_grid_loc_def {
// the largest priority wins.

t_grid_loc_spec x; //Horizontal location specification
t_grid_loc_spec y; //Veritcal location specification
t_grid_loc_spec y; //Vertical location specification

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

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

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

// Mapping between the sub tile's pins and the physical pins corresponding
// Mapping between the subtile's pins and the physical pins corresponding
// to the physical tile type.
std::vector<int> sub_tile_to_tile_pin_indices;

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

/** Stores NoC routers that have a different latency than the NoC-wide router latency.
* (router_user_id, overridden router latency)*/
std::map<int, double> router_latency_overrides;
/** Stores NoC links that have a different latency than the NoC-wide link latency.
* ((source router id, destination router id), overridden link latency)*/
std::map<std::pair<int, int>, double> link_latency_overrides;
/** Stores NoC links that have a different bandwidth than the NoC-wide link bandwidth.
* ((source router id, destination router id), overridden link bandwidth)*/
std::map<std::pair<int, int>, double> link_bandwidth_overrides;

/** Represents the name of a router tile on the FPGA device. This should match the name used in the arch file when
* describing a NoC router tile within the FPGA device*/
std::string noc_router_tile_name;
};

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

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

0 comments on commit a8034e2

Please sign in to comment.