SDC: Adjust SDC output for VPR
Signed-off-by: Tomasz Michalak <tmichalak@antmicro.com>
diff --git a/sdc-plugin/clocks.cc b/sdc-plugin/clocks.cc
index dc1dbcf..09acff7 100644
--- a/sdc-plugin/clocks.cc
+++ b/sdc-plugin/clocks.cc
@@ -170,14 +170,8 @@
for (auto& clock : clocks_) {
auto clock_wires = clock.GetClockWires();
file << "create_clock -period " << clock.Period();
- if (clock_wires.size() > 1) {
- file << " -name " << clock.Name();
- }
- file << " -waveform {" << clock.RisingEdge() << " "
- << clock.FallingEdge() << "}";
- for (auto clock_wire : clock_wires) {
- file << " " << RTLIL::unescape_id(clock_wire->name);
- }
+ file << " -waveform {" << clock.RisingEdge() << " " << clock.FallingEdge() << "}";
+ file << " " << Clock::ClockWireName(clock_wires.at(0));
file << std::endl;
}
}
@@ -231,3 +225,11 @@
falling_edge_ = falling_edge;
assert(falling_edge - rising_edge == period_ / 2);
}
+
+std::string Clock::ClockWireName(RTLIL::Wire* wire) {
+ if (!wire) {
+ return std::string();
+ }
+ std::string wire_name(RTLIL::unescape_id(wire->name));
+ return std::regex_replace(wire_name, std::regex{"\\$"}, "\\$");
+}
diff --git a/sdc-plugin/clocks.h b/sdc-plugin/clocks.h
index d98d5b4..c1147a0 100644
--- a/sdc-plugin/clocks.h
+++ b/sdc-plugin/clocks.h
@@ -42,6 +42,7 @@
float RisingEdge() { return rising_edge_; }
float FallingEdge() { return falling_edge_; }
void UpdateClock(RTLIL::Wire* wire, float period, float rising_edge, float falling_edge);
+ static std::string ClockWireName(RTLIL::Wire* wire);
private:
std::string name_;