@(#) $Header: /usr/local/scalawags_cvs/Scalawags/Simulator2006/simfuncs.wc,v 1.1 2006/03/13 23:15:57 abrown Exp $
simfuncs.tcl is a collection of functions which are too small to merit their own source files. Only a few of these functions are likely to be useful to normal users of the simulator.
proc ifibyte2fract { {ifibyte} {invertmult} } \
If invertmult==1 then convert the number range 0 to 255 to the range -1.0 to 1.0.
If invertmult==-1 then convert the number range 0 to 255 to the range 1.0 to -1.0.
No other values of invertmult are allowable. Use of other values of invertmult may produce undefined results.
proc iabs { {value} } \
Return the absolute value of the input parameter "value". Despite its name, iabs works with either integer or float.
proc Min { {a} {b} } \
Return the lesser of the two input parameters. Works with either integer or float.
proc Max { {a} {b} } \
Return the greater of the two input parameters. Works with either integer or float.
  # Mix in a proportation of a plus the remaining proportion from b.
  # For instance, if $proportion == 0.2, then return ($a*0.2)+($b*0.8).
  proc mix { {proportion} {a} {b} } \
Used for linear interpolation between the last two parameters.
proc getmix {{value} {a} {b}} \
The inverse function to "mix" above. The output is the proportion that value is of "a" versus "b".
For instance, "getmix 133 100 200" will return 0.33.
The remaining functions (GetBit, SetBit, GetValue, GetSymArray, PutSymArray, and RotatePoint) are unlikely to be useful to ordinary users.