Rysc:
The example is on page 1-11 (example 1-11) in the Analyzer Cookbook as follows:
set_output_delay - clock clkB_virt
-max [expr $CLKBs_max - $tSUb_max + $BDb_max - $CLKBd_min] ...
The variable values were defined above in the example and they would give the following expression:
[0.100 - 0.500 + 0.100 - 0.050]
So this would produce a negative number. I'm assuming TCL will evaluate this left to right but this is the first project I've used TCL. It seems to me that this expression as written is not correct but perhaps in this example it does make sense. By the way they describe the tSUb_xxx values as the clock to out of the external device which I think should be the setup of the external device. Probably a cut and paste error.
Now what you said actually makes sense and thats the way that I also think about the calculation (this is a case of me being stupid, blindly following an example and not thinking about what's really going on) so I think the expression should be:
[expr $tSUb_max + $BDb_max + $CLKBd_min - $CLKBs_max]
And yes my clocks are aligned and my simple calculation (in my head looking at the waveform) was:
slack = (period - (internal clock delay + output data path delay + output delay value (i.e external setup time required)).
But I had not consider the effect of a negative number for the output delay calculation. Which I think can be a valid result but not in my case. The setup numbers for the IC I'm interfacing to are in the 9.2 to 14.6ns range depending on the signal - obviously much larger than any board delays.
I originally thought that negative values would just be treated as essentially positive numbers for the output or input delays but in thinking about it that obviously would not be correct.
Thanks for making me actually think about this stuff.
Alan