Can anyone help me with this. I want to do something very simple which is to send an email message to my email account using a tcl script. For the life of me I can't seem to find out exactly how to do that. By the way I am using a pc, vista/xp.
Here is a simple script, and what it does is provide "random" IEEE standard floating point inputs to a floating point unit (I've designed in hardware), it then randomly choose to command the unit to add the inputs or subtract them, finally it monitors the outputs to check and see if the unit is operating correctly.
I am using the script to control a simulator which is actually providing the stimulus for my hardware and checking the outputs. Sooo when it does find an error I'd just like to receive an email notification. Thats pretty much it. Thanks in advance for your help.
TCL Script
-----------------------
do float_addsub_wave.do
restart
set UserTimeUnit ns
force -deposit RST 1
force -deposit CLK 1 0, 0 {10 ns} -r 20
force -deposit A 0
force -deposit B 0
force -deposit FLOAT_ADDSUB 0
force -deposit ADD_SUB 0
run 60 ns
force -deposit RST 0
set A_ARRAY(0) 0
set B_ARRAY(0) 0
proc myRand { dec_min dec_max } {
set hex_maxFactor [expr [expr $dec_max + 1] - $dec_min]
set dec_value [expr int([expr rand() * 100])]
set dec_value [expr [expr $dec_value % $hex_maxFactor] + $dec_min]
return $dec_value
}
proc myFloatRand { min max } {
set maxFactor [expr [expr $max + 1] - $min]
set value [expr ([expr rand() * $max])]
#set value [expr [expr $value / $maxFactor] + $min]
return $value
}
proc myRand_hex { dec_min dec_max } {
set hex_maxFactor [expr [expr $dec_max + 1] - $dec_min]
set dec_value [expr int([expr rand() * 100])]
set dec_value [expr [expr $dec_value % $hex_maxFactor] + $dec_min]
set hex_value [format %02x $dec_value]
return $hex_value
}
# The following procedures have been changed to single precision.
proc __reverse__ {s} {
for {set i [string length $s]} {$i>=0} {incr i -1} {
append sr [string index $s $i]
}
return $sr
}
proc floatToBinarLittleEndian_a {d} {
binary scan [binary format f $d] b* v
set v [__reverse__ $v]
set sign [string index $v 0]
set exponent [string range $v 1 8]
set mantissa [string range $v 9 end]
return [list $sign $exponent $mantissa]
}
proc floatToBinarLittleEndian_b {d} {
binary scan [binary format f $d] b* v
set v [__reverse__ $v]
set sign [string index $v 0]
set exponent [string range $v 1 8]
set mantissa [string range $v 9 end]
return "$sign$exponent$mantissa"
}
proc binarToFloatLittleEndian {ieee_float_single_precision} {
set v [binary format b32 [__reverse__ $ieee_float_single_precision]]
binary scan $v f v
return $v
}
set transaction_count 0
while {$transaction_count <= 10000 } {
set float_a [format %e [myFloatRand 7909.10987 4356456.987612345] ]
set float_b [format %e [myFloatRand 7909.10987 4356456.987612345] ]
set binary_a [floatToBinarLittleEndian_b $float_a]
set binary_b [floatToBinarLittleEndian_b $float_b]
binary scan [binary format B32 $binary_a] H8 bin2hex_a
binary scan [binary format B32 $binary_b] H8 bin2hex_b
#echo " $binary_a $bin2hex_a $float_a $binary_b $bin2hex_b $float_b "
set opcode [myRand 0 1]
if { $opcode == 0 } {
set IEEE_SUM [format %e [expr $float_a + $float_b] ]
set action "+"
} else {
set IEEE_SUM [format %e [expr $float_a - $float_b] ]
set action "-"
}
set IEEE_SUM_BINARY [floatToBinarLittleEndian_b $IEEE_SUM]
binary scan [binary format B32 $IEEE_SUM_BINARY] H8 IEEE_bin2hex_a
force -deposit A $bin2hex_a
force -deposit B $bin2hex_b
force -deposit FLOAT_ADDSUB 1
force -deposit ADD_SUB $opcode
run 20 ns
force -deposit FLOAT_ADDSUB 0
force -deposit ADD_SUB 0
run 20 ns
while { [examine -hex FINISHED] == 0 } {run 20 ns}
set IEEE_FLOAT [examine -hex float_sum_dif]
binary scan [binary format H8 $IEEE_FLOAT] B32 hex2bin_a
set SUM_DIFF [format %e [binarToFloatLittleEndian $hex2bin_a] ]
if { ($IEEE_SUM != $SUM_DIFF) && ( [expr abs([expr $IEEE_SUM - $SUM_DIFF])] > 1 ) } {
run 40 ns
error " The values do not match the correct answer to the equation $float_a $action $float_b is $IEEE_SUM ---> $IEEE_bin2hex_a instead you said it was $SUM_DIFF hex value ---> $IEEE_FLOAT "
} else {
echo " OK looks like its working the equation was $float_a $action $float_b = $IEEE_SUM and you said it was $SUM_DIFF hex value ---> $IEEE_FLOAT "
}
incr transaction_count
}