diff options
author | Gabe Black <gabeblack@google.com> | 2018-05-24 01:37:55 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-08-08 10:09:54 +0000 |
commit | 16fa8d7cc8c92f5ab879e4cf9c6c0bbb3567860f (patch) | |
tree | 7b6faaacb4574a555e561534aa4a8508c0624c32 /src/systemc/tests/systemc/communication/sc_buffer/test01 | |
parent | 7235d3b5211d0ba8f528d930a4c1e7ad62eec51a (diff) | |
download | gem5-16fa8d7cc8c92f5ab879e4cf9c6c0bbb3567860f.tar.xz |
systemc: Import tests from the Accellera systemc distribution.
Change-Id: Iad76b398949a55d768a34d027a2d8e3739953da6
Reviewed-on: https://gem5-review.googlesource.com/10845
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/tests/systemc/communication/sc_buffer/test01')
-rw-r--r-- | src/systemc/tests/systemc/communication/sc_buffer/test01/golden/test01.log | 102 | ||||
-rw-r--r-- | src/systemc/tests/systemc/communication/sc_buffer/test01/test01.cpp | 102 |
2 files changed, 204 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/communication/sc_buffer/test01/golden/test01.log b/src/systemc/tests/systemc/communication/sc_buffer/test01/golden/test01.log new file mode 100644 index 000000000..708a33b5c --- /dev/null +++ b/src/systemc/tests/systemc/communication/sc_buffer/test01/golden/test01.log @@ -0,0 +1,102 @@ +SystemC Simulation +0 s 0 +0 s 3 +1 ns 3 +2 ns 3 +3 ns 3 +4 ns 3 +5 ns 3 +6 ns 3 +7 ns 3 +8 ns 3 +9 ns 3 +10 ns 3 +11 ns 3 +12 ns 3 +13 ns 3 +14 ns 3 +15 ns 3 +16 ns 3 +17 ns 3 +18 ns 3 +19 ns 3 +20 ns 3 +21 ns 3 +22 ns 3 +23 ns 3 +24 ns 3 +25 ns 3 +26 ns 3 +27 ns 3 +28 ns 3 +29 ns 3 +30 ns 3 +31 ns 3 +32 ns 3 +33 ns 3 +34 ns 3 +35 ns 3 +36 ns 3 +37 ns 3 +38 ns 3 +39 ns 3 +40 ns 3 +41 ns 3 +42 ns 3 +43 ns 3 +44 ns 3 +45 ns 3 +46 ns 3 +47 ns 3 +48 ns 3 +49 ns 3 +50 ns 3 +51 ns 3 +52 ns 3 +53 ns 3 +54 ns 3 +55 ns 3 +56 ns 3 +57 ns 3 +58 ns 3 +59 ns 3 +60 ns 3 +61 ns 3 +62 ns 3 +63 ns 3 +64 ns 3 +65 ns 3 +66 ns 3 +67 ns 3 +68 ns 3 +69 ns 3 +70 ns 3 +71 ns 3 +72 ns 3 +73 ns 3 +74 ns 3 +75 ns 3 +76 ns 3 +77 ns 3 +78 ns 3 +79 ns 3 +80 ns 3 +81 ns 3 +82 ns 3 +83 ns 3 +84 ns 3 +85 ns 3 +86 ns 3 +87 ns 3 +88 ns 3 +89 ns 3 +90 ns 3 +91 ns 3 +92 ns 3 +93 ns 3 +94 ns 3 +95 ns 3 +96 ns 3 +97 ns 3 +98 ns 3 +99 ns 3 diff --git a/src/systemc/tests/systemc/communication/sc_buffer/test01/test01.cpp b/src/systemc/tests/systemc/communication/sc_buffer/test01/test01.cpp new file mode 100644 index 000000000..2f7b49f4f --- /dev/null +++ b/src/systemc/tests/systemc/communication/sc_buffer/test01/test01.cpp @@ -0,0 +1,102 @@ +/***************************************************************************** + + Licensed to Accellera Systems Initiative Inc. (Accellera) under one or + more contributor license agreements. See the NOTICE file distributed + with this work for additional information regarding copyright ownership. + Accellera licenses this file to you under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with the + License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied. See the License for the specific language governing + permissions and limitations under the License. + + *****************************************************************************/ + +/***************************************************************************** + + test01.cpp -- + + Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 + + *****************************************************************************/ + +/***************************************************************************** + + MODIFICATION LOG - modifiers, enter your name, affiliation, date and + changes you are making here. + + Name, Affiliation, Date: + Description of Modification: + + *****************************************************************************/ + +// $Log: test01.cpp,v $ +// Revision 1.1.1.1 2006/12/15 20:25:56 acg +// systemc_tests-2.3 +// +// Revision 1.2 2006/01/24 19:11:29 acg +// Andy Goodrich: Changed sc_simulation_time() usage to sc_time_stamp(). +// + +// test of sc_buffer<T> -- general test + +#include "systemc.h" + +SC_MODULE( mod_a ) +{ + sc_in<bool> clk; + sc_out<int> out; + + void main_action() + { + while( true ) { + wait(); + out = 3; + } + } + + SC_CTOR( mod_a ) + { + SC_THREAD( main_action ); + sensitive << clk.pos(); + } +}; + +SC_MODULE( mod_b ) +{ + sc_in<int> in; + + void main_action() + { + cout << sc_time_stamp() << " " << in.read() << endl; + } + + SC_CTOR( mod_b ) + { + SC_METHOD( main_action ); + sensitive << in; + } +}; + +int +sc_main( int, char*[] ) +{ + mod_a a( "a" ); + mod_b b( "b" ); + + sc_clock clk; + sc_buffer<int> buf; + + a.clk( clk ); + a.out( buf ); + b.in( buf ); + + sc_start( 100, SC_NS); + + return 0; +} |