[1] | 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 | |
---|
[27] | 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 | #ifdef HAVE_CONFIG_H |
---|
| 44 | #include "config.h" |
---|
| 45 | #endif |
---|
[1] | 46 | |
---|
| 47 | using namespace std; |
---|
| 48 | |
---|
| 49 | namespace sc_core { |
---|
| 50 | void assert_before_init () |
---|
| 51 | { |
---|
| 52 | if (sc_core::already_initialized == true) |
---|
| 53 | exit (14); |
---|
| 54 | } |
---|
| 55 | static |
---|
| 56 | void add_sensitivity (const sc_event &s) |
---|
| 57 | { |
---|
| 58 | if (method == NULL) { |
---|
| 59 | cerr << "declare a process before declaring " << s << " event\n"; |
---|
| 60 | exit (1); |
---|
| 61 | } |
---|
| 62 | method->sensitivity_list.push_back(s); |
---|
| 63 | } |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | // |
---|
| 67 | using namespace sc_core; |
---|
| 68 | |
---|
| 69 | // ---------------------------------------------------------------------------- |
---|
| 70 | // CLASS : sc_sensitive |
---|
| 71 | // |
---|
| 72 | // Static sensitivity class for events. |
---|
| 73 | // ---------------------------------------------------------------------------- |
---|
| 74 | |
---|
| 75 | sc_sensitive& sc_sensitive::operator << (const sc_port_base& port) |
---|
| 76 | { |
---|
| 77 | sc_event s (port,sc_event::VAL); |
---|
| 78 | sc_core::add_sensitivity (s); |
---|
| 79 | return *this; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | sc_sensitive& sc_sensitive::operator () (const sc_port_base& port) |
---|
| 83 | { |
---|
| 84 | return *this << port; |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | sc_sensitive& sc_sensitive::operator << (const sc_event &e) |
---|
| 88 | { |
---|
| 89 | sc_core::add_sensitivity (e); |
---|
| 90 | return *this; |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | sc_sensitive& sc_sensitive::operator () (const sc_event& e) |
---|
| 94 | { |
---|
| 95 | return *this << e; |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | sc_sensitive& sc_sensitive::operator << (sc_event_finder& e) |
---|
| 99 | { |
---|
| 100 | return *this << e.port (); |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | sc_sensitive& sc_sensitive::operator () (sc_event_finder& e) |
---|
| 104 | { |
---|
| 105 | return *this << e; |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | sc_sensitive& sc_sensitive::operator << (const sc_interface &e) |
---|
| 109 | { |
---|
| 110 | return *this << e.default_event (); |
---|
| 111 | } |
---|
| 112 | |
---|
| 113 | sc_sensitive& sc_sensitive::operator () (const sc_interface &e) |
---|
| 114 | { |
---|
| 115 | return *this << e; |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | |
---|
| 119 | |
---|
| 120 | // ---------------------------------------------------------------------------- |
---|
| 121 | // CLASS : sc_sensitive_pos |
---|
| 122 | // |
---|
| 123 | // Static sensitivity class for positive edge events. |
---|
| 124 | // ---------------------------------------------------------------------------- |
---|
| 125 | |
---|
| 126 | sc_sensitive_pos& sc_sensitive_pos::operator << (const sc_port_base& port) |
---|
| 127 | { |
---|
| 128 | sc_event s (port,sc_event::POS); |
---|
| 129 | sc_core::add_sensitivity (s); |
---|
| 130 | return *this; |
---|
| 131 | } |
---|
| 132 | |
---|
| 133 | sc_sensitive_pos& sc_sensitive_pos::operator () (const sc_port_base& port) |
---|
| 134 | { |
---|
| 135 | return *this << port; |
---|
| 136 | } |
---|
| 137 | |
---|
| 138 | /* |
---|
| 139 | sc_sensitive_pos& sc_sensitive_pos::operator << (const sc_interface &e) |
---|
| 140 | { |
---|
| 141 | sc_event s (e, sc_event::POS); |
---|
| 142 | sc_core::add_sensitivity (s); |
---|
| 143 | return *this; |
---|
| 144 | }; |
---|
| 145 | |
---|
| 146 | sc_sensitive_pos& sc_sensitive_pos::operator () (const sc_interface &e) |
---|
| 147 | { |
---|
| 148 | return *this << e; |
---|
| 149 | }; |
---|
| 150 | */ |
---|
| 151 | |
---|
| 152 | // ---------------------------------------------------------------------------- |
---|
| 153 | // CLASS : sc_sensitive_neg |
---|
| 154 | // |
---|
| 155 | // Static sensitivity class for negative edge events. |
---|
| 156 | // ---------------------------------------------------------------------------- |
---|
| 157 | |
---|
| 158 | sc_sensitive_neg& sc_sensitive_neg::operator << (const sc_port_base& port) |
---|
| 159 | { |
---|
| 160 | sc_event s (port,sc_event::NEG); |
---|
| 161 | sc_core::add_sensitivity (s); |
---|
| 162 | return *this; |
---|
| 163 | } |
---|
| 164 | |
---|
| 165 | sc_sensitive_neg& sc_sensitive_neg::operator () (const sc_port_base& port) |
---|
| 166 | { |
---|
| 167 | return *this << port; |
---|
| 168 | } |
---|
| 169 | |
---|
| 170 | |
---|
| 171 | |
---|