datawidth.cpp revision 12855
12131SN/A/*****************************************************************************
25268Sksewell@umich.edu
35224Sksewell@umich.edu  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
45224Sksewell@umich.edu  more contributor license agreements.  See the NOTICE file distributed
52131SN/A  with this work for additional information regarding copyright ownership.
65224Sksewell@umich.edu  Accellera licenses this file to you under the Apache License, Version 2.0
75224Sksewell@umich.edu  (the "License"); you may not use this file except in compliance with the
85224Sksewell@umich.edu  License.  You may obtain a copy of the License at
95224Sksewell@umich.edu
105224Sksewell@umich.edu    http://www.apache.org/licenses/LICENSE-2.0
115224Sksewell@umich.edu
125224Sksewell@umich.edu  Unless required by applicable law or agreed to in writing, software
135224Sksewell@umich.edu  distributed under the License is distributed on an "AS IS" BASIS,
145224Sksewell@umich.edu  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
155224Sksewell@umich.edu  implied.  See the License for the specific language governing
162131SN/A  permissions and limitations under the License.
175224Sksewell@umich.edu
185224Sksewell@umich.edu *****************************************************************************/
195224Sksewell@umich.edu
205224Sksewell@umich.edu/*****************************************************************************
215224Sksewell@umich.edu
225224Sksewell@umich.edu  datawidth.cpp --
235224Sksewell@umich.edu
245224Sksewell@umich.edu  Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
255224Sksewell@umich.edu
265224Sksewell@umich.edu *****************************************************************************/
275224Sksewell@umich.edu
282665Ssaidi@eecs.umich.edu/*****************************************************************************
295224Sksewell@umich.edu
305224Sksewell@umich.edu  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
315222Sksewell@umich.edu  changes you are making here.
328696Sguodeyuan@tsinghua.org.cn
338696Sguodeyuan@tsinghua.org.cn      Name, Affiliation, Date:
342131SN/A  Description of Modification:
352131SN/A
362239SN/A *****************************************************************************/
372239SN/A
382131SN/A                /*******************************************/
398575Sgblack@eecs.umich.edu                /* Implementation Filename:  datawidth.cc  */
408575Sgblack@eecs.umich.edu                /*******************************************/
418575Sgblack@eecs.umich.edu
422131SN/A#include "datawidth.h"
438738Sgblack@eecs.umich.edu
442447SN/Avoid
452447SN/Adatawidth::entry()
462447SN/A{
476378Sgblack@eecs.umich.edu  sc_unsigned   tmp_a (in1_width);
4811294Sandreas.hansson@arm.com  sc_unsigned   tmp_b (in2_width);
492131SN/A  sc_unsigned   tmp_result (result_width);
508578Sgblack@eecs.umich.edu
518578Sgblack@eecs.umich.edu  while (true) {
528578Sgblack@eecs.umich.edu
538578Sgblack@eecs.umich.edu    // HANDSHAKING
548578Sgblack@eecs.umich.edu    do { wait(); } while (ready != 1);
558578Sgblack@eecs.umich.edu
568578Sgblack@eecs.umich.edu    // COMPUTATION
578578Sgblack@eecs.umich.edu    tmp_a = in1.read();
588578Sgblack@eecs.umich.edu    tmp_b = in2.read();
598578Sgblack@eecs.umich.edu    tmp_result = tmp_a + tmp_b;
608578Sgblack@eecs.umich.edu
618578Sgblack@eecs.umich.edu    // WRITE OUTPUT
628578Sgblack@eecs.umich.edu    result.write(tmp_result);		// result = in1 + in2
638578Sgblack@eecs.umich.edu    wait();
648578Sgblack@eecs.umich.edu  }
658578Sgblack@eecs.umich.edu}
668578Sgblack@eecs.umich.edu