4
4
import cocotb
5
5
from cocotb .clock import Clock
6
6
from cocotb .triggers import ClockCycles
7
- import random
8
7
9
8
10
9
@cocotb .test ()
@@ -17,21 +16,20 @@ async def test_project(dut):
17
16
18
17
dut ._log .info ("Test project behavior" )
19
18
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
26
24
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 )
29
27
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
34
32
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.
37
35
0 commit comments