source: sources/src/entity.h@ 56

Last change on this file since 56 was 52, checked in by meunier, 14 years ago

Code formatting in all source files.

File size: 3.0 KB
RevLine 
[1]1/*------------------------------------------------------------\
[52]2 | |
3 | Tool : systemcass |
4 | |
5 | File : entity.h |
6 | |
7 | Author : Buchmann Richard |
8 | Taktak Sami |
9 | |
10 | Date : 09_07_2004 |
11 | |
12 \------------------------------------------------------------*/
[1]13#ifndef __ENTITY_H__
14#define __ENTITY_H__
15
[27]16#include <iostream>
17#include <list>
18#include "sc_fwd.h"
19#include "sc_port.h"
20#include "sc_signal.h"
[1]21
22namespace sc_core {
23
[52]24// Entity class
25struct entity {
[1]26 enum { SIGNAL, PORT } type;
[52]27 union {
28 // port & signal aren't const because we need to modify
29 // some fields in elaboration step.
30 sc_port_base * port;
31 sc_signal_base * signal;
32 };
33 sc_object * object;
34 sc_interface * interface;
35 bool operator ==(const sc_port_base & port_) {
36 return (type == PORT) && (&port_ == port);
37 }
[1]38
[52]39 bool operator ==(const sc_signal_base & signal_) {
40 return (type == SIGNAL) && (&signal_ == signal);
41 }
[1]42
[52]43 bool operator <(const entity & e_) const {
44 return (void *) this < (void *) &e_;
45 } // casting to "unsigned int" causes warnings
[1]46
[52]47 const char * kind() const {
48 return object->kind();
49 }
[1]50
[52]51 size_t data_size_in_bytes() const {
52 return interface->data_size_in_bytes();
53 }
[1]54
[52]55 entity(/*const */sc_port_base & port_) {
56 type = PORT;
57 port = &port_;
58 object = &port_;
59 interface = &port_;
60 }
61
62 entity(/*const */sc_signal_base & signal_) {
63 type = SIGNAL;
64 signal = &signal_;
65 object = &signal_;
66 interface = &signal_;
67 }
68};
69
70// list
71typedef std::list < entity > equi_t;
72typedef std::list < equi_t > equi_list_t;
73
74// Miscellanous functions
75equi_t & get_equi(const sc_interface &);
76equi_t & get_equi(const tab_t * pointer);
77bool has_equi(/*const */sc_port_base &);
78equi_t & merge_equi(const tab_t * pointer);
79sc_port_base * get_out_port(const equi_t &);
80const char * get_name(const equi_t &);
81const char * get_module_name(const equi_t &);
82std::ostream & operator <<(std::ostream &, const equi_t &);
83std::ostream & operator <<(std::ostream &, const entity &);
84
85const equi_list_t & get_equi_list();
86int get_signal_table_size();
87
88// Bind functions
89void bind(sc_port_base & p1, sc_port_base & p2);
90void bind(sc_port_base & p1, sc_signal_base & s1);
91
[1]92} // end of sc_core namespace
[52]93
[1]94#endif /* __ENTITY_H__ */
95
[52]96/*
97# Local Variables:
98# tab-width: 4;
99# c-basic-offset: 4;
100# c-file-offsets:((innamespace . 0)(inline-open . 0));
101# indent-tabs-mode: nil;
102# End:
103#
104# vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
105*/
Note: See TracBrowser for help on using the repository browser.