Kratos runtime for debugging
Project description
Kratos Debugger Runtime
This is the runtime library required to debug Kratos hardware designs. You
need a C++17 compatible compiler, such as g++-8
to compile the library.
How to use Kratos-Runtime
The following instruction is based on Linux and tested against Verilator and ncsim.
$ git clone https://github.com/Kuree/kratos-runtime
$ cd kratos-runtime
$ git submodule update --init --recursive
$ mkdir build
$ cd ./build
$ cmake ..
$ make -j
After that, you can find the library as build/src/libkratos-runtime.so
. You
can either copy that library to any place you like or simply use symbolic
link.
Generate Kratos-Runtime debug database for your design
When calling verilog()
function, you can supply another argument called
debug_db_filename
to specify the location where kratos can output the
debug files,
verilog(design, debug_db_filename="debug.db")
Using Kratos-runtime with Verilator
Once you have compiled the shared library, you can ask
verialtor
to link your test bench with kratos-runtime
. Before you do that,
since we need to read the internal signals, we need to inject verilator
specific info via a pass:
_kratos.passes.insert_verilator_public(design.internal_generator)
_kratos
is the namespace for native C++ binding, you can use it via
import _kratos
.
When invoking the verilator
command, you need to specify the kratos runtime
name as well as --vpi
switch, for instance:
verilator --cc design.sv test_tb.sv libkratos-runtime.so --vpi --exe
You can symbolic link libkratos-runtime.so
inside obj_dir
so that the linker
and find it easily.
Once the test bench is compiled, you need to use LD_LIBRARY_PATH
to let the
system to load, such as
$ LD_LIBRARY_PATH=./obj_dir/ ./obj_dir/Vtest
Or you can let the linker to fix the shared library path in the verilator
,
which is beyond the scope of this tutorial.
Using kratos-runtime with Ncsim
Ncsim is much easier to use than verilator
. Once you have the design, simply
tell the simulator that you want to load the vpi and dpi library, such as
irun test_tb.sv test.sv -sv_lib libkratos-runtime.so -loadvpi libkratos-runtime.so:initialize_runtime_vpi -access +r
-access +r
is necessary to allow the runtime to read out simulation variables.
What to do after launch the simulation
You can now use any debugger that's compatible with the Kratos debug protocol. Kratos has provide an open-source version of debugger extension inside VS Code. You can install it here and use it to debug your design.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for kratos_runtime-0.0.5-py3-none-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7e5d9aa74f9281c9c6ef1213ae26e1e4c543351a06ab956e5e3566396e903b2 |
|
MD5 | a7d5c1a6c8763854da56ff3b5ee778ed |
|
BLAKE2b-256 | 8285b9e05e38d560cc6b9049bec66c50db07dcae2de105ee6ad8b11d093a4582 |
Hashes for kratos_runtime-0.0.5-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f6780393aec094080ae15afee0e677bb8a5097e6d7c185b2773fc949046c36d |
|
MD5 | 4c8b4918de7be96c9a7e6e23245636fc |
|
BLAKE2b-256 | cb3d51f1a15d6ef531d20aeea5df7f60e94bd2bb1bd4851f1d172d7c3f213321 |
Hashes for kratos_runtime-0.0.5-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0baabae8a1801175dbdea041427db1ec79622845a1cc189cef4dadb8ede5bce9 |
|
MD5 | 9e95066eb60967b399671ff8eb4c5df4 |
|
BLAKE2b-256 | 4ee42e3e123336f83d9986b27a252fcee6aa00decca4f8132032f3c04520aca3 |
Hashes for kratos_runtime-0.0.5-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 683b537677b3fc442e96d0f96f0ef6dfdcbd6b6ebba68222816c0c4c05758058 |
|
MD5 | 95b832093bc9c7638dbec141584a524d |
|
BLAKE2b-256 | bed8c306739b193f609dca867560d0b791ff5fa2dfc17ac39f0482029f127424 |