Quick Start

Quick Start Guide

1. Install Kathryn

  • install library
    •     sudo apt install build-essential cmake
  • start clone the repository
    •    git clone https://github.com/Tanawin1701d/Kathryn 
  • change directory
    •    cd Kathryn 
  • make directory for code building
    •    mkdir cmake-build-debug & cd cmake-build-debug
  • build and compile
    •    cmake .. & make -j<number_of_your_thread>

2. Test Simulator

  • each parameter file in params folder is the set of configuration on each provided workload.

  • the smParams refers to the simulation test workload

  • change the path in file smParams from

    • prefix is the destination folder of vcd and profiler file.
    • prefix = /media/tanawin/tanawin1701e/project2/Kathryn/KOut/simpleTest/ to
    • prefix = <projectPath>/KOut/simpleTest/
  • you may change for other parameter file

  • change directiory to cmake-build-debug

       cd cmake-build-debug
  • run using this command

       ./kathryn <projectPath>/params/smParams

3. Test Generator

  • the genParams refers to the gen test workload

  • change the path in file genParams from

    • genFolder is the destination folder of verilog generated file.
    • genFolder = /media/tanawin/tanawin1701e/project2/Kathryn/KOut/genTest/model to
    • genFolder = <projectPath>/KOut/genTest/model
  • you may change for other parameter file

  • change directiory to cmake-build-debug

       cd cmake-build-debug
  • run using this command

       ./kathryn <projectPath>/params/genParams

4. Build Your First Model(Blink)

  • build blink.cpp at project directory

  • firstly, let write the model

    •     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
       
              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);
                      }
                  }
              }
          };
    • BlinkAB is the designer's module which must inherit class Module and write constructor with at least one input argument.
    • ```` flow() ``` is the function to describe the behavior of the module
  • Next, let write the simple simulator testbench

    •     struct BlinkAB_sim: public SimInterface{
          
              explicit BlinkAB_sim(PARAM& params ):
                  SimInterface(100, /// limit cycle
                               params["vcdFile"], /// des VCD file
                               params["profFile"]) /// des prof file
                               {}
          };
    • BlinkAB_sim is the designer's testbench which must inherit class SimInterface
  • Next, let write main function for both simulation and generation to build the model

    •     int main(int argc, char* argv[]){
              auto params = readParamKathryn(argv[1]);
              int mode;
              std::cout << "simulate press 0 <-> generate press 1" << std::endl;
              std::cin >> mode;
              mMod(ex, BlinkAB, 0); /// build module
              startModelKathryn(); /// start modeling
              if (mode == 1){
                  startGenKathryn(params); /// start generate
              }else if (mode == 0){
                  BlinkAB_sim simulator(params); /// build simulator
                  simulator.simStart();
              }
              resetKathryn();
          }
    • first, we use mMod to build the BlinkAB module.

    • second, we use function startModelKathryn() to start modeling.

    • third, we use function startGenKathryn(params) to generate verilog incase generating but we use BlinkAB_sim simulator(params); simulator.simStart(); incase simulation.

    • forth, we reset the system to free memory.

  • Next, add blink.cpp to CMakeLists.txt at add_executable section

  • Finally, change directory to cmake-build-debug then compile and run like first two section.

  • (Optionally) if you use clion just press the run button on the left-hand side!