datawidth.cpp revision 12855:588919e0e4aa
113540Sandrea.mondelli@ucf.edu/*****************************************************************************
210235Syasuko.eckert@amd.com
310235Syasuko.eckert@amd.com  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
410235Syasuko.eckert@amd.com  more contributor license agreements.  See the NOTICE file distributed
510235Syasuko.eckert@amd.com  with this work for additional information regarding copyright ownership.
610235Syasuko.eckert@amd.com  Accellera licenses this file to you under the Apache License, Version 2.0
710235Syasuko.eckert@amd.com  (the "License"); you may not use this file except in compliance with the
810235Syasuko.eckert@amd.com  License.  You may obtain a copy of the License at
910235Syasuko.eckert@amd.com
1010235Syasuko.eckert@amd.com    http://www.apache.org/licenses/LICENSE-2.0
1110235Syasuko.eckert@amd.com
1210235Syasuko.eckert@amd.com  Unless required by applicable law or agreed to in writing, software
1310235Syasuko.eckert@amd.com  distributed under the License is distributed on an "AS IS" BASIS,
1410235Syasuko.eckert@amd.com  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1510235Syasuko.eckert@amd.com  implied.  See the License for the specific language governing
1610235Syasuko.eckert@amd.com  permissions and limitations under the License.
1710235Syasuko.eckert@amd.com
1810235Syasuko.eckert@amd.com *****************************************************************************/
1910235Syasuko.eckert@amd.com
2010235Syasuko.eckert@amd.com/*****************************************************************************
2110235Syasuko.eckert@amd.com
2210235Syasuko.eckert@amd.com  datawidth.cpp --
2310235Syasuko.eckert@amd.com
2410235Syasuko.eckert@amd.com  Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
2510235Syasuko.eckert@amd.com
2610235Syasuko.eckert@amd.com *****************************************************************************/
2710235Syasuko.eckert@amd.com
2810235Syasuko.eckert@amd.com/*****************************************************************************
2910235Syasuko.eckert@amd.com
3010235Syasuko.eckert@amd.com  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
3110235Syasuko.eckert@amd.com  changes you are making here.
3210235Syasuko.eckert@amd.com
3310235Syasuko.eckert@amd.com      Name, Affiliation, Date:
3410235Syasuko.eckert@amd.com  Description of Modification:
3510235Syasuko.eckert@amd.com
3610235Syasuko.eckert@amd.com *****************************************************************************/
3710235Syasuko.eckert@amd.com
3810235Syasuko.eckert@amd.com                /*******************************************/
3910235Syasuko.eckert@amd.com                /* Implementation Filename:  datawidth.cc  */
4010235Syasuko.eckert@amd.com                /*******************************************/
4110235Syasuko.eckert@amd.com
4210235Syasuko.eckert@amd.com#include "datawidth.h"
4310235Syasuko.eckert@amd.com
4410235Syasuko.eckert@amd.comvoid
4510235Syasuko.eckert@amd.comdatawidth::entry()
4610235Syasuko.eckert@amd.com{
4710235Syasuko.eckert@amd.com  sc_signed   tmp_a (in1_width);
4810235Syasuko.eckert@amd.com  sc_signed   tmp_b (in2_width);
4910235Syasuko.eckert@amd.com  sc_signed   tmp_result (result_width);
5010235Syasuko.eckert@amd.com
5110235Syasuko.eckert@amd.com  while (true) {
5210235Syasuko.eckert@amd.com
5310235Syasuko.eckert@amd.com    // HANDSHAKING
5410235Syasuko.eckert@amd.com    do { wait(); } while (ready != 1);
5510235Syasuko.eckert@amd.com
5610235Syasuko.eckert@amd.com    // COMPUTATION
5710235Syasuko.eckert@amd.com    tmp_a = in1.read();
5810235Syasuko.eckert@amd.com    tmp_b = in2.read();
5910235Syasuko.eckert@amd.com    tmp_result = tmp_a + tmp_b;
6010235Syasuko.eckert@amd.com
6110235Syasuko.eckert@amd.com    // WRITE OUTPUT
6210235Syasuko.eckert@amd.com    result.write(tmp_result);		// result = in1 + in2
6310235Syasuko.eckert@amd.com    wait();
6410235Syasuko.eckert@amd.com  }
6510235Syasuko.eckert@amd.com}
6610235Syasuko.eckert@amd.com