source: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Test.cpp

Last change on this file was 81, checked in by rosiere, 16 years ago
  • Finish Environment (and test)
  • Continue predictor_unit
  • Add external tools
  • svn keyword "Id" set
  • Property svn:keywords set to Id
File size: 925 bytes
Line 
1/*
2 * $Id: Test.cpp 81 2008-04-15 18:40:01Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/include/Parameters.h"
9
10
11namespace morpheo              {
12namespace behavioural          {
13
14  bool is_natural            (double  val )  { return ( (val >= 0) && (floor(val) == ceil(val)));};
15  bool is_positive           (double  val )  { return ( (val >= 1) && (floor(val) == ceil(val)));};
16  bool is_power2             (uint32_t val)  { return is_natural(::log2(static_cast<double>(val)));};
17  bool is_multiple           (uint32_t val1,
18                              uint32_t val2) { return is_positive((1.0*val1)/(1.0*val2));};
19  bool is_between_inclusive  (uint32_t val,
20                              uint32_t min,
21                              uint32_t max)  { return ((val >= min) && (val <= max));};
22  bool is_between_exclusive  (uint32_t val,
23                              uint32_t min,
24                              uint32_t max)  { return ((val >  min) && (val <  max));};
25}; // end namespace behavioural         
26}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.