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

Last change on this file since 42 was 42, checked in by rosiere, 17 years ago

Modification des classes d'encapsulation des interfaces :

  • gère les signaux à écrire dans le vhdl
  • les traces pour le testbench
  • la génération des vhdl structurelles

-> test sur la Pattern History Table

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