forked from ms3273/ece4750-S01-pymtl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRegIncrRTL_test.py
57 lines (38 loc) · 1.4 KB
/
RegIncrRTL_test.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#=======================================================================
# RegIncrRTL_test.py
#=======================================================================
import random
import pytest
from pymtl import *
from RegIncrRTL import RegIncrRTL as RegIncr
from RegIncrFL_test import (
simple_test_vectors,
do_random_test,
)
#-----------------------------------------------------------------------
# test_simple
#-----------------------------------------------------------------------
@pytest.mark.parametrize( 'dtype', [8] )
def test_simple( dtype, test_verilog ):
# instantiate the model and elaborate it
model = RegIncr( dtype )
#---------------------------------------------------------------------
# TASK 5: Add verilog translation to the test harness here
#---------------------------------------------------------------------
model.elaborate()
# create the simulator
sim = SimulationTool( model )
# verify the model
print
for input_vector, expected_out in simple_test_vectors:
model.in_.value = input_vector
sim.print_line_trace()
sim.cycle()
assert model.out == expected_out
sim.print_line_trace()
#-----------------------------------------------------------------------
# test_random
#-----------------------------------------------------------------------
@pytest.mark.parametrize( 'dtype', [8] )
def test_random( dtype ):
do_random_test( RegIncr, dtype )