summaryrefslogtreecommitdiff
path: root/src/systemc/tests/include/specialized_signals/scx_signal_unsigned.h
blob: 7cfc409c181b3cc8a3396343ed254ce66fd30ae2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
/*****************************************************************************

  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
  more contributor license agreements.  See the NOTICE file distributed
  with this work for additional information regarding copyright ownership.
  Accellera licenses this file to you under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with the
  License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  implied.  See the License for the specific language governing
  permissions and limitations under the License.

 *****************************************************************************/

/*****************************************************************************

  sc_signal_unsigned.cpp -- The sc_signal<sc_unsigned<W> > implementations.

  Original Author: Andy Goodrich, Forte Design Systems, 2002-10-22

 *****************************************************************************/

/*****************************************************************************

  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
  changes you are making here.

      Name, Affiliation, Date:
  Description of Modification:

 *****************************************************************************/

/*
$Log: scx_signal_unsigned.h,v $
Revision 1.1  2011/08/15 17:31:11  acg
 Andy Goodrich: moved specialized signals from examples to this tree.

Revision 1.2  2011/08/15 16:43:24  acg
 Torsten Maehne: changes to remove unused argument warnings.

Revision 1.1.1.1  2006/12/15 20:20:03  acg
SystemC 2.3

Revision 1.2  2005/12/26 20:11:14  acg
Fixed up copyright.

Revision 1.1.1.1  2005/12/19 23:16:42  acg
First check in of SystemC 2.1 into its own archive.

Revision 1.17  2005/09/15 23:01:52  acg
Added std:: prefix to appropriate methods and types to get around
issues with the Edison Front End.

Revision 1.16  2005/05/03 19:52:26  acg
Get proper header locations on includes.

Revision 1.15  2005/05/03 19:50:20  acg
Name space version.

Revision 1.12  2005/04/11 19:05:36  acg
Change to sc_clock for Microsoft VCC 6.0. Changes for namespaces

Revision 1.11  2005/04/03 22:52:52  acg
Namespace changes.

Revision 1.10  2005/03/21 22:31:33  acg
Changes to sc_core namespace.

Revision 1.9  2004/09/27 21:01:59  acg
Andy Goodrich - Forte Design Systems, Inc.
   - This is specialized signal support that allows better use of signals
     and ports whose target value is a SystemC native type.

*/



#include <systemc>
#include <typeinfo>

/*****************************************************************************

  sc_signal_unsigned.h -- The sc_signal<sc_dt::sc_biguint<W> > definitions.

  Original Author: Andy Goodrich, Forte Design Systems, 2002-10-22

 *****************************************************************************/

/*****************************************************************************

  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
  changes you are making here.

      Name, Affiliation, Date:
  Description of Modification:

 *****************************************************************************/

/*
$Log: scx_signal_unsigned.h,v $
Revision 1.1  2011/08/15 17:31:11  acg
 Andy Goodrich: moved specialized signals from examples to this tree.

Revision 1.3  2011/08/15 16:43:24  acg
 Torsten Maehne: changes to remove unused argument warnings.

Revision 1.2  2011/06/28 21:23:02  acg
 Andy Goodrich: merging of SCV tree.

Revision 1.1.1.1  2006/12/15 20:20:03  acg
SystemC 2.3

Revision 1.4  2006/10/23 19:40:36  acg
 Andy Goodrich: added an explicit dynamic cast to keep gcc 4.x happy.

Revision 1.3  2006/03/21 01:31:49  acg
 Andy Goodrich: changed over to sc_get_current_process_b() from
 sc_get_current_process_base() since the function's name changed.

Revision 1.2  2005/12/26 20:11:14  acg
Fixed up copyright.

Revision 1.1.1.1  2005/12/19 23:16:42  acg
First check in of SystemC 2.1 into its own archive.

Revision 1.28  2005/09/15 23:01:52  acg
Added std:: prefix to appropriate methods and types to get around
issues with the Edison Front End.

Revision 1.27  2005/07/30 03:44:11  acg
Changes from 2.1.

Revision 1.26  2005/05/09 17:17:12  acg
Changes from 2.1.

Revision 1.25  2005/05/08 19:04:06  acg
Fix bug in concat_set(int64,off). Other changes from 2.1 examples usage.

Revision 1.24  2005/05/03 19:50:20  acg
Name space version.

Revision 1.22  2005/03/21 22:31:33  acg
Changes to sc_core namespace.

Revision 1.21  2005/01/10 17:51:58  acg
Improvements.

Revision 1.20  2004/11/09 00:11:27  acg
Added support for sc_generic_base<T> in place of sc_concatref. sc_concatref
now is derived from sc_generic_base<sc_concatref>.

Revision 1.19  2004/09/27 21:01:59  acg
Andy Goodrich - Forte Design Systems, Inc.
   - This is specialized signal support that allows better use of signals
     and ports whose target value is a SystemC native type.

*/


#if !defined(SC_SIGNAL_UNSIGNED_H)
#define SC_SIGNAL_UNSIGNED_H

#if ( !defined(_MSC_VER) || _MSC_VER > 1200 )
#    define SC_TEMPLATE template<int W>
#else
#    define SC_TEMPLATE template<> template<int W>
#endif


// FORWARD REFERENCES AND USINGS:

using sc_dt::sc_signed;
using sc_dt::int64;
using sc_dt::uint64;

namespace sc_core {

class sc_unsigned_sigref;

//==============================================================================
// CLASS sc_unsigned_part_if
//
// This class provides generic access to part selections for signals whose
// data type is sc_dt::sc_biguint<W>. This class serves as the base class for the
// sc_dt::sc_biguint<W> specialization of the sc_signal_in_if<T> class. The methods
// in this class may be over-ridden individually, those that are not overridden
// will produce an error message when called. The methods are used by the
// sc_unsigned_sigref class.
//
// Notes:
//   (1) Descriptions of the methods and operators in this class appear with
//       their implementations in sc_signal<sc_dt::sc_biguint<W> >.
//==============================================================================
class sc_unsigned_part_if : virtual public sc_interface {
  protected:
	// constructor:
  	sc_unsigned_part_if() {}

  public:
    // perform a part read.
	virtual sc_dt::sc_unsigned* part_read_target();
  	virtual sc_dt::sc_unsigned read_part( int left, int right ) const;

    // perform a part write.
	virtual sc_unsigned_sigref& select_part( int left, int right );
    virtual void write_part( sc_dt::int64 v, int left, int right );
    virtual void write_part( sc_dt::uint64 v, int left, int right );
    virtual void write_part( const sc_dt::sc_signed& v, int left, int right );
    virtual void write_part( const sc_dt::sc_unsigned& v, int left, int right );


  private:
  	sc_unsigned_part_if( const sc_unsigned_part_if& );
  	sc_unsigned_part_if& operator = ( const sc_unsigned_part_if& );
};


//==============================================================================
// CLASS sc_signal_in_if<sc_dt::sc_biguint<W> >
//
// This is the class specializations for the sc_signal_in_if<T> class to
// provide additional features for sc_signal instances whose template is
// sc_dt::sc_biguint<W>, including part access.
//
// Notes:
//   (1) Descriptions of the methods and operators in this class appear with
//       their implementations in sc_signal<sc_dt::sc_biguint<W> >.
//==============================================================================
template< int W >
class sc_signal_in_if<sc_dt::sc_biguint<W> > : public sc_unsigned_part_if {
	friend class sc_unsigned_sigref;
  public:
    typedef sc_signal_in_if<sc_dt::sc_biguint<W> > this_type;

    // get the value changed event
    virtual const sc_event& value_changed_event() const = 0;


    // read the current value
    virtual const sc_dt::sc_biguint<W>& read() const = 0;

