1 | /*------------------------------------------------------------\ |
---|
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 | \------------------------------------------------------------*/ |
---|
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 | |
---|
37 | #include "sc_clock.h" |
---|
38 | #include <cassert> |
---|
39 | #ifdef HAVE_CONFIG_H |
---|
40 | #include "config.h" |
---|
41 | #endif |
---|
42 | |
---|
43 | using namespace std; |
---|
44 | |
---|
45 | namespace sc_core { |
---|
46 | |
---|
47 | const char *const sc_clock::kind_string = "sc_clock"; |
---|
48 | |
---|
49 | // ---------------------------------------------------------------------------- |
---|
50 | // CLASS : sc_clock |
---|
51 | // |
---|
52 | // ---------------------------------------------------------------------------- |
---|
53 | |
---|
54 | |
---|
55 | sc_clock::sc_clock(): base_type() |
---|
56 | { |
---|
57 | init (); |
---|
58 | posedge_first = true; |
---|
59 | } |
---|
60 | |
---|
61 | sc_clock::sc_clock(const char *name_): base_type(name_) |
---|
62 | { |
---|
63 | init (); |
---|
64 | posedge_first = true; |
---|
65 | } |
---|
66 | |
---|
67 | sc_clock::sc_clock(const char *name_, |
---|
68 | const sc_time& period_, |
---|
69 | double duty_cycle_, |
---|
70 | const sc_time& start_time_, |
---|
71 | bool posedge_first_) : base_type(name_) |
---|
72 | { |
---|
73 | init (); |
---|
74 | assert(period_ == 1); |
---|
75 | assert(duty_cycle_ == 0.5); |
---|
76 | assert(start_time_ == SC_ZERO_TIME); |
---|
77 | posedge_first = posedge_first_; |
---|
78 | } |
---|
79 | |
---|
80 | sc_clock::sc_clock(const char *name_, |
---|
81 | double period_, |
---|
82 | double duty_cycle_, |
---|
83 | double start_time_, |
---|
84 | bool posedge_first_) : base_type(name_) |
---|
85 | { |
---|
86 | init (); |
---|
87 | assert(period_ == 1); |
---|
88 | assert(duty_cycle_ == 0.5); |
---|
89 | assert(start_time_ == SC_ZERO_TIME); |
---|
90 | posedge_first = posedge_first_; |
---|
91 | } |
---|
92 | |
---|
93 | sc_clock::~sc_clock () |
---|
94 | { |
---|
95 | } |
---|
96 | |
---|
97 | void |
---|
98 | sc_clock::init () |
---|
99 | { |
---|
100 | set_kind (kind_string); |
---|
101 | } |
---|
102 | |
---|
103 | sc_clock::this_type& sc_clock::operator = ( const data_type& value_) { |
---|
104 | write(value_); |
---|
105 | return *this; |
---|
106 | } |
---|
107 | |
---|
108 | } // end of sc_core namespace |
---|
109 | |
---|