test.cpp revision 12855:588919e0e4aa
1/*****************************************************************************
2
3  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4  more contributor license agreements.  See the NOTICE file distributed
5  with this work for additional information regarding copyright ownership.
6  Accellera licenses this file to you under the Apache License, Version 2.0
7  (the "License"); you may not use this file except in compliance with the
8  License.  You may obtain a copy of the License at
9
10    http://www.apache.org/licenses/LICENSE-2.0
11
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15  implied.  See the License for the specific language governing
16  permissions and limitations under the License.
17
18 *****************************************************************************/
19
20/*****************************************************************************
21
22  test.cpp --
23
24  Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
25
26 *****************************************************************************/
27
28/*****************************************************************************
29
30  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
31  changes you are making here.
32
33      Name, Affiliation, Date:
34  Description of Modification:
35
36 *****************************************************************************/
37
38/*
39If a process is sensitive to sc_port<some_if<T>, N> and
40this port is bind to two signals, the process is responding
41to only the events on first signal, it's not responding to
42events on second (or other) signals. it seems to me as a
43bug. how to resolve this problem??
44
45Thanks in advance,
46kiran
47
48when i run the following program i got this output.
490: Method Activated
500: Method Activated
513: Method Activated
52
53but expected output is,
540: Method Activated
550: Method Activated
561: Method Activated
572: Method Activated
583: Method Activated
59*/
60
61#include "systemc.h"
62
63SC_MODULE(tst) {
64  sc_port<sc_signal_in_if<bool>, 2> INP;
65
66  void print_mthd() {
67    cout <<sc_time_stamp()<<": Method Activated"<<endl;
68  }
69
70  SC_CTOR(tst) {
71    SC_METHOD(print_mthd);
72    sensitive << INP;
73  }
74};
75
76int sc_main(int argc, char* argv[]) {
77
78  sc_signal<bool> INP1, INP2;
79
80  tst tsti("tsti");
81  tsti.INP(INP1);
82  tsti.INP(INP2);
83
84  sc_start(0, SC_NS);
85
86  INP1.write(1);
87  sc_start(1, SC_NS);
88  INP2.write(1);
89  sc_start(1, SC_NS);
90  INP2.write(0);
91  sc_start(1, SC_NS);
92  INP1.write(0);
93  sc_start(1, SC_NS);
94
95  return 0;
96}
97
98
99/*
100=====
101M.N.V.Satya Kiran,M.Tech
102Project Trainee, ED&T Synthesis,
103Building: WAY- 3.24,
104Phone: +31-40-2743924.
105NatLab-Philips Research Laboratories,
106Prof.Holstlaan 4, 5656 AA Eindhoven,
107The Netherlands.
108*/
109