source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Queue/SelfTest/include/test.h @ 67

Last change on this file since 67 was 67, checked in by rosiere, 17 years ago

Ajout d'un nouveau composant : fifo generic (un port lecture et un port ecriture).

File size: 1.1 KB
Line 
1/*
2 * $Id$
3 *
4 * [ Description ]
5 *
6 * Test "RegisterFile"
7 */
8
9#ifdef SYSTEMC
10#include "systemc.h"
11#endif
12
13#include <string>
14#include <iostream>
15#include <sys/time.h>
16
17#include "Behavioural/Generic/Queue/include/Queue.h"
18
19using namespace std;
20using namespace morpheo;
21using namespace morpheo::behavioural;
22using namespace morpheo::behavioural::generic;
23
24using namespace morpheo::behavioural::generic::queue;
25
26void test    (string name,
27              morpheo::behavioural::generic::queue::Parameters * param);
28
29class Time
30{
31private : timeval time_begin;
32// private : timeval time_end;
33 
34public  : Time ()
35  {
36    gettimeofday(&time_begin     ,NULL);
37  };
38
39public  : ~Time ()
40  {
41    cout << *this;
42  };
43
44public  : friend ostream& operator<< (ostream& output_stream,
45                                      const Time & x)
46  {
47    timeval time_end;
48   
49    gettimeofday(&time_end       ,NULL);
50   
51    uint32_t nb_cycles = static_cast<uint32_t>(sc_simulation_time());
52
53    double average = static_cast<double>(nb_cycles) / static_cast<double>(time_end.tv_sec-x.time_begin.tv_sec);
54   
55    output_stream << nb_cycles << "\t(" << average << " cycles / seconds )" << endl;
56
57    return output_stream;
58  }
59};
Note: See TracBrowser for help on using the repository browser.