Skip to content

Commit 6407c12

Browse files
Richard Renacomodi
Richard Ren
authored andcommitted
Added Cinternal instances
The following are all the sqashed commits messages: added instances of Cinternal to mux, tri, buffer added the Cinternal to struct definitions in physical_types.h Previous change with CINTERNAL_REQD was lost, reuploaded removed Cinternal element from buffer readjusted comment in physical_types.h Propogates c_internal from arch to rr_graph; reads c_internal; writes c_internal to output Signed-off-by: Alessandro Comodi <[email protected]>
1 parent 2bb3101 commit 6407c12

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

libs/libarchfpga/src/physical_types.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,7 @@ enum class BufferSize {
12251225
* R: Equivalent resistance of the buffer/switch. *
12261226
* Cin: Input capacitance. *
12271227
* Cout: Output capacitance. *
1228+
* Cinternal: Internal capacitance in a buffer with fanout. *
12281229
* Tdel_map: A map where the key is the number of inputs and the entry *
12291230
* is the corresponding delay. If there is only one entry at key *
12301231
* UNDEFINED, then delay is a constant (doesn't vary with fan-in). *
@@ -1242,6 +1243,7 @@ struct t_arch_switch_inf {
12421243
float R = 0.;
12431244
float Cin = 0.;
12441245
float Cout = 0.;
1246+
float Cinternal = 0.; // defined the property Cinternal
12451247
float mux_trans_size = 1.;
12461248
BufferSize buf_size_type = BufferSize::AUTO;
12471249
float buf_size = 0.;
@@ -1293,6 +1295,7 @@ struct t_arch_switch_inf {
12931295
* R: Equivalent resistance of the buffer/switch. *
12941296
* Cin: Input capacitance. *
12951297
* Cout: Output capacitance. *
1298+
* Cinternal: Internal capacitance in a buffer. *
12961299
* Tdel: Intrinsic delay. The delay through an unloaded switch is *
12971300
* Tdel + R * Cout. *
12981301
* mux_trans_size: The area of each transistor in the segment's driving mux *
@@ -1303,6 +1306,7 @@ struct t_rr_switch_inf {
13031306
float R = 0.;
13041307
float Cin = 0.;
13051308
float Cout = 0.;
1309+
float Cinternal = 0.; //defined the property Cinternal
13061310
float Tdel = 0.;
13071311
float mux_trans_size = 0.;
13081312
float buf_size = 0.;

libs/libarchfpga/src/read_xml_arch_file.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3074,23 +3074,23 @@ static void ProcessSwitches(pugi::xml_node Parent,
30743074
SwitchType type = SwitchType::MUX;
30753075
if (0 == strcmp(type_name, "mux")) {
30763076
type = SwitchType::MUX;
3077-
expect_only_attributes(Node, {"type", "name", "R", "Cin", "Cout", "Tdel", "buf_size", "power_buf_size", "mux_trans_size"}, " with type '"s + type_name + "'"s, loc_data);
3077+
expect_only_attributes(Node, {"type", "name", "R", "Cin", "Cout", "Cinternal", "Tdel", "buf_size", "power_buf_size", "mux_trans_size"}, " with type '"s + type_name + "'"s, loc_data); // buffered switch should have a Cinternal element
30783078

30793079
} else if (0 == strcmp(type_name, "tristate")) {
30803080
type = SwitchType::TRISTATE;
3081-
expect_only_attributes(Node, {"type", "name", "R", "Cin", "Cout", "Tdel", "buf_size", "power_buf_size"}, " with type '"s + type_name + "'"s, loc_data);
3081+
expect_only_attributes(Node, {"type", "name", "R", "Cin", "Cout", "Cinternal", "Tdel", "buf_size", "power_buf_size"}, " with type '"s + type_name + "'"s, loc_data); // buffered switch should have a Cinternal element
30823082

30833083
} else if (0 == strcmp(type_name, "buffer")) {
30843084
type = SwitchType::BUFFER;
3085-
expect_only_attributes(Node, {"type", "name", "R", "Cin", "Cout", "Tdel", "buf_size", "power_buf_size"}, " with type '"s + type_name + "'"s, loc_data);
3085+
expect_only_attributes(Node, {"type", "name", "R", "Cin", "Cout", "Tdel", "buf_size", "power_buf_size"}, " with type '"s + type_name + "'"s, loc_data); // buffer should not have a Cinternal element
30863086

30873087
} else if (0 == strcmp(type_name, "pass_gate")) {
30883088
type = SwitchType::PASS_GATE;
3089-
expect_only_attributes(Node, {"type", "name", "R", "Cin", "Cout", "Tdel"}, " with type '"s + type_name + "'"s, loc_data);
3089+
expect_only_attributes(Node, {"type", "name", "R", "Cin", "Cout", "Tdel"}, " with type '"s + type_name + "'"s, loc_data); // unbuffered switch does not have Cinternal element
30903090

30913091
} else if (0 == strcmp(type_name, "short")) {
30923092
type = SwitchType::SHORT;
3093-
expect_only_attributes(Node, {"type", "name", "R", "Cin", "Cout", "Tdel"}, " with type "s + type_name + "'"s, loc_data);
3093+
expect_only_attributes(Node, {"type", "name", "R", "Cin", "Cout", "Tdel"}, " with type "s + type_name + "'"s, loc_data); // unbuffered switch does not have Cinternal element
30943094

30953095
} else {
30963096
archfpga_throw(loc_data.filename_c_str(), loc_data.line(Node),
@@ -3102,13 +3102,16 @@ static void ProcessSwitches(pugi::xml_node Parent,
31023102

31033103
ReqOpt COUT_REQD = TIMING_ENABLE_REQD;
31043104
ReqOpt CIN_REQD = TIMING_ENABLE_REQD;
3105+
ReqOpt CINTERNAL_REQD = OPTIONAL; //defined the parameter
3106+
31053107
if (arch_switch.type() == SwitchType::SHORT) {
31063108
//Cin/Cout are optional on shorts, since they really only have one capacitance
31073109
CIN_REQD = OPTIONAL;
31083110
COUT_REQD = OPTIONAL;
31093111
}
31103112
arch_switch.Cin = get_attribute(Node, "Cin", loc_data, CIN_REQD).as_float(0);
31113113
arch_switch.Cout = get_attribute(Node, "Cout", loc_data, COUT_REQD).as_float(0);
3114+
arch_switch.Cinternal = get_attribute(Node, "Cinternal", loc_data, CINTERNAL_REQD).as_float(0); // retrieve the optional parameter
31123115

31133116
if (arch_switch.type() == SwitchType::MUX) {
31143117
//Only muxes have mux transistors

vpr/src/route/rr_graph.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,7 @@ void load_rr_switch_from_arch_switch(int arch_switch_idx,
893893
device_ctx.rr_switch_inf[rr_switch_idx].set_type(device_ctx.arch_switch_inf[arch_switch_idx].type());
894894
device_ctx.rr_switch_inf[rr_switch_idx].R = device_ctx.arch_switch_inf[arch_switch_idx].R;
895895
device_ctx.rr_switch_inf[rr_switch_idx].Cin = device_ctx.arch_switch_inf[arch_switch_idx].Cin;
896+
device_ctx.rr_switch_inf[rr_switch_idx].Cinternal = device_ctx.arch_switch_inf[arch_switch_idx].Cinternal; //now we can retrieve Cinternal from the arch and implement into the rr calculations.
896897
device_ctx.rr_switch_inf[rr_switch_idx].Cout = device_ctx.arch_switch_inf[arch_switch_idx].Cout;
897898
device_ctx.rr_switch_inf[rr_switch_idx].Tdel = rr_switch_Tdel;
898899
device_ctx.rr_switch_inf[rr_switch_idx].mux_trans_size = device_ctx.arch_switch_inf[arch_switch_idx].mux_trans_size;

vpr/src/route/rr_graph_reader.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,13 @@ void process_switches(pugi::xml_node parent, const pugiutil::loc_data& loc_data)
234234
rr_switch.R = get_attribute(SwitchSubnode, "R", loc_data).as_float();
235235
rr_switch.Cin = get_attribute(SwitchSubnode, "Cin", loc_data).as_float();
236236
rr_switch.Cout = get_attribute(SwitchSubnode, "Cout", loc_data).as_float();
237+
rr_switch.Cinternal = get_attribute(SwitchSubnode, "Cinternal", loc_data).as_float();
237238
rr_switch.Tdel = get_attribute(SwitchSubnode, "Tdel", loc_data).as_float();
238239
} else {
239240
rr_switch.R = 0;
240241
rr_switch.Cin = 0;
241242
rr_switch.Cout = 0;
243+
rr_switch.Cinternal = 0;
242244
rr_switch.Tdel = 0;
243245
}
244246
SwitchSubnode = get_single_child(Switch, "sizing", loc_data);

vpr/src/route/rr_graph_writer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ void write_rr_switches(fstream& fp) {
189189
}
190190
fp << ">" << endl;
191191

192-
fp << "\t\t\t<timing R=\"" << setprecision(FLOAT_PRECISION) << rr_switch.R << "\" Cin=\"" << setprecision(FLOAT_PRECISION) << rr_switch.Cin << "\" Cout=\"" << setprecision(FLOAT_PRECISION) << rr_switch.Cout << "\" Tdel=\"" << setprecision(FLOAT_PRECISION) << rr_switch.Tdel << "\"/>" << endl;
192+
fp << "\t\t\t<timing R=\"" << setprecision(FLOAT_PRECISION) << rr_switch.R << "\" Cin=\"" << setprecision(FLOAT_PRECISION) << rr_switch.Cin << "\" Cout=\"" << setprecision(FLOAT_PRECISION) << rr_switch.Cout << "\" Cinternal=\"" << setprecision(FLOAT_PRECISION) << rr_switch.Cinternal << //will print display the value of Cinternal
193+
"\" Tdel=\"" << setprecision(FLOAT_PRECISION) << rr_switch.Tdel << "\"/>" << endl;
193194
fp << "\t\t\t<sizing mux_trans_size=\"" << setprecision(FLOAT_PRECISION) << rr_switch.mux_trans_size << "\" buf_size=\"" << setprecision(FLOAT_PRECISION) << rr_switch.buf_size << "\"/>" << endl;
194195
fp << "\t\t</switch>" << endl;
195196
}

0 commit comments

Comments
 (0)