Deleted Added
sdiff udiff text old ( 6654:4c84e771cca7 ) new ( 9528:d05714c2ab9c )
full compact
1# Copyright (c) 2007 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 13 unchanged lines hidden (view full) ---

22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27# Authors: Nathan Binkert
28
29import sys
30
31tps = 1.0e12 # default to 1 THz (1 Tick == 1 ps)
32tps_fixed = False # once set to true, can't be changed
33
34# fix the global frequency and tell C++ about it
35def fixGlobalFrequency():
36 import internal
37 global tps, tps_fixed

--- 38 unchanged lines hidden (view full) ---

76 return 0
77
78 # convert the value from time to ticks
79 value *= tps
80
81 int_value = int(round(value))
82 err = (value - int_value) / value
83 if err > frequency_tolerance:
84 print >>sys.stderr, "Warning: rounding error > tolerance"
85 print >>sys.stderr, " %f rounded to %d" % (value, int_value)
86 return int_value
87
88__all__ = [ 'setGlobalFrequency', 'fixGlobalFrequency', 'fromSeconds',
89 'frequency_tolerance' ]