| |
|
| derrick_chi - Thu Feb 26, 2009 11:21 pm |
|
|
| Can anyone help me with this. I want to do something very simple and thats send an email message to my email account using a tcl script. This Script I am using is basically running a test for me and I just want an email notification when an error occurs, but for the life of me I can't seem to find out exactly how to do that. I am using a pc. Thanks in advanced. |
|
|
|
| derrick_chi - Mon Mar 16, 2009 8:55 pm |
|
|
| Come on no one here has a reply? No one? |
|
|
|
| fraguk - Fri Mar 20, 2009 10:42 am |
|
|
|
|
|
|
| derrick_chi - Fri Mar 20, 2009 11:31 am |
|
|
Thank you for the reply. I do have a few questions though, please forgive my ignorance, not a TCL expert. Can you provide some examples on how to actually use this in a script. I was reading over the information and it stated that I should download it, I would suspect that means copy it and put it in my TCL directory under a name that I choose? A little confused about the TCL install process, can you explain or point me in the right direction?
Here is a simple script I plan to use you code in. All this it does is provide "random" IEEE standard floating point inputs to a floating point unit I've designed (hardware), randomly choose to either add the inputs or subtract them and monitor 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.
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
} |
|
|
|
| fraguk - Fri Mar 20, 2009 1:00 pm |
|
|
Sorry derrick_chi but thats n ot my script, i posted it hopeing it my help you.
this tcl forum is not that bisey tbo.
you would probly get a quicker and better anser over on http://forum.egghelp.org/
good luck, and hope can get your script working  |
|
|
|