datatypes.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  datatypes.cpp --
23
24  Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-30
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
39#include "datatypes.h"
40
41void datatypes::entry()
42
43{
44  sc_bigint<8>    tmp1;
45  sc_bigint<8>    tmp1r;
46  sc_biguint<8>   tmp2;
47  sc_biguint<8>   tmp2r;
48  long            tmp3;
49  long            tmp3r;
50  int             tmp4;
51  int             tmp4r;
52  short           tmp5;
53  short           tmp5r;
54  char            tmp6;
55  char            tmp6r;
56
57// define 1 dimensional array
58   int  tmp7[2];
59   char tmp8[2];
60
61// reset_loop
62  if (reset.read() == true) {
63    out_valid.write(false);
64    out_ack.write(false);
65    wait();
66  } else wait();
67
68//
69// main loop
70//
71// initialization of sc_array
72
73   tmp7[0] = 12;
74   tmp7[1] = 0;
75   tmp8[1] = 'G';
76
77
78 while(1) {
79    while(in_valid.read()==false) wait();
80
81    //reading the inputs
82    tmp1 = in_value1.read();
83    tmp2 = in_value2.read();
84    tmp3 = in_value3.read();
85    tmp4 = in_value4.read();
86    tmp5 = in_value5.read();
87    tmp6 = in_value6.read();
88    tmp8[0] = in_value7.read();
89
90    out_ack.write(true);
91
92    //execute mixed data type or operations
93
94    // signed(8) <- signed(8) & unsigned(8)
95    tmp1r = tmp1 | tmp2;
96    // unsigned(8) <- char & long
97    tmp2r = tmp6 | tmp3;
98    // long <- int & char
99    tmp3r = tmp4 | tmp6;
100    // int <- int & short
101    tmp4r = tmp4 | tmp5;
102    // short <- short & const
103    tmp5r = tmp5 | 5;
104    // char <- char_array[0] & int_array[1]
105    tmp6r = tmp8[0] | tmp7[1];
106
107    //write outputs
108    out_value1.write(tmp1r);
109    out_value2.write(tmp2r);
110    out_value3.write(tmp3r);
111    out_value4.write(tmp4r);
112    out_value5.write(tmp5r);
113    out_value6.write(tmp6r);
114    out_valid.write(true);
115    wait();
116    out_ack.write(false);
117    out_valid.write(false);
118
119 }
120
121} // End
122
123
124