source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Ifetch_unit/Ifetch_unit_Glue/SelfTest/src/test.cpp @ 82

Last change on this file since 82 was 82, checked in by rosiere, 16 years ago
  • support locale (now must "just" translate)
  • update all component with new test format
  • update all component with usage
  • New component : decod queue and prediction_unit
  • Property svn:keywords set to Id
File size: 5.0 KB
Line 
1/*
2 * $Id: test.cpp 82 2008-05-01 16:48:45Z rosiere $
3 *
4 * [ Description ]
5 *
6 * Test
7 */
8
9#define NB_ITERATION  1
10#define CYCLE_MAX     (128*NB_ITERATION)
11
12#include "Behavioural/Core/Multi_Front_end/Front_end/Ifetch_unit/Ifetch_unit_Glue/SelfTest/include/test.h"
13#include "Common/include/Test.h"
14#include "Behavioural/include/Allocation.h"
15
16void test (string name,
17           morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::ifetch_unit_glue::Parameters * _param)
18{
19  msg(_("<%s> : Simulation SystemC.\n"),name.c_str());
20
21#ifdef STATISTICS
22  morpheo::behavioural::Parameters_Statistics * _parameters_statistics = new morpheo::behavioural::Parameters_Statistics (5,50);
23#endif
24
25  Ifetch_unit_Glue * _Ifetch_unit_Glue = new Ifetch_unit_Glue
26    (name.c_str(),
27#ifdef STATISTICS
28     _parameters_statistics,
29#endif
30     _param,
31     USE_ALL);
32 
33#ifdef SYSTEMC
34  /*********************************************************************
35   * Déclarations des signaux
36   *********************************************************************/
37  string rename;
38
39  sc_clock              *  in_CLOCK  = new sc_clock ("clock", 1.0, 0.5);         
40  sc_signal<Tcontrol_t> *  in_NRESET = new sc_signal<Tcontrol_t> ("NRESET");
41
42  ALLOC_SC_SIGNAL(out_ICACHE_REQ_VAL        ,"out_ICACHE_REQ_VAL        ",Tcontrol_t);
43  ALLOC_SC_SIGNAL( in_ICACHE_REQ_ADDRESS_VAL," in_ICACHE_REQ_ADDRESS_VAL",Tcontrol_t);
44  ALLOC_SC_SIGNAL(out_ICACHE_REQ_QUEUE_VAL  ,"out_ICACHE_REQ_QUEUE_VAL  ",Tcontrol_t);
45  ALLOC_SC_SIGNAL( in_ICACHE_REQ_ACK        ," in_ICACHE_REQ_ACK        ",Tcontrol_t);
46  ALLOC_SC_SIGNAL(out_ICACHE_REQ_ADDRESS_ACK,"out_ICACHE_REQ_ADDRESS_ACK",Tcontrol_t);
47  ALLOC_SC_SIGNAL( in_ICACHE_REQ_QUEUE_ACK  ," in_ICACHE_REQ_QUEUE_ACK  ",Tcontrol_t);
48  ALLOC_SC_SIGNAL(out_ICACHE_REQ_TYPE       ,"out_ICACHE_REQ_TYPE       ",Ticache_type_t);
49  ALLOC_SC_SIGNAL( in_EVENT_VAL             ," in_EVENT_VAL             ",Tcontrol_t);
50  ALLOC_SC_SIGNAL(out_EVENT_ADDRESS_VAL     ,"out_EVENT_ADDRESS_VAL     ",Tcontrol_t);
51  ALLOC_SC_SIGNAL(out_EVENT_QUEUE_VAL       ,"out_EVENT_QUEUE_VAL       ",Tcontrol_t);
52  ALLOC_SC_SIGNAL(out_EVENT_ACK             ,"out_EVENT_ACK             ",Tcontrol_t);
53  ALLOC_SC_SIGNAL( in_EVENT_ADDRESS_ACK     ," in_EVENT_ADDRESS_ACK     ",Tcontrol_t);
54  ALLOC_SC_SIGNAL( in_EVENT_QUEUE_ACK       ," in_EVENT_QUEUE_ACK       ",Tcontrol_t);
55 
56  /********************************************************
57   * Instanciation
58   ********************************************************/
59 
60  msg(_("<%s> : Instanciation of _Ifetch_unit_Glue.\n"),name.c_str());
61
62  (*(_Ifetch_unit_Glue->in_CLOCK))        (*(in_CLOCK));
63  (*(_Ifetch_unit_Glue->in_NRESET))       (*(in_NRESET));
64
65  INSTANCE_SC_SIGNAL(_Ifetch_unit_Glue,out_ICACHE_REQ_VAL        );
66  INSTANCE_SC_SIGNAL(_Ifetch_unit_Glue, in_ICACHE_REQ_ADDRESS_VAL);
67  INSTANCE_SC_SIGNAL(_Ifetch_unit_Glue,out_ICACHE_REQ_QUEUE_VAL  );
68  INSTANCE_SC_SIGNAL(_Ifetch_unit_Glue, in_ICACHE_REQ_ACK        );
69  INSTANCE_SC_SIGNAL(_Ifetch_unit_Glue,out_ICACHE_REQ_ADDRESS_ACK);
70  INSTANCE_SC_SIGNAL(_Ifetch_unit_Glue, in_ICACHE_REQ_QUEUE_ACK  );
71  INSTANCE_SC_SIGNAL(_Ifetch_unit_Glue,out_ICACHE_REQ_TYPE       );
72  INSTANCE_SC_SIGNAL(_Ifetch_unit_Glue, in_EVENT_VAL             );
73  INSTANCE_SC_SIGNAL(_Ifetch_unit_Glue,out_EVENT_ADDRESS_VAL     );
74  INSTANCE_SC_SIGNAL(_Ifetch_unit_Glue,out_EVENT_QUEUE_VAL       );
75  INSTANCE_SC_SIGNAL(_Ifetch_unit_Glue,out_EVENT_ACK             );
76  INSTANCE_SC_SIGNAL(_Ifetch_unit_Glue, in_EVENT_ADDRESS_ACK     );
77  INSTANCE_SC_SIGNAL(_Ifetch_unit_Glue, in_EVENT_QUEUE_ACK       );
78
79  msg(_("<%s> : Start Simulation ............\n"),name.c_str());
80   
81  Time * _time = new Time();
82
83  /********************************************************
84   * Simulation - Begin
85   ********************************************************/
86
87  // Initialisation
88
89  const uint32_t seed = 0;
90//const uint32_t seed = static_cast<uint32_t>(time(NULL));
91
92  srand(seed);
93
94  SC_START(0);
95  LABEL("Initialisation");
96
97  LABEL("Reset");
98  in_NRESET->write(0);
99  SC_START(5);
100  in_NRESET->write(1); 
101
102  LABEL("Loop of Test");
103
104  for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++)
105    {
106      LABEL("Iteration %d",iteration);
107
108      SC_START(1);
109    }
110
111  /********************************************************
112   * Simulation - End
113   ********************************************************/
114
115  TEST_OK ("End of Simulation");
116  delete _time;
117
118  msg(_("<%s> : ............ Stop Simulation\n"),name.c_str());
119
120  delete in_CLOCK;
121  delete in_NRESET;
122
123  delete out_ICACHE_REQ_VAL        ;
124  delete  in_ICACHE_REQ_ADDRESS_VAL;
125  delete out_ICACHE_REQ_QUEUE_VAL  ;
126  delete  in_ICACHE_REQ_ACK        ;
127  delete out_ICACHE_REQ_ADDRESS_ACK;
128  delete  in_ICACHE_REQ_QUEUE_ACK  ;
129  delete out_ICACHE_REQ_TYPE       ;
130  delete  in_EVENT_VAL             ;
131  delete out_EVENT_ADDRESS_VAL     ;
132  delete out_EVENT_QUEUE_VAL       ;
133  delete out_EVENT_ACK             ;
134  delete  in_EVENT_ADDRESS_ACK     ;
135  delete  in_EVENT_QUEUE_ACK       ;
136#endif
137
138  delete _Ifetch_unit_Glue;
139#ifdef STATISTICS
140  delete _parameters_statistics;
141#endif
142}
Note: See TracBrowser for help on using the repository browser.