112855Sgabeblack@google.com/*****************************************************************************
212855Sgabeblack@google.com
312855Sgabeblack@google.com  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
412855Sgabeblack@google.com  more contributor license agreements.  See the NOTICE file distributed
512855Sgabeblack@google.com  with this work for additional information regarding copyright ownership.
612855Sgabeblack@google.com  Accellera licenses this file to you under the Apache License, Version 2.0
712855Sgabeblack@google.com  (the "License"); you may not use this file except in compliance with the
812855Sgabeblack@google.com  License.  You may obtain a copy of the License at
912855Sgabeblack@google.com
1012855Sgabeblack@google.com    http://www.apache.org/licenses/LICENSE-2.0
1112855Sgabeblack@google.com
1212855Sgabeblack@google.com  Unless required by applicable law or agreed to in writing, software
1312855Sgabeblack@google.com  distributed under the License is distributed on an "AS IS" BASIS,
1412855Sgabeblack@google.com  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1512855Sgabeblack@google.com  implied.  See the License for the specific language governing
1612855Sgabeblack@google.com  permissions and limitations under the License.
1712855Sgabeblack@google.com
1812855Sgabeblack@google.com *****************************************************************************/
1912855Sgabeblack@google.com
2012855Sgabeblack@google.com// method_with_reset.cpp -- test for
2112855Sgabeblack@google.com//
2212855Sgabeblack@google.com//  Original Author: John Aynsley, Doulos, Inc.
2312855Sgabeblack@google.com//
2412855Sgabeblack@google.com// MODIFICATION LOG - modifiers, enter your name, affiliation, date and
2512855Sgabeblack@google.com//
2612855Sgabeblack@google.com// $Log: method_with_reset.cpp,v $
2712855Sgabeblack@google.com// Revision 1.2  2011/05/08 19:18:46  acg
2812855Sgabeblack@google.com//  Andy Goodrich: remove extraneous + prefixes from git diff.
2912855Sgabeblack@google.com//
3012855Sgabeblack@google.com
3112855Sgabeblack@google.com// Method processes with sync and async resets, reset_event, sc_event_or_list
3212855Sgabeblack@google.com
3312855Sgabeblack@google.com#define SC_INCLUDE_DYNAMIC_PROCESSES
3412855Sgabeblack@google.com
3512855Sgabeblack@google.com#include <systemc>
3612855Sgabeblack@google.com
3712855Sgabeblack@google.comusing namespace sc_core;
3812855Sgabeblack@google.comusing std::cout;
3912855Sgabeblack@google.comusing std::endl;
4012855Sgabeblack@google.com
4112855Sgabeblack@google.comstruct Top: sc_module
4212855Sgabeblack@google.com{
4312855Sgabeblack@google.com  Top(sc_module_name _name)
4412855Sgabeblack@google.com  : clk("clk")
4512855Sgabeblack@google.com  , count(0)
4612855Sgabeblack@google.com  {
4712855Sgabeblack@google.com    SC_THREAD(ctrl);
4812855Sgabeblack@google.com
4912855Sgabeblack@google.com    SC_METHOD(method_sync_reset);
5012855Sgabeblack@google.com      sensitive << clk.posedge_event();
5112855Sgabeblack@google.com      reset_signal_is(reset, true);
5212855Sgabeblack@google.com      dont_initialize();
5312855Sgabeblack@google.com      m1 = sc_get_current_process_handle();
5412855Sgabeblack@google.com
5512855Sgabeblack@google.com    SC_METHOD(method_async_reset);
5612855Sgabeblack@google.com      sensitive << clk.posedge_event();
5712855Sgabeblack@google.com      async_reset_signal_is(reset, true);
5812855Sgabeblack@google.com      dont_initialize();
5912855Sgabeblack@google.com      m2 = sc_get_current_process_handle();
6012855Sgabeblack@google.com
6112855Sgabeblack@google.com    f0 = f1 = f2 = f3 = f4 = f5 = f6 = f7 = f8 = f9 = 0;
6212855Sgabeblack@google.com    f10 = f11 = f12 = f13 = f14 = f15 = f16 = f17 = f18 = f19 = 0;
6312855Sgabeblack@google.com    f20 = f21 = f22 = f23 = f24 = f25 = f26 = f27 = f28 = f29 = 0;
6412855Sgabeblack@google.com    f30 = f31 = f32 = f33 = f34 = f35 = f36 = f37 = f38 = f39 = 0;
6512855Sgabeblack@google.com    f40 = f41 = f42 = f43 = f44 = f45 = f46 = f47 = f48 = f49 = 0;
6612855Sgabeblack@google.com    f50 = f51 = f52 = f53 = f54 = f55 = f56 = f57 = f58 = f59 = 0;
6712855Sgabeblack@google.com  }
6812855Sgabeblack@google.com
6912855Sgabeblack@google.com  sc_process_handle m1, m2, m3, m4, m5, m6;
7012855Sgabeblack@google.com  sc_signal<bool> clk, reset, sreset, areset;
7112855Sgabeblack@google.com  int count;
7212855Sgabeblack@google.com  int f0, f1, f2, f3, f4, f5, f6, f7, f8, f9;
7312855Sgabeblack@google.com  int f10, f11, f12, f13, f14, f15, f16, f17, f18, f19;
7412855Sgabeblack@google.com  int f20, f21, f22, f23, f24, f25, f26, f27, f28, f29;
7512855Sgabeblack@google.com  int f30, f31, f32, f33, f34, f35, f36, f37, f38, f39;
7612855Sgabeblack@google.com  int f40, f41, f42, f43, f44, f45, f46, f47, f48, f49;
7712855Sgabeblack@google.com  int f50, f51, f52, f53, f54, f55, f56, f57, f58, f59;
7812855Sgabeblack@google.com
7912855Sgabeblack@google.com  void ctrl()
8012855Sgabeblack@google.com  {
8112855Sgabeblack@google.com    count = 1;
8212855Sgabeblack@google.com    reset.write(false);
8312855Sgabeblack@google.com    sreset.write(false);
8412855Sgabeblack@google.com    areset.write(false);
8512855Sgabeblack@google.com    clk.write(false);
8612855Sgabeblack@google.com    wait(10, SC_NS);
8712855Sgabeblack@google.com
8812855Sgabeblack@google.com    count = 2;
8912855Sgabeblack@google.com    reset.write(true);
9012855Sgabeblack@google.com    wait(10, SC_NS);
9112855Sgabeblack@google.com
9212855Sgabeblack@google.com    count = 3;
9312855Sgabeblack@google.com    reset.write(false);
9412855Sgabeblack@google.com    wait(10, SC_NS);
9512855Sgabeblack@google.com
9612855Sgabeblack@google.com    count = 4;
9712855Sgabeblack@google.com    reset.write(true);
9812855Sgabeblack@google.com    wait(10, SC_NS);
9912855Sgabeblack@google.com
10012855Sgabeblack@google.com    count = 5;
10112855Sgabeblack@google.com    clk.write(true);
10212855Sgabeblack@google.com    wait(10, SC_NS);
10312855Sgabeblack@google.com
10412855Sgabeblack@google.com    count = 6;
10512855Sgabeblack@google.com    clk.write(false);
10612855Sgabeblack@google.com    wait(10, SC_NS);
10712855Sgabeblack@google.com
10812855Sgabeblack@google.com    count = 7;
10912855Sgabeblack@google.com    reset.write(false);
11012855Sgabeblack@google.com    wait(10, SC_NS);
11112855Sgabeblack@google.com
11212855Sgabeblack@google.com    count = 8;
11312855Sgabeblack@google.com    clk.write(true);
11412855Sgabeblack@google.com    wait(10, SC_NS);
11512855Sgabeblack@google.com
11612855Sgabeblack@google.com    count = 9;
11712855Sgabeblack@google.com    clk.write(false);
11812855Sgabeblack@google.com    wait(10, SC_NS);
11912855Sgabeblack@google.com
12012855Sgabeblack@google.com    count = 10;
12112855Sgabeblack@google.com    clk.write(true);
12212855Sgabeblack@google.com    wait(10, SC_NS);
12312855Sgabeblack@google.com
12412855Sgabeblack@google.com    count = 11;
12512855Sgabeblack@google.com    reset.write(true);
12612855Sgabeblack@google.com    wait(10, SC_NS);
12712855Sgabeblack@google.com
12812855Sgabeblack@google.com    count = 12;
12912855Sgabeblack@google.com    reset.write(false);
13012855Sgabeblack@google.com    wait(10, SC_NS);
13112855Sgabeblack@google.com
13212855Sgabeblack@google.com    count = 13;
13312855Sgabeblack@google.com    reset.write(true);
13412855Sgabeblack@google.com    wait(10, SC_NS);
13512855Sgabeblack@google.com
13612855Sgabeblack@google.com    count = 14;
13712855Sgabeblack@google.com    clk.write(false);
13812855Sgabeblack@google.com    wait(sc_time(200, SC_NS) - sc_time_stamp());
13912855Sgabeblack@google.com
14012855Sgabeblack@google.com    count = 15;
14112855Sgabeblack@google.com    clk.write(true);
14212855Sgabeblack@google.com    wait(10, SC_NS);
14312855Sgabeblack@google.com
14412855Sgabeblack@google.com    count = 16;
14512855Sgabeblack@google.com    clk.write(false);
14612855Sgabeblack@google.com    wait(10, SC_NS);
14712855Sgabeblack@google.com
14812855Sgabeblack@google.com    count = 17;
14912855Sgabeblack@google.com    clk.write(true);
15012855Sgabeblack@google.com    wait(10, SC_NS);
15112855Sgabeblack@google.com
15212855Sgabeblack@google.com    count = 18;
15312855Sgabeblack@google.com    reset.write(false);
15412855Sgabeblack@google.com    wait(10, SC_NS);
15512855Sgabeblack@google.com
15612855Sgabeblack@google.com    count = 19;
15712855Sgabeblack@google.com    reset.write(true);
15812855Sgabeblack@google.com    wait(10, SC_NS);
15912855Sgabeblack@google.com
16012855Sgabeblack@google.com    count = 20;
16112855Sgabeblack@google.com    reset.write(false);
16212855Sgabeblack@google.com    wait(10, SC_NS);
16312855Sgabeblack@google.com
16412855Sgabeblack@google.com    count = 21;
16512855Sgabeblack@google.com    clk.write(false);
16612855Sgabeblack@google.com    wait(sc_time(300, SC_NS) - sc_time_stamp());
16712855Sgabeblack@google.com
16812855Sgabeblack@google.com    count = 22;
16912855Sgabeblack@google.com    clk.write(true);
17012855Sgabeblack@google.com    wait(10, SC_NS);
17112855Sgabeblack@google.com
17212855Sgabeblack@google.com    count = 23;
17312855Sgabeblack@google.com    clk.write(false);
17412855Sgabeblack@google.com    m1.disable();
17512855Sgabeblack@google.com    m2.disable();
17612855Sgabeblack@google.com
17712855Sgabeblack@google.com    sc_spawn_options opt3;
17812855Sgabeblack@google.com    opt3.spawn_method();
17912855Sgabeblack@google.com    opt3.set_sensitivity( &clk.posedge_event() );
18012855Sgabeblack@google.com    opt3.reset_signal_is(sreset, true);
18112855Sgabeblack@google.com    opt3.async_reset_signal_is(areset, true);
18212855Sgabeblack@google.com    m3 = sc_spawn(sc_bind( &Top::spawned_method, this ), "m3", &opt3);
18312855Sgabeblack@google.com
18412855Sgabeblack@google.com    sc_spawn_options opt4;
18512855Sgabeblack@google.com    opt4.spawn_method();
18612855Sgabeblack@google.com    opt4.set_sensitivity( &m3.reset_event() );
18712855Sgabeblack@google.com    opt4.dont_initialize();
18812855Sgabeblack@google.com    m4 = sc_spawn(sc_bind( &Top::reset_handler, this), "m4", &opt4);
18912855Sgabeblack@google.com
19012855Sgabeblack@google.com    sc_spawn_options opt5;
19112855Sgabeblack@google.com    opt5.spawn_method();
19212855Sgabeblack@google.com    m5 = sc_spawn(sc_bind( &Top::reset_or_terminated_handler, this), "m5", &opt5);
19312855Sgabeblack@google.com
19412855Sgabeblack@google.com    std::vector<sc_event*> vec = this->get_child_events();
19512855Sgabeblack@google.com    sc_assert( vec.size() == 0 );
19612855Sgabeblack@google.com    wait(10, SC_NS);
19712855Sgabeblack@google.com
19812855Sgabeblack@google.com    m6 = sc_spawn(sc_bind( &Top::multiple_reset_handler, this) );
19912855Sgabeblack@google.com
20012855Sgabeblack@google.com    count = 24;
20112855Sgabeblack@google.com    clk.write(true);
20212855Sgabeblack@google.com    wait(10, SC_NS);
20312855Sgabeblack@google.com
20412855Sgabeblack@google.com    count = 25;
20512855Sgabeblack@google.com    clk.write(false);
20612855Sgabeblack@google.com    wait(10, SC_NS);
20712855Sgabeblack@google.com
20812855Sgabeblack@google.com    count = 26;
20912855Sgabeblack@google.com    sreset.write(true);
21012855Sgabeblack@google.com    wait(10, SC_NS);
21112855Sgabeblack@google.com
21212855Sgabeblack@google.com    count = 27;
21312855Sgabeblack@google.com    clk.write(true);
21412855Sgabeblack@google.com    wait(sc_time(500, SC_NS) - sc_time_stamp());
21512855Sgabeblack@google.com
21612855Sgabeblack@google.com    count = 28;
21712855Sgabeblack@google.com    clk.write(false);
21812855Sgabeblack@google.com    sreset.write(false);
21912855Sgabeblack@google.com    wait(10, SC_NS);
22012855Sgabeblack@google.com
22112855Sgabeblack@google.com    count = 29;
22212855Sgabeblack@google.com    m3.reset();
22312855Sgabeblack@google.com    wait(10, SC_NS);
22412855Sgabeblack@google.com
22512855Sgabeblack@google.com    count = 30;
22612855Sgabeblack@google.com    areset.write(true);
22712855Sgabeblack@google.com    wait(10, SC_NS);
22812855Sgabeblack@google.com
22912855Sgabeblack@google.com    count = 31;
23012855Sgabeblack@google.com    areset.write(false);
23112855Sgabeblack@google.com    wait(10, SC_NS);
23212855Sgabeblack@google.com
23312855Sgabeblack@google.com    count = 32;
23412855Sgabeblack@google.com    areset.write(true);
23512855Sgabeblack@google.com    wait(10, SC_NS);
23612855Sgabeblack@google.com
23712855Sgabeblack@google.com    count = 33;
23812855Sgabeblack@google.com    clk.write(true);
23912855Sgabeblack@google.com    wait(10, SC_NS);
24012855Sgabeblack@google.com
24112855Sgabeblack@google.com    count = 34;
24212855Sgabeblack@google.com    clk.write(false);
24312855Sgabeblack@google.com    wait(10, SC_NS);
24412855Sgabeblack@google.com
24512855Sgabeblack@google.com    count = 35;
24612855Sgabeblack@google.com    areset.write(false);
24712855Sgabeblack@google.com    wait(sc_time(600, SC_NS) - sc_time_stamp());
24812855Sgabeblack@google.com
24912855Sgabeblack@google.com    count = 36;
25012855Sgabeblack@google.com    m3.kill();
25112855Sgabeblack@google.com    wait(10, SC_NS);
25212855Sgabeblack@google.com
25312855Sgabeblack@google.com    count = 37;
25412855Sgabeblack@google.com    m1.reset();
25512855Sgabeblack@google.com    wait(10, SC_NS);
25612855Sgabeblack@google.com
25712855Sgabeblack@google.com    count = 38;
25812855Sgabeblack@google.com    m2.reset();
25912855Sgabeblack@google.com    wait(10, SC_NS);
26012855Sgabeblack@google.com
26112855Sgabeblack@google.com
26212855Sgabeblack@google.com  }
26312855Sgabeblack@google.com
26412855Sgabeblack@google.com  void method_sync_reset()
26512855Sgabeblack@google.com  {
26612855Sgabeblack@google.com    if (reset)
26712855Sgabeblack@google.com      switch (count)
26812855Sgabeblack@google.com      {
26912855Sgabeblack@google.com        case  5: sc_assert( sc_time_stamp() == sc_time( 40, SC_NS) ); f0=1; break;
27012855Sgabeblack@google.com        case 15: sc_assert( sc_time_stamp() == sc_time(200, SC_NS) ); f3=1; break;
27112855Sgabeblack@google.com        case 17: sc_assert( sc_time_stamp() == sc_time(220, SC_NS) ); f4=1; break;
27212855Sgabeblack@google.com        default: sc_assert( false );
27312855Sgabeblack@google.com      }
27412855Sgabeblack@google.com    else
27512855Sgabeblack@google.com      switch (count)
27612855Sgabeblack@google.com      {
27712855Sgabeblack@google.com        case  8: sc_assert( sc_time_stamp() == sc_time( 70, SC_NS) ); f1=1; break;
27812855Sgabeblack@google.com        case 10: sc_assert( sc_time_stamp() == sc_time( 90, SC_NS) ); f2=1; break;
27912855Sgabeblack@google.com        case 22: sc_assert( sc_time_stamp() == sc_time(300, SC_NS) ); f5=1; break;
28012855Sgabeblack@google.com        case 37: sc_assert( sc_time_stamp() == sc_time(610, SC_NS) ); f55=1; break;
28112855Sgabeblack@google.com        default: sc_assert( false );
28212855Sgabeblack@google.com      }
28312855Sgabeblack@google.com  }
28412855Sgabeblack@google.com
28512855Sgabeblack@google.com  void method_async_reset()
28612855Sgabeblack@google.com  {
28712855Sgabeblack@google.com    if (reset)
28812855Sgabeblack@google.com      switch (count)
28912855Sgabeblack@google.com      {
29012855Sgabeblack@google.com        case  2: sc_assert( sc_time_stamp() == sc_time( 10, SC_NS) ); f10=1; break;
29112855Sgabeblack@google.com        case  4: sc_assert( sc_time_stamp() == sc_time( 30, SC_NS) ); f11=1; break;
29212855Sgabeblack@google.com        case  5: sc_assert( sc_time_stamp() == sc_time( 40, SC_NS) ); f12=1; break;
29312855Sgabeblack@google.com        case 11: sc_assert( sc_time_stamp() == sc_time(100, SC_NS) ); f15=1; break;
29412855Sgabeblack@google.com        case 13: sc_assert( sc_time_stamp() == sc_time(120, SC_NS) ); f16=1; break;
29512855Sgabeblack@google.com        case 15: sc_assert( sc_time_stamp() == sc_time(200, SC_NS) ); f17=1; break;
29612855Sgabeblack@google.com        case 17: sc_assert( sc_time_stamp() == sc_time(220, SC_NS) ); f18=1; break;
29712855Sgabeblack@google.com        case 19: sc_assert( sc_time_stamp() == sc_time(240, SC_NS) ); f19=1; break;
29812855Sgabeblack@google.com        default: sc_assert( false );
29912855Sgabeblack@google.com      }
30012855Sgabeblack@google.com    else
30112855Sgabeblack@google.com      switch (count)
30212855Sgabeblack@google.com      {
30312855Sgabeblack@google.com        case  8: sc_assert( sc_time_stamp() == sc_time( 70, SC_NS) ); f13=1; break;
30412855Sgabeblack@google.com        case 10: sc_assert( sc_time_stamp() == sc_time( 90, SC_NS) ); f14=1; break;
30512855Sgabeblack@google.com        case 22: sc_assert( sc_time_stamp() == sc_time(300, SC_NS) ); f20=1; break;
30612855Sgabeblack@google.com        case 38: sc_assert( sc_time_stamp() == sc_time(620, SC_NS) ); f57=1; break;
30712855Sgabeblack@google.com        default: sc_assert( false );
30812855Sgabeblack@google.com      }
30912855Sgabeblack@google.com  }
31012855Sgabeblack@google.com
31112855Sgabeblack@google.com  void spawned_method()
31212855Sgabeblack@google.com  {
31312855Sgabeblack@google.com    switch (count)
31412855Sgabeblack@google.com    {
31512855Sgabeblack@google.com      case 23: sc_assert( sc_time_stamp() == sc_time(310, SC_NS) ); f30=1; break;
31612855Sgabeblack@google.com      case 24: sc_assert( sc_time_stamp() == sc_time(320, SC_NS) ); f31=1; break;
31712855Sgabeblack@google.com      case 27: sc_assert( sc_time_stamp() == sc_time(350, SC_NS) ); f32=1; break;
31812855Sgabeblack@google.com      case 29: sc_assert( sc_time_stamp() == sc_time(510, SC_NS) ); f34=1; break;
31912855Sgabeblack@google.com      case 30: sc_assert( sc_time_stamp() == sc_time(520, SC_NS) ); f36=1; break;
32012855Sgabeblack@google.com      case 32: sc_assert( sc_time_stamp() == sc_time(540, SC_NS) ); f38=1; break;
32112855Sgabeblack@google.com      case 33: sc_assert( sc_time_stamp() == sc_time(550, SC_NS) ); f40=1; break;
32212855Sgabeblack@google.com      default: sc_assert( false );
32312855Sgabeblack@google.com    }
32412855Sgabeblack@google.com  }
32512855Sgabeblack@google.com
32612855Sgabeblack@google.com  void reset_handler()
32712855Sgabeblack@google.com  {
32812855Sgabeblack@google.com    switch (count)
32912855Sgabeblack@google.com    {
33012855Sgabeblack@google.com      case 27: sc_assert( sc_time_stamp() == sc_time(350, SC_NS) ); f33=1; break;
33112855Sgabeblack@google.com      case 29: sc_assert( sc_time_stamp() == sc_time(510, SC_NS) ); f35=1; break;
33212855Sgabeblack@google.com      case 30: sc_assert( sc_time_stamp() == sc_time(520, SC_NS) ); f37=1; break;
33312855Sgabeblack@google.com      case 32: sc_assert( sc_time_stamp() == sc_time(540, SC_NS) ); f39=1; break;
33412855Sgabeblack@google.com      case 33: sc_assert( sc_time_stamp() == sc_time(550, SC_NS) ); f41=1; break;
33512855Sgabeblack@google.com      default: sc_assert( false );
33612855Sgabeblack@google.com    }
33712855Sgabeblack@google.com  }
33812855Sgabeblack@google.com
33912855Sgabeblack@google.com  sc_event_or_list event_list;
34012855Sgabeblack@google.com
34112855Sgabeblack@google.com  void reset_or_terminated_handler()
34212855Sgabeblack@google.com  {
34312855Sgabeblack@google.com    switch (count)
34412855Sgabeblack@google.com    {
34512855Sgabeblack@google.com      case 23: sc_assert( sc_time_stamp() == sc_time(310, SC_NS) ); f42=1; break;
34612855Sgabeblack@google.com      case 27: sc_assert( sc_time_stamp() == sc_time(350, SC_NS) ); f43=1; break;
34712855Sgabeblack@google.com      case 29: sc_assert( sc_time_stamp() == sc_time(510, SC_NS) ); f44=1; break;
34812855Sgabeblack@google.com      case 30: sc_assert( sc_time_stamp() == sc_time(520, SC_NS) ); f45=1; break;
34912855Sgabeblack@google.com      case 32: sc_assert( sc_time_stamp() == sc_time(540, SC_NS) ); f46=1; break;
35012855Sgabeblack@google.com      case 33: sc_assert( sc_time_stamp() == sc_time(550, SC_NS) ); f47=1; break;
35112855Sgabeblack@google.com      case 36: sc_assert( sc_time_stamp() == sc_time(600, SC_NS) ); f48=1; break;
35212855Sgabeblack@google.com      default: sc_assert( false );
35312855Sgabeblack@google.com    }
35412855Sgabeblack@google.com    event_list = m3.reset_event() | m3.terminated_event();
35512855Sgabeblack@google.com    next_trigger(event_list);
35612855Sgabeblack@google.com  }
35712855Sgabeblack@google.com
35812855Sgabeblack@google.com  void multiple_reset_handler()
35912855Sgabeblack@google.com  {
36012855Sgabeblack@google.com    sc_event_or_list or_list;
36112855Sgabeblack@google.com    or_list |= m1.reset_event();
36212855Sgabeblack@google.com    or_list |= m2.reset_event();
36312855Sgabeblack@google.com    or_list |= m3.reset_event();
36412855Sgabeblack@google.com    or_list |= m4.reset_event();
36512855Sgabeblack@google.com    or_list |= m5.reset_event();
36612855Sgabeblack@google.com
36712855Sgabeblack@google.com    while (true)
36812855Sgabeblack@google.com    {
36912855Sgabeblack@google.com      wait(or_list);
37012855Sgabeblack@google.com      switch (count)
37112855Sgabeblack@google.com      {
37212855Sgabeblack@google.com        case 27: sc_assert( sc_time_stamp() == sc_time(350, SC_NS) ); f50=1; break;
37312855Sgabeblack@google.com        case 29: sc_assert( sc_time_stamp() == sc_time(510, SC_NS) ); f51=1; break;
37412855Sgabeblack@google.com        case 30: sc_assert( sc_time_stamp() == sc_time(520, SC_NS) ); f52=1; break;
37512855Sgabeblack@google.com        case 32: sc_assert( sc_time_stamp() == sc_time(540, SC_NS) ); f53=1; break;
37612855Sgabeblack@google.com        case 33: sc_assert( sc_time_stamp() == sc_time(550, SC_NS) ); f54=1; break;
37712855Sgabeblack@google.com        case 37: sc_assert( sc_time_stamp() == sc_time(610, SC_NS) ); f56=1; break;
37812855Sgabeblack@google.com        case 38: sc_assert( sc_time_stamp() == sc_time(620, SC_NS) ); f58=1; break;
37912855Sgabeblack@google.com        default: sc_assert( false );
38012855Sgabeblack@google.com      }
38112855Sgabeblack@google.com    }
38212855Sgabeblack@google.com  }
38312855Sgabeblack@google.com
38412855Sgabeblack@google.com  SC_HAS_PROCESS(Top);
38512855Sgabeblack@google.com};
38612855Sgabeblack@google.com
38712855Sgabeblack@google.comint sc_main(int argc, char* argv[])
38812855Sgabeblack@google.com{
38912855Sgabeblack@google.com  sc_allow_process_control_corners = true; // Andy's hack to switch on async_reset with method
39012855Sgabeblack@google.com
39112855Sgabeblack@google.com  Top top("top");
39212855Sgabeblack@google.com
39312855Sgabeblack@google.com  sc_start();
39412855Sgabeblack@google.com
39512855Sgabeblack@google.com  sc_assert( top.f0 );
39612855Sgabeblack@google.com  sc_assert( top.f1 );
39712855Sgabeblack@google.com  sc_assert( top.f2 );
39812855Sgabeblack@google.com  sc_assert( top.f3 );
39912855Sgabeblack@google.com  sc_assert( top.f4 );
40012855Sgabeblack@google.com  sc_assert( top.f5 );
40112855Sgabeblack@google.com  sc_assert( top.f10 );
40212855Sgabeblack@google.com  sc_assert( top.f11 );
40312855Sgabeblack@google.com  sc_assert( top.f12 );
40412855Sgabeblack@google.com  sc_assert( top.f13 );
40512855Sgabeblack@google.com  sc_assert( top.f14 );
40612855Sgabeblack@google.com  sc_assert( top.f15 );
40712855Sgabeblack@google.com  sc_assert( top.f16 );
40812855Sgabeblack@google.com  sc_assert( top.f17 );
40912855Sgabeblack@google.com  sc_assert( top.f18 );
41012855Sgabeblack@google.com  sc_assert( top.f19 );
41112855Sgabeblack@google.com  sc_assert( top.f20 );
41212855Sgabeblack@google.com
41312855Sgabeblack@google.com  sc_assert( top.f30 );
41412855Sgabeblack@google.com  sc_assert( top.f31 );
41512855Sgabeblack@google.com  sc_assert( top.f32 );
41612855Sgabeblack@google.com  sc_assert( top.f33 );
41712855Sgabeblack@google.com  sc_assert( top.f34 );
41812855Sgabeblack@google.com  sc_assert( top.f35 );
41912855Sgabeblack@google.com  sc_assert( top.f36 );
42012855Sgabeblack@google.com  sc_assert( top.f37 );
42112855Sgabeblack@google.com  sc_assert( top.f38 );
42212855Sgabeblack@google.com  sc_assert( top.f39 );
42312855Sgabeblack@google.com  sc_assert( top.f40 );
42412855Sgabeblack@google.com  sc_assert( top.f41 );
42512855Sgabeblack@google.com  sc_assert( top.f42 );
42612855Sgabeblack@google.com  sc_assert( top.f43 );
42712855Sgabeblack@google.com  sc_assert( top.f44 );
42812855Sgabeblack@google.com  sc_assert( top.f45 );
42912855Sgabeblack@google.com  sc_assert( top.f46 );
43012855Sgabeblack@google.com  sc_assert( top.f47 );
43112855Sgabeblack@google.com  sc_assert( top.f48 );
43212855Sgabeblack@google.com
43312855Sgabeblack@google.com  sc_assert( top.f50 );
43412855Sgabeblack@google.com  sc_assert( top.f51 );
43512855Sgabeblack@google.com  sc_assert( top.f52 );
43612855Sgabeblack@google.com  sc_assert( top.f53 );
43712855Sgabeblack@google.com  sc_assert( top.f54 );
43812855Sgabeblack@google.com  sc_assert( top.f55 );
43912855Sgabeblack@google.com  sc_assert( top.f56 );
44012855Sgabeblack@google.com  sc_assert( top.f57 );
44112855Sgabeblack@google.com  sc_assert( top.f58 );
44212855Sgabeblack@google.com
44312855Sgabeblack@google.com  cout << endl << "Success" << endl;
44412855Sgabeblack@google.com  return 0;
44512855Sgabeblack@google.com}
44612855Sgabeblack@google.com
447