Skip to content
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

[WIP] Reorganize place timing files #2829

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2deff2b
move place_delay files to a directory
soheilshahrouz Nov 28, 2024
be8519b
remove unused struct frp, timing_place_lookup.cpp
soheilshahrouz Nov 28, 2024
47dec5c
create two files for each placement delay model
soheilshahrouz Nov 28, 2024
bf02e65
add compute_delta_delays_utils files
soheilshahrouz Nov 29, 2024
cddb152
add doxygen comments for delay_reduce, add_delay_to_matrix, and find_…
soheilshahrouz Nov 29, 2024
553ff53
move lines that don't depend on loop vars to outside the loop
soheilshahrouz Nov 29, 2024
7d4fd01
remove fix_uninitialized_coordinates
soheilshahrouz Nov 29, 2024
9ce28bf
doxygen comments for get_best_classes and route_connection_delay
soheilshahrouz Nov 29, 2024
f188b79
remove unused includes and constants from timing_place_lookup.cpp
soheilshahrouz Nov 29, 2024
107738c
total_num_internal_pins member function for t_sub_tile
soheilshahrouz Nov 30, 2024
b06cceb
make get_port_by_name() a member function of t_sub_tile
soheilshahrouz Nov 30, 2024
85dcb10
add get_port to t_logicl_block_type
soheilshahrouz Nov 30, 2024
296b589
add get_port_by_pin() to t_sub_tile and t_logical_block_type
soheilshahrouz Nov 30, 2024
c246372
add PlacementDelayModelCreator class
soheilshahrouz Nov 30, 2024
6488a35
Merge branch 'master' into temp_organize_place_timng
soheilshahrouz Nov 30, 2024
c08e8cf
fix compilation errors
soheilshahrouz Dec 1, 2024
75a7658
add find_pin() and find_pin_class() to t_physical_tile_type
soheilshahrouz Dec 1, 2024
eecfde2
move timing_place.cpp/.h and place_timing_update.cpp/.h to place/timi…
soheilshahrouz Dec 1, 2024
4aa3d74
add files for PlacerSetupSlacks and PlacerCriticalities
soheilshahrouz Dec 1, 2024
a5a036f
move highly_crit_pins from PlacerMoveContext to PlacerCriticalities
soheilshahrouz Dec 1, 2024
871b289
last commit before I go home
soheilshahrouz Dec 2, 2024
7d7d488
remove timing_place.h
soheilshahrouz Dec 2, 2024
246498d
make some methods static in PlacerTimingCosts
soheilshahrouz Dec 5, 2024
d579250
delete PlacementDelayModelCreator's constructor
soheilshahrouz Dec 5, 2024
864bd28
remove one of the signatures of pick_from_block and pick_from_highly_…
soheilshahrouz Dec 5, 2024
e3cad45
update comments for pick_from_block and pick_from_highly_critical_block
soheilshahrouz Dec 5, 2024
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
6 changes: 3 additions & 3 deletions libs/libarchfpga/src/arch_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ bool check_model_clocks(t_model* model, const char* file, uint32_t line) {
bool check_model_combinational_sinks(const t_model* model, const char* file, uint32_t line) {
//Outputs should have no combinational sinks
for (t_model_ports* port = model->outputs; port != nullptr; port = port->next) {
if (port->combinational_sink_ports.size() != 0) {
if (!port->combinational_sink_ports.empty()) {
archfpga_throw(file, line,
"Model '%s' output port '%s' can not have combinational sink ports",
model->name, port->name);
Expand Down Expand Up @@ -114,9 +114,9 @@ void check_port_direct_mappings(t_physical_tile_type_ptr physical_tile, t_sub_ti
}

for (auto pin_map : pin_direct_map) {
auto block_port = get_port_by_pin(logical_block, pin_map.first.pin);
const t_port* block_port = logical_block->get_port_by_pin(pin_map.first.pin);

auto sub_tile_port = get_port_by_pin(sub_tile, pin_map.second.pin);
const t_physical_tile_port* sub_tile_port = sub_tile->get_port_by_pin(pin_map.second.pin);

VTR_ASSERT(block_port != nullptr);
VTR_ASSERT(sub_tile_port != nullptr);
Expand Down
6 changes: 3 additions & 3 deletions libs/libarchfpga/src/arch_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class InstPort {

InstPort() = default;
InstPort(const std::string& str);
std::string instance_name() const { return instance_.name; }
std::string port_name() const { return port_.name; }
const std::string& instance_name() const { return instance_.name; }
const std::string& port_name() const { return port_.name; }

int instance_low_index() const { return instance_.low_idx; }
int instance_high_index() const { return instance_.high_idx; }
Expand All @@ -40,7 +40,7 @@ class InstPort {

private:
struct name_index {
std::string name = "";
std::string name;
int low_idx = UNSPECIFIED;
int high_idx = UNSPECIFIED;
};
Expand Down
110 changes: 109 additions & 1 deletion libs/libarchfpga/src/physical_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,56 @@ bool t_physical_tile_type::is_empty() const {
return name == std::string(EMPTY_BLOCK_NAME);
}

int t_physical_tile_type::find_pin(std::string_view port_name, int pin_index_in_port) const {
int ipin = OPEN;
int port_base_ipin = 0;
int num_port_pins = OPEN;
int pin_offset = 0;

bool port_found = false;
for (const t_sub_tile& sub_tile : sub_tiles) {
for (const t_physical_tile_port& port : sub_tile.ports) {
if (port_name == port.name) {
port_found = true;
num_port_pins = port.num_pins;
break;
}

port_base_ipin += port.num_pins;
}

if (port_found) {
break;
}

port_base_ipin = 0;
pin_offset += sub_tile.num_phy_pins;
}

if (num_port_pins != OPEN) {
VTR_ASSERT(pin_index_in_port < num_port_pins);

ipin = port_base_ipin + pin_index_in_port + pin_offset;
}

return ipin;
}

int t_physical_tile_type::find_pin_class(std::string_view port_name, int pin_index_in_port, e_pin_type pin_type) const {
int iclass = OPEN;

int ipin = find_pin(port_name, pin_index_in_port);

if (ipin != OPEN) {
iclass = pin_class[ipin];

if (iclass != OPEN) {
VTR_ASSERT(class_inf[iclass].type == pin_type);
}
}
return iclass;
}

/*
* t_logical_block_type
*/
Expand All @@ -144,6 +194,28 @@ bool t_logical_block_type::is_empty() const {
return name == std::string(EMPTY_BLOCK_NAME);
}

const t_port* t_logical_block_type::get_port(std::string_view port_name) const {
for (int i = 0; i < pb_type->num_ports; i++) {
auto port = pb_type->ports[i];
if (port_name == port.name) {
return &pb_type->ports[port.index];
}
}

return nullptr;
}

const t_port* t_logical_block_type::get_port_by_pin(int pin) const {
for (int i = 0; i < pb_type->num_ports; i++) {
const t_port& port = pb_type->ports[i];
if (pin >= port.absolute_first_pin_index && pin < port.absolute_first_pin_index + port.num_pins) {
return &pb_type->ports[port.index];
}
}

return nullptr;
}

/**
* t_pb_graph_node
*/
Expand Down Expand Up @@ -220,7 +292,7 @@ std::string t_pb_graph_pin::to_string(const bool full_description) const {
return pin_string;
}

/**
/*
* t_pb_graph_edge
*/

Expand Down Expand Up @@ -253,3 +325,39 @@ bool t_pb_graph_edge::belongs_to_pattern(int pattern_index) const {
// return false otherwise
return false;
}

/*
* t_sub_tile
*/

int t_sub_tile::total_num_internal_pins() const {
int num_pins = 0;

for (t_logical_block_type_ptr eq_site : equivalent_sites) {
num_pins += (int)eq_site->pin_logical_num_to_pb_pin_mapping.size();
}

num_pins *= capacity.total();

return num_pins;
}

const t_physical_tile_port* t_sub_tile::get_port(std::string_view port_name) {
for (const t_physical_tile_port& port : ports) {
if (port_name == port.name) {
return &ports[port.index];
}
}

return nullptr;
}

const t_physical_tile_port* t_sub_tile::get_port_by_pin(int pin) const {
for (const t_physical_tile_port& port : ports) {
if (pin >= port.absolute_first_pin_index && pin < port.absolute_first_pin_index + port.num_pins) {
return &ports[port.index];
}
}

return nullptr;
}
48 changes: 39 additions & 9 deletions libs/libarchfpga/src/physical_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
* Authors: Jason Luu and Kenneth Kent
*/

#ifndef PHYSICAL_TYPES_H
#define PHYSICAL_TYPES_H
#pragma once

#include <functional>
#include <utility>
Expand Down Expand Up @@ -704,11 +703,7 @@ struct t_physical_tile_type {
* tile_block_pin_directs_map[logical block index][logical block pin] -> physical tile pin */
std::unordered_map<int, std::unordered_map<int, vtr::bimap<t_logical_pin, t_physical_pin>>> tile_block_pin_directs_map;

/* Returns the indices of pins that contain a clock for this physical logic block */
std::vector<int> get_clock_pins_indices() const;

// Returns the sub tile location of the physical tile given an input pin
int get_sub_tile_loc_from_pin(int pin_num) const;

// TODO: Remove is_input_type / is_output_type as part of
// https://github.com/verilog-to-routing/vtr-verilog-to-routing/issues/1193
Expand All @@ -719,8 +714,21 @@ struct t_physical_tile_type {
// Does this t_physical_tile_type contain an outpad?
bool is_output_type = false;

// Is this t_physical_tile_type an empty type?
public: // Function members
///@brief Returns the indices of pins that contain a clock for this physical logic block
std::vector<int> get_clock_pins_indices() const;

///@brief Returns the sub tile location of the physical tile given an input pin
int get_sub_tile_loc_from_pin(int pin_num) const;

///@brief Is this t_physical_tile_type an empty type?
bool is_empty() const;

///@brief Returns the relative pin index within a sub tile that corresponds to the pin within the given port and its index in the port
int find_pin(std::string_view port_name, int pin_index_in_port) const;

///@brief Returns the pin class associated with the specified pin_index_in_port within the port port_name on type
int find_pin_class(std::string_view port_name, int pin_index_in_port, e_pin_type pin_type) const;
};

/* Holds the capacity range of a certain sub_tile block within the parent physical tile type.
Expand Down Expand Up @@ -796,6 +804,19 @@ struct t_sub_tile {
int num_phy_pins = 0;

int index = -1;

public:
int total_num_internal_pins() const;

/**
* @brief Returns the physical tile port given the port name and the corresponding sub tile
*/
const t_physical_tile_port* get_port(std::string_view port_name);

/**
* @brief Returns the physical tile port given the pin name and the corresponding sub tile
*/
const t_physical_tile_port* get_port_by_pin(int pin) const;
};

/** A logical pin defines the pin index of a logical block type (i.e. a top level PB type)
Expand Down Expand Up @@ -950,6 +971,17 @@ struct t_logical_block_type {

// Is this t_logical_block_type empty?
bool is_empty() const;

public:
/**
* @brief Returns the logical block port given the port name and the corresponding logical block type
*/
const t_port* get_port(std::string_view port_name) const;

/**
* @brief Returns the logical block port given the pin name and the corresponding logical block type
*/
const t_port* get_port_by_pin(int pin) const;
};

/*************************************************************************************************
Expand Down Expand Up @@ -2124,5 +2156,3 @@ struct t_arch {
/// Stores NoC-related architectural information when there is an embedded NoC
t_noc_inf* noc = nullptr;
};

#endif
Loading
Loading