| 13 | }}} |
| 14 | |
| 15 | Omit the {{{--gui}}} and end the tcl script with {{{quit}}} to run in batch mode. |
| 16 | Here is a simple example, to test a 4x4 multiplier with inputs (a,b) and output p: |
| 17 | |
| 18 | {{{ |
| 19 | puts "Starting multiplier test" |
| 20 | set errz 0 |
| 21 | for {set i 0} {$i < 16} {incr i} { |
| 22 | for {set j 0} {$j < 16} {incr j} { |
| 23 | add_force a -radix dec $i |
| 24 | add_force b -radix dec $j |
| 25 | run 10 |
| 26 | set calc_p [expr {$i * $j}] |
| 27 | set sim_p [get_value -radix unsigned p] |
| 28 | if {$calc_p != $sim_p} { |
| 29 | puts "ERROR: Calculated: $calc_p simulated: $sim_p" |
| 30 | incr errz |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 | puts "$errz total errors" |
| 35 | quit |