    // get a reference to the current value (for tracing)
    virtual const sc_dt::sc_biguint<W>& get_data_ref() const = 0;


    // was there a value changed event?
    virtual bool event() const = 0;

  protected:
    // constructor
    sc_signal_in_if()
    {}

  private: // disabled
    sc_signal_in_if( const this_type& );
    this_type& operator = ( const this_type& );
};

//=============================================================================
//  CLASS : sc_unsigned_sigref
//
//  Proxy class for sc_signal_uint bit and part selection.
//=============================================================================
class sc_unsigned_sigref : public sc_dt::sc_unsigned_subref_r
{
  public:
    sc_unsigned_sigref() : sc_dt::sc_unsigned_subref_r() {}
    virtual ~sc_unsigned_sigref() {}
    virtual void concat_set(sc_dt::int64 src, int low_i);
    virtual void concat_set(const sc_dt::sc_signed& src, int low_i);
    virtual void concat_set(const sc_dt::sc_unsigned& src, int low_i);
    virtual void concat_set(const sc_dt::sc_lv_base& src, int low_i);
    virtual void concat_set(sc_dt::uint64 src, int low_i);

  public:
    inline void initialize( sc_unsigned_part_if* if_p, int left_, int right_ );

  public:
    inline void operator = ( sc_dt::uint64 v );
    inline void operator = ( const char* v );
    inline void operator = ( unsigned long v );
    inline void operator = ( long v );
    inline void operator = ( unsigned int v );
    inline void operator = ( int v );
    inline void operator = ( sc_dt::int64 v );
    inline void operator = ( double v );
    inline void operator = ( const sc_unsigned_sigref& v );
    template<typename T>
    inline void operator = ( const sc_dt::sc_generic_base<T>& v );
    inline void operator = ( const sc_dt::sc_signed& v );
    inline void operator = ( const sc_dt::sc_unsigned& v );
    inline void operator = ( const sc_dt::sc_bv_base& v );
    inline void operator = ( const sc_dt::sc_lv_base& v );

  public:
    static sc_vpool<sc_unsigned_sigref> m_pool; // Pool of objects to use.

  protected:
    sc_unsigned_part_if*                m_if_p; // Target for selection.

  private:

