Skip to content

Commit 697f8a7

Browse files
committed
Tatum: store triggering edge info in TimingGraph
Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
1 parent d98cabb commit 697f8a7

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

libs/EXTERNAL/libtatum/libtatum/tatum/TimingGraph.cpp

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,32 @@ NodeId TimingGraph::add_node(const NodeType type) {
198198
return node_id;
199199
}
200200

201+
NodeId TimingGraph::add_node(const NodeType type, int trigg_edge) {
202+
//Invalidate the levelization
203+
is_levelized_ = false;
204+
205+
//Reserve an ID
206+
NodeId node_id = NodeId(node_ids_.size());
207+
node_ids_.push_back(node_id);
208+
209+
//Type
210+
node_types_.push_back(type);
211+
212+
//Triggering Edge
213+
trigg_edges_.push_back(trigg_edge);
214+
215+
//Edges
216+
node_out_edges_.push_back(std::vector<EdgeId>());
217+
node_in_edges_.push_back(std::vector<EdgeId>());
218+
219+
//Verify sizes
220+
TATUM_ASSERT(node_types_.size() == node_out_edges_.size());
221+
TATUM_ASSERT(node_types_.size() == node_in_edges_.size());
222+
223+
//Return the ID of the added node
224+
return node_id;
225+
}
226+
201227
EdgeId TimingGraph::add_edge(const EdgeType type, const NodeId src_node, const NodeId sink_node) {
202228
//We require that the source/sink node must already be in the graph,
203229
// so we can update them with thier edge references
@@ -556,6 +582,7 @@ void TimingGraph::remap_nodes(const tatum::util::linear_map<NodeId,NodeId>& node
556582
node_types_ = clean_and_reorder_values(node_types_, node_id_map);
557583
node_in_edges_ = clean_and_reorder_values(node_in_edges_, node_id_map);
558584
node_out_edges_ = clean_and_reorder_values(node_out_edges_, node_id_map);
585+
trigg_edges_ = clean_and_reorder_values(trigg_edges_, node_id_map);
559586

560587
//Update references
561588
edge_src_nodes_ = update_all_refs(edge_src_nodes_, node_id_map);
@@ -597,7 +624,8 @@ bool TimingGraph::validate_sizes() const {
597624
if ( node_ids_.size() != node_types_.size()
598625
|| node_ids_.size() != node_in_edges_.size()
599626
|| node_ids_.size() != node_out_edges_.size()
600-
|| node_ids_.size() != node_levels_.size()) {
627+
|| node_ids_.size() != node_levels_.size()
628+
|| node_ids_.size() != trigg_edges_.size()) {
601629
throw tatum::Error("Inconsistent node attribute sizes");
602630
}
603631

libs/EXTERNAL/libtatum/libtatum/tatum/TimingGraph.hpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,24 @@ class TimingGraph {
8484
///\returns The type of the node
8585
NodeType node_type(const NodeId id) const { return node_types_[id]; }
8686

87+
int trigg_edge(const NodeId id) const { return trigg_edges_[id]; }
88+
std::string trigg_edge_str(const NodeId id) const {
89+
switch(trigg_edges_[id]) {
90+
case 0:
91+
return "RISING";
92+
break;
93+
case 1:
94+
return "FALLING";
95+
break;
96+
case 2:
97+
return "DONT_CARE";
98+
break;
99+
default:
100+
return "ERROR";
101+
break;
102+
}
103+
}
104+
87105
///\param id The node id
88106
///\returns A range of all out-going edges the node drives
89107
edge_range node_out_edges(const NodeId id) const { return tatum::util::make_range(node_out_edges_[id].begin(), node_out_edges_[id].end()); }
@@ -198,6 +216,7 @@ class TimingGraph {
198216
///\param type The type of the node to be added
199217
///\warning Graph will likely need to be re-levelized after modification
200218
NodeId add_node(const NodeType type);
219+
NodeId add_node(const NodeType type, int trigg_edge);
201220

202221
///Adds an edge to the timing graph
203222
///\param type The edge's type
@@ -282,6 +301,7 @@ class TimingGraph {
282301
//Node data
283302
tatum::util::linear_map<NodeId,NodeId> node_ids_; //The node IDs in the graph
284303
tatum::util::linear_map<NodeId,NodeType> node_types_; //Type of node
304+
tatum::util::linear_map<NodeId,int> trigg_edges_; //Triggering edge of the clock
285305
tatum::util::linear_map<NodeId,std::vector<EdgeId>> node_in_edges_; //Incomiing edge IDs for node
286306
tatum::util::linear_map<NodeId,std::vector<EdgeId>> node_out_edges_; //Out going edge IDs for node
287307
tatum::util::linear_map<NodeId,LevelId> node_levels_; //Out going edge IDs for node

0 commit comments

Comments
 (0)