source: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Component_vhdl_instance.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.4 KB
Line 
1#ifdef VHDL
2/*
3 * $Id$
4 *
5 * [ Description ]
6 *
7 */
8
9#include "Behavioural/include/Component.h"
10
11namespace morpheo              {
12namespace behavioural          {
13
14  void Component::vhdl_instance (Vhdl * & vhdl)
15  {
16    uint32_t             cpt = 0;
17    map<Signal *,string> tab;
18
19    vhdl->set_library_work (_entity->get_name() + "_Pack");
20
21    // for each entity
22    list<Entity *>         * list_component = _list_component;
23    list<Entity *>::iterator i              = list_component->begin();
24    if (not list_component->empty())
25      {
26        while (i != list_component->end())
27          {
28            vhdl->set_library_work ((*i)->get_name() + "_Pack");
29
30            list<string> list_port_map;
31           
32            // for each interface
33            list<Interface_fifo *>         * list_interface = (*i)->get_interfaces_list()->get_interface_list();
34            list<Interface_fifo *>::iterator j              = list_interface->begin();
35            if (not list_interface->empty())
36              {
37                while (j != list_interface->end())
38                  {
39                    // for each signal
40                    list<Signal *>         * list_signal = (*j)->get_signal_list();
41                    list<Signal *>::iterator k           = list_signal->begin();
42                    if (not list_signal->empty())
43                      {
44                        while (k != list_signal->end())
45                          {
46                            // test if is connect with external interface or with an another component.
47                            Signal * signal_src  = (*k);
48                            if (signal_src->presence_vhdl () == true)
49                              {
50                                Signal * signal_dest = (*k)->get_signal_link();
51                                string   name_src    = signal_src->get_name();
52                                string   name_dest;
53                               
54                                if (_entity->find_signal(signal_dest) == false)
55                                  {
56                                    // find if signal is already link
57                                    map<Signal *,string>::iterator it = tab.find(signal_src); 
58                                    if (tab.find(signal_src) == tab.end())
59                                      {
60                                        // Create name
61                                        name_dest = "signal_"+toString(cpt++);
62                                       
63                                        tab [signal_src ] = name_dest;
64                                        tab [signal_dest] = name_dest;
65                                       
66                                        // Add a new signal
67                                        vhdl->set_signal (name_dest, signal_src->get_size());
68                                      }
69                                    else
70                                      name_dest = (*it).second;
71                                  }
72                                else
73                                  name_dest = signal_dest->get_name();
74                               
75                                vhdl->set_body_component_port_map (list_port_map, name_src, name_dest);
76                              }
77                            ++k;
78                          }
79                      }
80                    ++j;
81                  }
82              }
83            vhdl->set_body_component ("instance_"+(*i)->get_name(),(*i)->get_name(),list_port_map);
84            ++i;
85          }
86      }
87  };
88
89}; // end namespace behavioural
90}; // end namespace morpheo
91#endif
Note: See TracBrowser for help on using the repository browser.