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
paramsfolder is the set of configuration on each provided workload. -
the
smParamsrefers to the simulation test workload -
change the path in file
smParamsfromprefixis the destination folder of vcd and profiler file.prefix = /media/tanawin/tanawin1701e/project2/Kathryn/KOut/simpleTest/toprefix = <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
genParamsrefers to the gen test workload -
change the path in file
genParamsfromgenFolderis the destination folder of verilog generated file.genFolder = /media/tanawin/tanawin1701e/project2/Kathryn/KOut/genTest/modeltogenFolder = <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.cppat 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); } } } }; BlinkABis the designer's module which must inherit classModuleand 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_simis the designer's testbench which must inherit classSimInterface
-
-
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
mModto 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 useBlinkAB_sim simulator(params); simulator.simStart();incase simulation. -
forth, we reset the system to free memory.
-
-
Next, add
blink.cpptoCMakeLists.txtatadd_executablesection -
Finally, change directory to
cmake-build-debugthen compile and run like first two section. -
(Optionally) if you use clion just press the run button on the left-hand side!