source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Counter/src/Counter_allocation.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: 2.1 KB
Line 
1#ifdef SYSTEMC
2/*
3 * $Id: Counter_allocation.cpp 82 2008-05-01 16:48:45Z rosiere $
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/Generic/Counter/include/Counter.h"
10
11namespace morpheo                    {
12namespace behavioural {
13namespace generic {
14namespace counter {
15
16  void Counter::allocation (void)
17  {
18    log_printf(FUNC,Counter,"allocation","Begin");
19
20    _component   = new Component (_usage);
21
22    Entity * entity = _component->set_entity (_name     
23                                             ,"Counter" 
24#ifdef POSITION
25                                             ,COMBINATORY
26#endif
27                                              );
28   
29    _interfaces = entity->set_interfaces();
30
31    // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32    {
33      Interface * interface = _interfaces->set_interface(""
34#ifdef POSITION
35                                                         , IN 
36                                                         , SOUTH
37                                                         , "Generalist interface"
38#endif
39                                                         );
40     
41      in_CLOCK              = interface->set_signal_clk              ("clock" ,1,CLOCK_VHDL_NO);
42      in_NRESET             = interface->set_signal_in  <Tcontrol_t> ("nreset",1,RESET_VHDL_NO);
43    }
44
45    // ~~~~~[ Interface : "counter" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46     {
47        in_COUNTER_DATA  = new SC_IN (Tdata_t)    * [_param._nb_port];
48        in_COUNTER_ADDSUB= new SC_IN (Tcontrol_t) * [_param._nb_port];
49       out_COUNTER_DATA  = new SC_OUT(Tdata_t)    * [_param._nb_port];
50       
51       for (uint32_t i=0; i<_param._nb_port; i++)
52         {
53           Interface_fifo * interface = _interfaces->set_interface("counter_"+toString(i)
54#ifdef POSITION
55                                                                   , IN 
56                                                                   , SOUTH
57                                                                   , "Counter interface"
58#endif
59                                                                   );
60           
61            in_COUNTER_DATA   [i] = interface->set_signal_in  <Tdata_t   > ("data"  , _param._size_data);
62            in_COUNTER_ADDSUB [i] = interface->set_signal_in  <Tcontrol_t> ("addsub", 1                );
63           out_COUNTER_DATA   [i] = interface->set_signal_out <Tdata_t   > ("data"  , _param._size_data);
64         }
65     }
66#ifdef POSITION
67    _component->generate_file();
68#endif
69
70    // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   
71    log_printf(FUNC,Counter,"allocation","End");
72  };
73
74}; // end namespace counter
75}; // end namespace generic
76
77}; // end namespace behavioural
78}; // end namespace morpheo             
79#endif
Note: See TracBrowser for help on using the repository browser.