|
3 | 3 | #include <algorithm>
|
4 | 4 | #include <utility>
|
5 | 5 | #include <vector>
|
| 6 | +#include <fstream> |
6 | 7 | #include "vtr_assert.h"
|
7 | 8 |
|
8 | 9 | #include "vtr_util.h"
|
@@ -890,6 +891,29 @@ void create_rr_graph(const t_graph_type graph_type,
|
890 | 891 | echo_file_name,
|
891 | 892 | is_flat);
|
892 | 893 | }
|
| 894 | + { |
| 895 | + std::ofstream file1("switch_delay.txt"); |
| 896 | + std::ofstream file2("exact_delay.txt"); |
| 897 | + |
| 898 | + if (!file1.is_open() || !file2.is_open()) { |
| 899 | + std::cerr << "Error opening files!" << std::endl; |
| 900 | + return; |
| 901 | + } |
| 902 | + |
| 903 | + for (const RRNodeId driver_node : device_ctx.rr_graph.nodes()) { |
| 904 | + for (const RREdgeId edge_id : device_ctx.rr_graph.edge_range(driver_node)) { |
| 905 | + int i_switch = device_ctx.rr_graph.edge_switch(edge_id); |
| 906 | + float edge_switch_delay = device_ctx.rr_graph.rr_switch_inf(RRSwitchId(i_switch)).Tdel; |
| 907 | + float edge_exact_delay = device_ctx.rr_graph.edge_delay(edge_id); |
| 908 | + |
| 909 | + file1 << size_t(edge_id) << " " << edge_switch_delay << "\n"; |
| 910 | + file2 << size_t(edge_id) << " " << edge_exact_delay << "\n"; |
| 911 | + } |
| 912 | + } |
| 913 | + |
| 914 | + file1.close(); |
| 915 | + file2.close(); |
| 916 | + } |
893 | 917 | }
|
894 | 918 |
|
895 | 919 | static void add_intra_cluster_edges_rr_graph(RRGraphBuilder& rr_graph_builder,
|
@@ -1860,29 +1884,33 @@ void load_rr_switch_from_arch_switch(RRGraphBuilder& rr_graph_builder,
|
1860 | 1884 | int fanin,
|
1861 | 1885 | const float R_minW_nmos,
|
1862 | 1886 | const float R_minW_pmos) {
|
1863 |
| - /* figure out, by looking at the arch switch's Tdel map, what the delay of the new |
1864 |
| - * rr switch should be */ |
1865 |
| - double rr_switch_Tdel = arch_sw_inf.at(arch_switch_idx).Tdel(fanin); |
| 1887 | + const t_arch_switch_inf& arch_switch = arch_sw_inf.at(arch_switch_idx); |
| 1888 | + t_rr_switch_inf& rr_switch_to_be_updated = rr_graph_builder.rr_switch()[RRSwitchId(rr_switch_idx)]; |
| 1889 | + t_rr_switch_offset_inf& rr_switch_offset_to_be_updated = rr_graph_builder.rr_switch_offset_inf()[RRSwitchOffsetInfoId (rr_switch_idx)]; |
1866 | 1890 |
|
1867 | 1891 | /* copy over the arch switch to rr_switch_inf[rr_switch_idx], but with the changed Tdel value */
|
1868 |
| - rr_graph_builder.rr_switch()[RRSwitchId(rr_switch_idx)].set_type(arch_sw_inf.at(arch_switch_idx).type()); |
1869 |
| - rr_graph_builder.rr_switch()[RRSwitchId(rr_switch_idx)].R = arch_sw_inf.at(arch_switch_idx).R; |
1870 |
| - rr_graph_builder.rr_switch()[RRSwitchId(rr_switch_idx)].Cin = arch_sw_inf.at(arch_switch_idx).Cin; |
1871 |
| - rr_graph_builder.rr_switch()[RRSwitchId(rr_switch_idx)].Cinternal = arch_sw_inf.at(arch_switch_idx).Cinternal; |
1872 |
| - rr_graph_builder.rr_switch()[RRSwitchId(rr_switch_idx)].Cout = arch_sw_inf.at(arch_switch_idx).Cout; |
1873 |
| - rr_graph_builder.rr_switch()[RRSwitchId(rr_switch_idx)].Tdel = rr_switch_Tdel; |
1874 |
| - rr_graph_builder.rr_switch()[RRSwitchId(rr_switch_idx)].mux_trans_size = arch_sw_inf.at(arch_switch_idx).mux_trans_size; |
1875 |
| - if (arch_sw_inf.at(arch_switch_idx).buf_size_type == BufferSize::AUTO) { |
| 1892 | + rr_switch_to_be_updated.set_type(arch_switch.type()); |
| 1893 | + rr_switch_to_be_updated.R = arch_switch.R; |
| 1894 | + rr_switch_to_be_updated.Cin = arch_switch.Cin; |
| 1895 | + rr_switch_to_be_updated.Cinternal = arch_switch.Cinternal; |
| 1896 | + rr_switch_to_be_updated.Cout = arch_switch.Cout; |
| 1897 | + /* figure out, by looking at the arch switch's Tdel map, what the delay of the new |
| 1898 | + * rr switch should be */ |
| 1899 | + rr_switch_to_be_updated.Tdel = arch_switch.Tdel(fanin); |
| 1900 | + rr_switch_to_be_updated.mux_trans_size = arch_switch.mux_trans_size; |
| 1901 | + if (arch_switch.buf_size_type == BufferSize::AUTO) { |
1876 | 1902 | //Size based on resistance
|
1877 |
| - rr_graph_builder.rr_switch()[RRSwitchId(rr_switch_idx)].buf_size = trans_per_buf(arch_sw_inf.at(arch_switch_idx).R, R_minW_nmos, R_minW_pmos); |
| 1903 | + rr_switch_to_be_updated.buf_size = trans_per_buf(arch_switch.R, R_minW_nmos, R_minW_pmos); |
1878 | 1904 | } else {
|
1879 |
| - VTR_ASSERT(arch_sw_inf.at(arch_switch_idx).buf_size_type == BufferSize::ABSOLUTE); |
| 1905 | + VTR_ASSERT(arch_switch.buf_size_type == BufferSize::ABSOLUTE); |
1880 | 1906 | //Use the specified size
|
1881 |
| - rr_graph_builder.rr_switch()[RRSwitchId(rr_switch_idx)].buf_size = arch_sw_inf.at(arch_switch_idx).buf_size; |
| 1907 | + rr_switch_to_be_updated.buf_size = arch_switch.buf_size; |
1882 | 1908 | }
|
1883 |
| - rr_graph_builder.rr_switch()[RRSwitchId(rr_switch_idx)].name = arch_sw_inf.at(arch_switch_idx).name; |
1884 |
| - rr_graph_builder.rr_switch()[RRSwitchId(rr_switch_idx)].power_buffer_type = arch_sw_inf.at(arch_switch_idx).power_buffer_type; |
1885 |
| - rr_graph_builder.rr_switch()[RRSwitchId(rr_switch_idx)].power_buffer_size = arch_sw_inf.at(arch_switch_idx).power_buffer_size; |
| 1909 | + rr_switch_to_be_updated.name = arch_switch.name; |
| 1910 | + rr_switch_to_be_updated.power_buffer_type = arch_switch.power_buffer_type; |
| 1911 | + rr_switch_to_be_updated.power_buffer_size = arch_switch.power_buffer_size; |
| 1912 | + |
| 1913 | + rr_switch_offset_to_be_updated.Tdel = rr_switch_to_be_updated.Tdel; |
1886 | 1914 | }
|
1887 | 1915 |
|
1888 | 1916 | /* switch indices of each rr_node original point into the global device_ctx.arch_switch_inf array.
|
|
0 commit comments