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_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" 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.comint sc_main(int ac, char *av[])
4512855Sgabeblack@google.com{
4612855Sgabeblack@google.com
4712855Sgabeblack@google.com// 1. DECLARATION SYNTAX
4812855Sgabeblack@google.com  std_ulogic	s1;
4912855Sgabeblack@google.com  std_ulogic    s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;
5012855Sgabeblack@google.com
5112855Sgabeblack@google.com
5212855Sgabeblack@google.com// 2. TYPE CONVERSION
5312855Sgabeblack@google.com
5412855Sgabeblack@google.com  // std_ulogic <- std_ulogic
5512855Sgabeblack@google.com  s1  = 'U';
5612855Sgabeblack@google.com  s2  = 'X';
5712855Sgabeblack@google.com  s3  = '0';
5812855Sgabeblack@google.com  s4  = '1';
5912855Sgabeblack@google.com  s5  = 'Z';
6012855Sgabeblack@google.com  s6  = 'W';
6112855Sgabeblack@google.com  s7  = 'L';
6212855Sgabeblack@google.com  s8  = 'H';
6312855Sgabeblack@google.com  s9  = '-';
6412855Sgabeblack@google.com  s10 = true;
6512855Sgabeblack@google.com  s11 = false;
6612855Sgabeblack@google.com
6712855Sgabeblack@google.com  cout 	<< "\nstd_ulogic \t<=\t\t std_ulogic"
6812855Sgabeblack@google.com	<< "\n-------------------------------------------"
6912855Sgabeblack@google.com       	<< "\nUNINITIALIZED \t= " << s1  << "\t\t 'U'"
7012855Sgabeblack@google.com	<< "\nUNKNOWN \t= "       << s2  << "\t\t 'X'"
7112855Sgabeblack@google.com       	<< "\nZERO \t\t= "        << s3  << "\t\t '0'"
7212855Sgabeblack@google.com	<< "\nONE \t\t= "         << s4  << "\t\t '1'"
7312855Sgabeblack@google.com	<< "\nTRISTATE \t= "      << s5  << "\t\t 'Z'"
7412855Sgabeblack@google.com       	<< "\nWEAK-UNKNOWN \t= "  << s6  << "\t\t 'W'"
7512855Sgabeblack@google.com	<< "\nWEAK-ZERO \t= "     << s7  << "\t\t 'L'"
7612855Sgabeblack@google.com	<< "\nWEAK-ONE \t= "      << s8  << "\t\t 'H'"
7712855Sgabeblack@google.com	<< "\nDONT-CARE \t= "     << s9  << "\t\t '-'"
7812855Sgabeblack@google.com	<< "\nTRUE \t\t= "        << s10 << "\t\t true"
7912855Sgabeblack@google.com	<< "\nFALSE \t\t= "       << s11 << "\t\t false"
8012855Sgabeblack@google.com       	<< "\n" << endl;
8112855Sgabeblack@google.com
8212855Sgabeblack@google.com  // std_ulogic <- literals
8312855Sgabeblack@google.com  std_ulogic 	a, b, c, d;
8412855Sgabeblack@google.com
8512855Sgabeblack@google.com  a = true;
8612855Sgabeblack@google.com  b = false;
8712855Sgabeblack@google.com  c = 1;
8812855Sgabeblack@google.com  d = 0;
8912855Sgabeblack@google.com
9012855Sgabeblack@google.com  cout  << "std_ulogic   <=\t literals"
9112855Sgabeblack@google.com        << "\n-------------------------"
9212855Sgabeblack@google.com        << "\nA = " << a << "\t\t true"
9312855Sgabeblack@google.com        << "\nB = " << b << "\t\t false"
9412855Sgabeblack@google.com        << "\nC = " << c << "\t\t 1"
9512855Sgabeblack@google.com        << "\nD = " << d << "\t\t 0"
9612855Sgabeblack@google.com        << "\n" << endl;
9712855Sgabeblack@google.com
9812855Sgabeblack@google.com  // std_ulogic <- bool
9912855Sgabeblack@google.com  std_ulogic    su1, su2, su3, su4;
10012855Sgabeblack@google.com  bool		b1, b2, b3, b4;
10112855Sgabeblack@google.com
10212855Sgabeblack@google.com  b1  = true;
10312855Sgabeblack@google.com  b2  = false;
10412855Sgabeblack@google.com  b3  = 1;
10512855Sgabeblack@google.com  b4  = 0;
10612855Sgabeblack@google.com
10712855Sgabeblack@google.com  su1 = b1;
10812855Sgabeblack@google.com  su2 = b2;
10912855Sgabeblack@google.com  su3 = b3;
11012855Sgabeblack@google.com  su4 = b4;
11112855Sgabeblack@google.com
11212855Sgabeblack@google.com  cout  << "std_ulogic  <=\t bool"
11312855Sgabeblack@google.com        << "\n---------------------"
11412855Sgabeblack@google.com        << "\nTRUE \t= "  << su1 << "\t " << b1
11512855Sgabeblack@google.com        << "\nFALSE \t= " << su2 << "\t " << b2
11612855Sgabeblack@google.com        << "\n1 \t= " 	  << su3 << "\t " << b3
11712855Sgabeblack@google.com        << "\n0 \t= " 	  << su4 << "\t " << b4
11812855Sgabeblack@google.com        << "\n" << endl;
11912855Sgabeblack@google.com
12012855Sgabeblack@google.com  // std_ulogic <- char
12112855Sgabeblack@google.com  std_ulogic	sc1, sc2, sc3, sc4, sc5, sc6, sc7, sc8, sc9;
12212855Sgabeblack@google.com  std_ulogic	sc10, sc11, sc12, sc13, sc14, sc15, sc16, sc17, sc18, sc19;
12312855Sgabeblack@google.com  char		c1, c2, c3, c4, c5, c6, c7, c8, c9;
12412855Sgabeblack@google.com  char		c10, c11, c12, c13, c14, c15, c16, c17, c18, c19;
12512855Sgabeblack@google.com
12612855Sgabeblack@google.com  c1  = 'U';
12712855Sgabeblack@google.com  c2  = 'u';
12812855Sgabeblack@google.com  c3  = 'X';
12912855Sgabeblack@google.com  c4  = 'x';
13012855Sgabeblack@google.com  c5  = '0';
13112855Sgabeblack@google.com  c6  = '1';
13212855Sgabeblack@google.com  c7  = 'Z';
13312855Sgabeblack@google.com  c8  = 'z';
13412855Sgabeblack@google.com  c9  = 'W';
13512855Sgabeblack@google.com  c10 = 'w';
13612855Sgabeblack@google.com  c11 = 'L';
13712855Sgabeblack@google.com  c12 = 'l';
13812855Sgabeblack@google.com  c13 = 'H';
13912855Sgabeblack@google.com  c14 = 'h';
14012855Sgabeblack@google.com  c15 = '-';
14112855Sgabeblack@google.com  c16 = 'D';
14212855Sgabeblack@google.com  c17 = 'd';
14312855Sgabeblack@google.com  c18 = 'B';
14412855Sgabeblack@google.com  c19 = 'F';
14512855Sgabeblack@google.com
14612855Sgabeblack@google.com  sc1  = c1;
14712855Sgabeblack@google.com  sc2  = c2;
14812855Sgabeblack@google.com  sc3  = c3;
14912855Sgabeblack@google.com  sc4  = c4;
15012855Sgabeblack@google.com  sc5  = c5;
15112855Sgabeblack@google.com  sc6  = c6;
15212855Sgabeblack@google.com  sc7  = c7;
15312855Sgabeblack@google.com  sc8  = c8;
15412855Sgabeblack@google.com  sc9  = c9;
15512855Sgabeblack@google.com  sc10 = c10;
15612855Sgabeblack@google.com  sc11 = c11;
15712855Sgabeblack@google.com  sc12 = c12;
15812855Sgabeblack@google.com  sc13 = c13;
15912855Sgabeblack@google.com  sc14 = c14;
16012855Sgabeblack@google.com  sc15 = c15;
16112855Sgabeblack@google.com  sc16 = c16;
16212855Sgabeblack@google.com  sc17 = c17;
16312855Sgabeblack@google.com  sc18 = c18;
16412855Sgabeblack@google.com  sc19 = c19;
16512855Sgabeblack@google.com
16612855Sgabeblack@google.com  cout  << "std_ulogic  <=\t char"
16712855Sgabeblack@google.com        << "\n---------------------"
16812855Sgabeblack@google.com        << "\nSC1 \t= "  << sc1  << "\t '" << c1  << "'"
16912855Sgabeblack@google.com        << "\nSC2 \t= "  << sc2  << "\t '" << c2  << "'"
17012855Sgabeblack@google.com        << "\nSC3 \t= "  << sc3  << "\t '" << c3  << "'"
17112855Sgabeblack@google.com        << "\nSC4 \t= "  << sc4  << "\t '" << c4  << "'"
17212855Sgabeblack@google.com        << "\nSC5 \t= "  << sc5  << "\t '" << c5  << "'"
17312855Sgabeblack@google.com        << "\nSC6 \t= "  << sc6  << "\t '" << c6  << "'"
17412855Sgabeblack@google.com        << "\nSC7 \t= "  << sc7  << "\t '" << c7  << "'"
17512855Sgabeblack@google.com        << "\nSC8 \t= "  << sc8  << "\t '" << c8  << "'"
17612855Sgabeblack@google.com        << "\nSC9 \t= "  << sc9  << "\t '" << c9  << "'"
17712855Sgabeblack@google.com        << "\nSC10 \t= " << sc10 << "\t '" << c10 << "'"
17812855Sgabeblack@google.com        << "\nSC11 \t= " << sc11 << "\t '" << c11 << "'"
17912855Sgabeblack@google.com        << "\nSC12 \t= " << sc12 << "\t '" << c12 << "'"
18012855Sgabeblack@google.com        << "\nSC13 \t= " << sc13 << "\t '" << c13 << "'"
18112855Sgabeblack@google.com        << "\nSC14 \t= " << sc14 << "\t '" << c14 << "'"
18212855Sgabeblack@google.com        << "\nSC15 \t= " << sc15 << "\t '" << c15 << "'"
18312855Sgabeblack@google.com        << "\nSC16 \t= " << sc16 << "\t '" << c16 << "'"
18412855Sgabeblack@google.com        << "\nSC17 \t= " << sc17 << "\t '" << c17 << "'"
18512855Sgabeblack@google.com        << "\nSC18 \t= " << sc18 << "\t '" << c18 << "'"
18612855Sgabeblack@google.com        << "\nSC19 \t= " << sc19 << "\t '" << c19 << "'"
18712855Sgabeblack@google.com        << "\n" << endl;
18812855Sgabeblack@google.com
18912855Sgabeblack@google.com
19012855Sgabeblack@google.com// 3. OPERATORS
19112855Sgabeblack@google.com//    Supported operators:	~ & ^ | &= ^= |= == != =
19212855Sgabeblack@google.com
19312855Sgabeblack@google.com#define VAL1	'1'
19412855Sgabeblack@google.com#define VAL2	'1'
19512855Sgabeblack@google.com
19612855Sgabeblack@google.com  std_ulogic 	op1 = sc_logic(VAL1);
19712855Sgabeblack@google.com  std_ulogic  	op2 = sc_logic(VAL2);
19812855Sgabeblack@google.com  std_ulogic 	r1, r2, r3, r4, r5, r6, r7, r8, r9;
19912855Sgabeblack@google.com  std_ulogic 	r10, r11, r12, r13, r14, r15, r16, r17, r18, r19;
20012855Sgabeblack@google.com  std_ulogic 	r20, r21, r22, r23, r24, r25, r26, r27, r28, r29;
20112855Sgabeblack@google.com  std_ulogic 	r30, r31, r32, r33, r34, r35;
20212855Sgabeblack@google.com
20312855Sgabeblack@google.com//  r1 = op1 * op2;			// Multiplication
20412855Sgabeblack@google.com
20512855Sgabeblack@google.com//  r2 = op1 / op2;			// Division
20612855Sgabeblack@google.com
20712855Sgabeblack@google.com//  r3 = op1 % op2;			// Modulus
20812855Sgabeblack@google.com
20912855Sgabeblack@google.com//  r4 = op1 + op2;			// Addition
21012855Sgabeblack@google.com
21112855Sgabeblack@google.com//  r5 = op1 - op2;			// Subtraction
21212855Sgabeblack@google.com
21312855Sgabeblack@google.com//  r6 = !op1;				// Logical NOT
21412855Sgabeblack@google.com
21512855Sgabeblack@google.com//  r7 = op1 && op2;			// Logical AND
21612855Sgabeblack@google.com
21712855Sgabeblack@google.com//  r8 = op1 || op2;			// Logical OR
21812855Sgabeblack@google.com
21912855Sgabeblack@google.com//  r9 = op1 < op2;			// Less than
22012855Sgabeblack@google.com
22112855Sgabeblack@google.com//  r10 = op1 <= op2;			// Less than or equal
22212855Sgabeblack@google.com
22312855Sgabeblack@google.com//  r11 = op1 > op2;			// Greater than
22412855Sgabeblack@google.com
22512855Sgabeblack@google.com//  r12 = op1 >= op2;			// Greater than or equal
22612855Sgabeblack@google.com
22712855Sgabeblack@google.com//  r13 = op1 += op2;			// Compound addition
22812855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
22912855Sgabeblack@google.com
23012855Sgabeblack@google.com//  r14 = op1 -= op2;			// Compound subtraction
23112855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
23212855Sgabeblack@google.com
23312855Sgabeblack@google.com//  r15 = op1 *= op2;			// Compound multiplication
23412855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
23512855Sgabeblack@google.com
23612855Sgabeblack@google.com//  r16 = op1 /= op2;			// Compound division
23712855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
23812855Sgabeblack@google.com
23912855Sgabeblack@google.com//  r17 = op1 %= op2;			// Compound modulus
24012855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
24112855Sgabeblack@google.com
24212855Sgabeblack@google.com//  r18 = op1 <<= op2;			// Compound shift left
24312855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
24412855Sgabeblack@google.com
24512855Sgabeblack@google.com//  r19 = op1 >>= op2;			// Compound shift right
24612855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
24712855Sgabeblack@google.com
24812855Sgabeblack@google.com  r20 = op1 &= op2;			// Compound bitwise AND
24912855Sgabeblack@google.com    op1 = VAL1; op2 = VAL2;
25012855Sgabeblack@google.com
25112855Sgabeblack@google.com  r21 = op1 ^= op2;			// Compound bitwise XOR
25212855Sgabeblack@google.com    op1 = VAL1; op2 = VAL2;
25312855Sgabeblack@google.com
25412855Sgabeblack@google.com  r22 = op1 |= op2;			// Compound bitwise OR
25512855Sgabeblack@google.com    op1 = VAL1; op2 = VAL2;
25612855Sgabeblack@google.com
25712855Sgabeblack@google.com//  r23 = op2++;				// Postfix increment
25812855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
25912855Sgabeblack@google.com
26012855Sgabeblack@google.com//  r24 = ++op2;				// Prefix increment
26112855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
26212855Sgabeblack@google.com
26312855Sgabeblack@google.com//  r25 = op2--;				// Postfix decrement
26412855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
26512855Sgabeblack@google.com
26612855Sgabeblack@google.com//  r26 = --op2;				// Prefix decrement
26712855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
26812855Sgabeblack@google.com
26912855Sgabeblack@google.com//  r27 = (op1 > op2) ? true : false;	// Arithmetic if
27012855Sgabeblack@google.com//  r28 = (op1 < op2) ? true : false;	// Arithmetic if
27112855Sgabeblack@google.com
27212855Sgabeblack@google.com//  r29 = op1, r29 = op2;		 	// Comma
27312855Sgabeblack@google.com
27412855Sgabeblack@google.com  r30 = ~op1;				// Bitwise NOT
27512855Sgabeblack@google.com
27612855Sgabeblack@google.com//  r31 = op1 << op2;			// Left shift
27712855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
27812855Sgabeblack@google.com
27912855Sgabeblack@google.com//  r32 = op1 >> op2;			// Right shift
28012855Sgabeblack@google.com//    op1 = VAL1; op2 = VAL2;
28112855Sgabeblack@google.com
28212855Sgabeblack@google.com  r33 = op1 & op2;			// Bitwise AND
28312855Sgabeblack@google.com
28412855Sgabeblack@google.com  r34 = op1 ^ op2;			// Bitwise XOR
28512855Sgabeblack@google.com
28612855Sgabeblack@google.com  r35 = op1 | op2;			// Bitwise OR
28712855Sgabeblack@google.com
28812855Sgabeblack@google.com  cout 	<< "op1 \t operator \t op2 \t result  [All operands are std_ulogic]"
28912855Sgabeblack@google.com	<< "\n----------------------------------------------------------------"
29012855Sgabeblack@google.com// 	<< "\n" << op1 << "\t    * \t\t " << op2 << "\t = " << r1
29112855Sgabeblack@google.com// 	<< "\n" << op1 << "\t    / \t\t " << op2 << "\t = " << r2
29212855Sgabeblack@google.com// 	<< "\n" << op1 << "\t    % \t\t " << op2 << "\t = " << r3
29312855Sgabeblack@google.com// 	<< "\n" << op1 << "\t    + \t\t " << op2 << "\t = " << r4
29412855Sgabeblack@google.com// 	<< "\n" << op1 << "\t    - \t\t " << op2 << "\t = " << r5
29512855Sgabeblack@google.com//  	<< "\n!(" << op1 << ") \t\t\t\t = " << r6
29612855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    && \t\t " << op2 << "\t = " << r7
29712855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    || \t\t " << op2 << "\t = " << r8
29812855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    < \t\t "  << op2 << "\t = " << r9
29912855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    <= \t\t " << op2 << "\t = " << r10
30012855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    > \t\t "  << op2 << "\t = " << r11
30112855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    >= \t\t " << op2 << "\t = " << r12
30212855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    += \t\t " << op2 << "\t = " << r13
30312855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    -= \t\t " << op2 << "\t = " << r14
30412855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    *= \t\t " << op2 << "\t = " << r15
30512855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    /= \t\t " << op2 << "\t = " << r16
30612855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    %= \t\t " << op2 << "\t = " << r17
30712855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    <<=\t\t " << op2 << "\t = " << r18
30812855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    >>=\t\t " << op2 << "\t = " << r19
30912855Sgabeblack@google.com  	<< "\n" << op1 << "\t    &= \t\t " << op2 << "\t = " << r20
31012855Sgabeblack@google.com  	<< "\n" << op1 << "\t    ^= \t\t " << op2 << "\t = " << r21
31112855Sgabeblack@google.com  	<< "\n" << op1 << "\t    |= \t\t " << op2 << "\t = " << r22
31212855Sgabeblack@google.com//  	<< "\n" << "\t    ()++ \t " << op2 << "\t = " << r23
31312855Sgabeblack@google.com//  	<< "\n" << "\t    ++() \t " << op2 << "\t = " << r24
31412855Sgabeblack@google.com//  	<< "\n" << "\t    ()-- \t " << op2 << "\t = " << r25
31512855Sgabeblack@google.com//  	<< "\n" << "\t    --() \t " << op2 << "\t = " << r26
31612855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    > ?: \t " << op2 << "\t = " << r27
31712855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    < ?: \t " << op2 << "\t = " << r28
31812855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    , \t\t " << op2 << "\t = " << r29
31912855Sgabeblack@google.com  	<< "\n~(" << op1 << ") \t\t\t\t = " << r30
32012855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    << \t\t " << op2 << "\t = " << r31
32112855Sgabeblack@google.com//  	<< "\n" << op1 << "\t    >> \t\t " << op2 << "\t = " << r32
32212855Sgabeblack@google.com  	<< "\n" << op1 << "\t    & \t\t " << op2 << "\t = " << r33
32312855Sgabeblack@google.com  	<< "\n" << op1 << "\t    ^ \t\t " << op2 << "\t = " << r34
32412855Sgabeblack@google.com  	<< "\n" << op1 << "\t    | \t\t " << op2 << "\t = " << r35
32512855Sgabeblack@google.com 	<< endl;
32612855Sgabeblack@google.com
32712855Sgabeblack@google.com  if (op1 == op2)			// Equality
32812855Sgabeblack@google.com   cout << op1 << "\t    == \t\t " << op2 << "\t -> true" << endl;
32912855Sgabeblack@google.com  else
33012855Sgabeblack@google.com   cout << op1 << "\t    == \t\t " << op2 << "\t -> false" << endl;
33112855Sgabeblack@google.com
33212855Sgabeblack@google.com  if (op1 != op2)			// Inequality
33312855Sgabeblack@google.com   cout << op1 << "\t    != \t\t " << op2 << "\t -> true" << endl;
33412855Sgabeblack@google.com  else
33512855Sgabeblack@google.com   cout << op1 << "\t    != \t\t " << op2 << "\t -> false" << endl;
33612855Sgabeblack@google.com
33712855Sgabeblack@google.com  op1 = op2 = 0;			// Assignment operator concatenation
33812855Sgabeblack@google.com   cout << op1 << "\t    = \t\t " << op2 << endl;
33912855Sgabeblack@google.com
34012855Sgabeblack@google.com// 4. OPERATOR DEFINITIONS
34112855Sgabeblack@google.com//	& | ^ ~
34212855Sgabeblack@google.com  std_ulogic 	v1, v2, v3, v4, v5, v6, v7, v8, v9;
34312855Sgabeblack@google.com  std_ulogic	uu, ux, u0, u1, uz, uw, ul, uh, ud;
34412855Sgabeblack@google.com  std_ulogic	xu, xx, x0, x1, xz, xw, xl, xh, xd;
34512855Sgabeblack@google.com  std_ulogic	_0u, _0x, _00, _01, _0z, _0w, _0l, _0h, _0d;
34612855Sgabeblack@google.com  std_ulogic	_1u, _1x, _10, _11, _1z, _1w, _1l, _1h, _1d;
34712855Sgabeblack@google.com  std_ulogic	zu, zx, z0, z1, zz, zw, zl, zh, zd;
34812855Sgabeblack@google.com  std_ulogic	wu, wx, w0, w1, wz, ww, wl, wh, wd;
34912855Sgabeblack@google.com  std_ulogic	lu, lx, l0, l1, lz, lw, ll, lh, ld;
35012855Sgabeblack@google.com  std_ulogic	hu, hx, h0, h1, hz, hw, hl, hh, hd;
35112855Sgabeblack@google.com  std_ulogic	du, dx, d0, d1, dz, dw, dl, dh, dd;
35212855Sgabeblack@google.com
35312855Sgabeblack@google.com  v1  = 'U';
35412855Sgabeblack@google.com  v2  = 'X';
35512855Sgabeblack@google.com  v3  = '0';
35612855Sgabeblack@google.com  v4  = '1';
35712855Sgabeblack@google.com  v5  = 'Z';
35812855Sgabeblack@google.com  v6  = 'W';
35912855Sgabeblack@google.com  v7  = 'L';
36012855Sgabeblack@google.com  v8  = 'H';
36112855Sgabeblack@google.com  v9  = '-';
36212855Sgabeblack@google.com
36312855Sgabeblack@google.com  uu = v1 & v1;	   ux = v1 & v2;    u0 = v1 & v3;
36412855Sgabeblack@google.com  u1 = v1 & v4;	   uz = v1 & v5;    uw = v1 & v6;
36512855Sgabeblack@google.com  ul = v1 & v7;	   uh = v1 & v8;    ud = v1 & v9;
36612855Sgabeblack@google.com
36712855Sgabeblack@google.com  xu = v2 & v1;	   xx = v2 & v2;    x0 = v2 & v3;
36812855Sgabeblack@google.com  x1 = v2 & v4;	   xz = v2 & v5;    xw = v2 & v6;
36912855Sgabeblack@google.com  xl = v2 & v7;	   xh = v2 & v8;    xd = v2 & v9;
37012855Sgabeblack@google.com
37112855Sgabeblack@google.com  _0u = v3 & v1;   _0x = v3 & v2;    _00 = v3 & v3;
37212855Sgabeblack@google.com  _01 = v3 & v4;   _0z = v3 & v5;    _0w = v3 & v6;
37312855Sgabeblack@google.com  _0l = v3 & v7;   _0h = v3 & v8;    _0d = v3 & v9;
37412855Sgabeblack@google.com
37512855Sgabeblack@google.com  _1u = v4 & v1;   _1x = v4 & v2;    _10 = v4 & v3;
37612855Sgabeblack@google.com  _11 = v4 & v4;   _1z = v4 & v5;    _1w = v4 & v6;
37712855Sgabeblack@google.com  _1l = v4 & v7;   _1h = v4 & v8;    _1d = v4 & v9;
37812855Sgabeblack@google.com
37912855Sgabeblack@google.com  zu = v5 & v1;	   zx = v5 & v2;    z0 = v5 & v3;
38012855Sgabeblack@google.com  z1 = v5 & v4;	   zz = v5 & v5;    zw = v5 & v6;
38112855Sgabeblack@google.com  zl = v5 & v7;	   zh = v5 & v8;    zd = v5 & v9;
38212855Sgabeblack@google.com
38312855Sgabeblack@google.com  wu = v6 & v1;	   wx = v6 & v2;    w0 = v6 & v3;
38412855Sgabeblack@google.com  w1 = v6 & v4;	   wz = v6 & v5;    ww = v6 & v6;
38512855Sgabeblack@google.com  wl = v6 & v7;	   wh = v6 & v8;    wd = v6 & v9;
38612855Sgabeblack@google.com
38712855Sgabeblack@google.com  lu = v7 & v1;	   lx = v7 & v2;    l0 = v7 & v3;
38812855Sgabeblack@google.com  l1 = v7 & v4;	   lz = v7 & v5;    lw = v7 & v6;
38912855Sgabeblack@google.com  ll = v7 & v7;	   lh = v7 & v8;    ld = v7 & v9;
39012855Sgabeblack@google.com
39112855Sgabeblack@google.com  hu = v8 & v1;	   hx = v8 & v2;    h0 = v8 & v3;
39212855Sgabeblack@google.com  h1 = v8 & v4;	   hz = v8 & v5;    hw = v8 & v6;
39312855Sgabeblack@google.com  hl = v8 & v7;	   hh = v8 & v8;    hd = v8 & v9;
39412855Sgabeblack@google.com
39512855Sgabeblack@google.com  du = v9 & v1;	   dx = v9 & v2;    d0 = v9 & v3;
39612855Sgabeblack@google.com  d1 = v9 & v4;	   dz = v9 & v5;    dw = v9 & v6;
39712855Sgabeblack@google.com  dl = v9 & v7;	   dh = v9 & v8;    dd = v9 & v9;
39812855Sgabeblack@google.com
39912855Sgabeblack@google.com  cout	<< "\n+-------------------------+"
40012855Sgabeblack@google.com       	<< "\n| AND (&) | X | 0 | 1 | Z |"
40112855Sgabeblack@google.com	<< "\n+-------------------------+"
40212855Sgabeblack@google.com  	<< "\n|    X    | " << xx << " | " << x0 << " | "
40312855Sgabeblack@google.com	   	            << x1 << " | " << xz << " | "
40412855Sgabeblack@google.com	<< "\n+-------------------------+"
40512855Sgabeblack@google.com  	<< "\n|    0    | " << _0x << " | " << _00 << " | "
40612855Sgabeblack@google.com	   	            << _01 << " | " << _0z << " | "
40712855Sgabeblack@google.com	<< "\n+-------------------------+"
40812855Sgabeblack@google.com  	<< "\n|    1    | " << _1x << " | " << _10 << " | "
40912855Sgabeblack@google.com	   	            << _11 << " | " << _1z << " | "
41012855Sgabeblack@google.com	<< "\n+-------------------------+"
41112855Sgabeblack@google.com  	<< "\n|    Z    | " << zx << " | " << z0 << " | "
41212855Sgabeblack@google.com	   	            << z1 << " | " << zz << " | "
41312855Sgabeblack@google.com	<< "\n+-------------------------+"
41412855Sgabeblack@google.com	<< endl;
41512855Sgabeblack@google.com
41612855Sgabeblack@google.com  uu = v1 | v1;	   ux = v1 | v2;    u0 = v1 | v3;
41712855Sgabeblack@google.com  u1 = v1 | v4;	   uz = v1 | v5;    uw = v1 | v6;
41812855Sgabeblack@google.com  ul = v1 | v7;	   uh = v1 | v8;    ud = v1 | v9;
41912855Sgabeblack@google.com
42012855Sgabeblack@google.com  xu = v2 | v1;	   xx = v2 | v2;    x0 = v2 | v3;
42112855Sgabeblack@google.com  x1 = v2 | v4;	   xz = v2 | v5;    xw = v2 | v6;
42212855Sgabeblack@google.com  xl = v2 | v7;	   xh = v2 | v8;    xd = v2 | v9;
42312855Sgabeblack@google.com
42412855Sgabeblack@google.com  _0u = v3 | v1;   _0x = v3 | v2;    _00 = v3 | v3;
42512855Sgabeblack@google.com  _01 = v3 | v4;   _0z = v3 | v5;    _0w = v3 | v6;
42612855Sgabeblack@google.com  _0l = v3 | v7;   _0h = v3 | v8;    _0d = v3 | v9;
42712855Sgabeblack@google.com
42812855Sgabeblack@google.com  _1u = v4 | v1;   _1x = v4 | v2;    _10 = v4 | v3;
42912855Sgabeblack@google.com  _11 = v4 | v4;   _1z = v4 | v5;    _1w = v4 | v6;
43012855Sgabeblack@google.com  _1l = v4 | v7;   _1h = v4 | v8;    _1d = v4 | v9;
43112855Sgabeblack@google.com
43212855Sgabeblack@google.com  zu = v5 | v1;	   zx = v5 | v2;    z0 = v5 | v3;
43312855Sgabeblack@google.com  z1 = v5 | v4;	   zz = v5 | v5;    zw = v5 | v6;
43412855Sgabeblack@google.com  zl = v5 | v7;	   zh = v5 | v8;    zd = v5 | v9;
43512855Sgabeblack@google.com
43612855Sgabeblack@google.com  wu = v6 | v1;	   wx = v6 | v2;    w0 = v6 | v3;
43712855Sgabeblack@google.com  w1 = v6 | v4;	   wz = v6 | v5;    ww = v6 | v6;
43812855Sgabeblack@google.com  wl = v6 | v7;	   wh = v6 | v8;    wd = v6 | v9;
43912855Sgabeblack@google.com
44012855Sgabeblack@google.com  lu = v7 | v1;	   lx = v7 | v2;    l0 = v7 | v3;
44112855Sgabeblack@google.com  l1 = v7 | v4;	   lz = v7 | v5;    lw = v7 | v6;
44212855Sgabeblack@google.com  ll = v7 | v7;	   lh = v7 | v8;    ld = v7 | v9;
44312855Sgabeblack@google.com
44412855Sgabeblack@google.com  hu = v8 | v1;	   hx = v8 | v2;    h0 = v8 | v3;
44512855Sgabeblack@google.com  h1 = v8 | v4;	   hz = v8 | v5;    hw = v8 | v6;
44612855Sgabeblack@google.com  hl = v8 | v7;	   hh = v8 | v8;    hd = v8 | v9;
44712855Sgabeblack@google.com
44812855Sgabeblack@google.com  du = v9 | v1;	   dx = v9 | v2;    d0 = v9 | v3;
44912855Sgabeblack@google.com  d1 = v9 | v4;	   dz = v9 | v5;    dw = v9 | v6;
45012855Sgabeblack@google.com  dl = v9 | v7;	   dh = v9 | v8;    dd = v9 | v9;
45112855Sgabeblack@google.com
45212855Sgabeblack@google.com  cout	<< "\n+-------------------------+"
45312855Sgabeblack@google.com       	<< "\n| OR  (|) | X | 0 | 1 | Z |"
45412855Sgabeblack@google.com	<< "\n+-------------------------+"
45512855Sgabeblack@google.com  	<< "\n|    X    | " << xx << " | " << x0 << " | "
45612855Sgabeblack@google.com	   	            << x1 << " | " << xz << " | "
45712855Sgabeblack@google.com	<< "\n+-------------------------+"
45812855Sgabeblack@google.com  	<< "\n|    0    | " << _0x << " | " << _00 << " | "
45912855Sgabeblack@google.com	   	            << _01 << " | " << _0z << " | "
46012855Sgabeblack@google.com	<< "\n+-------------------------+"
46112855Sgabeblack@google.com  	<< "\n|    1    | " << _1x << " | " << _10 << " | "
46212855Sgabeblack@google.com	   	            << _11 << " | " << _1z << " | "
46312855Sgabeblack@google.com	<< "\n+-------------------------+"
46412855Sgabeblack@google.com  	<< "\n|    Z    | " << zx << " | " << z0 << " | "
46512855Sgabeblack@google.com	   	            << z1 << " | " << zz << " | "
46612855Sgabeblack@google.com	<< "\n+-------------------------+"
46712855Sgabeblack@google.com	<< endl;
46812855Sgabeblack@google.com
46912855Sgabeblack@google.com  uu = v1 ^ v1;	   ux = v1 ^ v2;    u0 = v1 ^ v3;
47012855Sgabeblack@google.com  u1 = v1 ^ v4;	   uz = v1 ^ v5;    uw = v1 ^ v6;
47112855Sgabeblack@google.com  ul = v1 ^ v7;	   uh = v1 ^ v8;    ud = v1 ^ v9;
47212855Sgabeblack@google.com
47312855Sgabeblack@google.com  xu = v2 ^ v1;	   xx = v2 ^ v2;    x0 = v2 ^ v3;
47412855Sgabeblack@google.com  x1 = v2 ^ v4;	   xz = v2 ^ v5;    xw = v2 ^ v6;
47512855Sgabeblack@google.com  xl = v2 ^ v7;	   xh = v2 ^ v8;    xd = v2 ^ v9;
47612855Sgabeblack@google.com
47712855Sgabeblack@google.com  _0u = v3 ^ v1;   _0x = v3 ^ v2;    _00 = v3 ^ v3;
47812855Sgabeblack@google.com  _01 = v3 ^ v4;   _0z = v3 ^ v5;    _0w = v3 ^ v6;
47912855Sgabeblack@google.com  _0l = v3 ^ v7;   _0h = v3 ^ v8;    _0d = v3 ^ v9;
48012855Sgabeblack@google.com
48112855Sgabeblack@google.com  _1u = v4 ^ v1;   _1x = v4 ^ v2;    _10 = v4 ^ v3;
48212855Sgabeblack@google.com  _11 = v4 ^ v4;   _1z = v4 ^ v5;    _1w = v4 ^ v6;
48312855Sgabeblack@google.com  _1l = v4 ^ v7;   _1h = v4 ^ v8;    _1d = v4 ^ v9;
48412855Sgabeblack@google.com
48512855Sgabeblack@google.com  zu = v5 ^ v1;	   zx = v5 ^ v2;    z0 = v5 ^ v3;
48612855Sgabeblack@google.com  z1 = v5 ^ v4;	   zz = v5 ^ v5;    zw = v5 ^ v6;
48712855Sgabeblack@google.com  zl = v5 ^ v7;	   zh = v5 ^ v8;    zd = v5 ^ v9;
48812855Sgabeblack@google.com
48912855Sgabeblack@google.com  wu = v6 ^ v1;	   wx = v6 ^ v2;    w0 = v6 ^ v3;
49012855Sgabeblack@google.com  w1 = v6 ^ v4;	   wz = v6 ^ v5;    ww = v6 ^ v6;
49112855Sgabeblack@google.com  wl = v6 ^ v7;	   wh = v6 ^ v8;    wd = v6 ^ v9;
49212855Sgabeblack@google.com
49312855Sgabeblack@google.com  lu = v7 ^ v1;	   lx = v7 ^ v2;    l0 = v7 ^ v3;
49412855Sgabeblack@google.com  l1 = v7 ^ v4;	   lz = v7 ^ v5;    lw = v7 ^ v6;
49512855Sgabeblack@google.com  ll = v7 ^ v7;	   lh = v7 ^ v8;    ld = v7 ^ v9;
49612855Sgabeblack@google.com
49712855Sgabeblack@google.com  hu = v8 ^ v1;	   hx = v8 ^ v2;    h0 = v8 ^ v3;
49812855Sgabeblack@google.com  h1 = v8 ^ v4;	   hz = v8 ^ v5;    hw = v8 ^ v6;
49912855Sgabeblack@google.com  hl = v8 ^ v7;	   hh = v8 ^ v8;    hd = v8 ^ v9;
50012855Sgabeblack@google.com
50112855Sgabeblack@google.com  du = v9 ^ v1;	   dx = v9 ^ v2;    d0 = v9 ^ v3;
50212855Sgabeblack@google.com  d1 = v9 ^ v4;	   dz = v9 ^ v5;    dw = v9 ^ v6;
50312855Sgabeblack@google.com  dl = v9 ^ v7;	   dh = v9 ^ v8;    dd = v9 ^ v9;
50412855Sgabeblack@google.com
50512855Sgabeblack@google.com  cout	<< "\n+-------------------------+"
50612855Sgabeblack@google.com       	<< "\n| XOR (^) | X | 0 | 1 | Z |"
50712855Sgabeblack@google.com	<< "\n+-------------------------+"
50812855Sgabeblack@google.com  	<< "\n|    X    | " << xx << " | " << x0 << " | "
50912855Sgabeblack@google.com	   	            << x1 << " | " << xz << " | "
51012855Sgabeblack@google.com	<< "\n+-------------------------+"
51112855Sgabeblack@google.com  	<< "\n|    0    | " << _0x << " | " << _00 << " | "
51212855Sgabeblack@google.com	   	            << _01 << " | " << _0z << " | "
51312855Sgabeblack@google.com	<< "\n+-------------------------+"
51412855Sgabeblack@google.com  	<< "\n|    1    | " << _1x << " | " << _10 << " | "
51512855Sgabeblack@google.com	   	            << _11 << " | " << _1z << " | "
51612855Sgabeblack@google.com	<< "\n+-------------------------+"
51712855Sgabeblack@google.com  	<< "\n|    Z    | " << zx << " | " << z0 << " | "
51812855Sgabeblack@google.com	   	            << z1 << " | " << zz << " | "
51912855Sgabeblack@google.com	<< "\n+-------------------------+"
52012855Sgabeblack@google.com	<< endl;
52112855Sgabeblack@google.com
52212855Sgabeblack@google.com  std_ulogic 	nu, nx, n0, n1, nz, nw, nl, nh, nd;
52312855Sgabeblack@google.com
52412855Sgabeblack@google.com  nu = ~v1;
52512855Sgabeblack@google.com  nx = ~v2;
52612855Sgabeblack@google.com  n0 = ~v3;
52712855Sgabeblack@google.com  n1 = ~v4;
52812855Sgabeblack@google.com  nz = ~v5;
52912855Sgabeblack@google.com  nw = ~v6;
53012855Sgabeblack@google.com  nl = ~v7;
53112855Sgabeblack@google.com  nh = ~v8;
53212855Sgabeblack@google.com  nd = ~v9;
53312855Sgabeblack@google.com
53412855Sgabeblack@google.com  cout	<< "\n+-------------------------+"
53512855Sgabeblack@google.com       	<< "\n| NOT (~) | X | 0 | 1 | Z |"
53612855Sgabeblack@google.com	<< "\n+-------------------------+"
53712855Sgabeblack@google.com  	<< "\n|         | " << nx << " | " << n0 << " | "
53812855Sgabeblack@google.com	   	            << n1 << " | " << nz << " | "
53912855Sgabeblack@google.com	<< "\n+-------------------------+"
54012855Sgabeblack@google.com	<< endl;
54112855Sgabeblack@google.com    return 0;
54212855Sgabeblack@google.com}
543