Update tutorial documentation to reflect using cocotb_test_suite.
Change-Id: I0e24e15f4f43d1be2f8d7ff57969f5b6fc2a5419
diff --git a/doc/tutorials/writing_kelvin_programs.md b/doc/tutorials/writing_kelvin_programs.md
index 8dea78a..cec72cd 100644
--- a/doc/tutorials/writing_kelvin_programs.md
+++ b/doc/tutorials/writing_kelvin_programs.md
@@ -115,7 +115,10 @@
await core_mini_axi.reset()
cocotb.start_soon(core_mini_axi.clock.start())
-+ with open("../tests/cocotb/tutorial/kelvin_v2_program.elf", "rb") as f:
++ r = runfiles.Create()
++ elf_path = r.Rlocation(
++ "kelvin_hw/tests/cocotb/tutorial/kelvin_v2_program.elf")
++ with open(elf_path, "rb") as f:
+ entry_point = await core_mini_axi.load_elf(f)
```
@@ -134,10 +137,11 @@
await core_mini_axi.reset()
cocotb.start_soon(core_mini_axi.clock.start())
- with open("../tests/cocotb/tutorial/kelvin_v2_program.elf", "rb") as f:
+ r = runfiles.Create()
+ elf_path = r.Rlocation(
+ "kelvin_hw/tests/cocotb/tutorial/kelvin_v2_program.elf")
+ with open(elf_path, "rb") as f:
entry_point = await core_mini_axi.load_elf(f)
-
-+ with open("../tests/cocotb/tutorial/kelvin_v2_program.elf", "rb") as f:
+ inputs1_addr = core_mini_axi.lookup_symbol(f, "input1_buffer")
+ inputs2_addr = core_mini_axi.lookup_symbol(f, "input2_buffer")
@@ -161,10 +165,11 @@
await core_mini_axi.reset()
cocotb.start_soon(core_mini_axi.clock.start())
- with open("../tests/cocotb/tutorial/kelvin_v2_program.elf", "rb") as f:
+ r = runfiles.Create()
+ elf_path = r.Rlocation(
+ "kelvin_hw/tests/cocotb/tutorial/kelvin_v2_program.elf")
+ with open(elf_path, "rb") as f:
entry_point = await core_mini_axi.load_elf(f)
-
- with open("../tests/cocotb/tutorial/kelvin_v2_program.elf", "rb") as f:
inputs1_addr = core_mini_axi.lookup_symbol(f, "input1_buffer")
inputs2_addr = core_mini_axi.lookup_symbol(f, "input2_buffer")
@@ -188,10 +193,11 @@
await core_mini_axi.reset()
cocotb.start_soon(core_mini_axi.clock.start())
- with open("../tests/cocotb/tutorial/kelvin_v2_program.elf", "rb") as f:
+ r = runfiles.Create()
+ elf_path = r.Rlocation(
+ "kelvin_hw/tests/cocotb/tutorial/kelvin_v2_program.elf")
+ with open(elf_path, "rb") as f:
entry_point = await core_mini_axi.load_elf(f)
-
- with open("../tests/cocotb/tutorial/kelvin_v2_program.elf", "rb") as f:
inputs1_addr = core_mini_axi.lookup_symbol(f, "input1_buffer")
inputs2_addr = core_mini_axi.lookup_symbol(f, "input2_buffer")
diff --git a/tests/cocotb/tutorial/BUILD b/tests/cocotb/tutorial/BUILD
index bc85393..ed9660d 100644
--- a/tests/cocotb/tutorial/BUILD
+++ b/tests/cocotb/tutorial/BUILD
@@ -48,10 +48,11 @@
"test_module": ["tutorial.py"],
"deps": [
"//kelvin_test_utils:core_mini_axi_sim_interface",
+ "@rules_python//python/runfiles",
],
"data": glob(["**/*.elf"]),
},
- vcs_data = [
+ vcs_data = glob(["**/*.elf"]) + [
"//tests/cocotb:coverage_exclude.cfg",
],
vcs_build_args = VCS_BUILD_ARGS,
diff --git a/tests/cocotb/tutorial/tutorial.py b/tests/cocotb/tutorial/tutorial.py
index 9960880..f42624d 100644
--- a/tests/cocotb/tutorial/tutorial.py
+++ b/tests/cocotb/tutorial/tutorial.py
@@ -15,6 +15,7 @@
import cocotb
import numpy as np
+from bazel_tools.tools.python.runfiles import runfiles
from kelvin_test_utils.core_mini_axi_interface import CoreMiniAxiInterface
@cocotb.test()