Skip to content

Commit 9761055

Browse files
Merge pull request #2829 from verilog-to-routing/temp_organize_place_timng
Reorganize place timing files
2 parents 6ce9dbe + ebfc14a commit 9761055

File tree

65 files changed

+3326
-3407
lines changed

Some content is hidden

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

65 files changed

+3326
-3407
lines changed

libs/libarchfpga/src/arch_check.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ bool check_model_clocks(t_model* model, const char* file, uint32_t line) {
3232
bool check_model_combinational_sinks(const t_model* model, const char* file, uint32_t line) {
3333
//Outputs should have no combinational sinks
3434
for (t_model_ports* port = model->outputs; port != nullptr; port = port->next) {
35-
if (port->combinational_sink_ports.size() != 0) {
35+
if (!port->combinational_sink_ports.empty()) {
3636
archfpga_throw(file, line,
3737
"Model '%s' output port '%s' can not have combinational sink ports",
3838
model->name, port->name);
@@ -114,9 +114,9 @@ void check_port_direct_mappings(t_physical_tile_type_ptr physical_tile, t_sub_ti
114114
}
115115

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

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

121121
VTR_ASSERT(block_port != nullptr);
122122
VTR_ASSERT(sub_tile_port != nullptr);

libs/libarchfpga/src/arch_util.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class InstPort {
2323

2424
InstPort() = default;
2525
InstPort(const std::string& str);
26-
std::string instance_name() const { return instance_.name; }
27-
std::string port_name() const { return port_.name; }
26+
const std::string& instance_name() const { return instance_.name; }
27+
const std::string& port_name() const { return port_.name; }
2828

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

4141
private:
4242
struct name_index {
43-
std::string name = "";
43+
std::string name;
4444
int low_idx = UNSPECIFIED;
4545
int high_idx = UNSPECIFIED;
4646
};

libs/libarchfpga/src/physical_types.cpp

+109-1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,56 @@ bool t_physical_tile_type::is_empty() const {
136136
return name == std::string(EMPTY_BLOCK_NAME);
137137
}
138138

139+
int t_physical_tile_type::find_pin(std::string_view port_name, int pin_index_in_port) const {
140+
int ipin = OPEN;
141+
int port_base_ipin = 0;
142+
int num_port_pins = OPEN;
143+
int pin_offset = 0;
144+
145+
bool port_found = false;
146+
for (const t_sub_tile& sub_tile : sub_tiles) {
147+
for (const t_physical_tile_port& port : sub_tile.ports) {
148+
if (port_name == port.name) {
149+
port_found = true;
150+
num_port_pins = port.num_pins;
151+
break;
152+
}
153+
154+
port_base_ipin += port.num_pins;
155+
}
156+
157+
if (port_found) {
158+
break;
159+
}
160+
161+
port_base_ipin = 0;
162+
pin_offset += sub_tile.num_phy_pins;
163+
}
164+
165+
if (num_port_pins != OPEN) {
166+
VTR_ASSERT(pin_index_in_port < num_port_pins);
167+
168+
ipin = port_base_ipin + pin_index_in_port + pin_offset;
169+
}
170+
171+
return ipin;
172+
}
173+
174+
int t_physical_tile_type::find_pin_class(std::string_view port_name, int pin_index_in_port, e_pin_type pin_type) const {
175+
int iclass = OPEN;
176+
177+
int ipin = find_pin(port_name, pin_index_in_port);
178+
179+
if (ipin != OPEN) {
180+
iclass = pin_class[ipin];
181+
182+
if (iclass != OPEN) {
183+
VTR_ASSERT(class_inf[iclass].type == pin_type);
184+
}
185+
}
186+
return iclass;
187+
}
188+
139189
/*
140190
* t_logical_block_type
141191
*/
@@ -144,6 +194,28 @@ bool t_logical_block_type::is_empty() const {
144194
return name == std::string(EMPTY_BLOCK_NAME);
145195
}
146196

197+
const t_port* t_logical_block_type::get_port(std::string_view port_name) const {
198+
for (int i = 0; i < pb_type->num_ports; i++) {
199+
auto port = pb_type->ports[i];
200+
if (port_name == port.name) {
201+
return &pb_type->ports[port.index];
202+
}
203+
}
204+
205+
return nullptr;
206+
}
207+
208+
const t_port* t_logical_block_type::get_port_by_pin(int pin) const {
209+
for (int i = 0; i < pb_type->num_ports; i++) {
210+
const t_port& port = pb_type->ports[i];
211+
if (pin >= port.absolute_first_pin_index && pin < port.absolute_first_pin_index + port.num_pins) {
212+
return &pb_type->ports[port.index];
213+
}
214+
}
215+
216+
return nullptr;
217+
}
218+
147219
/**
148220
* t_pb_graph_node
149221
*/
@@ -220,7 +292,7 @@ std::string t_pb_graph_pin::to_string(const bool full_description) const {
220292
return pin_string;
221293
}
222294

223-
/**
295+
/*
224296
* t_pb_graph_edge
225297
*/
226298

@@ -253,3 +325,39 @@ bool t_pb_graph_edge::belongs_to_pattern(int pattern_index) const {
253325
// return false otherwise
254326
return false;
255327
}
328+
329+
/*
330+
* t_sub_tile
331+
*/
332+
333+
int t_sub_tile::total_num_internal_pins() const {
334+
int num_pins = 0;
335+
336+
for (t_logical_block_type_ptr eq_site : equivalent_sites) {
337+
num_pins += (int)eq_site->pin_logical_num_to_pb_pin_mapping.size();
338+
}
339+
340+
num_pins *= capacity.total();
341+
342+
return num_pins;
343+
}
344+
345+
const t_physical_tile_port* t_sub_tile::get_port(std::string_view port_name) {
346+
for (const t_physical_tile_port& port : ports) {
347+
if (port_name == port.name) {
348+
return &ports[port.index];
349+
}
350+
}
351+
352+
return nullptr;
353+
}
354+
355+
const t_physical_tile_port* t_sub_tile::get_port_by_pin(int pin) const {
356+
for (const t_physical_tile_port& port : ports) {
357+
if (pin >= port.absolute_first_pin_index && pin < port.absolute_first_pin_index + port.num_pins) {
358+
return &ports[port.index];
359+
}
360+
}
361+
362+
return nullptr;
363+
}

libs/libarchfpga/src/physical_types.h

+39-9
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
* Authors: Jason Luu and Kenneth Kent
2525
*/
2626

27-
#ifndef PHYSICAL_TYPES_H
28-
#define PHYSICAL_TYPES_H
27+
#pragma once
2928

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

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

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

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

722-
// Is this t_physical_tile_type an empty type?
717+
public: // Function members
718+
///@brief Returns the indices of pins that contain a clock for this physical logic block
719+
std::vector<int> get_clock_pins_indices() const;
720+
721+
///@brief Returns the sub tile location of the physical tile given an input pin
722+
int get_sub_tile_loc_from_pin(int pin_num) const;
723+
724+
///@brief Is this t_physical_tile_type an empty type?
723725
bool is_empty() const;
726+
727+
///@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
728+
int find_pin(std::string_view port_name, int pin_index_in_port) const;
729+
730+
///@brief Returns the pin class associated with the specified pin_index_in_port within the port port_name on type
731+
int find_pin_class(std::string_view port_name, int pin_index_in_port, e_pin_type pin_type) const;
724732
};
725733

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

798806
int index = -1;
807+
808+
public:
809+
int total_num_internal_pins() const;
810+
811+
/**
812+
* @brief Returns the physical tile port given the port name and the corresponding sub tile
813+
*/
814+
const t_physical_tile_port* get_port(std::string_view port_name);
815+
816+
/**
817+
* @brief Returns the physical tile port given the pin name and the corresponding sub tile
818+
*/
819+
const t_physical_tile_port* get_port_by_pin(int pin) const;
799820
};
800821

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

951972
// Is this t_logical_block_type empty?
952973
bool is_empty() const;
974+
975+
public:
976+
/**
977+
* @brief Returns the logical block port given the port name and the corresponding logical block type
978+
*/
979+
const t_port* get_port(std::string_view port_name) const;
980+
981+
/**
982+
* @brief Returns the logical block port given the pin name and the corresponding logical block type
983+
*/
984+
const t_port* get_port_by_pin(int pin) const;
953985
};
954986

955987
/*************************************************************************************************
@@ -2124,5 +2156,3 @@ struct t_arch {
21242156
/// Stores NoC-related architectural information when there is an embedded NoC
21252157
t_noc_inf* noc = nullptr;
21262158
};
2127-
2128-
#endif

0 commit comments

Comments
 (0)