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  test03.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// test of dynamic design rule checking in signals.
39
40#define DEBUG_SYSTEMC
41#include "systemc.h"
42
43SC_MODULE( mod_a )
44{
45    sc_in_clk clk;
46
47    sc_out<int>      out_int;
48    sc_out<bool>     out_bool;
49    sc_out<sc_logic> out_logic;
50    sc_out<int>      out_int2;
51    sc_out_resolved  out_resolved;
52    sc_out_rv<1>     out_rv1;
53
54    void main_action1()
55    {
56        out_int = 42;
57        out_bool = true;
58        out_logic = SC_LOGIC_1;
59        out_int2 = 1;
60        out_resolved = SC_LOGIC_1;
61        out_rv1 = sc_lv<1>( SC_LOGIC_1 );
62    }
63
64    void main_action2()
65    {
66        out_int = 0;
67        out_bool = false;
68        out_logic = SC_LOGIC_0;
69        out_int2 = 0;
70        out_resolved = SC_LOGIC_0;
71        out_rv1 = sc_lv<1>( SC_LOGIC_0 );
72    }
73
74    SC_CTOR( mod_a )
75    {
76        SC_METHOD( main_action1 );
77        sensitive << clk.pos();
78        dont_initialize();
79        SC_METHOD( main_action2 );
80        sensitive << clk.neg();
81        dont_initialize();
82    }
83};
84
85int
86sc_main( int, char*[] )
87{
88    sc_clock clk;
89
90    sc_signal<int> sig_int("sig_int");
91    sc_signal<bool> sig_bool("sig_bool");
92    sc_signal<sc_logic> sig_logic("sig_logic");
93    sc_buffer<int> buf_int("buf_int");
94    sc_signal_resolved sig_resolved("sig_resolved");
95    sc_signal_rv<1> sig_rv1("sig_rv1");
96
97    mod_a a("a");
98    a(clk, sig_int, sig_bool, sig_logic, buf_int, sig_resolved, sig_rv1);
99
100    sc_start( 20, SC_NS );
101
102    return 0;
103}
104