    // disabled
    sc_unsigned_sigref( const sc_unsigned_sigref& a );
};


//==============================================================================
// CLASS sc_signal<sc_dt::sc_biguint<W> >
//
// This class implements a signal whose value acts like an sc_dt::sc_biguint<W> data
// value. This class is a specialization of the generic sc_signal class to
// implement tailored support for the sc_dt::sc_biguint<W> class.
//
// Notes:
//   (1) Descriptions of the methods and operators in this class appear with
//       their implementations.
//==============================================================================
SC_TEMPLATE
class sc_signal<sc_dt::sc_biguint<W> > :
    public sc_dt::sc_biguint<W>,
	public sc_prim_channel,
    public sc_signal_inout_if<sc_dt::sc_biguint<W> >
{
  public: // typedefs
    typedef sc_signal<sc_dt::sc_biguint<W> > this_type;

  public: // constructors and destructor:
    inline sc_signal();
    explicit inline sc_signal(const char* name_);
    virtual inline ~sc_signal();

  public: // base methods:
    inline bool base_event() const;
    inline const sc_dt::sc_biguint<W>& base_read() const;
    inline const sc_event& base_value_changed_event() const;
    inline void base_write( sc_dt::int64 value );
    inline void base_write( sc_dt::uint64 value );
    inline void base_write( const sc_dt::sc_signed& value );
    inline void base_write( const sc_dt::sc_unsigned& value );

  public: // sc_prim_channel virtual methods:
    virtual inline const char* kind() const;
    virtual inline void update();

  public: // sc_interface virtual methods:
    virtual inline const sc_event& default_event() const;
    virtual inline void register_port(
		sc_port_base& port_, const char* if_typename_ );

  public: // sc_unsigned_channel virtual methods:
    virtual inline sc_dt::sc_unsigned* part_read_target();
    virtual inline sc_dt::sc_unsigned read_part(int left, int right) const;
	virtual sc_unsigned_sigref& select_part( int left, int right );
	virtual inline void write_part( sc_dt::int64 v, int left, int right );
	virtual inline void write_part( sc_dt::uint64 v, int left, int right );
	virtual inline void write_part( const sc_dt::sc_signed& v, int left, int right );
	virtual inline void write_part(const sc_dt::sc_unsigned& v, int left, int right);

  public: // interface virtual methods:
    virtual inline bool event() const;
    virtual inline const sc_dt::sc_biguint<W>& get_data_ref() const;
    virtual inline sc_signal<sc_dt::sc_biguint<W> >& get_signal();
    virtual inline const sc_dt::sc_biguint<W>& read() const;
    virtual inline const sc_event& value_changed_event() const;
    virtual inline void write( const sc_in<sc_dt::sc_biguint<W> >& value );
    virtual inline void write( const sc_inout<sc_dt::sc_biguint<W> >& value );
    virtual inline void write( const sc_dt::sc_biguint<W>& value );

  public: // part selections:
  	inline sc_unsigned_sigref& operator () ( int left, int right );
	// #### Need to add range() and bit()!
  	inline sc_unsigned_sigref& operator [] ( int bit );

  public: // operators:
    inline void operator = ( const this_type& new_val );
    inline void operator = ( const char* new_val );
    inline void operator = ( sc_dt::uint64 new_val );
    inline void operator = ( sc_dt::int64 new_val );
    inline void operator = ( int new_val );
    inline void operator = ( long new_val );
    inline void operator = ( short new_val );
    inline void operator = ( unsigned int new_val );
    inline void operator = ( unsigned long new_val );
    inline void operator = ( unsigned short new_val );
    template<typename T>
    inline void operator = ( const sc_dt::sc_generic_base<T>& new_val );
    inline void operator = ( const sc_dt::sc_signed& new_val );
    inline void operator = ( const sc_dt::sc_unsigned& new_val );
    inline void operator = ( const sc_dt::sc_bv_base& new_val );
    inline void operator = ( const sc_dt::sc_lv_base& new_val );

    // concatenation methods (we inherit length and gets from sc_dt::sc_biguint<W>):

    virtual inline void concat_set(sc_dt::int64 src, int low_i);
    virtual inline void concat_set(const sc_dt::sc_lv_base& src, int low_i);
    virtual inline void concat_set(const sc_dt::sc_signed& src, int low_i);
    virtual inline void concat_set(const sc_dt::sc_unsigned& src, int low_i);
    virtual inline void concat_set(sc_dt::uint64 src, int low_i);

  protected: // debugging methods:
    // #### void check_port();
	void check_writer();

  private: // Disabled operations that sc_dt::sc_biguint<W> supports:
    sc_dt::sc_unsigned& operator ++ ();          // prefix
    const sc_dt::sc_unsigned& operator ++ (int); // postfix
    sc_dt::sc_unsigned& operator -- ();          // prefix
    const sc_dt::sc_unsigned& operator -- (int); // postfix
    sc_dt::sc_unsigned& operator += (const sc_dt::sc_signed&    );
    sc_dt::sc_unsigned& operator += (const sc_dt::sc_unsigned&  );
    sc_dt::sc_unsigned& operator += (sc_dt::int64               );
    sc_dt::sc_unsigned& operator += (sc_dt::uint64              );
    sc_dt::sc_unsigned& operator += (long                );
    sc_dt::sc_unsigned& operator += (unsigned long       );
    sc_dt::sc_unsigned& operator += (int                 );
    sc_dt::sc_unsigned& operator += (unsigned int        );
    sc_dt::sc_unsigned& operator -= (const sc_dt::sc_signed&    );
    sc_dt::sc_unsigned& operator -= (const sc_dt::sc_unsigned&  );
    sc_dt::sc_unsigned& operator -= (sc_dt::int64               );
    sc_dt::sc_unsigned& operator -= (sc_dt::uint64              );
    sc_dt::sc_unsigned& operator -= (long                );
    sc_dt::sc_unsigned& operator -= (unsigned long       );
    sc_dt::sc_unsigned& operator -= (int                 );
    sc_dt::sc_unsigned& operator -= (unsigned int        );
    sc_dt::sc_unsigned& operator *= (const sc_dt::sc_signed&    );
    sc_dt::sc_unsigned& operator *= (const sc_dt::sc_unsigned&  );
    sc_dt::sc_unsigned& operator *= (sc_dt::int64               );
    sc_dt::sc_unsigned& operator *= (sc_dt::uint64              );
    sc_dt::sc_unsigned& operator *= (long                );
    sc_dt::sc_unsigned& operator *= (unsigned long       );
    sc_dt::sc_unsigned& operator *= (int                 );
    sc_dt::sc_unsigned& operator *= (unsigned int        );
    sc_dt::sc_unsigned& operator /= (const sc_dt::sc_signed&    );
    sc_dt::sc_unsigned& operator /= (const sc_dt::sc_unsigned&  );
    sc_dt::sc_unsigned& operator /= (sc_dt::int64               );
    sc_dt::sc_unsigned& operator /= (sc_dt::uint64              );
    sc_dt::sc_unsigned& operator /= (long                );
    sc_dt::sc_unsigned& operator /= (unsigned long       );
    sc_dt::sc_unsigned& operator /= (int                 );
    sc_dt::sc_unsigned& operator /= (unsigned int        );
    sc_dt::sc_unsigned& operator %= (const sc_dt::sc_signed&    );
    sc_dt::sc_unsigned& operator %= (const sc_dt::sc_unsigned&  );
    sc_dt::sc_unsigned& operator %= (sc_dt::int64               );
    sc_dt::sc_unsigned& operator %= (sc_dt::uint64              );
    sc_dt::sc_unsigned& operator %= (long                );
    sc_dt::sc_unsigned& operator %= (unsigned long       );
    sc_dt::sc_unsigned& operator %= (int                 );
    sc_dt::sc_unsigned& operator %= (unsigned int        );
    sc_dt::sc_unsigned& operator &= (const sc_dt::sc_signed&    );
    sc_dt::sc_unsigned& operator &= (const sc_dt::sc_unsigned&  );
    sc_dt::sc_unsigned& operator &= (sc_dt::int64               );
    sc_dt::sc_unsigned& operator &= (sc_dt::uint64              );
    sc_dt::sc_unsigned& operator &= (long                );
    sc_dt::sc_unsigned& operator &= (unsigned long       );
    sc_dt::sc_unsigned& operator &= (int                 );
    sc_dt::sc_unsigned& operator &= (unsigned int        );
    sc_dt::sc_unsigned& operator |= (const sc_dt::sc_signed&    );
    sc_dt::sc_unsigned& operator |= (const sc_dt::sc_unsigned&  );
    sc_dt::sc_unsigned& operator |= (sc_dt::int64               );
    sc_dt::sc_unsigned& operator |= (sc_dt::uint64              );
    sc_dt::sc_unsigned& operator |= (long                );
    sc_dt::sc_unsigned& operator |= (unsigned long       );
    sc_dt::sc_unsigned& operator |= (int                 );
    sc_dt::sc_unsigned& operator |= (unsigned int        );
    sc_dt::sc_unsigned& operator ^= (const sc_dt::sc_signed&    );
    sc_dt::sc_unsigned& operator ^= (const sc_dt::sc_unsigned&  );
    sc_dt::sc_unsigned& operator ^= (sc_dt::int64               );
    sc_dt::sc_unsigned& operator ^= (sc_dt::uint64              );
    sc_dt::sc_unsigned& operator ^= (long                );
    sc_dt::sc_unsigned& operator ^= (unsigned long       );
    sc_dt::sc_unsigned& operator ^= (int                 );
    sc_dt::sc_unsigned& operator ^= (unsigned int        );

  protected:
    mutable sc_event*  m_changed_event_p; // Value changed event this object.
    sc_dt::uint64      m_event_delta;     // Delta cycle of last event.
    sc_dt::sc_unsigned m_new_val;         // New value for this object instance.
    sc_port_base*      m_output_p;        // Single write port verify field.
    sc_process_b*   m_writer_p;        // Single writer verify field.
};


SC_TEMPLATE // Return true if a changed event happened in the last delta cycle.
inline bool sc_signal<sc_dt::sc_biguint<W> >::base_event() const
{
    return simcontext()->delta_count() == m_event_delta + 1;
}


SC_TEMPLATE // Return this object's sc_dt::sc_biguint<W> object instance.
inline const sc_dt::sc_biguint<W>& sc_signal<sc_dt::sc_biguint<W> >::base_read() const
{
	return *this;
}


SC_TEMPLATE // Return the value changed event, allocating it if necessary.
inline const sc_event& sc_signal<sc_dt::sc_biguint<W> >::base_value_changed_event() const
{
    if ( !m_changed_event_p ) m_changed_event_p = new sc_event;
    return *m_changed_event_p;
}


SC_TEMPLATE // Write a const sc_dt::sc_signed& value to this object instance.
inline void sc_signal<sc_dt::sc_biguint<W> >::base_write( const sc_dt::sc_signed& value )
{
#   if defined(DEBUG_SYSTEMC)
        check_writer();
#   endif
    m_new_val = value;
    request_update();
}

SC_TEMPLATE // Write a const sc_dt::sc_unsigned& value to this object instance.
inline void sc_signal<sc_dt::sc_biguint<W> >::base_write( const sc_dt::sc_unsigned& value )
{
#   if defined(DEBUG_SYSTEMC)
        check_writer();
#   endif
    m_new_val = value;
    request_update();
}

SC_TEMPLATE // Write a sc_dt::int64 value to this object instance.
inline void sc_signal<sc_dt::sc_biguint<W> >::base_write( sc_dt::int64 value )
{
#   if defined(DEBUG_SYSTEMC)
        check_writer();
#   endif
    m_new_val = value;
    request_update();
}


SC_TEMPLATE // Write a sc_dt::uint64 value to this object instance.
inline void sc_signal<sc_dt::sc_biguint<W> >::base_write( sc_dt::uint64 value )
{
#   if defined(DEBUG_SYSTEMC)
        check_writer();
#   endif
    m_new_val = value;
    request_update();
}


//------------------------------------------------------------------------------
//"sc_signal<sc_dt::sc_biguint<W> >::check_writer"
//
// This method checks to see if there is more than one writer for this
// object instance by keeping track of the process performing the write.
//------------------------------------------------------------------------------
SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::check_writer()
{
    sc_process_b* writer_p = sc_get_current_process_b();
    if( m_writer_p == 0 )
    {
        m_writer_p = writer_p;
    }
    else if( m_writer_p != writer_p )
    {
        sc_signal_invalid_writer( name(), kind(),
                                  m_writer_p->name(), writer_p->name() );
    }
}


//------------------------------------------------------------------------------
//"sc_signal<sc_dt::sc_biguint<W> >::concat_set"
//
// These virtual methods allow value assignments to this object instance
// from various sources. The position within the supplied source of the
// low order bit for this object instance's value is low_i.
//     src   = source value.
//     low_i = bit within src to serve as low order bit of this object
//             instance's value.
//------------------------------------------------------------------------------
SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::concat_set(sc_dt::int64 src, int low_i)
{
    if ( low_i < 64 )
    {
        base_write(src >> low_i);
    }
    else
    {
        base_write( (sc_dt::int64)((src < 0 ) ?  -1 : 0 ));
    }
}

SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::concat_set(
	const sc_dt::sc_lv_base& src, int low_i)
{
    sc_dt::sc_unsigned tmp(src.length());
    tmp = src >> low_i;
    base_write( tmp );
}

SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::concat_set(
	const sc_dt::sc_signed& src, int low_i)
{
    base_write( (src >> low_i) );
}

SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::concat_set(
	const sc_dt::sc_unsigned& src, int low_i)
{
    base_write( (src >> low_i) );
}

SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::concat_set(sc_dt::uint64 src, int low_i)
{
	base_write( (sc_dt::uint64)(( low_i < 64 ) ? src >> low_i : 0));
}



SC_TEMPLATE // Return the default event for this object instance.
inline const sc_event& sc_signal<sc_dt::sc_biguint<W> >::default_event() const
	{ return base_value_changed_event(); }


SC_TEMPLATE // Return true if a changed event happened in the last delta cycle.
inline bool sc_signal<sc_dt::sc_biguint<W> >::event() const
	{ return base_event(); }


SC_TEMPLATE // Return a reference to the value of this object instance.
inline const sc_dt::sc_biguint<W>& sc_signal<sc_dt::sc_biguint<W> >::get_data_ref() const
	{ return *this; }


SC_TEMPLATE // Return a pointer to this object instance.
inline sc_signal<sc_dt::sc_biguint<W> >& sc_signal<sc_dt::sc_biguint<W> >::get_signal()
	{ return *this; }


SC_TEMPLATE // Return a kind value of "sc_signal".
inline const char* sc_signal<sc_dt::sc_biguint<W> >::kind() const
{
	return "sc_signal";
}


//------------------------------------------------------------------------------
//"sc_signal_uint::operator ()
//
// This operator returns a part selection of this object instance.
//     left  = left-hand bit of the selection.
//     right = right-hand bit of the selection.
//------------------------------------------------------------------------------
SC_TEMPLATE
inline sc_unsigned_sigref& sc_signal<sc_dt::sc_biguint<W> >::operator () (int left, int right)
{
    sc_unsigned_sigref* result_p;   // Value to return.

	result_p = sc_unsigned_sigref::m_pool.allocate();
	result_p->initialize(this, left, right);
	return *result_p;
}


//------------------------------------------------------------------------------
//"sc_signal_uint::operator []"
//
// This operator returns a bit selection of this object instance.
//     i = bit to be selected.
//------------------------------------------------------------------------------
SC_TEMPLATE
inline sc_unsigned_sigref& sc_signal<sc_dt::sc_biguint<W> >::operator [] ( int bit )
{
    return operator () (bit,bit);
}


SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::operator = ( const this_type& new_val )
	{ base_write( new_val ); }

SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::operator = ( const char* new_val )
	{ sc_dt::sc_biguint<W> tmp = new_val; m_new_val = tmp; request_update(); }


SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::operator = ( const sc_dt::sc_unsigned& new_val )
	{ base_write(new_val); }


SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::operator = ( sc_dt::uint64 new_val )
	{ base_write(new_val); }


SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::operator = ( sc_dt::int64 new_val )
	{ base_write(new_val); }


SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::operator = ( int new_val )
	{ base_write((sc_dt::int64)new_val); }


SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::operator = ( long new_val )
	{ base_write((sc_dt::int64)new_val); }


SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::operator = ( short new_val )
	{ base_write((sc_dt::int64)new_val); }


SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::operator = ( unsigned int new_val )
	{ base_write((sc_dt::int64)new_val); }


SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::operator = ( unsigned long new_val )
	{ base_write((sc_dt::int64)new_val); }


SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::operator = ( unsigned short new_val )
	{ base_write((sc_dt::int64)new_val); }


SC_TEMPLATE
template<typename T>
inline void sc_signal<sc_dt::sc_biguint<W> >::operator = (
	const sc_dt::sc_generic_base<T>& new_val )
{
	sc_dt::sc_unsigned temp(W);
    new_val->to_sc_unsigned(temp);
    base_write(temp);
}


SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::operator = ( const sc_dt::sc_signed& new_val )
	{ base_write(new_val); }

SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::operator = ( const sc_dt::sc_bv_base& new_val )
	{ base_write( (sc_dt::sc_biguint<W>)new_val ); }

SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::operator = ( const sc_dt::sc_lv_base& new_val )
	{ base_write( (sc_dt::sc_biguint<W>)new_val ); }


SC_TEMPLATE
inline sc_dt::sc_unsigned* sc_signal<sc_dt::sc_biguint<W> >::part_read_target()
	{ return this; }


SC_TEMPLATE
inline const sc_dt::sc_biguint<W>& sc_signal<sc_dt::sc_biguint<W> >::read() const
	{ return *this; }


SC_TEMPLATE // Read a portion of a value.
inline sc_dt::sc_unsigned sc_signal<sc_dt::sc_biguint<W> >::read_part(
	int left, int right ) const
{
	sc_dt::sc_unsigned tmp(left-right+1);
	tmp = (*(const sc_dt::sc_biguint<W>*)this)(left,right);
    return tmp;
}

SC_TEMPLATE
inline void sc_signal<sc_dt::sc_biguint<W> >::register_port(
	sc_port_base& port_, const char* if_typename_ )
{
#       ifdef DEBUG_SYSTEMC
		std::string nm( if_typename_ );
		if( nm == typeid( sc_signal_inout_if<sc_dt::sc_biguint<W> > ).name() )
		{
			if( m_output_p != 0 )
			{
				sc_signal_invalid_writer( name(), kind(),
					 m_output_p->name(), port_.name() );
			}
			m_output_p = &port_;
		}
#       else
            if ( &port_ && if_typename_ ) {} // Silence unused args warning.
#       endif
}


SC_TEMPLATE // Autogenerated name object instance constructor.
inline sc_signal<sc_dt::sc_biguint<W> >::sc_signal() :
	sc_prim_channel(sc_gen_unique_name( "signal" )),
	m_changed_event_p(0),
	m_new_val(W),
	m_output_p(0),
	m_writer_p(0)
{ }


SC_TEMPLATE // Explicitly named object instance constructor.
inline sc_signal<sc_dt::sc_biguint<W> >::sc_signal(const char* name_) :
	sc_prim_channel(name_),
	m_changed_event_p(0),
	m_new_val(W),
	m_output_p(0),
	m_writer_p(0)
{ }


SC_TEMPLATE // Object instance destructor.
inline sc_signal<sc_dt::sc_biguint<W> >::~sc_signal()
{
	if ( m_changed_event_p ) delete m_changed_event_p;
}


SC_TEMPLATE // Update the current value from new value.
inline void sc_signal<sc_dt::sc_biguint<W> >::update()
{
    if ( m_changed_event_p )
    {
        if ( m_new_val != *this )
        {
            m_changed_event_p->notify_delayed();
            m_event_delta = simcontext()->delta_count();
        }
    }
	sc_dt::sc_unsigned::operator = (m_new_val);
}


SC_TEMPLATE // Return the value changed event.
inline const sc_event& sc_signal<sc_dt::sc_biguint<W> >::value_changed_event() const
	{ return base_value_changed_event(); }


SC_TEMPLATE // Write a sc_in<sc_dt::sc_biguint<W> > value to this object instance.
inline void sc_signal<sc_dt::sc_biguint<W> >::write(
	const sc_in<sc_dt::sc_biguint<W> >& value )
	{ base_write( value ); }


SC_TEMPLATE // Write a sc_inout<sc_dt::sc_biguint<W> > value to this object instance.
inline void sc_signal<sc_dt::sc_biguint<W> >::write(
	const sc_inout<sc_dt::sc_biguint<W> >& value )
{ base_write( value ); }


SC_TEMPLATE // Write a sc_dt::sc_biguint<W> value to this object instance.
inline void sc_signal<sc_dt::sc_biguint<W> >::write( const sc_dt::sc_biguint<W>& value )
	{ base_write( value); }


SC_TEMPLATE // Write a portion of a value. If this is the first write in
            // a delta cycle we copy the existing value before setting the bits.
inline void sc_signal<sc_dt::sc_biguint<W> >::write_part(sc_dt::int64 v, int left, int right)
{
	m_new_val(left, right) = v;
	request_update();
}


SC_TEMPLATE // Select a portion of a value.
inline sc_unsigned_sigref& sc_signal<sc_dt::sc_biguint<W> >::select_part(
	int left, int right)
{
    sc_unsigned_sigref* result_p = sc_unsigned_sigref::m_pool.allocate();
    result_p->initialize(dynamic_cast<sc_unsigned_part_if*>(this), left, right);
    return *result_p;
}


SC_TEMPLATE // Write a portion of a value. If this is the first write in
            // a delta cycle we copy the existing value before setting the bits.
inline void sc_signal<sc_dt::sc_biguint<W> >::write_part(sc_dt::uint64 v, int left, int right)
{
	m_new_val(left, right) = v;
	request_update();
}


SC_TEMPLATE // Write a portion of a value. If this is the first write in
            // a delta cycle we copy the existing value before setting the bits.
inline void sc_signal<sc_dt::sc_biguint<W> >::write_part(
	const sc_dt::sc_signed& v, int left, int right )
{
	m_new_val(left, right) = v;
	request_update();
}


SC_TEMPLATE // Write a portion of a value. If this is the first write in
            // a delta cycle we copy the existing value before setting the bits.
inline void sc_signal<sc_dt::sc_biguint<W> >::write_part(
	const sc_dt::sc_unsigned& v, int left, int right )
{
	m_new_val(left, right) = v;
	request_update();
}


//==============================================================================
// CLASS sc_in<sc_dt::sc_biguint<W> >
//
// This class implements an input port whose target acts like an sc_dt::sc_biguint<W> data
// value. This class is a specialization of the generic sc_in class to
// implement tailored support for the sc_dt::sc_biguint<W> class.
//==============================================================================
SC_TEMPLATE
class sc_in<sc_dt::sc_biguint<W> > :
    public sc_port<sc_signal_in_if<sc_dt::sc_biguint<W> >, 1,
                   SC_ONE_OR_MORE_BOUND>,
    public sc_dt::sc_value_base
{
  public:

    // typedefs

    typedef sc_dt::sc_biguint<W>                      data_type;
    typedef sc_signal_in_if<sc_dt::sc_biguint<W> >    if_type;
    typedef sc_port<if_type,1,SC_ONE_OR_MORE_BOUND>   base_type;
    typedef sc_in<sc_dt::sc_biguint<W> >              this_type;

    typedef if_type                                   in_if_type;
    typedef base_type                                 in_port_type;
    typedef sc_signal_inout_if<sc_dt::sc_biguint<W> > inout_if_type;
    typedef sc_inout<sc_dt::sc_biguint<W> >           inout_port_type;

  public:

    // bind methods and operators:

    void bind( const in_if_type& interface_ )
        { sc_port_base::bind( const_cast<in_if_type&>( interface_) );}
    void operator () ( const in_if_type& interface_ )
        { sc_port_base::bind( const_cast<in_if_type&>( interface_) );}
    void bind( in_port_type& parent_ )
        { sc_port_base::bind(parent_);}
    void operator () ( in_port_type& parent_ )
        { sc_port_base::bind(parent_);}
    void bind( inout_port_type& parent_ )
        { sc_port_base::bind(parent_);}
    void operator () ( inout_port_type& parent_ )
        { sc_port_base::bind(parent_);}

  protected:
    // called by pbind (for internal use only)
    virtual inline int vbind( sc_interface& interface_ )
        {
            return sc_port_b<if_type>::vbind( interface_ );
        }
    virtual inline int vbind( sc_port_base& parent_ )
        {
            in_port_type* in_parent = dynamic_cast<in_port_type*>( &parent_ );
            if( in_parent != 0 ) {
                sc_port_base::bind( *in_parent );
                return 0;
            }
            inout_port_type* inout_parent = dynamic_cast<inout_port_type*>( &parent_ );
            if( inout_parent != 0 ) {
                sc_port_base::bind( *inout_parent );
                return 0;
            }
            // type mismatch
            return 2;
        }


    // constructors

  public:
    sc_in()
        : base_type(), m_traces( 0 )
        {}

    explicit sc_in( const char* name_ )
        : base_type( name_ ), m_traces( 0 )
        {}

    explicit sc_in( const in_if_type& interface_ )
        : base_type( const_cast<in_if_type&>( interface_ ) ), m_traces( 0 )
        {}

    sc_in( const char* name_, const in_if_type& interface_ )
        : base_type( name_, const_cast<in_if_type&>( interface_ ) ), m_traces( 0 )
        {}

    explicit sc_in( in_port_type& parent_ )
        : base_type( parent_ ), m_traces( 0 )
        {}

    sc_in( const char* name_, in_port_type& parent_ )
        : base_type( name_, parent_ ), m_traces( 0 )
        {}

    explicit sc_in( inout_port_type& parent_ )
        : base_type(), m_traces( 0 )
        { sc_port_base::bind( parent_ ); }

    sc_in( const char* name_, inout_port_type& parent_ )
        : base_type( name_ ), m_traces( 0 )
        { sc_port_base::bind( parent_ ); }

    sc_in( this_type& parent_ )
        : base_type( parent_ ), m_traces( 0 )
        {}

    sc_in( const char* name_, this_type& parent_ )
        : base_type( name_, parent_ ), m_traces( 0 )
        {}


    // destructor

    virtual inline ~sc_in()
        {
            remove_traces();
        }

    // bit and part selection

    sc_dt::sc_unsigned_bitref_r operator [] ( int i ) const
        { return (*this)->read()[i]; }
    sc_dt::sc_unsigned_bitref_r bit( int i ) const
        { return (*this)->read()[i]; }
    sc_dt::sc_unsigned_subref_r operator () ( int left, int right ) const
        { return (*this)->read()(left,right); }
    sc_dt::sc_unsigned_subref_r range( int left, int right ) const
        { return (*this)->read()(left,right); }


    // interface access shortcut methods

    // get the default event

    const sc_event& default_event() const
        { return (*this)->value_changed_event(); }


    // get the value changed event

    const sc_event& value_changed_event() const
        { return (*this)->value_changed_event(); }


    // read the current value

    const sc_dt::sc_biguint<W>& read() const
        { return (*this)->read(); }

    operator const sc_dt::sc_biguint<W>& () const
        { return (*this)->read(); }

    // was there a value changed event?

    bool event() const
        { return (*this)->event(); }


    // (other) event finder method(s)

    sc_event_finder& value_changed() const
        {
            return *new sc_event_finder_t<in_if_type>(
                *this, &in_if_type::value_changed_event );
        }



    // reduction methods:

    inline bool and_reduce() const
        { return (*this)->read().and_reduce(); }
    inline bool nand_reduce() const
        { return (*this)->read().nand_reduce(); }
    inline bool nor_reduce() const
        { return (*this)->read().nor_reduce(); }
    inline bool or_reduce() const
        { return (*this)->read().or_reduce(); }
    inline bool xnor_reduce() const
        { return (*this)->read().xnor_reduce(); }
    inline bool xor_reduce() const
        { return (*this)->read().xor_reduce(); }


    // called when elaboration is done
    /*  WHEN DEFINING THIS METHOD IN A DERIVED CLASS, */
    /*  MAKE SURE THAT THIS METHOD IS CALLED AS WELL. */

    virtual inline void end_of_elaboration()
        {
            if( m_traces != 0 ) {
                for( unsigned int i = 0; i < m_traces->size(); ++ i ) {
                    sc_trace_params* p = (*m_traces)[i];
                    sc_trace( p->tf, read(), p->name );
                }
                remove_traces();
            }
        }

    virtual inline const char* kind() const
        { return "sc_in"; }


    // called by sc_trace
    void add_trace( sc_trace_file* tf_, const std::string& name_ ) const
        {
            if( tf_ != 0 ) {
                if( m_traces == 0 ) {
                    m_traces = new sc_trace_params_vec;
                }
                m_traces->push_back( new sc_trace_params( tf_, name_ ) );
            }
        }


    // concatenation methods

    virtual inline int concat_length(bool* xz_present_p) const
        { return (*this)->read().concat_length( xz_present_p ); }
    virtual inline sc_dt::uint64 concat_get_uint64() const
        { return (*this)->read().concat_get_uint64(); }
    virtual inline bool concat_get_ctrl( sc_dt::sc_digit* dst_p, int low_i ) const
        { return (*this)->read().concat_get_ctrl(dst_p, low_i); }
    virtual inline bool concat_get_data( sc_dt::sc_digit* dst_p, int low_i ) const
        { return (*this)->read().concat_get_data(dst_p, low_i); }

  protected:
    void remove_traces() const
        {
            if( m_traces != 0 ) {
                for( int i = m_traces->size() - 1; i >= 0; -- i ) {
                    delete (*m_traces)[i];
                }
                delete m_traces;
                m_traces = 0;
            }
        }

    mutable sc_trace_params_vec* m_traces;


  private:

    // disabled
    sc_in( const sc_in<sc_dt::sc_biguint<W> >& );
    sc_in<sc_dt::sc_biguint<W> >& operator = ( const sc_in<sc_dt::sc_biguint<W> >& );

#ifdef __GNUC__
    // Needed to circumvent a problem in the g++-2.95.2 compiler:
    // This unused variable forces the compiler to instantiate
    // an object of T template so an implicit conversion from
    // read() to a C++ intrinsic data type will work.
    static data_type dummy;
#endif

};



SC_TEMPLATE
inline std::ostream& operator << (
    std::ostream& os, const sc_in<sc_dt::sc_biguint<W> >& a )
{
    a.read().print( os );
    return os;
}


//==============================================================================
// CLASS sc_inout<sc_dt::sc_biguint<W> >
//
// This class implements an input/output port whose target acts like an
// sc_dt::sc_biguint<W> data value. It is derived from the sc_unsigned_in. This class is a
// specialization of the generic sc_inout class to implement tailored support
// for the sc_dt::sc_biguint<W> class.
//==============================================================================
SC_TEMPLATE
class sc_inout<sc_dt::sc_biguint<W> > :
    public sc_port<sc_signal_inout_if<sc_dt::sc_biguint<W> >, 1,
                   SC_ONE_OR_MORE_BOUND>,
    public sc_dt::sc_value_base
{
  public:

    // typedefs

    typedef sc_dt::sc_biguint<W>                      data_type;
    typedef sc_signal_inout_if<sc_dt::sc_biguint<W> > if_type;
    typedef sc_port<if_type,1,SC_ONE_OR_MORE_BOUND>   base_type;
    typedef sc_inout<sc_dt::sc_biguint<W> >           this_type;

    typedef if_type                                   inout_if_type;
    typedef base_type                                 inout_port_type;

  public:

    // bind methods and operators:

    void bind( const inout_if_type& interface_ )
        { sc_port_base::bind( const_cast<inout_if_type&>( interface_) ); }
    void operator () ( const inout_if_type& interface_ )
        { sc_port_base::bind( const_cast<inout_if_type&>( interface_) ); }
    void bind( inout_port_type& parent_ )
        { sc_port_base::bind(parent_); }
    void operator () ( inout_port_type& parent_ )
        { sc_port_base::bind(parent_); }

  protected:
    // called by pbind (for internal use only)
    virtual inline int vbind( sc_interface& interface_ )
        {
            return sc_port_b<if_type>::vbind( interface_ );
        }
    virtual inline int vbind( sc_port_base& parent_ )
        {
            inout_port_type* inout_parent = dynamic_cast<inout_port_type*>( &parent_ );
            if( inout_parent != 0 ) {
                sc_port_base::bind( *inout_parent );
                return 0;
            }
            // type mismatch
            return 2;
        }


    // constructors

  public:
    sc_inout()
        : base_type(), m_init_val_p(0), m_traces( 0 )
        {}

    explicit sc_inout( const char* name_ )
        : base_type( name_ ), m_init_val_p(0), m_traces( 0 )
        {}

    explicit sc_inout( inout_if_type& interface_ )
        : base_type( interface_ ), m_init_val_p(0), m_traces( 0 )
        {}

    sc_inout( const char* name_, inout_if_type& interface_ )
        : base_type( name_, interface_ ), m_init_val_p(0), m_traces( 0 )
        {}

    explicit sc_inout( inout_port_type& parent_ )
        : base_type( parent_ ), m_init_val_p(0), m_traces( 0 )
        {}

    sc_inout( const char* name_, inout_port_type& parent_ )
        : base_type( name_, parent_ ), m_init_val_p(0), m_traces( 0 )
        {}

    sc_inout( this_type& parent_ )
        : base_type( parent_ ), m_init_val_p(0), m_traces( 0 )
        {}

    sc_inout( const char* name_, this_type& parent_ )
        : base_type( name_, parent_ ), m_init_val_p(0), m_traces( 0 )
        {}


    // destructor

    virtual inline ~sc_inout()
        {
            remove_traces();
        }

    // bit and part selection

    sc_dt::sc_unsigned_bitref_r operator [] ( int i ) const
        { return (*this)->read()[i]; }
    sc_dt::sc_unsigned_bitref_r bit( int i ) const
        { return (*this)->read()[i]; }
    sc_unsigned_sigref& operator [] ( int i )
        { return (*this)->select_part(i,i); }
    sc_unsigned_sigref& bit( int i )
        { return (*this)->select_part(i,i); }
    sc_dt::sc_unsigned_subref_r operator () ( int left, int right ) const
        { return (*this)->read()(left,right); }
    sc_dt::sc_unsigned_subref_r range( int left, int right ) const
        { return (*this)->read()(left,right); }
    sc_unsigned_sigref& operator () ( int left, int right )
        { return (*this)->select_part(left,right); }
    sc_unsigned_sigref& range( int left, int right )
        { return (*this)->select_part(left,right); }


    // interface access shortcut methods

    // get the default event

    const sc_event& default_event() const
        { return (*this)->value_changed_event(); }


    // get the value changed event

    const sc_event& value_changed_event() const
        { return (*this)->value_changed_event(); }


    // read the current value

    const sc_dt::sc_biguint<W>& read() const
        { return (*this)->read(); }

    operator const sc_dt::sc_biguint<W>& () const
        { return (*this)->read(); }

    // was there a value changed event?

    bool event() const
        { return (*this)->event(); }


    // (other) event finder method(s)

    sc_event_finder& value_changed() const
        {
            return *new sc_event_finder_t<inout_if_type>(
                *this, &inout_if_type::value_changed_event );
        }



    // reduction methods:

    inline bool and_reduce() const
        { return (*this)->read().and_reduce(); }
    inline bool nand_reduce() const
        { return (*this)->read().nand_reduce(); }
    inline bool nor_reduce() const
        { return (*this)->read().nor_reduce(); }
    inline bool or_reduce() const
        { return (*this)->read().or_reduce(); }
    inline bool xnor_reduce() const
        { return (*this)->read().xnor_reduce(); }
    inline bool xor_reduce() const
        { return (*this)->read().xor_reduce(); }


    // called when elaboration is done
    /*  WHEN DEFINING THIS METHOD IN A DERIVED CLASS, */
    /*  MAKE SURE THAT THIS METHOD IS CALLED AS WELL. */

    virtual inline void end_of_elaboration()
        {
            if( m_init_val_p != 0 ) {
                (*this)->write( *m_init_val_p );
                delete m_init_val_p;
                m_init_val_p = 0;
            }
            if( m_traces != 0 ) {
                for( unsigned int i = 0; i < m_traces->size(); ++ i ) {
                    sc_trace_params* p = (*m_traces)[i];
                    sc_trace( p->tf, read(), p->name );
                }
                remove_traces();
            }
        }

    virtual inline const char* kind() const
        { return "sc_inout"; }

    // value initialization

    inline void initialize( const sc_dt::sc_biguint<W>& value_ )
    {
        inout_if_type* iface = dynamic_cast<inout_if_type*>( this->get_interface() );
        if( iface != 0 ) {
            iface->write( value_ );
        } else {
            if( m_init_val_p == 0 ) {
                m_init_val_p = new sc_dt::sc_biguint<W>;
            }
            *m_init_val_p = value_;
        }
    }


    // called by sc_trace
    void add_trace( sc_trace_file* tf_, const std::string& name_ ) const
        {
            if( tf_ != 0 ) {
                if( m_traces == 0 ) {
                    m_traces = new sc_trace_params_vec;
                }
                m_traces->push_back( new sc_trace_params( tf_, name_ ) );
            }
        }


    // concatenation methods

    virtual inline int concat_length(bool* xz_present_p) const
        { return (*this)->read().concat_length( xz_present_p ); }
    virtual inline sc_dt::uint64 concat_get_uint64() const
        { return (*this)->read().concat_get_uint64(); }
    virtual inline bool concat_get_ctrl( sc_dt::sc_digit* dst_p, int low_i ) const
        { return (*this)->read().concat_get_ctrl(dst_p, low_i); }
    virtual inline bool concat_get_data( sc_dt::sc_digit* dst_p, int low_i ) const
        { return (*this)->read().concat_get_data(dst_p, low_i); }
    virtual inline void concat_set(sc_dt::int64 src, int low_i)
        { *this = (src >> ((low_i < 64) ? low_i : 63)); }
#if 0 // ####
    virtual inline void concat_set(const sc_dt::sc_lv_base& src, int low_i)
        { *this = src >> low_i; }
#endif // 0 ####
    virtual inline void concat_set(const sc_dt::sc_signed& src, int low_i)
        { *this = (src >> low_i); }
    virtual inline void concat_set(const sc_dt::sc_unsigned& src, int low_i)
        { *this = (src >> low_i); }
    virtual inline void concat_set(sc_dt::uint64 src, int low_i)
        { *this = (low_i < 64 ) ? src >> low_i : (sc_dt::uint64)0; }

    // assignment operators:

  public:
	inline void operator = ( const this_type& new_val )
		{ (*this)->write( (const sc_dt::sc_unsigned&)new_val ); }
    inline void operator = ( const char* new_val )
		{ sc_dt::sc_unsigned aa(W); aa = new_val; (*this)->write( aa ); }
    inline void operator = ( sc_dt::uint64 new_val )
        { (*this)->write(new_val); }
    inline void operator = ( sc_dt::int64 new_val )
        { (*this)->write((sc_dt::int64)new_val); }
    inline void operator = ( int new_val )
        { (*this)->write((sc_dt::int64)new_val); }
    inline void operator = ( long new_val )
        { (*this)->write((sc_dt::int64)new_val); }
    inline void operator = ( short new_val )
        { (*this)->write((sc_dt::uint64)new_val); }
    inline void operator = ( unsigned int new_val )
        { (*this)->write((sc_dt::uint64)new_val); }
    inline void operator = ( unsigned long new_val )
        { (*this)->write((sc_dt::uint64)new_val); }
    inline void operator = ( unsigned short new_val )
        { (*this)->write((sc_dt::uint64)new_val); }
    template<typename T>
    inline void operator = ( const sc_dt::sc_generic_base<T>& new_val )
		{
			sc_dt::sc_unsigned temp(W);
			new_val->to_sc_unsigned(temp);
            (*this)->write(temp);
		}
    inline void operator = ( const sc_dt::sc_signed& new_val )
        { (*this)->write(new_val); }
    inline void operator = ( const sc_dt::sc_unsigned& new_val )
        { (*this)->write(new_val); }
    inline void operator = ( const sc_dt::sc_bv_base& new_val )
        { (*this)->write((sc_dt::sc_biguint<W>)new_val); }
    inline void operator = ( const sc_dt::sc_lv_base& new_val )
        { (*this)->write((sc_dt::sc_biguint<W>)new_val); }

    inline void write( const sc_in<sc_dt::sc_biguint<W> >& new_val )
        { (*this)->write( new_val.read() ); }
    inline void write( const sc_inout<sc_dt::sc_biguint<W> >& new_val )
        { (*this)->write( new_val.read() ); }
    inline void write( const sc_dt::sc_biguint<W>& new_val )
        { (*this)->write( new_val ); }

  protected:
    void remove_traces() const
        {
            if( m_traces != 0 ) {
                for( int i = m_traces->size() - 1; i >= 0; -- i ) {
                    delete (*m_traces)[i];
                }
                delete m_traces;
                m_traces = 0;
            }
        }

    sc_dt::sc_biguint<W>*               m_init_val_p;
    mutable sc_trace_params_vec* m_traces;


  private:

    // disabled
    sc_inout( const sc_inout<sc_dt::sc_biguint<W> >& );

#ifdef __GNUC__
    // Needed to circumvent a problem in the g++-2.95.2 compiler:
    // This unused variable forces the compiler to instantiate
    // an object of T template so an implicit conversion from
    // read() to a C++ intrinsic data type will work.
    static data_type dummy;
#endif

};



SC_TEMPLATE
inline std::ostream& operator << (
    std::ostream& os, const sc_inout<sc_dt::sc_biguint<W> >& a )
{
    a.read().print( os );
    return os;
}


//==============================================================================
// CLASS sc_out<sc_dt::sc_biguint<W> >
//
// This class implements an output port whose target acts like an
// sc_dt::sc_biguint<W> data value. This class is a derivation of sc_inout, since
// output ports are really no different from input/output ports.
//==============================================================================
SC_TEMPLATE
class sc_out<sc_dt::sc_biguint<W> > : public sc_inout<sc_dt::sc_biguint<W> >
{
  public:

