Skip to content

Commit a25fb73

Browse files
tpagaraniacomodi
authored andcommitted
add changes to write blackbox SDF timing
1 parent 7ff9f73 commit a25fb73

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

vpr/src/base/netlist_writer.cpp

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@
9292
//File local type declarations
9393
//
9494

95+
typedef std::pair<double, std::string> pair_d;
96+
9597
/*enum class PortType {
9698
* IN,
9799
* OUT,
@@ -553,9 +555,9 @@ class BlackBoxInst : public Instance {
553555
std::map<std::string, std::vector<std::string>> input_port_conns, ///<Port connections: Dictionary of <port,nets>
554556
std::map<std::string, std::vector<std::string>> output_port_conns, ///<Port connections: Dictionary of <port,nets>
555557
std::vector<Arc> timing_arcs, ///<Combinational timing arcs
556-
std::map<std::string, double> ports_tsu, ///<Port setup checks
557-
std::map<std::string, double> ports_thld, ///<Port hold checks
558-
std::map<std::string, double> ports_tcq) ///<Port clock-to-q delays
558+
std::map<std::string, pair_d> ports_tsu, ///<Port setup checks
559+
std::map<std::string, pair_d> ports_thld, ///<Port hold checks
560+
std::map<std::string, pair_d> ports_tcq) ///<Port clock-to-q delays
559561
: type_name_(type_name)
560562
, inst_name_(inst_name)
561563
, params_(params)
@@ -565,7 +567,7 @@ class BlackBoxInst : public Instance {
565567
, timing_arcs_(timing_arcs)
566568
, ports_tsu_(ports_tsu)
567569
, ports_thld_(ports_thld)
568-
, ports_tcq_(ports_tcq) {}
570+
, ports_tcq_(ports_tcq){}
569571

570572
void print_blif(std::ostream& os, size_t& unconn_count, int depth = 0) override {
571573
os << indent(depth) << ".subckt " << type_name_ << " \\"
@@ -690,12 +692,12 @@ class BlackBoxInst : public Instance {
690692

691693
//Clock-to-Q delays
692694
for (auto kv : ports_tcq_) {
693-
double clock_to_q_ps = get_delay_ps(kv.second);
695+
double clock_to_q_ps = get_delay_ps(kv.second.first);
694696

695697
std::stringstream delay_triple;
696698
delay_triple << "(" << clock_to_q_ps << ":" << clock_to_q_ps << ":" << clock_to_q_ps << ")";
697699

698-
os << indent(depth + 3) << "(IOPATH (posedge clock) " << escape_sdf_identifier(kv.first) << " " << delay_triple.str() << " " << delay_triple.str() << ")\n";
700+
os << indent(depth + 3) << "(IOPATH (posedge " << escape_sdf_identifier(kv.second.second) << ") " << escape_sdf_identifier(kv.first) << " " << delay_triple.str() << " " << delay_triple.str() << ")\n";
699701
}
700702
os << indent(depth + 2) << ")\n"; //ABSOLUTE
701703
}
@@ -705,20 +707,20 @@ class BlackBoxInst : public Instance {
705707
//Setup checks
706708
os << indent(depth + 1) << "(TIMINGCHECK\n";
707709
for (auto kv : ports_tsu_) {
708-
double setup_ps = get_delay_ps(kv.second);
710+
double setup_ps = get_delay_ps(kv.second.first);
709711

710712
std::stringstream delay_triple;
711713
delay_triple << "(" << setup_ps << ":" << setup_ps << ":" << setup_ps << ")";
712714

713-
os << indent(depth + 2) << "(SETUP " << escape_sdf_identifier(kv.first) << " (posedge clock) " << delay_triple.str() << ")\n";
715+
os << indent(depth + 2) << "(SETUP " << escape_sdf_identifier(kv.first) << " (posedge " << escape_sdf_identifier(kv.second.second) << ") " << delay_triple.str() << ")\n";
714716
}
715717
for (auto kv : ports_thld_) {
716-
double hold_ps = get_delay_ps(kv.second);
718+
double hold_ps = get_delay_ps(kv.second.first);
717719

718720
std::stringstream delay_triple;
719721
delay_triple << "(" << hold_ps << ":" << hold_ps << ":" << hold_ps << ")";
720722

721-
os << indent(depth + 2) << "(HOLD " << escape_sdf_identifier(kv.first) << " (posedge clock) " << delay_triple.str() << ")\n";
723+
os << indent(depth + 2) << "(HOLD " << escape_sdf_identifier(kv.first) << " (posedge " << escape_sdf_identifier(kv.second.second) << ") " << delay_triple.str() << ")\n";
722724
}
723725
os << indent(depth + 1) << ")\n"; //TIMINGCHECK
724726
}
@@ -750,9 +752,9 @@ class BlackBoxInst : public Instance {
750752
std::map<std::string, std::vector<std::string>> input_port_conns_;
751753
std::map<std::string, std::vector<std::string>> output_port_conns_;
752754
std::vector<Arc> timing_arcs_;
753-
std::map<std::string, double> ports_tsu_;
754-
std::map<std::string, double> ports_thld_;
755-
std::map<std::string, double> ports_tcq_;
755+
std::map<std::string, pair_d> ports_tsu_;
756+
std::map<std::string, pair_d> ports_thld_;
757+
std::map<std::string, pair_d> ports_tcq_;
756758
};
757759

758760
/**
@@ -1284,9 +1286,9 @@ class NetlistWriterVisitor : public NetlistVisitor {
12841286
std::map<std::string, std::vector<std::string>> input_port_conns;
12851287
std::map<std::string, std::vector<std::string>> output_port_conns;
12861288
std::vector<Arc> timing_arcs;
1287-
std::map<std::string, double> ports_tsu;
1288-
std::map<std::string, double> ports_thld;
1289-
std::map<std::string, double> ports_tcq;
1289+
std::map<std::string, pair_d> ports_tsu;
1290+
std::map<std::string, pair_d> ports_thld;
1291+
std::map<std::string, pair_d> ports_tcq;
12901292

12911293
params["ADDR_WIDTH"] = "0";
12921294
params["DATA_WIDTH"] = "0";
@@ -1342,7 +1344,7 @@ class NetlistWriterVisitor : public NetlistVisitor {
13421344
}
13431345

13441346
input_port_conns[port_name].push_back(net);
1345-
ports_tsu[port_name] = pin->tsu;
1347+
ports_tsu[port_name] = std::make_pair(pin->tsu, pin->associated_clock_pin->port->name);
13461348
}
13471349
}
13481350

@@ -1378,7 +1380,7 @@ class NetlistWriterVisitor : public NetlistVisitor {
13781380
"Unrecognized input port class '%s' for primitive '%s' (%s)\n", port_class.c_str(), atom->name, pb_type->name);
13791381
}
13801382
output_port_conns[port_name].push_back(net);
1381-
ports_tcq[port_name] = pin->tco_max;
1383+
ports_tcq[port_name] = std::make_pair(pin->tco_max,pin->associated_clock_pin->port->name); //pin->tco_max;
13821384
}
13831385
}
13841386

@@ -1427,9 +1429,9 @@ class NetlistWriterVisitor : public NetlistVisitor {
14271429
std::map<std::string, std::vector<std::string>> input_port_conns;
14281430
std::map<std::string, std::vector<std::string>> output_port_conns;
14291431
std::vector<Arc> timing_arcs;
1430-
std::map<std::string, double> ports_tsu;
1431-
std::map<std::string, double> ports_thld;
1432-
std::map<std::string, double> ports_tcq;
1432+
std::map<std::string, pair_d> ports_tsu;
1433+
std::map<std::string, pair_d> ports_thld;
1434+
std::map<std::string, pair_d> ports_tcq;
14331435

14341436
params["WIDTH"] = "0";
14351437

@@ -1523,9 +1525,9 @@ class NetlistWriterVisitor : public NetlistVisitor {
15231525
std::map<std::string, std::vector<std::string>> input_port_conns;
15241526
std::map<std::string, std::vector<std::string>> output_port_conns;
15251527
std::vector<Arc> timing_arcs;
1526-
std::map<std::string, double> ports_tsu;
1527-
std::map<std::string, double> ports_thld;
1528-
std::map<std::string, double> ports_tcq;
1528+
std::map<std::string, pair_d> ports_tsu;
1529+
std::map<std::string, pair_d> ports_thld;
1530+
std::map<std::string, pair_d> ports_tcq;
15291531

15301532
params["WIDTH"] = "0";
15311533

@@ -1621,9 +1623,9 @@ class NetlistWriterVisitor : public NetlistVisitor {
16211623
std::map<std::string, std::vector<std::string>> input_port_conns;
16221624
std::map<std::string, std::vector<std::string>> output_port_conns;
16231625
std::vector<Arc> timing_arcs;
1624-
std::map<std::string, double> ports_tsu;
1625-
std::map<std::string, double> ports_thld;
1626-
std::map<std::string, double> ports_tcq;
1626+
std::map<std::string, pair_d> ports_tsu;
1627+
std::map<std::string, pair_d> ports_thld;
1628+
std::map<std::string, pair_d> ports_tcq;
16271629

16281630
//Delay matrix[sink_tnode] -> tuple of source_port_name, pin index, delay
16291631
std::map<tatum::NodeId, std::vector<std::tuple<std::string, int, double>>> tnode_delay_matrix;
@@ -1662,8 +1664,8 @@ class NetlistWriterVisitor : public NetlistVisitor {
16621664

16631665
input_port_conns[port->name].push_back(net);
16641666
if (pin->type == PB_PIN_SEQUENTIAL) {
1665-
if (!std::isnan(pin->tsu)) ports_tsu[port->name] = pin->tsu;
1666-
if (!std::isnan(pin->thld)) ports_thld[port->name] = pin->thld;
1667+
if (!std::isnan(pin->tsu)) ports_tsu[port->name] = std::make_pair(pin->tsu, pin->associated_clock_pin->port->name);
1668+
if (!std::isnan(pin->thld)) ports_thld[port->name] = std::make_pair(pin->thld, pin->associated_clock_pin->port->name);
16671669
}
16681670
}
16691671
}
@@ -1698,7 +1700,7 @@ class NetlistWriterVisitor : public NetlistVisitor {
16981700

16991701

17001702
output_port_conns[port->name].push_back(net);
1701-
if (pin->type == PB_PIN_SEQUENTIAL && !std::isnan(pin->tco_max)) ports_tcq[port->name] = pin->tco_max;
1703+
if (pin->type == PB_PIN_SEQUENTIAL && !std::isnan(pin->tco_max)) ports_tcq[port->name] = std::make_pair(pin->tco_max,pin->associated_clock_pin->port->name);
17021704
}
17031705
}
17041706

0 commit comments

Comments
 (0)