1 | /* |
---|
2 | * $Id: top_allocation.cpp 113 2009-04-14 18:39:12Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | * Test |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/Generic/Counter/SelfTest/include/top.h" |
---|
10 | #include "Behavioural/include/Allocation.h" |
---|
11 | |
---|
12 | void top::allocation (void) |
---|
13 | { |
---|
14 | cout << "<" << name << "> : Construction of component" << endl; |
---|
15 | |
---|
16 | try |
---|
17 | { |
---|
18 | param->test(); |
---|
19 | } |
---|
20 | catch (morpheo::ErrorMorpheo & error) |
---|
21 | { |
---|
22 | cout << "<" << name << "> : " << error.what (); |
---|
23 | return; |
---|
24 | } |
---|
25 | catch (...) |
---|
26 | { |
---|
27 | cerr << "<" << name << "> : This test must generate a error" << endl; |
---|
28 | exit (EXIT_FAILURE); |
---|
29 | } |
---|
30 | #ifdef STATISTICS |
---|
31 | param_stat = new morpheo::behavioural::Parameters_Statistics (5,50); |
---|
32 | #endif |
---|
33 | |
---|
34 | Tusage_t _usage = USE_ALL; |
---|
35 | |
---|
36 | //_usage = usage_unset(_usage,USE_SYSTEMC ); |
---|
37 | //_usage = usage_unset(_usage,USE_VHDL ); |
---|
38 | //_usage = usage_unset(_usage,USE_VHDL_TESTBENCH ); |
---|
39 | //_usage = usage_unset(_usage,USE_VHDL_TESTBENCH_ASSERT); |
---|
40 | //_usage = usage_unset(_usage,USE_POSITION ); |
---|
41 | //_usage = usage_unset(_usage,USE_STATISTICS ); |
---|
42 | //_usage = usage_unset(_usage,USE_INFORMATION ); |
---|
43 | |
---|
44 | cout << "<" << name << "> Create component" << endl; |
---|
45 | |
---|
46 | component = new Counter |
---|
47 | (name.c_str(), |
---|
48 | #ifdef STATISTICS |
---|
49 | param_stat, |
---|
50 | #endif |
---|
51 | param, |
---|
52 | _usage); |
---|
53 | |
---|
54 | #ifdef SYSTEMC |
---|
55 | /********************************************************************* |
---|
56 | * Déclarations des signaux |
---|
57 | *********************************************************************/ |
---|
58 | cout << "<" << name << "> Create signal" << endl; |
---|
59 | |
---|
60 | in_CLOCK = new sc_clock ("clock", TIME_PERIOD, TIME_UNIT, 0.5); //name,period,time_unit,duty_cycle |
---|
61 | |
---|
62 | ALLOC0_SC_SIGNAL( in_NRESET ," in_NRESET ",Tcontrol_t); |
---|
63 | ALLOC1_SC_SIGNAL( in_COUNTER_DATA ," in_COUNTER_DATA ",Tdata_t ,param->_nb_port); |
---|
64 | ALLOC1_SC_SIGNAL( in_COUNTER_ADDSUB," in_COUNTER_ADDSUB",Tcontrol_t,param->_nb_port); |
---|
65 | ALLOC1_SC_SIGNAL(out_COUNTER_DATA ,"out_COUNTER_DATA ",Tdata_t ,param->_nb_port); |
---|
66 | |
---|
67 | /******************************************************** |
---|
68 | * Instanciation |
---|
69 | ********************************************************/ |
---|
70 | |
---|
71 | cout << "<" << name << "> Instanciation of component" << endl; |
---|
72 | |
---|
73 | INSTANCE0_SC_SIGNAL(component, in_CLOCK ); |
---|
74 | INSTANCE0_SC_SIGNAL(component, in_NRESET ); |
---|
75 | INSTANCE1_SC_SIGNAL(component, in_COUNTER_DATA ,param->_nb_port); |
---|
76 | INSTANCE1_SC_SIGNAL(component, in_COUNTER_ADDSUB,param->_nb_port); |
---|
77 | INSTANCE1_SC_SIGNAL(component,out_COUNTER_DATA ,param->_nb_port); |
---|
78 | #endif |
---|
79 | } |
---|