    // typedefs

    typedef sc_dt::sc_biguint<W>                          data_type;

    typedef sc_out<data_type>                   this_type;
    typedef sc_inout<data_type>                 base_type;

    typedef typename base_type::inout_if_type   inout_if_type;
    typedef typename base_type::inout_port_type inout_port_type;

    // constructors

    sc_out()
        : base_type()
        {}

    explicit sc_out( const char* name_ )
        : base_type( name_ )
        {}

    explicit sc_out( inout_if_type& interface_ )
        : base_type( interface_ )
        {}

    sc_out( const char* name_, inout_if_type& interface_ )
        : base_type( name_, interface_ )
        {}

    explicit sc_out( inout_port_type& parent_ )
        : base_type( parent_ )
        {}

    sc_out( const char* name_, inout_port_type& parent_ )
        : base_type( name_, parent_ )
        {}

    sc_out( this_type& parent_ )
        : base_type( parent_ )
        {}

    sc_out( const char* name_, this_type& parent_ )
        : base_type( name_, parent_ )
        {}


    // destructor (does nothing)

    virtual inline ~sc_out()
        {}


    // assignment operators:

  public:
	inline void operator = ( const this_type& new_val )
		{ (*this)->write( (const sc_dt::sc_unsigned&)new_val ); }
    inline void operator = ( const char* new_val )
		{ sc_dt::sc_unsigned aa(W); aa = new_val; (*this)->write( aa ); }
    inline void operator = ( sc_dt::uint64 new_val )
        { (*this)->write(new_val); }
    inline void operator = ( sc_dt::int64 new_val )
        { (*this)->write((sc_dt::uint64)new_val); }
    inline void operator = ( int new_val )
        { (*this)->write((sc_dt::uint64)new_val); }
    inline void operator = ( long new_val )
        { (*this)->write((sc_dt::uint64)new_val); }
    inline void operator = ( short new_val )
        { (*this)->write((sc_dt::uint64)new_val); }
    inline void operator = ( unsigned int new_val )
        { (*this)->write((sc_dt::uint64)new_val); }
    inline void operator = ( unsigned long new_val )
        { (*this)->write((sc_dt::uint64)new_val); }
    inline void operator = ( unsigned short new_val )
        { (*this)->write((sc_dt::uint64)new_val); }
    template<typename T>
    inline void operator = ( const sc_dt::sc_generic_base<T>& new_val )
		{
			sc_dt::sc_unsigned temp(W);
			new_val->to_sc_unsigned(temp);
            (*this)->write(temp);
		}
    inline void operator = ( const sc_dt::sc_signed& new_val )
        { (*this)->write(new_val); }
    inline void operator = ( const sc_dt::sc_unsigned& new_val )
        { (*this)->write(new_val); }
    inline void operator = ( const sc_dt::sc_bv_base& new_val )
        { (*this)->write((sc_dt::sc_biguint<W>)new_val); }
    inline void operator = ( const sc_dt::sc_lv_base& new_val )
        { (*this)->write((sc_dt::sc_biguint<W>)new_val); }

