params.py (5822:05ffa2c3c800) | params.py (6214:1ec0ec8933ae) |
---|---|
1# Copyright (c) 2004-2006 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 --- 303 unchanged lines hidden (view full) --- 312 # CheckedInt is an abstract base class, so we actually don't 313 # want to do any processing on it... the rest of this code is 314 # just for classes that derive from CheckedInt. 315 if name == 'CheckedInt': 316 return 317 318 if not cls.cxx_predecls: 319 # most derived types require this, so we just do it here once | 1# Copyright (c) 2004-2006 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 --- 303 unchanged lines hidden (view full) --- 312 # CheckedInt is an abstract base class, so we actually don't 313 # want to do any processing on it... the rest of this code is 314 # just for classes that derive from CheckedInt. 315 if name == 'CheckedInt': 316 return 317 318 if not cls.cxx_predecls: 319 # most derived types require this, so we just do it here once |
320 cls.cxx_predecls = ['#include "sim/host.hh"'] | 320 cls.cxx_predecls = ['#include "base/types.hh"'] |
321 322 if not cls.swig_predecls: 323 # most derived types require this, so we just do it here once 324 cls.swig_predecls = ['%import "stdint.i"\n' + | 321 322 if not cls.swig_predecls: 323 # most derived types require this, so we just do it here once 324 cls.swig_predecls = ['%import "stdint.i"\n' + |
325 '%import "sim/host.hh"'] | 325 '%import "base/types.hh"'] |
326 327 if not (hasattr(cls, 'min') and hasattr(cls, 'max')): 328 if not (hasattr(cls, 'size') and hasattr(cls, 'unsigned')): 329 panic("CheckedInt subclass %s must define either\n" \ 330 " 'min' and 'max' or 'size' and 'unsigned'\n", 331 name); 332 if cls.unsigned: 333 cls.min = 0 --- 427 unchanged lines hidden (view full) --- 761 def __str__(self): 762 return self.value 763 764# how big does a rounding error need to be before we warn about it? 765frequency_tolerance = 0.001 # 0.1% 766 767class TickParamValue(NumericParamValue): 768 cxx_type = 'Tick' | 326 327 if not (hasattr(cls, 'min') and hasattr(cls, 'max')): 328 if not (hasattr(cls, 'size') and hasattr(cls, 'unsigned')): 329 panic("CheckedInt subclass %s must define either\n" \ 330 " 'min' and 'max' or 'size' and 'unsigned'\n", 331 name); 332 if cls.unsigned: 333 cls.min = 0 --- 427 unchanged lines hidden (view full) --- 761 def __str__(self): 762 return self.value 763 764# how big does a rounding error need to be before we warn about it? 765frequency_tolerance = 0.001 # 0.1% 766 767class TickParamValue(NumericParamValue): 768 cxx_type = 'Tick' |
769 cxx_predecls = ['#include "sim/host.hh"'] | 769 cxx_predecls = ['#include "base/types.hh"'] |
770 swig_predecls = ['%import "stdint.i"\n' + | 770 swig_predecls = ['%import "stdint.i"\n' + |
771 '%import "sim/host.hh"'] | 771 '%import "base/types.hh"'] |
772 773 def getValue(self): 774 return long(self.value) 775 776class Latency(TickParamValue): 777 def __init__(self, value): 778 if isinstance(value, (Latency, Clock)): 779 self.ticks = value.ticks --- 59 unchanged lines hidden (view full) --- 839 def ini_str(self): 840 return '%d' % self.getValue() 841 842# A generic frequency and/or Latency value. Value is stored as a latency, 843# but to avoid ambiguity this object does not support numeric ops (* or /). 844# An explicit conversion to a Latency or Frequency must be made first. 845class Clock(ParamValue): 846 cxx_type = 'Tick' | 772 773 def getValue(self): 774 return long(self.value) 775 776class Latency(TickParamValue): 777 def __init__(self, value): 778 if isinstance(value, (Latency, Clock)): 779 self.ticks = value.ticks --- 59 unchanged lines hidden (view full) --- 839 def ini_str(self): 840 return '%d' % self.getValue() 841 842# A generic frequency and/or Latency value. Value is stored as a latency, 843# but to avoid ambiguity this object does not support numeric ops (* or /). 844# An explicit conversion to a Latency or Frequency must be made first. 845class Clock(ParamValue): 846 cxx_type = 'Tick' |
847 cxx_predecls = ['#include "sim/host.hh"'] | 847 cxx_predecls = ['#include "base/types.hh"'] |
848 swig_predecls = ['%import "stdint.i"\n' + | 848 swig_predecls = ['%import "stdint.i"\n' + |
849 '%import "sim/host.hh"'] | 849 '%import "base/types.hh"'] |
850 def __init__(self, value): 851 if isinstance(value, (Latency, Clock)): 852 self.ticks = value.ticks 853 self.value = value.value 854 elif isinstance(value, Frequency): 855 self.ticks = value.ticks 856 self.value = 1.0 / value.value 857 elif value.endswith('t'): --- 329 unchanged lines hidden --- | 850 def __init__(self, value): 851 if isinstance(value, (Latency, Clock)): 852 self.ticks = value.ticks 853 self.value = value.value 854 elif isinstance(value, Frequency): 855 self.ticks = value.ticks 856 self.value = 1.0 / value.value 857 elif value.endswith('t'): --- 329 unchanged lines hidden --- |