Skip to content

Commit b913d0f

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

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

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

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ LevelId TimingGraph::node_level(const NodeId node) const {
174174
return node_levels_[node];
175175
}
176176

177-
178177
NodeId TimingGraph::add_node(const NodeType type) {
179178
//Invalidate the levelization
180179
is_levelized_ = false;
@@ -198,6 +197,32 @@ NodeId TimingGraph::add_node(const NodeType type) {
198197
return node_id;
199198
}
200199

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

560586
//Update references
561587
edge_src_nodes_ = update_all_refs(edge_src_nodes_, node_id_map);
@@ -597,7 +623,8 @@ bool TimingGraph::validate_sizes() const {
597623
if ( node_ids_.size() != node_types_.size()
598624
|| node_ids_.size() != node_in_edges_.size()
599625
|| node_ids_.size() != node_out_edges_.size()
600-
|| node_ids_.size() != node_levels_.size()) {
626+
|| node_ids_.size() != node_levels_.size()
627+
|| node_ids_.size() != trigg_edges_.size()) {
601628
throw tatum::Error("Inconsistent node attribute sizes");
602629
}
603630

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ 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+
8789
///\param id The node id
8890
///\returns A range of all out-going edges the node drives
8991
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 +200,7 @@ class TimingGraph {
198200
///\param type The type of the node to be added
199201
///\warning Graph will likely need to be re-levelized after modification
200202
NodeId add_node(const NodeType type);
203+
NodeId add_node(const NodeType type, int trigg_edge);
201204

202205
///Adds an edge to the timing graph
203206
///\param type The edge's type
@@ -282,6 +285,7 @@ class TimingGraph {
282285
//Node data
283286
tatum::util::linear_map<NodeId,NodeId> node_ids_; //The node IDs in the graph
284287
tatum::util::linear_map<NodeId,NodeType> node_types_; //Type of node
288+
tatum::util::linear_map<NodeId,int> trigg_edges_; //Triggering edge of the clock
285289
tatum::util::linear_map<NodeId,std::vector<EdgeId>> node_in_edges_; //Incomiing edge IDs for node
286290
tatum::util::linear_map<NodeId,std::vector<EdgeId>> node_out_edges_; //Out going edge IDs for node
287291
tatum::util::linear_map<NodeId,LevelId> node_levels_; //Out going edge IDs for node

0 commit comments

Comments
 (0)