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 main.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: Bishnupriya Bhattacharya, Cadence Design Systems, 34 September 5, 2003 35 Description of Modification: change sc_get_curr_proc_handle() to 36 sc_get_last_created_process_handle() 37 38 *****************************************************************************/ 39 40// test the kind string of objects 41 42#include "systemc.h" 43 44#define WRITE(a) \ 45{ \ 46 cout << (a).kind() << endl; \ 47 const sc_object* obj = &(a); \ 48 cout << obj->kind() << endl; \ 49} 50 51SC_MODULE( mod_a ) 52{ 53 sc_in_clk clk; 54 55 void method_action() 56 {} 57 58 void thread_action() 59 {} 60 61 void cthread_action() 62 {} 63 64 SC_CTOR( mod_a ) 65 { 66 SC_METHOD( method_action ); 67 WRITE( *sc_get_current_process_handle().get_process_object() ); 68 SC_THREAD( thread_action ); 69 WRITE( *sc_get_current_process_handle().get_process_object() ); 70 SC_CTHREAD( cthread_action, clk.pos() ); 71 WRITE( *sc_get_current_process_handle().get_process_object() ); 72 } 73}; 74 75extern void foo( const sc_signal<int>& ); 76 77int 78sc_main( int, char*[] ) 79{ 80 mod_a a( "a" ); 81 WRITE( a ); 82 83 sc_clock clk; 84 WRITE( clk ); 85 86 sc_fifo<int> fifo; 87 WRITE( fifo ); 88 89 sc_mutex mutex; 90 WRITE( mutex ); 91 92 sc_signal<int> signal; 93 WRITE( signal ); 94 95 sc_signal<bool> signal_bool; 96 WRITE( signal_bool ); 97 98 sc_signal<sc_logic> signal_logic; 99 WRITE( signal_logic ); 100 101 sc_signal_resolved signal_resolved; 102 WRITE( signal_resolved ); 103 104 sc_signal_rv<8> signal_rv; 105 WRITE( signal_rv ); 106 107 foo( signal ); 108 109 return 0; 110} 111