source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Counter/src/Counter_allocation.cpp @ 88

Last change on this file since 88 was 88, checked in by rosiere, 15 years ago

Almost complete design
with Test and test platform

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