Generation code optmization.
[vutg.git] / src / example5.vut
blob820278eeab5ce2ee0a772c2ada47e17b1a26396e
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3 =====================
4 file_name: example5.vut
5 Author: Rodrigo Peixoto
6 Date: 16/04/2008
7 License: GPL
8 ======================================================================
10 This program is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see http://www.gnu.org/licenses/.
23 =======================================================================
24 -->
26 <vut module_name="fulladder">
27 <time_scale t_div="10" unit="ns"/>
28 <waveform>
29 =========================================================
30 a[7:0] i@|00|00|ff|ff|random_alloc([R1,R2,R3],1000000)|
31 --------------------------------------------
32 b[7:0] i@|00|ff|00|ff|random_alloc([R4,R5,R6],1000000)|
33 =========================================================
34 result[7:0]o@|00|ff|ff|fe|ref_function(a,b)|
35 --------------------------------------------
36 overflow o@|0 |0 |0 |1 |ref_function(a,b)|
37 ============================================
38 </waveform>
39 <gen_with>
40 R1 = (0,80)
41 R2 = (5,80)
42 R3 = (30,80)
43 R4 = (81,ff)
44 R5 = (91,ff)
45 R6 = (a1,ff)
46 <python_code output="result">lambda a,b: a + b</python_code>
47 <python_code output="overflow">include_python_file("overflow.py")</python_code>
48 </gen_with>
50 </vut>