112855Sgabeblack@google.com/*****************************************************************************
212855Sgabeblack@google.com
312855Sgabeblack@google.com  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
412855Sgabeblack@google.com  more contributor license agreements.  See the NOTICE file distributed
512855Sgabeblack@google.com  with this work for additional information regarding copyright ownership.
612855Sgabeblack@google.com  Accellera licenses this file to you under the Apache License, Version 2.0
712855Sgabeblack@google.com  (the "License"); you may not use this file except in compliance with the
812855Sgabeblack@google.com  License.  You may obtain a copy of the License at
912855Sgabeblack@google.com
1012855Sgabeblack@google.com    http://www.apache.org/licenses/LICENSE-2.0
1112855Sgabeblack@google.com
1212855Sgabeblack@google.com  Unless required by applicable law or agreed to in writing, software
1312855Sgabeblack@google.com  distributed under the License is distributed on an "AS IS" BASIS,
1412855Sgabeblack@google.com  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1512855Sgabeblack@google.com  implied.  See the License for the specific language governing
1612855Sgabeblack@google.com  permissions and limitations under the License.
1712855Sgabeblack@google.com
1812855Sgabeblack@google.com *****************************************************************************/
1912855Sgabeblack@google.com
2012855Sgabeblack@google.com/*****************************************************************************
2112855Sgabeblack@google.com
2212855Sgabeblack@google.com  std_ulogic_vector_datatype.cpp --
2312855Sgabeblack@google.com
2412855Sgabeblack@google.com  Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
2512855Sgabeblack@google.com
2612855Sgabeblack@google.com *****************************************************************************/
2712855Sgabeblack@google.com
2812855Sgabeblack@google.com/*****************************************************************************
2912855Sgabeblack@google.com
3012855Sgabeblack@google.com  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
3112855Sgabeblack@google.com  changes you are making here.
3212855Sgabeblack@google.com
3312855Sgabeblack@google.com      Name, Affiliation, Date:
3412855Sgabeblack@google.com  Description of Modification:
3512855Sgabeblack@google.com
3612855Sgabeblack@google.com *****************************************************************************/
3712855Sgabeblack@google.com
3812855Sgabeblack@google.com/* Main file for "std_ulogic_vector" data type */
3912855Sgabeblack@google.com
4012855Sgabeblack@google.com#include "systemc.h"
4112855Sgabeblack@google.com
4212855Sgabeblack@google.comtypedef sc_logic std_ulogic;
4312855Sgabeblack@google.com
4412855Sgabeblack@google.com#define std_ulogic_vector sc_lv
4512855Sgabeblack@google.com#define bool_vector       sc_bv
4612855Sgabeblack@google.com
4712855Sgabeblack@google.comint sc_main(int ac, char *av[])
4812855Sgabeblack@google.com{
4912855Sgabeblack@google.com
5012855Sgabeblack@google.com// 0. SIZE OF TYPES
5112855Sgabeblack@google.com  int 		integer;
5212855Sgabeblack@google.com  short		short_integer;
5312855Sgabeblack@google.com  long		long_integer;
5412855Sgabeblack@google.com  unsigned long	unsigned_long;
5512855Sgabeblack@google.com  signed long	signed_long;
5612855Sgabeblack@google.com
5712855Sgabeblack@google.com  cout << "\nINTEGER SIZE \t\t= " 	<< sizeof integer	<< " bytes"
5812855Sgabeblack@google.com       << "\nSHORT INTEGER SIZE \t= " 	<< sizeof short_integer	<< " bytes"
5912855Sgabeblack@google.com       << "\nLONG INTEGER SIZE \t= " 	<< sizeof long_integer	<< " bytes"
6012855Sgabeblack@google.com       << "\nUNSIGNED LONG SIZE \t= " 	<< sizeof unsigned_long	<< " bytes"
6112855Sgabeblack@google.com       << "\nSIGNED LONG SIZE \t= " 	<< sizeof signed_long	<< " bytes"
6212855Sgabeblack@google.com       << "\n" << endl;
6312855Sgabeblack@google.com
6412855Sgabeblack@google.com// 1. DECLARATION SYNTAX
6512855Sgabeblack@google.com  std_ulogic_vector<9>		a;
6612855Sgabeblack@google.com  std_ulogic_vector<9>		b;
6712855Sgabeblack@google.com  std_ulogic_vector<68>		big;
6812855Sgabeblack@google.com  std_ulogic_vector<1284>	huge_;
6912855Sgabeblack@google.com
7012855Sgabeblack@google.com// 2. TYPE CONVERSION
7112855Sgabeblack@google.com
7212855Sgabeblack@google.com  // std_ulogic_vector <- C++ string
7312855Sgabeblack@google.com  a = "01XZUWLH-";
7412855Sgabeblack@google.com  b = "ZZ1XX0UU1WWW";
7512855Sgabeblack@google.com  big = "11110000111100001111000011110000111100001111000011110000111100001111";
7612855Sgabeblack@google.com  huge_ = "111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111000011110000111100001111";
7712855Sgabeblack@google.com
7812855Sgabeblack@google.com  cout 	<< "std_ulogic_vector \t<=\t C++ string"
7912855Sgabeblack@google.com	<< "\n-------------------------------------------"
8012855Sgabeblack@google.com	<< "\nA = " << a << "\t\t \"01XZUWLH-\" "
8112855Sgabeblack@google.com	<< "\nB = " << b << "\t\t \"ZZ1XX0UU1WWW\" "
8212855Sgabeblack@google.com	<< "\nBIG  = " << big << "\n      "
8312855Sgabeblack@google.com  <<"\"11110000111100001111000011110000111100001111000011110000111100001111\""
8412855Sgabeblack@google.com	<< "\nHUGE = " << huge_.range(0,63) << "\n       "
8512855Sgabeblack@google.com		       << huge_.range(64,127) << "\n       "
8612855Sgabeblack@google.com		       << huge_.range(128,191) << "\n       "
8712855Sgabeblack@google.com		       << huge_.range(192,255) << "\n       "
8812855Sgabeblack@google.com		       << huge_.range(256,319) << "\n       "
8912855Sgabeblack@google.com		       << huge_.range(320,383) << "\n       "
9012855Sgabeblack@google.com		       << huge_.range(384,447) << "\n       "
9112855Sgabeblack@google.com		       << huge_.range(448,511) << "\n       "
9212855Sgabeblack@google.com		       << huge_.range(512,575) << "\n       "
9312855Sgabeblack@google.com		       << huge_.range(576,639) << "\n       "
9412855Sgabeblack@google.com		       << huge_.range(640,703) << "\n       "
9512855Sgabeblack@google.com		       << huge_.range(704,767) << "\n       "
9612855Sgabeblack@google.com		       << huge_.range(768,831) << "\n       "
9712855Sgabeblack@google.com		       << huge_.range(832,895) << "\n       "
9812855Sgabeblack@google.com		       << huge_.range(896,959) << "\n       "
9912855Sgabeblack@google.com		       << huge_.range(960,1023) << "\n       "
10012855Sgabeblack@google.com		       << huge_.range(1024,1087) << "\n       "
10112855Sgabeblack@google.com		       << huge_.range(1088,1151) << "\n       "
10212855Sgabeblack@google.com		       << huge_.range(1152,1215) << "\n       "
10312855Sgabeblack@google.com		       << huge_.range(1216,1279) << "\n       "
10412855Sgabeblack@google.com		       << huge_.range(1280,1283)
10512855Sgabeblack@google.com	<< "\n" << endl;
10612855Sgabeblack@google.com
10712855Sgabeblack@google.com  // std_ulogic_vector <- std_ulogic_vector
10812855Sgabeblack@google.com  std_ulogic_vector<9>	c;
10912855Sgabeblack@google.com  std_ulogic_vector<68>	big2;
11012855Sgabeblack@google.com
11112855Sgabeblack@google.com  c = b;
11212855Sgabeblack@google.com  big2 = big;
11312855Sgabeblack@google.com
11412855Sgabeblack@google.com  cout 	<< "std_ulogic_vector \t<=\t std_ulogic_vector"
11512855Sgabeblack@google.com	<< "\n--------------------------------------------------"
11612855Sgabeblack@google.com	<< "\nC = " << c << "\t\t ZZ1XX0XX1XXX"
11712855Sgabeblack@google.com	<< "\nBIG2 = " << big2 << "\n      "
11812855Sgabeblack@google.com  <<"\"11110000111100001111000011110000111100001111000011110000111100001111\""
11912855Sgabeblack@google.com	<< "\n" << endl;
12012855Sgabeblack@google.com
12112855Sgabeblack@google.com  // std_ulogic_vector <- C++ array of std_ulogic
12212855Sgabeblack@google.com  std_ulogic_vector<9>	d;
12312855Sgabeblack@google.com  std_ulogic_vector<9>	e;
12412855Sgabeblack@google.com  std_ulogic_vector<68>	big3;
12512855Sgabeblack@google.com  std_ulogic	cb1[9]  = { sc_logic( 'U' ), sc_logic( 0 )  , sc_logic( 1 ),
12612855Sgabeblack@google.com                            sc_logic( 'X' ), sc_logic( 'Z' ), sc_logic( 'W' ),
12712855Sgabeblack@google.com                            sc_logic( 'H' ), sc_logic( 'L' ), sc_logic( '-' ) };
12812855Sgabeblack@google.com  std_ulogic	cb2[12] = { sc_logic( 'U' ), sc_logic( 'U' ), sc_logic( 'X' ),
12912855Sgabeblack@google.com                            sc_logic( 'X' ), sc_logic( 1 )  , sc_logic( 1 ),
13012855Sgabeblack@google.com                            sc_logic( 0 )  , sc_logic( 0 )  , sc_logic( 1 ),
13112855Sgabeblack@google.com                            sc_logic( 1 )  , sc_logic( 'X' ), sc_logic( 'X' ) };
13212855Sgabeblack@google.com  std_ulogic	cb3[80] = { sc_logic( 1 ), sc_logic( 1 ), sc_logic( 1 ),
13312855Sgabeblack@google.com                            sc_logic( 1 ), sc_logic( 0 ), sc_logic( 0 ),
13412855Sgabeblack@google.com                            sc_logic( 0 ), sc_logic( 0 ), sc_logic( 1 ),
13512855Sgabeblack@google.com                            sc_logic( 1 ), sc_logic( 1 ), sc_logic( 1 ),
13612855Sgabeblack@google.com                            sc_logic( 0 ), sc_logic( 0 ), sc_logic( 0 ),
13712855Sgabeblack@google.com                            sc_logic( 0 ), sc_logic( 1 ), sc_logic( 1 ),
13812855Sgabeblack@google.com                            sc_logic( 1 ), sc_logic( 1 ), sc_logic( 0 ),
13912855Sgabeblack@google.com                            sc_logic( 0 ), sc_logic( 0 ), sc_logic( 0 ),
14012855Sgabeblack@google.com                            sc_logic( 1 ), sc_logic( 1 ), sc_logic( 1 ),
14112855Sgabeblack@google.com                            sc_logic( 1 ), sc_logic( 0 ), sc_logic( 0 ),
14212855Sgabeblack@google.com                            sc_logic( 0 ), sc_logic( 0 ), sc_logic( 1 ),
14312855Sgabeblack@google.com                            sc_logic( 1 ), sc_logic( 1 ), sc_logic( 1 ),
14412855Sgabeblack@google.com                            sc_logic( 0 ), sc_logic( 0 ), sc_logic( 0 ),
14512855Sgabeblack@google.com                            sc_logic( 0 ), sc_logic( 1 ), sc_logic( 1 ),
14612855Sgabeblack@google.com                            sc_logic( 1 ), sc_logic( 1 ), sc_logic( 0 ),
14712855Sgabeblack@google.com                            sc_logic( 0 ), sc_logic( 0 ), sc_logic( 0 ),
14812855Sgabeblack@google.com                            sc_logic( 1 ), sc_logic( 1 ), sc_logic( 1 ),
14912855Sgabeblack@google.com                            sc_logic( 1 ), sc_logic( 0 ), sc_logic( 0 ),
15012855Sgabeblack@google.com                            sc_logic( 0 ), sc_logic( 0 ), sc_logic( 1 ),
15112855Sgabeblack@google.com                            sc_logic( 1 ), sc_logic( 1 ), sc_logic( 1 ),
15212855Sgabeblack@google.com                            sc_logic( 0 ), sc_logic( 0 ), sc_logic( 0 ),
15312855Sgabeblack@google.com                            sc_logic( 0 ), sc_logic( 1 ), sc_logic( 1 ),
15412855Sgabeblack@google.com                            sc_logic( 1 ), sc_logic( 1 ), sc_logic( 0 ),
15512855Sgabeblack@google.com                            sc_logic( 0 ), sc_logic( 0 ), sc_logic( 0 ),
15612855Sgabeblack@google.com                            sc_logic( 1 ), sc_logic( 1 ), sc_logic( 1 ),
15712855Sgabeblack@google.com                            sc_logic( 1 ), sc_logic( 0 ), sc_logic( 0 ),
15812855Sgabeblack@google.com                            sc_logic( 0 ), sc_logic( 0 ) };
15912855Sgabeblack@google.com
16012855Sgabeblack@google.com  d = cb1;
16112855Sgabeblack@google.com  e = cb2;
16212855Sgabeblack@google.com  big3 = cb3;
16312855Sgabeblack@google.com
16412855Sgabeblack@google.com  cout 	<< "std_ulogic_vector \t<=\t C++ array of bool"
16512855Sgabeblack@google.com	<< "\n--------------------------------------------------"
16612855Sgabeblack@google.com        << "\nD = " << d << "\t\t -, L, H, W, Z, X, 1, 0, U"
16712855Sgabeblack@google.com        << "\nE = " << e << "\t\t X, X, 1, 1, 0, 0, 1, 1, X, X, U, U"
16812855Sgabeblack@google.com	<< "\nBIG3 = " << big3 << "\n      "
16912855Sgabeblack@google.com    <<"\"11110000111100001111000011110000111100001111000011110000111100001111"
17012855Sgabeblack@google.com  	<<"\n       000011110000\""
17112855Sgabeblack@google.com	<< "\n" << endl;
17212855Sgabeblack@google.com
17312855Sgabeblack@google.com  // std_ulogic_vector <- bool_vector
17412855Sgabeblack@google.com  std_ulogic_vector<4>	f;
17512855Sgabeblack@google.com  bool_vector<4>	sv1;
17612855Sgabeblack@google.com
17712855Sgabeblack@google.com  sv1 = "1010";
17812855Sgabeblack@google.com
17912855Sgabeblack@google.com  f = sv1;
18012855Sgabeblack@google.com
18112855Sgabeblack@google.com  cout 	<< "std_ulogic_vector \t<=\t bool_vector"
18212855Sgabeblack@google.com	<< "\n--------------------------------------------"
18312855Sgabeblack@google.com	<< "\nF = " << f << "\t\t \"1010\" "
18412855Sgabeblack@google.com	<< "\n" << endl;
18512855Sgabeblack@google.com
18612855Sgabeblack@google.com  // std_ulogic_vector <- unsigned long
18712855Sgabeblack@google.com  std_ulogic_vector<4>	h;
18812855Sgabeblack@google.com  std_ulogic_vector<32>	i;
18912855Sgabeblack@google.com  std_ulogic_vector<40>	j;
19012855Sgabeblack@google.com  unsigned long		ul1 = 137; 	// ...10001001
19112855Sgabeblack@google.com  unsigned long		ul2 = 137; 	// ...10001001
19212855Sgabeblack@google.com  unsigned long		ul3 = 137; 	// ...10001001
19312855Sgabeblack@google.com
19412855Sgabeblack@google.com  h = ul1;
19512855Sgabeblack@google.com  i = ul2;
19612855Sgabeblack@google.com  j = ul3;
19712855Sgabeblack@google.com
19812855Sgabeblack@google.com  cout 	<< "std_ulogic_vector \t<=\t unsigned long"
19912855Sgabeblack@google.com	<< "\n----------------------------------------------"
20012855Sgabeblack@google.com	<< "\nH = " << h << "\t\t\t\t\t ...10001001 (137)"
20112855Sgabeblack@google.com	<< "\nI = " << i << "\t\t ...10001001 (137)"
20212855Sgabeblack@google.com	<< "\nJ = " << j << "\t ...10001001 (137)"
20312855Sgabeblack@google.com	<< "\n" << endl;
20412855Sgabeblack@google.com
20512855Sgabeblack@google.com  // std_ulogic_vector <- sc_unsigned
20612855Sgabeblack@google.com  std_ulogic_vector<4>	k;
20712855Sgabeblack@google.com  std_ulogic_vector<4>	l;
20812855Sgabeblack@google.com  std_ulogic_vector<4>	m;
20912855Sgabeblack@google.com  sc_biguint<2>		scu1;
21012855Sgabeblack@google.com  sc_biguint<4>		scu2;
21112855Sgabeblack@google.com  sc_biguint<8>		scu3;
21212855Sgabeblack@google.com
21312855Sgabeblack@google.com  scu1 = 3;	// .........11
21412855Sgabeblack@google.com  scu2 = 13; 	// .......1101
21512855Sgabeblack@google.com  scu3 = 137; 	// ...10001001
21612855Sgabeblack@google.com
21712855Sgabeblack@google.com  k = scu1;
21812855Sgabeblack@google.com  l = scu2;
21912855Sgabeblack@google.com  m = scu3;
22012855Sgabeblack@google.com
22112855Sgabeblack@google.com  cout 	<< "std_ulogic_vector \t<=\t sc_unsigned"
22212855Sgabeblack@google.com	<< "\n--------------------------------------------"
22312855Sgabeblack@google.com	<< "\nK = " << k << "\t\t       11 (3)"
22412855Sgabeblack@google.com	<< "\nL = " << l << "\t\t     1101 (13)"
22512855Sgabeblack@google.com	<< "\nM = " << m << "\t\t 10001001 (137)"
22612855Sgabeblack@google.com	<< "\n" << endl;
22712855Sgabeblack@google.com
22812855Sgabeblack@google.com  // std_ulogic_vector <- signed long
22912855Sgabeblack@google.com  std_ulogic_vector<5>	n;
23012855Sgabeblack@google.com  std_ulogic_vector<32>	o;
23112855Sgabeblack@google.com  std_ulogic_vector<40>	p;
23212855Sgabeblack@google.com  std_ulogic_vector<5> 	q;
23312855Sgabeblack@google.com  std_ulogic_vector<32>	r;
23412855Sgabeblack@google.com  std_ulogic_vector<40>	s;
23512855Sgabeblack@google.com  signed long		sl1 = 137;      // ...010001001
23612855Sgabeblack@google.com  signed long		sl2 = 137;      // ...010001001
23712855Sgabeblack@google.com  signed long		sl3 = 137;      // ...010001001
23812855Sgabeblack@google.com  signed long		sl4 = -137;     // ...101110111
23912855Sgabeblack@google.com  signed long		sl5 = -137;     // ...101110111
24012855Sgabeblack@google.com  signed long		sl6 = -137;     // ...101110111
24112855Sgabeblack@google.com
24212855Sgabeblack@google.com  n = sl1;
24312855Sgabeblack@google.com  o = sl2;
24412855Sgabeblack@google.com  p = sl3;
24512855Sgabeblack@google.com  q = sl4;
24612855Sgabeblack@google.com  r = sl5;
24712855Sgabeblack@google.com  s = sl6;
24812855Sgabeblack@google.com
24912855Sgabeblack@google.com  cout  << "std_ulogic_vector \t<=\t signed long"
25012855Sgabeblack@google.com        << "\n--------------------------------------------"
25112855Sgabeblack@google.com        << "\nN = " << n << "\t\t\t\t\t ...010001001 (137)"
25212855Sgabeblack@google.com        << "\nO = " << o << "\t\t ...010001001 (137)"
25312855Sgabeblack@google.com        << "\nP = " << p << "\t ...010001001 (137)"
25412855Sgabeblack@google.com        << "\nQ = " << q << "\t\t\t\t\t ...101110111 (-137)"
25512855Sgabeblack@google.com        << "\nR = " << r << "\t\t ...101110111 (-137)"
25612855Sgabeblack@google.com        << "\nS = " << s << "\t ...101110111 (-137)"
25712855Sgabeblack@google.com        << "\n" << endl;
25812855Sgabeblack@google.com
25912855Sgabeblack@google.com  // std_ulogic_vector <- sc_signed
26012855Sgabeblack@google.com  std_ulogic_vector<5>   t;
26112855Sgabeblack@google.com  std_ulogic_vector<5>   u;
26212855Sgabeblack@google.com  std_ulogic_vector<5>   v;
26312855Sgabeblack@google.com  std_ulogic_vector<5>   w;
26412855Sgabeblack@google.com  std_ulogic_vector<5>   x;
26512855Sgabeblack@google.com  std_ulogic_vector<5>   y;
26612855Sgabeblack@google.com  sc_bigint<3>   scs1;
26712855Sgabeblack@google.com  sc_bigint<5>   scs2;
26812855Sgabeblack@google.com  sc_bigint<9>   scs3;
26912855Sgabeblack@google.com  sc_bigint<3>   scs4;
27012855Sgabeblack@google.com  sc_bigint<5>   scs5;
27112855Sgabeblack@google.com  sc_bigint<9>   scs6;
27212855Sgabeblack@google.com
27312855Sgabeblack@google.com  scs1 = 3;     // ........011
27412855Sgabeblack@google.com  scs2 = 13;    // ......01101
27512855Sgabeblack@google.com  scs3 = 137;   // ..010001001
27612855Sgabeblack@google.com  scs4 = -3;    // ........101
27712855Sgabeblack@google.com  scs5 = -13;   // ......10011
27812855Sgabeblack@google.com  scs6 = -137;  // ..101110111
27912855Sgabeblack@google.com
28012855Sgabeblack@google.com  t = scs1;
28112855Sgabeblack@google.com  u = scs2;
28212855Sgabeblack@google.com  v = scs3;
28312855Sgabeblack@google.com  w = scs4;
28412855Sgabeblack@google.com  x = scs5;
28512855Sgabeblack@google.com  y = scs6;
28612855Sgabeblack@google.com
28712855Sgabeblack@google.com  cout  << "std_ulogic_vector \t<=\t sc_signed"
28812855Sgabeblack@google.com        << "\n------------------------------------------"
28912855Sgabeblack@google.com        << "\nT = " << t << "\t\t       011 (3)"
29012855Sgabeblack@google.com        << "\nU = " << u << "\t\t     01101 (13)"
29112855Sgabeblack@google.com        << "\nV = " << v << "\t\t 010001001 (137)"
29212855Sgabeblack@google.com        << "\nW = " << w << "\t\t       101 (-3)"
29312855Sgabeblack@google.com        << "\nX = " << x << "\t\t     10011 (-13)"
29412855Sgabeblack@google.com        << "\nY = " << y << "\t\t 101110111 (-137)"
29512855Sgabeblack@google.com        << "\n" << endl;
29612855Sgabeblack@google.com
29712855Sgabeblack@google.com  // std_ulogic_vector	.to_uint()
29812855Sgabeblack@google.com  std_ulogic_vector<4> 	tu1;
29912855Sgabeblack@google.com  std_ulogic_vector<32>	tu2;
30012855Sgabeblack@google.com  std_ulogic_vector<40>	tu3;
30112855Sgabeblack@google.com  std_ulogic_vector<4> 	tu4;
30212855Sgabeblack@google.com  sc_biguint<2>		tu5;
30312855Sgabeblack@google.com  sc_biguint<4>   	tu6;
30412855Sgabeblack@google.com  sc_biguint<8>   	tu7;
30512855Sgabeblack@google.com
30612855Sgabeblack@google.com  tu1 =                                     "1001";	// 9
30712855Sgabeblack@google.com  tu2 =         "10000000000000000000000000000001"; 	// 2147483649
30812855Sgabeblack@google.com  tu3 = "0000000110000000000000000000000000000001"; 	// 6442450945
30912855Sgabeblack@google.com  tu4 = "1101";
31012855Sgabeblack@google.com  tu5 = tu4.to_uint();
31112855Sgabeblack@google.com  tu6 = tu4.to_uint();
31212855Sgabeblack@google.com  tu7 = tu4.to_uint();
31312855Sgabeblack@google.com
31412855Sgabeblack@google.com  cout  << "std_ulogic_vector \t\t<=\t\t to_uint()"
31512855Sgabeblack@google.com        << "\n-----------------------------------------------------------------"
31612855Sgabeblack@google.com        << "\nTU1 = \t\t\t\t          " << tu1 << "\t " << tu1.to_uint()
31712855Sgabeblack@google.com        << "\nTU2 =         " << tu2 << "\t " << tu2.to_uint()
31812855Sgabeblack@google.com        << "\nTU3 = " << tu3 << "\t " << tu3.to_uint()
31912855Sgabeblack@google.com        << "\nTU4 = " << tu4 << " \t\t\t\t\t " << tu5 << "\t      ("
32012855Sgabeblack@google.com	   << tu5[1] << tu5[0] << ")"
32112855Sgabeblack@google.com        << "\nTU4 = " << tu4 << " \t\t\t\t\t " << tu6 << "\t    ("
32212855Sgabeblack@google.com	   << tu6[3] << tu6[2] << tu6[1] << tu6[0] << ")"
32312855Sgabeblack@google.com        << "\nTU4 = " << tu4 << " \t\t\t\t\t " << tu7 << "\t("
32412855Sgabeblack@google.com	   << tu7[7] << tu7[6] << tu7[5] << tu7[4]
32512855Sgabeblack@google.com	   << tu7[3] << tu7[2] << tu7[1] << tu7[0] << ")"
32612855Sgabeblack@google.com      	<< "\n" << endl;
32712855Sgabeblack@google.com
32812855Sgabeblack@google.com  // std_ulogic_vector	.to_int()
32912855Sgabeblack@google.com  std_ulogic_vector<4> 	ts1;
33012855Sgabeblack@google.com  std_ulogic_vector<32>	ts2;
33112855Sgabeblack@google.com  std_ulogic_vector<40>	ts3;
33212855Sgabeblack@google.com  std_ulogic_vector<5> 	ts4;
33312855Sgabeblack@google.com  sc_bigint<3>	ts5;
33412855Sgabeblack@google.com  sc_bigint<5> 	ts6;
33512855Sgabeblack@google.com  sc_bigint<9> 	ts7;
33612855Sgabeblack@google.com
33712855Sgabeblack@google.com  ts1 =                                     "1001";     // -7
33812855Sgabeblack@google.com  ts2 =         "11111111111111111111101111111001";     // -1031
33912855Sgabeblack@google.com  ts3 = "0000000111111111111111111111101111111001";     // 8589933561
34012855Sgabeblack@google.com  ts4 = "11001";
34112855Sgabeblack@google.com  ts5 = ts4.to_int();
34212855Sgabeblack@google.com  ts6 = ts4.to_int();
34312855Sgabeblack@google.com  ts7 = ts4.to_int();
34412855Sgabeblack@google.com
34512855Sgabeblack@google.com  cout  << "std_ulogic_vector \t\t<=\t\t to_int()"
34612855Sgabeblack@google.com        << "\n-----------------------------------------------------------------"
34712855Sgabeblack@google.com        << "\nTS1 = \t\t\t\t          " << ts1 << "\t " << ts1.to_int()
34812855Sgabeblack@google.com        << "\nTS2 =         " << ts2 << "\t " << ts2.to_int()
34912855Sgabeblack@google.com        << "\nTS3 = " << ts3 << "\t " << ts3.to_int()
35012855Sgabeblack@google.com        << "\nTS4 = " << ts4 << " \t\t\t\t\t " << ts5 << "\t      ("
35112855Sgabeblack@google.com           << ts5[2] << ts5[1] << ts5[0] << ")"
35212855Sgabeblack@google.com        << "\nTS4 = " << ts4 << " \t\t\t\t\t " << ts6 << "\t    ("
35312855Sgabeblack@google.com           << ts6[4] << ts6[3] << ts6[2] << ts6[1] << ts6[0] << ")"
35412855Sgabeblack@google.com        << "\nTS4 = " << ts4 << " \t\t\t\t\t " << ts7 << "\t("
35512855Sgabeblack@google.com           << ts7[8] << ts7[7] << ts7[6] << ts7[5]
35612855Sgabeblack@google.com           << ts7[4] << ts7[3] << ts7[2] << ts7[1] << ts7[0] << ")"
35712855Sgabeblack@google.com        << "\n" << endl;
35812855Sgabeblack@google.com
35912855Sgabeblack@google.com  // std_ulogic_vector       Typecasted to sc_unsigned
36012855Sgabeblack@google.com  std_ulogic_vector<4> 	tcu1;
36112855Sgabeblack@google.com  sc_biguint<2>   	tcu2;
36212855Sgabeblack@google.com  sc_biguint<4>   	tcu3;
36312855Sgabeblack@google.com  sc_biguint<8>   	tcu4;
36412855Sgabeblack@google.com
36512855Sgabeblack@google.com  tcu1 = "1101";
36612855Sgabeblack@google.com  tcu2 = tcu1;
36712855Sgabeblack@google.com  tcu3 = tcu1;
36812855Sgabeblack@google.com  tcu4 = tcu1;
36912855Sgabeblack@google.com
37012855Sgabeblack@google.com  cout  << "std_ulogic_vector \t\t<=\t\t Typecast sc_unsigned"
37112855Sgabeblack@google.com        << "\n-----------------------------------------------------------------"
37212855Sgabeblack@google.com        << "\nTCU1 = " << tcu1 << " \t\t\t\t\t " << tcu2 << "\t      ("
37312855Sgabeblack@google.com           << tcu2[1] << tcu2[0] << ")"
37412855Sgabeblack@google.com        << "\nTCU1 = " << tcu1 << " \t\t\t\t\t " << tcu3 << "\t    ("
37512855Sgabeblack@google.com           << tcu3[3] << tcu3[2] << tcu3[1] << tcu3[0] << ")"
37612855Sgabeblack@google.com        << "\nTCU1 = " << tcu1 << " \t\t\t\t\t " << tcu4 << "\t("
37712855Sgabeblack@google.com           << tcu4[7] << tcu4[6] << tcu4[5] << tcu4[4]
37812855Sgabeblack@google.com           << tcu4[3] << tcu4[2] << tcu4[1] << tcu4[0] << ")"
37912855Sgabeblack@google.com        << "\n" << endl;
38012855Sgabeblack@google.com
38112855Sgabeblack@google.com  // std_ulogic_vector       Typecasted to sc_signed
38212855Sgabeblack@google.com  std_ulogic_vector<5> 	tcs1;
38312855Sgabeblack@google.com  sc_bigint<3> 		tcs2;
38412855Sgabeblack@google.com  sc_bigint<5> 		tcs3;
38512855Sgabeblack@google.com  sc_bigint<9> 		tcs4;
38612855Sgabeblack@google.com
38712855Sgabeblack@google.com  tcs1 = "11001";
38812855Sgabeblack@google.com  tcs2 = sc_bigint<3>(tcs1);
38912855Sgabeblack@google.com  tcs3 = sc_bigint<5>(tcs1);
39012855Sgabeblack@google.com  tcs4 = sc_bigint<9>(tcs1);
39112855Sgabeblack@google.com
39212855Sgabeblack@google.com  cout  << "std_ulogic_vector \t\t<=\t\t Typecast sc_signed"
39312855Sgabeblack@google.com        << "\n-----------------------------------------------------------------"
39412855Sgabeblack@google.com        << "\nTCS1 = " << tcs1 << " \t\t\t\t\t " << tcs2 << "\t      ("
39512855Sgabeblack@google.com           << tcs2[2] << tcs2[1] << tcs2[0] << ")"
39612855Sgabeblack@google.com        << "\nTCS1 = " << tcs1 << " \t\t\t\t\t " << tcs3 << "\t    ("
39712855Sgabeblack@google.com           << tcs3[4] << tcs3[3] << tcs3[2] << tcs3[1] << tcs3[0] << ")"
39812855Sgabeblack@google.com        << "\nTCS1 = " << tcs1 << " \t\t\t\t\t " << tcs4 << "\t("
39912855Sgabeblack@google.com           << tcs4[8] << tcs4[7] << tcs4[6] << tcs4[5]
40012855Sgabeblack@google.com           << tcs4[4] << tcs4[3] << tcs4[2] << tcs4[1] << tcs4[0] << ")"
40112855Sgabeblack@google.com        << "\n" << endl;
40212855Sgabeblack@google.com
40312855Sgabeblack@google.com  // std_ulogic_vector     .to_string()
40412855Sgabeblack@google.com  std_ulogic_vector<9>	tstr;
40512855Sgabeblack@google.com  std::string           str;
40612855Sgabeblack@google.com
40712855Sgabeblack@google.com  tstr = "UXZ01WLH-";
40812855Sgabeblack@google.com  str  = tstr.to_string();
40912855Sgabeblack@google.com
41012855Sgabeblack@google.com  cout  << "std_ulogic_vector \t<=\t to_string()"
41112855Sgabeblack@google.com        << "\n--------------------------------------------"
41212855Sgabeblack@google.com        << "\nTSTR = " << tstr << " \t\t " << str
41312855Sgabeblack@google.com        << endl;
41412855Sgabeblack@google.com
41512855Sgabeblack@google.com
41612855Sgabeblack@google.com// 3. OPERATORS
41712855Sgabeblack@google.com//    Supported operators:      ~ & ^ | &= ^= |= = [] range()
41812855Sgabeblack@google.com//				and_reduce() or_reduce() xor_reduce()
41912855Sgabeblack@google.com  std_ulogic_vector<4>	ra;
42012855Sgabeblack@google.com  std_ulogic_vector<4>	rb;
42112855Sgabeblack@google.com  std_ulogic_vector<4>	rc;
42212855Sgabeblack@google.com  std_ulogic_vector<9>	rd;
42312855Sgabeblack@google.com  std_ulogic_vector<4>	re;
42412855Sgabeblack@google.com  std_ulogic_vector<4>	rf;
42512855Sgabeblack@google.com  std_ulogic_vector<4>	rg;
42612855Sgabeblack@google.com  std_ulogic_vector<9>	rh;
42712855Sgabeblack@google.com  std_ulogic_vector<4>	ri;
42812855Sgabeblack@google.com  std_ulogic_vector<4>	rj;
42912855Sgabeblack@google.com  std_ulogic_vector<4>	rl;
43012855Sgabeblack@google.com
43112855Sgabeblack@google.com  std_ulogic_vector<4>	rdata4;
43212855Sgabeblack@google.com  std_ulogic_vector<9>	rdata9;
43312855Sgabeblack@google.com
43412855Sgabeblack@google.com  rdata4 = "1000";
43512855Sgabeblack@google.com  rdata9 = "UXZ01WHL-";
43612855Sgabeblack@google.com
43712855Sgabeblack@google.com  ra.range(0,3) = rdata4;
43812855Sgabeblack@google.com  rb.range(3,0) = rdata4;
43912855Sgabeblack@google.com  ( rc.range(1,3), rc.range(0,0) ) = rdata4;
44012855Sgabeblack@google.com  ( rd.range(8,6), rd.range(5,0) ) = rdata9;
44112855Sgabeblack@google.com  re = "1111";
44212855Sgabeblack@google.com  re.range(2,2) = std_ulogic_vector<1>( rdata4[1] );
44312855Sgabeblack@google.com
44412855Sgabeblack@google.com  rf = rdata4.range(0,3);
44512855Sgabeblack@google.com  rg = rdata4.range(3,0);
44612855Sgabeblack@google.com  rh = ( rdata9.range(8,6), rdata9.range(5,0) );
44712855Sgabeblack@google.com  ri = ( rdata4.range(0,1), rdata4.range(2,3) );
44812855Sgabeblack@google.com  rj = "1111";
44912855Sgabeblack@google.com  rj[1] = rdata4.range(2,2)[0];
45012855Sgabeblack@google.com  rl = ( rdata4.range(1,1), rdata4.range(3,3),
45112855Sgabeblack@google.com        rdata4.range(0,0), rdata4.range(2,2) );
45212855Sgabeblack@google.com
45312855Sgabeblack@google.com  cout.precision(15);
45412855Sgabeblack@google.com  cout  << "\nrange() tests"
45512855Sgabeblack@google.com        << "\n-----------------------------------------------------------------"
45612855Sgabeblack@google.com        << "\nINITIAL 4-BIT \t" << rdata4
45712855Sgabeblack@google.com        << "\nINITIAL 9-BIT \t" << rdata9 << "\n"
45812855Sgabeblack@google.com        << "\nLVALUE RISE \t"
45912855Sgabeblack@google.com                << ra[0] << "\t" << ra[1] << "\t" << ra[2] << "\t" << ra[3]
46012855Sgabeblack@google.com        << "\nLVALUE FALL \t"
46112855Sgabeblack@google.com                << rb[0] << "\t" << rb[1] << "\t" << rb[2] << "\t" << rb[3]
46212855Sgabeblack@google.com        << "\nLVALUE SUB RISE "
46312855Sgabeblack@google.com                << rc[0] << "\t" << rc[1] << "\t" << rc[2] << "\t" << rc[3]
46412855Sgabeblack@google.com        << "\nLVALUE SUB FALL "
46512855Sgabeblack@google.com                << rd[0] << "\t" << rd[1] << "\t" << rd[2] << "\t"
46612855Sgabeblack@google.com                << rd[3] << "\t" << rd[4] << "\t" << rd[5] << "\t"
46712855Sgabeblack@google.com                << rd[6] << "\t" << rd[7] << "\t" << rd[8]
46812855Sgabeblack@google.com        << "\nLVALUE BIT \t"
46912855Sgabeblack@google.com                << re[0] << "\t" << re[1] << "\t" << re[2] << "\t" << re[3]
47012855Sgabeblack@google.com        << "\n\nRVALUE RISE \t"
47112855Sgabeblack@google.com                << rf[0] << "\t" << rf[1] << "\t" << rf[2] << "\t" << rf[3]
47212855Sgabeblack@google.com        << "\nRVALUE FALL \t"
47312855Sgabeblack@google.com                << rg[0] << "\t" << rg[1] << "\t" << rg[2] << "\t" << rg[3]
47412855Sgabeblack@google.com        << "\nRVALUE SUB FALL "
47512855Sgabeblack@google.com                << rh[0] << "\t" << rh[1] << "\t" << rh[2] << "\t"
47612855Sgabeblack@google.com                << rh[3] << "\t" << rh[4] << "\t" << rh[5] << "\t"
47712855Sgabeblack@google.com                << rh[6] << "\t" << rh[7] << "\t" << rh[8]
47812855Sgabeblack@google.com        << "\nRVALUE SUB RISE "
47912855Sgabeblack@google.com                << ri[0] << "\t" << ri[1] << "\t" << ri[2] << "\t" << ri[3]
48012855Sgabeblack@google.com        << "\nRVALUE BIT [] \t"
48112855Sgabeblack@google.com                << rj[0] << "\t" << rj[1] << "\t" << rj[2] << "\t" << rj[3]
48212855Sgabeblack@google.com        << "\nRVALUE BIT \t"
48312855Sgabeblack@google.com                << rl[0] << "\t" << rl[1] << "\t" << rl[2] << "\t" << rl[3]
48412855Sgabeblack@google.com        << endl;
48512855Sgabeblack@google.com
48612855Sgabeblack@google.com#define VAL1	"1010"
48712855Sgabeblack@google.com#define VAL2	"1000"
48812855Sgabeblack@google.com#define VAL3	"111011"
48912855Sgabeblack@google.com
49012855Sgabeblack@google.com  std_ulogic_vector<4> 	op1;
49112855Sgabeblack@google.com  op1 = VAL1;
49212855Sgabeblack@google.com  std_ulogic_vector<4>	op2;
49312855Sgabeblack@google.com  op2 = VAL2;
49412855Sgabeblack@google.com  std_ulogic_vector<4> 	r1, r2, r3, r4, r5, r6, r7, r8;
49512855Sgabeblack@google.com  std_ulogic_vector<4> 	r9,  r10, r11, r12, r13, r14;
49612855Sgabeblack@google.com  std_ulogic_vector<4>	r15, r16, r17, r18, r19;
49712855Sgabeblack@google.com  std_ulogic_vector<4> 	r20, r21, r22, r23, r24;
49812855Sgabeblack@google.com  std_ulogic_vector<4>	r25, r26, r27, r28, r29;
49912855Sgabeblack@google.com  std_ulogic_vector<4>	r30, r31, r32, r33, r34, r35;
50012855Sgabeblack@google.com  std_ulogic_vector<4>	r36, r37, r38, r39, r40, r41;
50112855Sgabeblack@google.com  std_ulogic 		r42, r43, r44;
50212855Sgabeblack@google.com
50312855Sgabeblack@google.com//  r1 = op1 * op2;			// Multiplication
50412855Sgabeblack@google.com
50512855Sgabeblack@google.com//  r2 = op1 / op2;			// Division
50612855Sgabeblack@google.com
50712855Sgabeblack@google.com//  r3 = op1 % op2;			// Modulus
50812855Sgabeblack@google.com
50912855Sgabeblack@google.com//  r4 = op1 + op2;			// Addition
51012855Sgabeblack@google.com
51112855Sgabeblack@google.com//  r5 = op1 - op2;			// Subtraction
51212855Sgabeblack@google.com
51312855Sgabeblack@google.com//  r6 = !op1;				// Logical NOT
51412855Sgabeblack@google.com
51512855Sgabeblack@google.com//  r7 = op1 && op2;			// Logical AND
51612855Sgabeblack@google.com
51712855Sgabeblack@google.com//  r8 = op1 || op2;			// Logical OR
51812855Sgabeblack@google.com
51912855Sgabeblack@google.com//  r9 = op1 < op2;			// Less than
52012855Sgabeblack@google.com
52112855Sgabeblack@google.com//  r10 = op1 <= op2;			// Less than or equal
52212855Sgabeblack@google.com
52312855Sgabeblack@google.com//  r11 = op1 > op2;			// Greater than
52412855Sgabeblack@google.com
52512855Sgabeblack@google.com//  r12 = op1 >= op2;			// Greater than or equal
52612855Sgabeblack@google.com
52712855Sgabeblack@google.com//  r13 = op1 += op2;			// Compound addition
52812855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
52912855Sgabeblack@google.com
53012855Sgabeblack@google.com//  r14 = op1 -= op2;			// Compound subtraction
53112855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
53212855Sgabeblack@google.com
53312855Sgabeblack@google.com//  r15 = op1 *= op2;			// Compound multiplication
53412855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
53512855Sgabeblack@google.com
53612855Sgabeblack@google.com//  r16 = op1 /= op2;			// Compound division
53712855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
53812855Sgabeblack@google.com
53912855Sgabeblack@google.com//  r17 = op1 %= op2;			// Compound modulus
54012855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
54112855Sgabeblack@google.com
54212855Sgabeblack@google.com//  r18 = op1 <<= op2;			// Compound shift left
54312855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
54412855Sgabeblack@google.com
54512855Sgabeblack@google.com//  r19 = op1 >>= op2;			// Compound shift right
54612855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
54712855Sgabeblack@google.com
54812855Sgabeblack@google.com  r20 = op1 &= op2;			// Compound bitwise AND
54912855Sgabeblack@google.com    op1 = VAL1; op2 = VAL2;
55012855Sgabeblack@google.com  r36 = op1 &= VAL3;
55112855Sgabeblack@google.com    op1 = VAL1;
55212855Sgabeblack@google.com
55312855Sgabeblack@google.com  r21 = op1 ^= op2;			// Compound bitwise XOR
55412855Sgabeblack@google.com    op1 = VAL1; op2 = VAL2;
55512855Sgabeblack@google.com  r37 = op1 ^= VAL3;
55612855Sgabeblack@google.com    op1 = VAL1;
55712855Sgabeblack@google.com
55812855Sgabeblack@google.com  r22 = op1 |= op2;			// Compound bitwise OR
55912855Sgabeblack@google.com    op1 = VAL1; op2 = VAL2;
56012855Sgabeblack@google.com  r38 = op1 |= VAL3;
56112855Sgabeblack@google.com    op1 = VAL1;
56212855Sgabeblack@google.com
56312855Sgabeblack@google.com//  r23 = op2++;				// Postfix increment
56412855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
56512855Sgabeblack@google.com
56612855Sgabeblack@google.com//  r24 = ++op2;				// Prefix increment
56712855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
56812855Sgabeblack@google.com
56912855Sgabeblack@google.com//  r25 = op2--;				// Postfix decrement
57012855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
57112855Sgabeblack@google.com
57212855Sgabeblack@google.com//  r26 = --op2;				// Prefix decrement
57312855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
57412855Sgabeblack@google.com
57512855Sgabeblack@google.com//  r27 = (op1 > op2) ? true : false;	// Arithmetic if
57612855Sgabeblack@google.com//  r28 = (op1 < op2) ? true : false;	// Arithmetic if
57712855Sgabeblack@google.com
57812855Sgabeblack@google.com//  r29 = op1, r29 = op2;		 	// Comma
57912855Sgabeblack@google.com
58012855Sgabeblack@google.com  r30 = ~op1;				// Bitwise NOT
58112855Sgabeblack@google.com
58212855Sgabeblack@google.com//  r31 = op1 << op2;			// Left shift
58312855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
58412855Sgabeblack@google.com
58512855Sgabeblack@google.com//  r32 = op1 >> op2;			// Right shift
58612855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
58712855Sgabeblack@google.com
58812855Sgabeblack@google.com  r33 = op1 & op2;			// Bitwise AND
58912855Sgabeblack@google.com  r39 = op1 & VAL3;
59012855Sgabeblack@google.com
59112855Sgabeblack@google.com  r34 = op1 ^ op2;			// Bitwise XOR
59212855Sgabeblack@google.com  r40 = op1 ^ VAL3;
59312855Sgabeblack@google.com
59412855Sgabeblack@google.com  r35 = op1 | op2;			// Bitwise OR
59512855Sgabeblack@google.com  r41 = op1 | VAL3;
59612855Sgabeblack@google.com
59712855Sgabeblack@google.com  r42 = and_reduce(op1);		// AND reduction
59812855Sgabeblack@google.com
59912855Sgabeblack@google.com  r43 = or_reduce(op1);			// OR reduction
60012855Sgabeblack@google.com
60112855Sgabeblack@google.com  r44 = xor_reduce(op1);		// XOR reduction
60212855Sgabeblack@google.com
60312855Sgabeblack@google.comcout << "\nop1\t operator\t op2\t result  [All operands are std_ulogic_vector]"
60412855Sgabeblack@google.com	<< "\n----------------------------------------------------------------"
60512855Sgabeblack@google.com// 	<< "\n" << op1 << "\t    * \t\t " << op2 << "\t = " << r1
60612855Sgabeblack@google.com// 	<< "\n" << op1 << "\t    / \t\t " << op2 << "\t = " << r2
60712855Sgabeblack@google.com// 	<< "\n" << op1 << "\t    % \t\t " << op2 << "\t = " << r3
60812855Sgabeblack@google.com// 	<< "\n" << op1 << "\t    + \t\t " << op2 << "\t = " << r4
60912855Sgabeblack@google.com// 	<< "\n" << op1 << "\t    - \t\t " << op2 << "\t = " << r5
61012855Sgabeblack@google.com//  	<< "\n!(" << op1 << ") \t\t\t\t = " << r6
61112855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    && \t\t " << op2 << "\t = " << r7
61212855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    || \t\t " << op2 << "\t = " << r8
61312855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    < \t\t "  << op2 << "\t = " << r9
61412855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    <= \t\t " << op2 << "\t = " << r10
61512855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    > \t\t "  << op2 << "\t = " << r11
61612855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    >= \t\t " << op2 << "\t = " << r12
61712855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    += \t\t " << op2 << "\t = " << r13
61812855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    -= \t\t " << op2 << "\t = " << r14
61912855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    *= \t\t " << op2 << "\t = " << r15
62012855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    /= \t\t " << op2 << "\t = " << r16
62112855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    %= \t\t " << op2 << "\t = " << r17
62212855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    <<=\t\t " << op2 << "\t = " << r18
62312855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    >>=\t\t " << op2 << "\t = " << r19
62412855Sgabeblack@google.com  	<< "\n" << op1 << "\t    &= \t\t " << op2 << "\t = " << r20
62512855Sgabeblack@google.com  	<< "\n" << op1 << "\t    ^= \t\t " << op2 << "\t = " << r21
62612855Sgabeblack@google.com  	<< "\n" << op1 << "\t    |= \t\t " << op2 << "\t = " << r22
62712855Sgabeblack@google.com//  	<< "\n" << "\t    ()++ \t " << op2 << "\t = " << r23
62812855Sgabeblack@google.com//  	<< "\n" << "\t    ++() \t " << op2 << "\t = " << r24
62912855Sgabeblack@google.com//  	<< "\n" << "\t    ()-- \t " << op2 << "\t = " << r25
63012855Sgabeblack@google.com//  	<< "\n" << "\t    --() \t " << op2 << "\t = " << r26
63112855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    > ?: \t " << op2 << "\t = " << r27
63212855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    < ?: \t " << op2 << "\t = " << r28
63312855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    , \t\t " << op2 << "\t = " << r29
63412855Sgabeblack@google.com  	<< "\n~(" << op1 << ") \t\t\t = " << r30
63512855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    << \t\t " << op2 << "\t = " << r31
63612855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    >> \t\t " << op2 << "\t = " << r32
63712855Sgabeblack@google.com  	<< "\n" << op1 << "\t    & \t\t " << op2 << "\t = " << r33
63812855Sgabeblack@google.com  	<< "\n" << op1 << "\t    ^ \t\t " << op2 << "\t = " << r34
63912855Sgabeblack@google.com  	<< "\n" << op1 << "\t    | \t\t " << op2 << "\t = " << r35
64012855Sgabeblack@google.com  	<< "\n\n" << op1 << "\t    &= \t\t " << VAL3 << "\t = " << r36
64112855Sgabeblack@google.com  	<< "\n" << op1 << "\t    ^= \t\t " << VAL3 << "\t = " << r37
64212855Sgabeblack@google.com  	<< "\n" << op1 << "\t    |= \t\t " << VAL3 << "\t = " << r38
64312855Sgabeblack@google.com  	<< "\n" << op1 << "\t    & \t\t " << VAL3 << "\t = " << r39
64412855Sgabeblack@google.com  	<< "\n" << op1 << "\t    ^ \t\t " << VAL3 << "\t = " << r40
64512855Sgabeblack@google.com  	<< "\n" << op1 << "\t    | \t\t " << VAL3 << "\t = " << r41
64612855Sgabeblack@google.com  	<< "\n\n" << op1 << "\t    and_reduce() \t = " << r42
64712855Sgabeblack@google.com  	<< "\n" << op1 << "\t    or_reduce() \t = " << r43
64812855Sgabeblack@google.com  	<< "\n" << op1 << "\t    xor_reduce() \t = " << r44
64912855Sgabeblack@google.com 	<< endl;
65012855Sgabeblack@google.com
65112855Sgabeblack@google.com  if (op1 == op2)			// Equality
65212855Sgabeblack@google.com   cout << "\n" << op1 << "\t    == \t\t " << op2 << "\t -> true" << endl;
65312855Sgabeblack@google.com  else
65412855Sgabeblack@google.com   cout << "\n" << op1 << "\t    == \t\t " << op2 << "\t -> false" << endl;
65512855Sgabeblack@google.com
65612855Sgabeblack@google.com  if (op1 != op2)			// Inequality
65712855Sgabeblack@google.com   cout << op1 << "\t    != \t\t " << op2 << "\t -> true" << endl;
65812855Sgabeblack@google.com  else
65912855Sgabeblack@google.com   cout << op1 << "\t    != \t\t " << op2 << "\t -> false" << endl;
66012855Sgabeblack@google.com
66112855Sgabeblack@google.com  op1 = op2 = "1111";		// Assignment operator concatenation
66212855Sgabeblack@google.com   cout << "\n" << op1 << "\t    = \t\t " << op2 << endl;
66312855Sgabeblack@google.com
66412855Sgabeblack@google.com
66512855Sgabeblack@google.com// 4. OPERATOR DEFINITIONS
66612855Sgabeblack@google.com//      & | ^ ~
66712855Sgabeblack@google.com  std_ulogic_vector<9> 	suv;
66812855Sgabeblack@google.com  std_ulogic_vector<9>	vu;
66912855Sgabeblack@google.com  std_ulogic_vector<9>	vx;
67012855Sgabeblack@google.com  std_ulogic_vector<9>	v0;
67112855Sgabeblack@google.com  std_ulogic_vector<9>	v1;
67212855Sgabeblack@google.com  std_ulogic_vector<9>	vz;
67312855Sgabeblack@google.com  std_ulogic_vector<9>	vw;
67412855Sgabeblack@google.com  std_ulogic_vector<9>	vl;
67512855Sgabeblack@google.com  std_ulogic_vector<9>	vh;
67612855Sgabeblack@google.com  std_ulogic_vector<9>	vd;
67712855Sgabeblack@google.com  std_ulogic_vector<9>	bang;
67812855Sgabeblack@google.com
67912855Sgabeblack@google.com  suv = "UX01ZWLH-";
68012855Sgabeblack@google.com
68112855Sgabeblack@google.com  vu = "UUUUUUUUU" & suv;
68212855Sgabeblack@google.com  vx = "XXXXXXXXX" & suv;
68312855Sgabeblack@google.com  v0 = "000000000" & suv;
68412855Sgabeblack@google.com  v1 = "111111111" & suv;
68512855Sgabeblack@google.com  vz = "ZZZZZZZZZ" & suv;
68612855Sgabeblack@google.com  vw = "WWWWWWWWW" & suv;
68712855Sgabeblack@google.com  vl = "LLLLLLLLL" & suv;
68812855Sgabeblack@google.com  vh = "HHHHHHHHH" & suv;
68912855Sgabeblack@google.com  vd = "---------" & suv;
69012855Sgabeblack@google.com
69112855Sgabeblack@google.com  cout	<< "\n+-------------------------+"
69212855Sgabeblack@google.com  << "\n| AND (&) | X | 0 | 1 | Z |"
69312855Sgabeblack@google.com  << "\n+-------------------------+"
69412855Sgabeblack@google.com  << "\n|    X    | " << vx[7] << " | " << vx[6] << " | "
69512855Sgabeblack@google.com  << vx[5] << " | " << vx[4] << " | "
69612855Sgabeblack@google.com  << "\n+-------------------------+"
69712855Sgabeblack@google.com  << "\n|    0    | " << v0[7] << " | " << v0[6] << " | "
69812855Sgabeblack@google.com  << v0[5] << " | " << v0[4] << " | "
69912855Sgabeblack@google.com  << "\n+-------------------------+"
70012855Sgabeblack@google.com  << "\n|    1    | " << v1[7] << " | " << v1[6] << " | "
70112855Sgabeblack@google.com  << v1[5] << " | " << v1[4] << " | "
70212855Sgabeblack@google.com  << "\n+-------------------------+"
70312855Sgabeblack@google.com  << "\n|    Z    | " << vz[7] << " | " << vz[6] << " | "
70412855Sgabeblack@google.com  << vz[5] << " | " << vz[4] << " | "
70512855Sgabeblack@google.com  << "\n+-------------------------+"
70612855Sgabeblack@google.com  << endl;
70712855Sgabeblack@google.com
70812855Sgabeblack@google.com  vu = "UUUUUUUUU" | suv;
70912855Sgabeblack@google.com  vx = "XXXXXXXXX" | suv;
71012855Sgabeblack@google.com  v0 = "000000000" | suv;
71112855Sgabeblack@google.com  v1 = "111111111" | suv;
71212855Sgabeblack@google.com  vz = "ZZZZZZZZZ" | suv;
71312855Sgabeblack@google.com  vw = "WWWWWWWWW" | suv;
71412855Sgabeblack@google.com  vl = "LLLLLLLLL" | suv;
71512855Sgabeblack@google.com  vh = "HHHHHHHHH" | suv;
71612855Sgabeblack@google.com  vd = "---------" | suv;
71712855Sgabeblack@google.com
71812855Sgabeblack@google.com  cout  << "\n+-------------------------+"
71912855Sgabeblack@google.com  << "\n| OR  (|) | X | 0 | 1 | Z |"
72012855Sgabeblack@google.com  << "\n+-------------------------+"
72112855Sgabeblack@google.com  << "\n|    X    | " << vx[7] << " | " << vx[6] << " | "
72212855Sgabeblack@google.com  << vx[5] << " | " << vx[4] << " | "
72312855Sgabeblack@google.com  << "\n+-------------------------+"
72412855Sgabeblack@google.com  << "\n|    0    | " << v0[7] << " | " << v0[6] << " | "
72512855Sgabeblack@google.com  << v0[5] << " | " << v0[4] << " | "
72612855Sgabeblack@google.com  << "\n+-------------------------+"
72712855Sgabeblack@google.com  << "\n|    1    | " << v1[7] << " | " << v1[6] << " | "
72812855Sgabeblack@google.com  << v1[5] << " | " << v1[4] << " | "
72912855Sgabeblack@google.com  << "\n+-------------------------+"
73012855Sgabeblack@google.com  << "\n|    Z    | " << vz[7] << " | " << vz[6] << " | "
73112855Sgabeblack@google.com  << vz[5] << " | " << vz[4] << " | "
73212855Sgabeblack@google.com  << "\n+-------------------------+"
73312855Sgabeblack@google.com  << endl;
73412855Sgabeblack@google.com
73512855Sgabeblack@google.com  vu = "UUUUUUUUU" ^ suv;
73612855Sgabeblack@google.com  vx = "XXXXXXXXX" ^ suv;
73712855Sgabeblack@google.com  v0 = "000000000" ^ suv;
73812855Sgabeblack@google.com  v1 = "111111111" ^ suv;
73912855Sgabeblack@google.com  vz = "ZZZZZZZZZ" ^ suv;
74012855Sgabeblack@google.com  vw = "WWWWWWWWW" ^ suv;
74112855Sgabeblack@google.com  vl = "LLLLLLLLL" ^ suv;
74212855Sgabeblack@google.com  vh = "HHHHHHHHH" ^ suv;
74312855Sgabeblack@google.com  vd = "---------" ^ suv;
74412855Sgabeblack@google.com
74512855Sgabeblack@google.com  cout  << "\n+-------------------------+"
74612855Sgabeblack@google.com  << "\n| XOR (^) | X | 0 | 1 | Z |"
74712855Sgabeblack@google.com  << "\n+-------------------------+"
74812855Sgabeblack@google.com  << "\n|    X    | " << vx[7] << " | " << vx[6] << " | "
74912855Sgabeblack@google.com  << vx[5] << " | " << vx[4] << " | "
75012855Sgabeblack@google.com  << "\n+-------------------------+"
75112855Sgabeblack@google.com  << "\n|    0    | " << v0[7] << " | " << v0[6] << " | "
75212855Sgabeblack@google.com  << v0[5] << " | " << v0[4] << " | "
75312855Sgabeblack@google.com  << "\n+-------------------------+"
75412855Sgabeblack@google.com  << "\n|    1    | " << v1[7] << " | " << v1[6] << " | "
75512855Sgabeblack@google.com  << v1[5] << " | " << v1[4] << " | "
75612855Sgabeblack@google.com  << "\n+-------------------------+"
75712855Sgabeblack@google.com  << "\n|    Z    | " << vz[7] << " | " << vz[6] << " | "
75812855Sgabeblack@google.com  << vz[5] << " | " << vz[4] << " | "
75912855Sgabeblack@google.com  << "\n+-------------------------+"
76012855Sgabeblack@google.com  << endl;
76112855Sgabeblack@google.com
76212855Sgabeblack@google.com  bang = ~suv;
76312855Sgabeblack@google.com
76412855Sgabeblack@google.com  cout	<< "\n+-------------------------+"
76512855Sgabeblack@google.com  << "\n| NOT (~) | X | 0 | 1 | Z |"
76612855Sgabeblack@google.com  << "\n+-------------------------+"
76712855Sgabeblack@google.com  << "\n|         | " << bang[7] << " | " << bang[6] << " | "
76812855Sgabeblack@google.com  << bang[5] << " | " << bang[4] << " | "
76912855Sgabeblack@google.com  << "\n+-------------------------+"
77012855Sgabeblack@google.com  << endl;
77112855Sgabeblack@google.com  return 0;
77212855Sgabeblack@google.com}
773