Skip to content

Commit 6128622

Browse files
Add documentation to atom_pb_bimap and general cleanup
1 parent c8fe4e0 commit 6128622

File tree

5 files changed

+14
-38
lines changed

5 files changed

+14
-38
lines changed

vpr/src/base/atom_lookup.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ class AtomLookup {
3737
inline AtomPBBimap &mutable_atom_pb_bimap() {VTR_ASSERT(!lock_atom_pb_bimap); return atom_to_pb_bimap_;}
3838
inline const AtomPBBimap &atom_pb_bimap() const {VTR_ASSERT(!lock_atom_pb_bimap); return atom_to_pb_bimap_;}
3939

40+
/**
41+
* @brief Set atom to pb bimap
42+
*
43+
* @param atom_to_pb Reference to AtomPBBimab to be copied from
44+
*/
45+
void set_atom_to_pb_bimap(const AtomPBBimap& atom_to_pb){atom_to_pb_bimap_ = atom_to_pb;}
46+
4047
/*
4148
* PB Pins
4249
*/
@@ -97,11 +104,6 @@ class AtomLookup {
97104

98105
///@brief Sets the bi-directional mapping between an atom netlist pin and timing graph node
99106
void set_atom_pin_tnode(const AtomPinId pin, const tatum::NodeId node, BlockTnode block_tnode_type);
100-
101-
// Setter function for atom_to_pb_
102-
void set_atom_to_pb_bimap(const AtomPBBimap& atom_to_pb){
103-
atom_to_pb_bimap_ = atom_to_pb;
104-
}
105107

106108
private: //Types
107109
private:

vpr/src/pack/atom_pb_bimap.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
// Forward declaration
66
class t_pb_graph_node;
77

8+
/**
9+
* @brief Class that holds a bimap between atoms and pb types.
10+
* This means that you can get a pb from an atom and the
11+
* other way around.
12+
*
13+
* Used in the global AtomLookup context and in ClusterLegalizer
14+
*/
815
class AtomPBBimap {
916
public:
1017
AtomPBBimap() = default;
@@ -30,8 +37,6 @@ class AtomPBBimap {
3037
*/
3138
void set_atom_pb(const AtomBlockId blk_id, const t_pb* pb);
3239

33-
const vtr::bimap<AtomBlockId, const t_pb*, vtr::linear_map, std::unordered_map> &atom_to_pb() const {return atom_to_pb_;}
34-
3540
private:
3641
vtr::bimap<AtomBlockId, const t_pb*, vtr::linear_map, std::unordered_map> atom_to_pb_;
3742
};

vpr/src/pack/pack.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ bool try_pack(t_packer_opts* packer_opts,
6363
// device if needed.
6464
DeviceContext& mutable_device_ctx = g_vpr_ctx.mutable_device();
6565

66-
6766
std::unordered_set<AtomNetId> is_clock, is_global;
6867
VTR_LOG("Begin packing '%s'.\n", packer_opts->circuit_file_name.c_str());
6968

vpr/src/util/vpr_utils.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "globals.h"
1717
#include "vpr_utils.h"
1818
#include "cluster_placement.h"
19-
#include "cluster_legalizer.h"
2019
#include "device_grid.h"
2120
#include "user_route_constraints.h"
2221
#include "grid_block.h"
@@ -978,34 +977,6 @@ AtomPinId find_atom_pin(ClusterBlockId blk_id, const t_pb_graph_pin* pb_gpin) {
978977
return atom_pin;
979978
}
980979

981-
// Retrieves the pb_graph_pin associated with an AtomPinId
982-
// Currently this function just wraps get_pb_graph_node_pin_from_model_port_pin()
983-
// in a more convenient interface.
984-
const t_pb_graph_pin* find_pb_graph_pin(const AtomNetlist& netlist, const AtomLookup& netlist_lookup, const AtomPinId pin_id) {
985-
VTR_ASSERT(pin_id);
986-
987-
//Get the graph node
988-
AtomBlockId blk_id = netlist.pin_block(pin_id);
989-
const t_pb_graph_node* pb_gnode = netlist_lookup.atom_pb_bimap().atom_pb_graph_node(blk_id);
990-
VTR_ASSERT(pb_gnode);
991-
992-
//The graph node and pin/block should agree on the model they represent
993-
VTR_ASSERT(netlist.block_model(blk_id) == pb_gnode->pb_type->model);
994-
995-
//Get the pin index
996-
AtomPortId port_id = netlist.pin_port(pin_id);
997-
int ipin = netlist.pin_port_bit(pin_id);
998-
999-
//Get the model port
1000-
const t_model_ports* model_port = netlist.port_model(port_id);
1001-
VTR_ASSERT(model_port);
1002-
1003-
return get_pb_graph_node_pin_from_model_port_pin(model_port, ipin, pb_gnode);
1004-
}
1005-
1006-
1007-
// TODO: Code duplication here. Could probably use a better pack-related abstraction
1008-
// to avoid all this, as this function is only used in vpr/src/pack
1009980
// Retrieves the pb_graph_pin associated with an AtomPinId
1010981
const t_pb_graph_pin* find_pb_graph_pin(const AtomNetlist& netlist, const AtomPBBimap& atom_pb_lookup, const AtomPinId pin_id) {
1011982
VTR_ASSERT(pin_id);

vpr/src/util/vpr_utils.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ int get_max_depth_of_pb_type(t_pb_type* pb_type);
189189
int get_max_nets_in_pb_type(const t_pb_type* pb_type);
190190
bool primitive_type_feasible(AtomBlockId blk_id, const t_pb_type* cur_pb_type);
191191
t_pb_graph_pin* get_pb_graph_node_pin_from_model_port_pin(const t_model_ports* model_port, const int model_pin, const t_pb_graph_node* pb_graph_node);
192-
const t_pb_graph_pin* find_pb_graph_pin(const AtomNetlist& netlist, const AtomLookup& netlist_lookup, const AtomPinId pin_id);
193192
/// @brief Gets the pb_graph_node pin at the given pin index for the given
194193
/// pb_graph_node.
195194
t_pb_graph_pin* get_pb_graph_node_pin_from_pb_graph_node(t_pb_graph_node* pb_graph_node, int ipin);

0 commit comments

Comments
 (0)