source: sources/src/sc_sensitive.cc @ 5

Last change on this file since 5 was 1, checked in by buchmann, 17 years ago

Initial import from CVS repository

File size: 4.5 KB
Line 
1/*------------------------------------------------------------\
2|                                                             |
3| Tool    :                  systemcass                       |
4|                                                             |
5| File    :                 sc_sensitive.cc                   |
6|                                                             |
7| Author  :                 Buchmann Richard                  |
8|                                                             |
9| Date    :                   09_07_2004                      |
10|                                                             |
11\------------------------------------------------------------*/
12
13/*
14 * This file is part of the Disydent Project
15 * Copyright (C) Laboratoire LIP6 - Département ASIM
16 * Universite Pierre et Marie Curie
17 *
18 * Home page          : http://www-asim.lip6.fr/disydent
19 * E-mail             : mailto:richard.buchmann@lip6.fr
20 *
21 * This library is free software; you  can redistribute it and/or modify it
22 * under the terms  of the GNU Library General Public  License as published
23 * by the Free Software Foundation; either version 2 of the License, or (at
24 * your option) any later version.
25 *
26 * Disydent is distributed  in the hope  that it  will be
27 * useful, but WITHOUT  ANY WARRANTY; without even the  implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
29 * Public License for more details.
30 *
31 * You should have received a copy  of the GNU General Public License along
32 * with the GNU C Library; see the  file COPYING. If not, write to the Free
33 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
34 */
35
36
37#include"sc_sensitive.h"
38#include"sc_port.h"
39#include"sc_event.h"
40#include"sc_event_finder.h"
41#include"sc_module.h"
42#include"internal.h"
43
44using namespace std;
45
46namespace sc_core {
47  void assert_before_init ()
48  {
49    if (sc_core::already_initialized == true)
50      exit (14);
51  }
52  static
53        void add_sensitivity (const sc_event &s)
54  {
55                if (method == NULL) {
56                        cerr << "declare a process before declaring " << s << " event\n";
57                        exit (1);
58                }
59    method->sensitivity_list.push_back(s);
60  }
61}
62
63//
64using namespace sc_core;
65
66// ----------------------------------------------------------------------------
67//  CLASS : sc_sensitive
68//
69//  Static sensitivity class for events.
70// ----------------------------------------------------------------------------
71
72sc_sensitive& sc_sensitive::operator << (const sc_port_base& port)
73{
74  sc_event s (port,sc_event::VAL);
75  sc_core::add_sensitivity (s);
76  return *this;
77}
78
79sc_sensitive& sc_sensitive::operator () (const sc_port_base& port)
80{
81  return *this << port;
82}
83
84sc_sensitive& sc_sensitive::operator << (const sc_event &e)
85{
86  sc_core::add_sensitivity (e);
87  return *this;
88}
89
90sc_sensitive& sc_sensitive::operator () (const sc_event& e)
91{
92  return *this << e;
93}
94
95sc_sensitive& sc_sensitive::operator << (sc_event_finder& e)
96{
97  return *this << e.port ();
98}
99
100sc_sensitive& sc_sensitive::operator () (sc_event_finder& e)
101{
102  return *this << e;
103}
104
105sc_sensitive& sc_sensitive::operator << (const sc_interface &e)
106{
107  return *this << e.default_event ();
108}
109
110sc_sensitive& sc_sensitive::operator () (const sc_interface &e)
111{
112  return *this << e;
113}
114
115
116
117// ----------------------------------------------------------------------------
118//  CLASS : sc_sensitive_pos
119//
120//  Static sensitivity class for positive edge events.
121// ----------------------------------------------------------------------------
122
123sc_sensitive_pos& sc_sensitive_pos::operator << (const sc_port_base& port)
124{
125  sc_event s (port,sc_event::POS);
126  sc_core::add_sensitivity (s);
127  return *this;
128}
129
130sc_sensitive_pos& sc_sensitive_pos::operator () (const sc_port_base& port)
131{
132  return *this << port;
133}
134
135/*
136sc_sensitive_pos& sc_sensitive_pos::operator << (const sc_interface &e)
137{
138        sc_event s (e, sc_event::POS);
139  sc_core::add_sensitivity (s);
140  return *this;
141};
142
143sc_sensitive_pos& sc_sensitive_pos::operator () (const sc_interface &e)
144{
145  return *this << e;
146};
147*/
148
149// ----------------------------------------------------------------------------
150//  CLASS : sc_sensitive_neg
151//
152//  Static sensitivity class for negative edge events.
153// ----------------------------------------------------------------------------
154
155sc_sensitive_neg& sc_sensitive_neg::operator << (const sc_port_base& port)
156{
157  sc_event s (port,sc_event::NEG);
158  sc_core::add_sensitivity (s);
159  return *this;
160}
161
162sc_sensitive_neg& sc_sensitive_neg::operator () (const sc_port_base& port)
163{
164  return *this << port;
165}
166
167
168
Note: See TracBrowser for help on using the repository browser.