  private:

    // disabled
    sc_out( const this_type& );
};



//------------------------------------------------------------------------------
//"sc_unsigned_sigref::initialize"
//
// This method initializes an object instance from the supplied arguments.
//     if_p   -> target of this selection.
//     left_  =  left-most bit in selection.
//     right_ =  right-most bit in selection.
//------------------------------------------------------------------------------
inline void sc_unsigned_sigref::initialize(
	sc_unsigned_part_if* if_p, int left_, int right_ )
{
    m_if_p = if_p;
    m_left = left_;
    m_right = right_;
	m_obj_p = if_p->part_read_target();
}


//------------------------------------------------------------------------------
//"sc_unsigned_sigref::operator ="
//
// These operators assign a value to the bits associated with this object
// instance within this object instance's target signal.
//------------------------------------------------------------------------------
inline void sc_unsigned_sigref::operator = ( sc_dt::uint64 v )
{
	m_if_p->write_part( v, m_left, m_right );
}

inline void sc_unsigned_sigref::operator = ( const char* v )
{
	sc_dt::sc_unsigned tmp(length());
	tmp = v;
	*this = tmp;
}

inline void sc_unsigned_sigref:: operator = ( sc_dt::int64 v )
{
    *this = (sc_dt::uint64)v;
}

inline void sc_unsigned_sigref:: operator = ( int v )
{
    *this = (sc_dt::uint64)v;
}

inline void sc_unsigned_sigref:: operator = ( long v )
{
    *this = (sc_dt::uint64)v;
}

inline void sc_unsigned_sigref:: operator = ( unsigned int v )
{
    *this = (sc_dt::uint64)v;
}

inline void sc_unsigned_sigref:: operator = ( unsigned long v )
{
    *this = (sc_dt::uint64)v;
}

void sc_unsigned_sigref::operator = ( const sc_unsigned_sigref& v )
{
    *this = (sc_dt::sc_unsigned)v;
}


inline void sc_unsigned_sigref:: operator = ( const sc_dt::sc_signed& v )
{
	m_if_p->write_part( v, m_left, m_right );
}

inline void sc_unsigned_sigref:: operator = ( const sc_dt::sc_unsigned& v )
{
	m_if_p->write_part( v, m_left, m_right );
}

template<typename T>
inline void sc_unsigned_sigref:: operator = (
	const sc_dt::sc_generic_base<T>& v )
{
	sc_dt::sc_unsigned temp(m_left-m_right+1);
    v->to_sc_unsigned(temp);
	m_if_p->write_part( temp, m_left, m_right );
}

#undef SC_TEMPLATE
} // namespace sc_core
#endif // !defined(SC_SIGNAL_UNSIGNED_H)

