//////////////////////////////////////////////////////////////////////////////////
//                                                                              //
//                  Cycle-Time Calculation for DLX-CPU Core                     //
//                 with Tomasulo Scheduling and Reorderbuffer                   //
//                                                                              //
//                           1998, Daniel Kroening                              //
//                                                                              //
//////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////
//                      abstract data type: a data path                         //
//////////////////////////////////////////////////////////////////////////////////

// maximal # of circuits on a path

#define MAXCIRCUITS 100

class patht
 {
 public:
  struct
   {
    const char *name;
    int delay;
   } circuits[MAXCIRCUITS];                    // the circuits on the path

  int circuitcount;                            // the number of circuits on the path
  int acc_delay;                               // accumulated gate delays

  patht();                                     // constructor
  patht(const char *name);                     // constructor; the argument is the name
                                               // of the source register

  patht& operator+=(const char *);             // append a circuit identifier
  patht& operator+=(int);                      // append a gate
  friend patht operator+(patht, const char *); // append a circuit identifier
  friend patht operator+(patht, int);          // append a gate
  
  void print();                                // print a path
 };

// determine the longest path

patht max(patht a, patht b);
patht max(patht a, patht b, patht c);
patht max(patht a, patht b, patht c, patht d);

class pathlistt
 {
 public:
  void add(patht path);               // add a path to the list
  
  patht max();                        // return the longest path
  
  print();                            // print all paths in the list
  
  pathlistt();                        // constructor
  ~pathlistt();                       // destructor
  
  struct datat
   {
    patht path;
    datat *n;
   } *list;
 };

