star102573.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  star102573.cpp --
23
24  Original Author: Preeti Panda, Synopsys, Inc., 2000-08-09
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#include <systemc.h>
39#include "for_nest.h"
40
41#define max  5
42#define max1 4
43#define max2 3
44#define max3 2
45
46void for_nest::entry()
47{
48
49  sc_signed tmp2(2);
50  sc_signed tmp4(4);
51  sc_signed tmp8(8);
52  sc_signed tmp6(6);
53
54  int i, j,  inp_tmp;
55
56  result.write(0);
57  out_valid.write(false);
58  wait();
59
60  main_loop:while(1) {
61
62    while (in_valid.read()==false) wait();
63    out_valid.write(true);
64    wait();
65    /* unrolled loop inside rolled loop */
66    loop1:for (i=1; i<=max; i++)  {
67      tmp2    = in_value.read();
68      inp_tmp = tmp2.to_int() +  i ;
69      loop2:for (j=1; j<=max1; j++)
70	     inp_tmp = inp_tmp - tmp2.to_int() ;
71      result.write(inp_tmp);
72      wait();
73    };
74    out_valid.write(false);
75    wait();
76    out_valid.write(true);
77    wait();
78
79    inp_tmp = in_value.read();
80    wait();
81    /* unrolled loop inside unrolled loop */
82    loop3:for (i=1; i<=max2; i++)  {
83      inp_tmp += i ;
84      loop4:for (j=1; j<=max3; j++) {
85	inp_tmp -= j ;
86      }
87    };
88    result.write(inp_tmp);
89    out_valid.write(false);
90    wait();
91    out_valid.write(true);
92    wait();
93
94  }
95}
96
97