hgraph.hpp

来自「实现把一个大电路划分成两个小电路」· HPP 代码 · 共 74 行

HPP
74
字号
#ifndef HGRAPH_HPP#define HGRAPH_HPP#ifndef NULL#define NULL 0#endif#define other(num) ((num)?0:1)#define LOCKED -10000#include "ll.hpp"extern int SEED; // random seed for initial partitioningextern double RATIO; // ratio of balance between partitionstypedef LL *ll;   // ptr to a linked liststruct net;       // predefine netstruct cell{int number;       // index # of cell in cells arrayLL first;         // ll of nets on cellnode *gainbucket; // ptr to cell in the bucket listsint block;        // which block (partition) the cell is inint gain;         // gain of cellint gainfromlock; // gain from moving and locking cellcell(int num,int side); // constructorcell() {}         // default constructor};struct net{int number;     // number of cells on netLL first;       // ll of cells on netint unlock[2];  // # of unlocked cells in each blockint lock[2];    // # of locked cells in each blocknet(int num);   // constructor, assigns num to numbernet() {}        // default constructor};class parthgraph{private:int numcells;   // number of cells in hgraphint numnets;    // number of nets in hgraphdouble ratio;   // ratio of balance between the blocksint minsize[2]; //cell *cells;    // array of cells in hgraphnet *nets;      // array of nets in hgraphint pmax;       // max number of pins per cellll buckets[2];  // buckets for gain updatesLL free;        // ll of free cellsint maxgain[2]; // max gain of any cell in each blockint balance[2];int passes;     // number of passespublic:parthgraph(void){}  // constructorvoid getgraph(char* filename); // loads hgraph filename from diskvoid part(void);               // performs partitioningvoid initgains(void);          // initializes gains and bucketsvoid swapall(void);void getprefix(int& prenum);void reinit(int prenum);cell* gethighest(void);void fixgain(LL &first,int operation,int single=0,int sameside=0);int cutset(void);void print(char *str);// debug functionsvoid printCells(); // printout cell infovoid printBucket(); // printout top buckets};#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?