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/Queue/SelfTest/include/top.h" |
---|
10 | #include "Behavioural/include/Allocation.h" |
---|
11 | |
---|
12 | void top::allocation (void) |
---|
13 | { |
---|
14 | if (setlocale (LC_ALL, "") == NULL) |
---|
15 | msgWarning(_("setlocale ko.\n")); |
---|
16 | |
---|
17 | try |
---|
18 | { |
---|
19 | _param->test(); |
---|
20 | } |
---|
21 | catch (morpheo::ErrorMorpheo & error) |
---|
22 | { |
---|
23 | msgError(_("<%s> : %s"),name.c_str(),error.what()); |
---|
24 | return; |
---|
25 | } |
---|
26 | catch (...) |
---|
27 | { |
---|
28 | msgError(_("<%s> : This test must generate a error"),name.c_str()); |
---|
29 | exit (EXIT_FAILURE); |
---|
30 | } |
---|
31 | |
---|
32 | _usage = USE_ALL; |
---|
33 | // _usage = usage_unset(_usage,USE_SYSTEMC ); |
---|
34 | // _usage = usage_unset(_usage,USE_VHDL ); |
---|
35 | // _usage = usage_unset(_usage,USE_VHDL_TESTBENCH ); |
---|
36 | // _usage = usage_unset(_usage,USE_VHDL_TESTBENCH_ASSERT); |
---|
37 | // _usage = usage_unset(_usage,USE_POSITION ); |
---|
38 | // _usage = usage_unset(_usage,USE_STATISTICS ); |
---|
39 | // _usage = usage_unset(_usage,USE_INFORMATION ); |
---|
40 | |
---|
41 | #ifdef STATISTICS |
---|
42 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
43 | _param_stat = new morpheo::behavioural::Parameters_Statistics (5,CYCLE_MAX); |
---|
44 | #endif |
---|
45 | |
---|
46 | component = new Queue |
---|
47 | (name.c_str(), |
---|
48 | #ifdef STATISTICS |
---|
49 | _param_stat, |
---|
50 | #endif |
---|
51 | _param, |
---|
52 | _usage |
---|
53 | ); |
---|
54 | |
---|
55 | #ifdef SYSTEMC |
---|
56 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
57 | { |
---|
58 | /********************************************************************* |
---|
59 | * Déclarations des signaux |
---|
60 | *********************************************************************/ |
---|
61 | msgInformation(_("<%s> : Create signal.\n"),name.c_str()); |
---|
62 | |
---|
63 | in_CLOCK = new sc_clock ("clock", TIME_PERIOD, TIME_UNIT, 0.5); //name,period,time_unit,duty_cycle |
---|
64 | |
---|
65 | ALLOC0_SC_SIGNAL( in_NRESET ," in_NRESET" ,Tcontrol_t); |
---|
66 | |
---|
67 | ALLOC0_SC_SIGNAL( in_INSERT_VAL , "in_INSERT_VAL" ,Tcontrol_t); |
---|
68 | ALLOC0_SC_SIGNAL(out_INSERT_ACK ,"out_INSERT_ACK" ,Tcontrol_t); |
---|
69 | ALLOC0_SC_SIGNAL( in_INSERT_DATA, "in_INSERT_DATA",Tdata_t ); |
---|
70 | ALLOC0_SC_SIGNAL(out_RETIRE_VAL ,"out_RETIRE_VAL" ,Tcontrol_t); |
---|
71 | ALLOC0_SC_SIGNAL( in_RETIRE_ACK , "in_RETIRE_ACK" ,Tcontrol_t); |
---|
72 | ALLOC0_SC_SIGNAL(out_RETIRE_DATA,"out_RETIRE_DATA",Tdata_t ); |
---|
73 | ALLOC1_SC_SIGNAL(out_SLOT_VAL ,"out_SLOT_VAL" ,Tcontrol_t,_param->_nb_port_slot); |
---|
74 | ALLOC1_SC_SIGNAL(out_SLOT_DATA ,"out_SLOT_DATA" ,Tdata_t ,_param->_nb_port_slot); |
---|
75 | ALLOC0_SC_SIGNAL(out_PTR_WRITE ,"out_PTR_WRITE" ,Tptr_t ); |
---|
76 | ALLOC0_SC_SIGNAL(out_PTR_READ ,"out_PTR_READ" ,Tptr_t ); |
---|
77 | |
---|
78 | /******************************************************** |
---|
79 | * Instanciation |
---|
80 | ********************************************************/ |
---|
81 | |
---|
82 | msgInformation(_("<%s> : Instanciation of _Queue.\n"),name.c_str()); |
---|
83 | |
---|
84 | INSTANCE0_SC_SIGNAL(component, in_CLOCK); |
---|
85 | INSTANCE0_SC_SIGNAL(component, in_NRESET); |
---|
86 | |
---|
87 | INSTANCE0_SC_SIGNAL(component, in_INSERT_VAL ); |
---|
88 | INSTANCE0_SC_SIGNAL(component,out_INSERT_ACK ); |
---|
89 | INSTANCE0_SC_SIGNAL(component, in_INSERT_DATA); |
---|
90 | INSTANCE0_SC_SIGNAL(component,out_RETIRE_VAL ); |
---|
91 | INSTANCE0_SC_SIGNAL(component, in_RETIRE_ACK ); |
---|
92 | INSTANCE0_SC_SIGNAL(component,out_RETIRE_DATA); |
---|
93 | INSTANCE1_SC_SIGNAL(component,out_SLOT_VAL ,_param->_nb_port_slot); |
---|
94 | INSTANCE1_SC_SIGNAL(component,out_SLOT_DATA ,_param->_nb_port_slot); |
---|
95 | if (_param->_have_port_ptr_write) |
---|
96 | INSTANCE0_SC_SIGNAL(component,out_PTR_WRITE ); |
---|
97 | if (_param->_have_port_ptr_read ) |
---|
98 | INSTANCE0_SC_SIGNAL(component,out_PTR_READ ); |
---|
99 | } |
---|
100 | #endif |
---|
101 | } |
---|