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