User Book
Simulation Section
4.Sim profiling tool

Simulation Profiling

Kathryn provides the automaticalic ways to track how many cycles which the model spend to do each state while simulating.

  • To enable the profiling tool, designer must first change MFP_OFF to MFP_ON at src/params/simParam.cpp

  • After simulation the profiling file will be written automatically at the file that specify when initializing simulator.

specific task tracking

Kathryn allows designers to track cycle spend at specific state (flow block), and the summary result will be write at the buttom of page that specify when initializing simulator.

  • use track(#name) or strack("name")
  • for example
  •             struct BlinkAB: public Module{
                    //////// swap blink A and B
                    mReg(a, 1); //// register name a 1 bit
                    mReg(b, 1); //// register name b 1 bit
                    mReg(c, 1);
                    mReg(x, 1);
     
                    BlinkAB(int x): Module(){}
     
                    void flow() override{
                        cwhile(true){ ///// loop forever
                            seq{ 
                                par{a <<= 1; b <<= 0;} ///// a is on <-> b is off
                                syWait(100); //// wait 100 cycle
                                par{a <<= 0; b <<= 1;}
                                syWait(100);
                                cif (x){ track(cIsBlink)
                                    c <<= 1;
                                }celse{
                                    c <<= 0;
                                }
                                syWait(100)
                            }
                        }
                    }
                };