namespace sc_core {

extern
void
sc_signal_invalid_writer( const char* name,
                          const char* kind,
                          const char* first_writer,
                          const char* second_writer );

//------------------------------------------------------------------------------
// POOL OF TEMPORARY INSTANCES OF sc_unsigned_sigref
//
// This allows use to pass const references for part and bit selections
// on sc_signal_signed object instances.
//------------------------------------------------------------------------------
sc_vpool<sc_unsigned_sigref> sc_unsigned_sigref::m_pool(8);


//------------------------------------------------------------------------------
//"sc_unsigned_part_if::default methods"
//
// These versions just produce errors if they are not overloaded but used.
//------------------------------------------------------------------------------
sc_dt::sc_unsigned* sc_unsigned_part_if::part_read_target()
{
    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
    return 0;
}
sc_dt::sc_unsigned sc_unsigned_part_if::read_part( int /*left*/, int /*right*/ ) const
{
    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
    return sc_dt::sc_unsigned(1);
}
sc_unsigned_sigref& sc_unsigned_part_if::select_part(int /*left*/, int /*right*/)
{
    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
    return *(sc_unsigned_sigref*)0;
}
void sc_unsigned_part_if::write_part( sc_dt::int64 v, int /*left*/, int /*right*/ )
{
    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
}
void sc_unsigned_part_if::write_part( sc_dt::uint64 v, int /*left*/, int /*right*/ )
{
    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
}
void sc_unsigned_part_if::write_part(
    const sc_dt::sc_signed& v, int /*left*/, int /*right*/ )
{
    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
}
void sc_unsigned_part_if::write_part(
    const sc_dt::sc_unsigned& v, int /*left*/, int /*right*/ )
{
    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
}



//------------------------------------------------------------------------------
//"sc_unsigned_sigref::concate_set"
//
// These methods assign this object instance's value from the supplied
// value starting at the supplied bit within that value.
//     src = value to use to set this object instance's value.
//     low_i = bit in src that is to be the low order bit of the value to set.
// #### OPTIMIZE
//------------------------------------------------------------------------------
void sc_unsigned_sigref::concat_set(sc_dt::int64 src, int low_i)
{
    sc_dt::int64 tmp;
    if ( low_i < 63 )
        tmp = src >> low_i;
    else
        tmp = (src < 0) ? -1 : 0;
    m_if_p->write_part( tmp, m_left, m_right );
}


void sc_unsigned_sigref::concat_set(const sc_dt::sc_signed& src, int low_i)
{
    m_if_p->write_part( src >> low_i, m_left, m_right );
}


void sc_unsigned_sigref::concat_set(const sc_dt::sc_lv_base& src, int low_i)
{
    sc_dt::sc_unsigned tmp(src.length());
    tmp = src;
    m_if_p->write_part( tmp >> low_i, m_left, m_right );
}


void sc_unsigned_sigref::concat_set(const sc_dt::sc_unsigned& src, int low_i)
{
    m_if_p->write_part( src >> low_i, m_left, m_right );
}


void sc_unsigned_sigref::concat_set(sc_dt::uint64 src, int low_i)
{
    sc_dt::uint64 tmp = (low_i < 63) ? (src >> low_i) : 0;
    m_if_p->write_part( tmp, m_left, m_right );
}


} // namespace sc_core