-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
27 lines (19 loc) · 733 Bytes
/
Copy pathtest.py
File metadata and controls
27 lines (19 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import cocotb
from cocotb.triggers import FallingEdge, Timer
# Example Testbench
#TODO: Actually Test :P
async def generate_clock(dut):
"""Generate clock pulses."""
for cycle in range(10):
dut.clk.value = 0
await Timer(1, units="ns")
dut.clk.value = 1
await Timer(1, units="ns")
@cocotb.test()
async def my_second_test(dut):
"""Try accessing the design."""
await cocotb.start(generate_clock(dut)) # run the clock "in the background"
await Timer(5, units="ns") # wait a bit
await FallingEdge(dut.clk) # wait for falling edge/"negedge"
#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!"