Fix logging code in test examples
Closes
@@ -37,6 +37,7 @@ Let's create a test file ``test_my_design.py`` containing the following:
import cocotb
from cocotb.triggers import Timer
+
@cocotb.test()
async def my_first_test(dut):
"""Try accessing the design."""
@@ -48,7 +49,7 @@ Let's create a test file ``test_my_design.py`` containing the following:
dut.clk <= 1
await Timer(1, units="ns")
- dut._log.info("my_signal_1 is", dut.my_signal_1.value)
+ dut._log.info("my_signal_1 is %s", dut.my_signal_1.value)
assert dut.my_signal_2.value[0] == 0, "my_signal_2[0] is not 0!"
dut._log.info("Running test...done")
@@ -84,6 +85,7 @@ from the test:
from cocotb.triggers import Timer
from cocotb.triggers import FallingEdge
+
async def generate_clock(dut):
"""Generate clock pulses."""
@@ -93,6 +95,7 @@ from the test:
dut.clk <= 1
await Timer(1, units="ns")
+
@cocotb.test()
async def my_second_test(dut):
"""Try accessing the design."""
@@ -104,7 +107,7 @@ from the test:
await Timer(5, units="ns") # wait a bit
await FallingEdge(dut.clk) # wait for falling edge/"negedge"
- dut._log.info("my_signal_1 is", dut.my_signal_1.value)
+ dut._log.info("my_signal_1 is %s", dut.my_signal_1.value)
assert dut.my_signal_2.value[0] == 0, "my_signal_2[0] is not 0!"
dut._log.info("Running test...done")
