datatypes.cpp revision 12855
18504SN/A/*****************************************************************************
28504SN/A
38504SN/A  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
49988Snilay@cs.wisc.edu  more contributor license agreements.  See the NOTICE file distributed
58825Snilay@cs.wisc.edu  with this work for additional information regarding copyright ownership.
69988Snilay@cs.wisc.edu  Accellera licenses this file to you under the Apache License, Version 2.0
78504SN/A  (the "License"); you may not use this file except in compliance with the
88504SN/A  License.  You may obtain a copy of the License at
98504SN/A
108504SN/A    http://www.apache.org/licenses/LICENSE-2.0
118504SN/A
128504SN/A  Unless required by applicable law or agreed to in writing, software
1310315Snilay@cs.wisc.edu  distributed under the License is distributed on an "AS IS" BASIS,
148504SN/A  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
158504SN/A  implied.  See the License for the specific language governing
169885Sstever@gmail.com  permissions and limitations under the License.
179885Sstever@gmail.com
188504SN/A *****************************************************************************/
199988Snilay@cs.wisc.edu
208504SN/A/*****************************************************************************
218504SN/A
228504SN/A  datatypes.cpp --
2310513SAli.Saidi@ARM.com
2410315Snilay@cs.wisc.edu  Original Author: Rocco Jonack, Synopsys, Inc., 1999-12-10
258504SN/A
2610242Ssteve.reinhardt@amd.com *****************************************************************************/
278504SN/A
289449SAli.Saidi@ARM.com/*****************************************************************************
298504SN/A
308673SN/A  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
3110513SAli.Saidi@ARM.com  changes you are making here.
328504SN/A
338504SN/A      Name, Affiliation, Date:
348504SN/A  Description of Modification:
358504SN/A
368504SN/A *****************************************************************************/
378504SN/A
388504SN/A
398504SN/A#include "datatypes.h"
408504SN/A
418963Sgblack@eecs.umich.eduvoid datatypes::entry(){
428504SN/A
438504SN/A  sc_biguint<2>     tmp1;
448504SN/A  sc_bigint<2>      tmp2;
458504SN/A  sc_biguint<3>     tmp3;
469988Snilay@cs.wisc.edu  sc_bigint<3>      tmp4;
478504SN/A  sc_biguint<2>     tmp1r;
488504SN/A  sc_bigint<2>      tmp2r;
498504SN/A  sc_biguint<3>     tmp3r;
508504SN/A  sc_bigint<3>      tmp4r;
518504SN/A
528504SN/A  // reset_loop
538504SN/A    out_valid.write(false);
548504SN/A    out_ack.write(false);
558504SN/A    wait();
568504SN/A
579988Snilay@cs.wisc.edu  //
588504SN/A  // main loop
598504SN/A  //
608504SN/A
618504SN/A  while(1) {
628835SAli.Saidi@ARM.com    //input handshake
638835SAli.Saidi@ARM.com    while(in_valid.read()==false) wait();
649885Sstever@gmail.com
658835SAli.Saidi@ARM.com    //reading the inputs
669988Snilay@cs.wisc.edu    tmp1 = in_value1.read();
678835SAli.Saidi@ARM.com    tmp2 = in_value2.read();
688835SAli.Saidi@ARM.com    tmp3 = in_value3.read();
698835SAli.Saidi@ARM.com    tmp4 = in_value4.read();
708963Sgblack@eecs.umich.edu
718963Sgblack@eecs.umich.edu    // input handshake
728835SAli.Saidi@ARM.com    out_ack.write(true);
738504SN/A
748504SN/A    //execute datatypes operations
759885Sstever@gmail.com    // unsigned(2) <- signed(3)/unsigned(2)
768504SN/A    tmp1r = tmp4 / tmp1;
779988Snilay@cs.wisc.edu    // signed(2) <-  unsigned(2)/signed(3)
7810451Snilay@cs.wisc.edu    tmp2r = tmp1 / tmp4;
798721SN/A    // unsigned(3) <- unsigned(3)/unsigned(2)
808721SN/A    tmp3r = tmp3 / tmp1;
818963Sgblack@eecs.umich.edu    // signed(3) <- signed(3)/signed(2)
829885Sstever@gmail.com    tmp4r = tmp4 / tmp2;
839885Sstever@gmail.com
849885Sstever@gmail.com    // write outputs
859885Sstever@gmail.com    out_value1.write(tmp1r);
869885Sstever@gmail.com    out_value2.write(tmp2r);
8710315Snilay@cs.wisc.edu    out_value3.write(tmp3r);
889988Snilay@cs.wisc.edu    out_value4.write(tmp4r);
8910315Snilay@cs.wisc.edu
909885Sstever@gmail.com    //output handshake
918504SN/A    out_valid.write(true);
928504SN/A    wait();
938504SN/A
949885Sstever@gmail.com    //input handshake
958504SN/A    out_ack.write(false);
968504SN/A
978504SN/A    //output handshake
988504SN/A    out_valid.write(false);
998504SN/A    wait();
1008504SN/A  }
1018504SN/A}
1028504SN/A
1039481Snilay@cs.wisc.edu// EOF
1048504SN/A
1058504SN/A
1069885Sstever@gmail.com