| 1 | .########################################################################## |
| 2 | .# |
| 3 | .# File: dmu_cov_inc.pal |
| 4 | .# |
| 5 | .# Description: |
| 6 | .# ----------- |
| 7 | .# Common Pal header file that uses a map of the sys(tem) being |
| 8 | .# simulated |
| 9 | .# .# $Id$ |
| 10 | .# |
| 11 | .########################################################################## |
| 12 | . $sys = "DMU"; # default system being simulated |
| 13 | // This is the dram monitor path where all signals are brought in |
| 14 | . $DMU_PATH = "`TOP_MOD.cpu.dmu"; |
| 15 | . $DMC_PATH = "`TOP_MOD.cpu.dmu.dmc"; |
| 16 | . $DSN_PATH = "`TOP_MOD.cpu.dmu.dsn"; |
| 17 | . $IOMMU_PATH = "`TOP_MOD.cpu.dmu.dmc.mmu"; |
| 18 | |
| 19 | .########################################################################### |
| 20 | .# toggle - use to generate toggle type coverage for a signal or field. |
| 21 | .# just pass the number of bits in the variable. Use like this: |
| 22 | .# |
| 23 | .# sample variable_toggle_sample (variable[5:0]) { |
| 24 | .# . &toggle(6); |
| 25 | .# } |
| 26 | .# |
| 27 | .########################################################################## |
| 28 | .sub toggle { |
| 29 | . local($num_bits) = @_; |
| 30 | . |
| 31 | . for($i=$num_bits-1; $i >= 0; $i--) { |
| 32 | . printf (" wildcard state s_bit_%02d_0 ( %d\'b", $i, $num_bits ); |
| 33 | . for($j=$num_bits-1; $j >= 0; $j--) { |
| 34 | . if( $i == $j ) { print "0"; } |
| 35 | . else { print "x"; } |
| 36 | . } |
| 37 | . print " );\n"; |
| 38 | . printf (" wildcard state s_bit_%02d_1 ( %d\'b", $i, $num_bits ); |
| 39 | . for($j=$num_bits-1; $j >= 0; $j--) { |
| 40 | . if( $i == $j ) { print "1"; } |
| 41 | . else { print "x"; } |
| 42 | . } |
| 43 | . print " );\n"; |
| 44 | . } |
| 45 | .} |
| 46 | . |
| 47 | .########################################################################### |
| 48 | .# toggle2 - use to generate toggle type coverage for a signal or field. |
| 49 | .# just pass the number of bits in the variable andn its name like this: |
| 50 | .# |
| 51 | .# sample variable_toggle_sample (variable[5:0]) { |
| 52 | .# . &toggle2(6, "variable" ); |
| 53 | .# } |
| 54 | .# |
| 55 | .# &toggle uses wildcards which are said to hurt performance. This uses |
| 56 | .# a different technique. |
| 57 | .########################################################################## |
| 58 | .#sub toggle2 { |
| 59 | .# local($num_bits,$variable) = @_; |
| 60 | .# |
| 61 | .# for($i=$num_bits-1; $i >= 0; $i--) { |
| 62 | .# printf(" state s_bit_%02d_0 ( %s[%d] == 1'b0 );\n", $i, $variable, $i ); |
| 63 | .# printf(" state s_bit_%02d_1 ( %s[%d] == 1'b1 );\n", $i, $variable, $i ); |
| 64 | .# } |
| 65 | .#} |
| 66 | |
| 67 | |
| 68 | |
| 69 | |