Skip to content

Commit 19f482a

Browse files
committed
updated /test/test.py and /docs/info.md
1 parent 27ed76d commit 19f482a

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

test/test.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import cocotb
55
from cocotb.clock import Clock
66
from cocotb.triggers import ClockCycles
7-
import random
87

98

109
@cocotb.test()
@@ -17,21 +16,20 @@ async def test_project(dut):
1716

1817
dut._log.info("Test project behavior")
1918

20-
for i in range(1000):
21-
# Set the input values you want to test
22-
a = random.randint(0, 15)
23-
b = random.randint(0, 15)
24-
dut.a.value = a
25-
dut.b.value = b
19+
for a in range(16):
20+
for b in range(16):
21+
# Set the input values you want to test
22+
dut.a.value = a
23+
dut.b.value = b
2624

27-
# Wait for one clock cycle to see the output values
28-
await ClockCycles(dut.clk, 10)
25+
# Wait for one clock cycle to see the output values
26+
await ClockCycles(dut.clk, 10)
2927

30-
# The following assersion is just an example of how to check the output values.
31-
# Change it to match the actual expected output of your module:
32-
dut._log.info(f"value of outputs are: {dut.sum.value} and {dut.carry_out.value}.")
33-
assert dut.sum.value == (a+b)%16 and dut.carry_out.value == (a+b)//16
28+
# The following assersion is just an example of how to check the output values.
29+
# Change it to match the actual expected output of your module:
30+
dut._log.info(f"value of outputs are: {dut.sum.value} and {dut.carry_out.value}.")
31+
assert dut.sum.value == (a+b)%16 and dut.carry_out.value == (a+b)//16
3432

35-
# Keep testing the module by changing the input values, waiting for
36-
# one or more clock cycles, and asserting the expected output values.
33+
# Keep testing the module by changing the input values, waiting for
34+
# one or more clock cycles, and asserting the expected output values.
3735

0 commit comments

Comments
 (0)