[1] | 1 | /*------------------------------------------------------------\ |
---|
[52] | 2 | | | |
---|
| 3 | | Tool : systemcass | |
---|
| 4 | | | |
---|
| 5 | | File : sc_clock.cc | |
---|
| 6 | | | |
---|
| 7 | | Author : Buchmann Richard | |
---|
| 8 | | Taktak Sami | |
---|
| 9 | | | |
---|
| 10 | | Date : 09_09_2005 | |
---|
| 11 | | | |
---|
| 12 | \------------------------------------------------------------*/ |
---|
[1] | 13 | |
---|
| 14 | /* |
---|
| 15 | * This file is part of the Disydent Project |
---|
| 16 | * Copyright (C) Laboratoire LIP6 - Département ASIM |
---|
| 17 | * Universite Pierre et Marie Curie |
---|
| 18 | * |
---|
| 19 | * Home page : http://www-asim.lip6.fr/disydent |
---|
| 20 | * E-mail : mailto:richard.buchmann@lip6.fr |
---|
| 21 | * |
---|
| 22 | * This library is free software; you can redistribute it and/or modify it |
---|
| 23 | * under the terms of the GNU Library General Public License as published |
---|
| 24 | * by the Free Software Foundation; either version 2 of the License, or (at |
---|
| 25 | * your option) any later version. |
---|
| 26 | * |
---|
| 27 | * Disydent is distributed in the hope that it will be |
---|
| 28 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
---|
| 30 | * Public License for more details. |
---|
| 31 | * |
---|
| 32 | * You should have received a copy of the GNU General Public License along |
---|
| 33 | * with the GNU C Library; see the file COPYING. If not, write to the Free |
---|
| 34 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
| 35 | */ |
---|
| 36 | |
---|
[52] | 37 | #include <cassert> |
---|
| 38 | |
---|
[27] | 39 | #include "sc_clock.h" |
---|
[52] | 40 | |
---|
[27] | 41 | #ifdef HAVE_CONFIG_H |
---|
| 42 | #include "config.h" |
---|
| 43 | #endif |
---|
[1] | 44 | |
---|
| 45 | using namespace std; |
---|
| 46 | |
---|
| 47 | namespace sc_core { |
---|
| 48 | |
---|
| 49 | const char *const sc_clock::kind_string = "sc_clock"; |
---|
| 50 | |
---|
| 51 | // ---------------------------------------------------------------------------- |
---|
| 52 | // CLASS : sc_clock |
---|
| 53 | // |
---|
| 54 | // ---------------------------------------------------------------------------- |
---|
| 55 | |
---|
| 56 | |
---|
[52] | 57 | sc_clock::sc_clock(): base_type() { |
---|
| 58 | init (); |
---|
| 59 | posedge_first = true; |
---|
[1] | 60 | } |
---|
| 61 | |
---|
| 62 | |
---|
[52] | 63 | sc_clock::sc_clock(const char * name_): base_type(name_) { |
---|
| 64 | init (); |
---|
| 65 | posedge_first = true; |
---|
[1] | 66 | } |
---|
| 67 | |
---|
[52] | 68 | |
---|
| 69 | sc_clock::sc_clock(const char * name_, |
---|
| 70 | const sc_time & period_, |
---|
| 71 | double duty_cycle_, |
---|
| 72 | const sc_time & start_time_, |
---|
| 73 | bool posedge_first_) : base_type(name_) { |
---|
| 74 | init (); |
---|
| 75 | assert(period_ == 1); |
---|
| 76 | assert(duty_cycle_ == 0.5); |
---|
| 77 | assert(start_time_ == SC_ZERO_TIME); |
---|
| 78 | posedge_first = posedge_first_; |
---|
[1] | 79 | } |
---|
| 80 | |
---|
[52] | 81 | |
---|
| 82 | sc_clock::sc_clock(const char * name_, |
---|
| 83 | double period_, |
---|
| 84 | double duty_cycle_, |
---|
| 85 | double start_time_, |
---|
| 86 | bool posedge_first_) : base_type(name_) { |
---|
| 87 | init (); |
---|
| 88 | assert(period_ == 1); |
---|
| 89 | assert(duty_cycle_ == 0.5); |
---|
| 90 | assert(start_time_ == SC_ZERO_TIME); |
---|
| 91 | posedge_first = posedge_first_; |
---|
[1] | 92 | } |
---|
| 93 | |
---|
[52] | 94 | |
---|
| 95 | sc_clock::~sc_clock() {} |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | void sc_clock::init () { |
---|
| 99 | set_kind(kind_string); |
---|
[1] | 100 | } |
---|
| 101 | |
---|
[52] | 102 | |
---|
| 103 | sc_clock::this_type & sc_clock::operator = (const data_type & value_) { |
---|
| 104 | write(value_); |
---|
| 105 | return *this; |
---|
[1] | 106 | } |
---|
| 107 | |
---|
| 108 | } // end of sc_core namespace |
---|
| 109 | |
---|
[52] | 110 | /* |
---|
| 111 | # Local Variables: |
---|
| 112 | # tab-width: 4; |
---|
| 113 | # c-basic-offset: 4; |
---|
| 114 | # c-file-offsets:((innamespace . 0)(inline-open . 0)); |
---|
| 115 | # indent-tabs-mode: nil; |
---|
| 116 | # End: |
---|
| 117 | # |
---|
| 118 | # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
| 119 | */ |
---|
| 120 | |
---|