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
30from m5.util import warn
31
32tps = 1.0e12 # default to 1 THz (1 Tick == 1 ps)
33tps_fixed = False # once set to true, can't be changed
34
35# fix the global frequency and tell C++ about it
36def fixGlobalFrequency():
37 import internal
38 global tps, tps_fixed

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

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