Random alloc fixed!
[vutg.git] / src / example5.vut
blobdad536a953e588018ecb5cead22048e625bd4603
1 <?xml version="1.0" encoding="UTF-8"?>
2 <vut module_name="fulladder">
3 <time_scale t_div="10" unit="ns"/>
4 <waveform>
5 ============================================
6 a[7:0] i@|00|00|ff|ff|random_alloc([R1,R2,R3],1000)|
7 --------------------------------------------
8 b[7:0] i@|00|ff|00|ff|random_alloc([R4,R5,R6],1000)|
9 ============================================
10 result[7:0]o@|00|ff|ff|fe|ref_function(a,b)|
11 --------------------------------------------
12 overflow o@|0 |0 |0 |1 |ref_function(a,b)|
13 ============================================
14 </waveform>
15 <gen_with>
16 R1 = (0,80)
17 R2 = (5,80)
18 R3 = (30,80)
19 R4 = (81,ff)
20 R5 = (91,ff)
21 R6 = (a1,ff)
23 <python_code output="result">lambda a,b: a + b</python_code>
25 <!--python_code output="overflow">include_python_file("overflow.py")</python_code-->
26 <python_code output="overflow">
27 lambda a,b: (a+b) > 255 and 1 or 0
28 #Eh o mesmo que if (a + b) > 255: return 1; else: return 0
29 #uma estencao seria res = python_code_file{dut.py}
30 </python_code>
31 </gen_with>
33 </vut>