vuctl.v 58.3 KB
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
/*
*************************************************************************
*									*
*               Copyright (C) 1994, Silicon Graphics, Inc.		*
*									*
*  These coded instructions, statements, and computer programs  contain	*
*  unpublished  proprietary  information of Silicon Graphics, Inc., and	*
*  are protected by Federal copyright  law.  They  may not be disclosed	*
*  to  third  parties  or copied or duplicated in any form, in whole or	*
*  in part, without the prior written consent of Silicon Graphics, Inc.	*
*									*
*************************************************************************
*/

// $Id: vuctl.v,v 1.1 2002/03/28 00:26:14 berndt Exp $

/*
*************************************************************************
*									*
*	Project Reality							*
*									*
*	Module:		vuctl						*
*	Description:	vector unit control for all two vector unit	* 
*			datapaths and two multipliers.			*
*									*
*	Designer:	Brian Ferguson					*
*	Date:		8/11/94						*
*									*
*************************************************************************
*/

// vuctl.v: 	RSP vector unit control

`timescale 1ns / 10ps

`include "vopcodes.h"

module	vuctl (	clk, reset_l,
		su_instvld_rd, su_instvldk_rd, 
		su_vseqone_rd, 
		su_instelem_rd, su_instfunc_rd,
		su_rdcmpcd_rd, su_rdcryout_rd, su_rdcmpcdad_rd, 
		su_wrcmpcd_wb, su_wrcryout_wb, su_wrcmpcdad_wb,

		vdp_vs_sign0_mu, vdp_vt_sign0_mu,
		vdp_vs_zero0_mu, vdp_vt_zero0_mu,
		vdp_aluovr0_mu,	vdp_aluco0_mu,
		vdp_aluzero0_mu, vdp_aluone0_mu,

		vdp_vs_sign1_mu, vdp_vt_sign1_mu,
		vdp_vs_zero1_mu, vdp_vt_zero1_mu,
		vdp_aluovr1_mu,	vdp_aluco1_mu,
		vdp_aluzero1_mu, vdp_aluone1_mu,

		vdp_addlwco0_ac, vdp_addlwov0_ac,
		vdp_csupco0_ac, vdp_addupco0_ac,

		vdp_addlwco1_ac, vdp_addlwov1_ac, 
		vdp_csupco1_ac, vdp_addupco1_ac,

		vmu_co_clal0_ac, vmu_co_clal1_ac,
		vmu_co_clah0_ac, vmu_co_clah1_ac,

		vdp_acc0bit15_wb, vdp_acc0bit21_wb,
		vdp_acc0bit31_wb, vdp_acc0bit47_wb,
		vdp_achizero0_wb, vdp_achione0_wb,
		vdp_acmizero0_wb,

		vdp_acc1bit15_wb, vdp_acc1bit21_wb,
		vdp_acc1bit31_wb, vdp_acc1bit47_wb,
		vdp_achizero1_wb, vdp_achione1_wb,
		vdp_acmizero1_wb,

		vct_couprsl0_mu, vct_smuprsl0_mu, 
		vct_colwrsl0_mu, 

		vct_couprsl1_mu, vct_smuprsl1_mu, 
		vct_colwrsl1_mu, 

		vct_smlwrsl0_mu, 
		vct_smlwrsl1_mu, 

		vct_sgnmplr_mu, vct_sgnmplcnd_mu, 
		vct_shftlftone0_mu, vct_shftlftone1_mu,

		vct_aluctl0_mu, vct_alucin0_mu,
		vct_alucmpvt0_mu,
		vct_cmpvt0_mu,

		vct_aluctl1_mu, vct_alucin1_mu,
		vct_alucmpvt1_mu,
		vct_cmpvt1_mu,

		vct_instvld_ac,

		vct_aclwsl0_ac, 
		vct_aclwsl1_ac, 

		vct_cslwcsl0_ac,
		vct_cslwcsl1_ac,
		vct_csupcen0_ac,
		vct_csupcen1_ac,

		vct_acmisl0_ac,
		vct_acmisl1_ac,

		vct_acupsl0_ac, 
		vct_acupsl1_ac, 

		vct_rndvlu0_ac,
		vct_cslwasl0_ac, vct_cslwbsl0_ac,
		vct_addlwci0_ac,
		vct_csupasl0_ac, vct_csupbsl0_ac,
		vct_incrdwn0_ac, vct_incrci0_ac,
		vct_incrmxsl0_ac,

		vct_rndvlu1_ac,
		vct_cslwasl1_ac, vct_cslwbsl1_ac,
		vct_addlwci1_ac,
		vct_csupasl1_ac, vct_csupbsl1_ac,
		vct_incrdwn1_ac, vct_incrci1_ac,
		vct_incrmxsl1_ac,

		vct_rsltsl0_wb, vct_rsltsl1_wb,

		vct_clprslt0_wb, vct_clprslt1_wb,

		su_cont_to_from, 

/*
*	The following signals are for register file address decoding
*	only.
*/

		su_vs_addr_rd,

		vct_dvtypop_ac,
		vct_vs_addr_ac

		);


/*
*	The following signals are the input signals to the 
*	vector unit control block.
*
*	The first group are input signals to the control block 
*	which provide general control such as clocks, reset
*	hold, instruction decoding and reading/writing the 
*	control registers.
*/

	input	clk;			/* vu clock */
	input	reset_l;		/* vu active low reset */

	input	su_instvld_rd;		/* valid CP2 instruction for vu */
	input	su_instvldk_rd;		/* valid CP2 instruction for vu with kill */
	input	su_vseqone_rd;		/* vs field of instruction equal to 1 */
	input   [3:0] su_instelem_rd;	/* element field of instruction */
	input   [5:0] su_instfunc_rd;	/* function field of instruction */

	input	su_rdcmpcd_rd;		/* read vector compare code register */
	input	su_rdcryout_rd;		/* read vector carry out register */
	input	su_rdcmpcdad_rd;	/* read vector compare add register */

	input	su_wrcmpcd_wb;		/* write vector compare code register */
	input	su_wrcryout_wb;		/* write vector carry out register */
	input	su_wrcmpcdad_wb;	/* write vector compare add register */

/*
*	The next group are input signals to the control block from
*	the multiply stage of the vector unit datapaths.
*/


	input	vdp_vs_zero0_mu;	/* vs operand is equal to zero vector 0 */
	input	vdp_vs_zero1_mu;	/* vs operand is equal to zero vector 1 */

	input	vdp_vt_zero0_mu;	/* vt operand is equal to zero vector 0 */
	input	vdp_vt_zero1_mu;	/* vt operand is equal to zero vector 1 */

	input	vdp_vs_sign0_mu;	/* vs sign bit from vector 0 */
	input	vdp_vs_sign1_mu;	/* vs sign bit from vector 1 */

	input	vdp_vt_sign0_mu;	/* vt sign bit from vector 0 */
	input	vdp_vt_sign1_mu;	/* vt sign bit from vector 1 */

	input	vdp_aluovr0_mu;		/* overflow bit from alu vector 0 */
	input	vdp_aluco0_mu;		/* carry out from alu vector 0 */
	input	vdp_aluzero0_mu;	/* alu result equal to zero vector 0 */
	input	vdp_aluone0_mu;		/* alu result is equal to one vector 0 */

	input	vdp_aluovr1_mu;		/* overflow bit from alu vector 1 */
	input	vdp_aluco1_mu;		/* carry out from alu vector 1 */
	input	vdp_aluzero1_mu;	/* alu result is equal to zero vector 1 */
	input	vdp_aluone1_mu;		/* alu result is equal to one vector 1 */

/*
*	The next group are input signals to the control block from
*	the accumulate stage of the vector unit datapaths.
*/

	input	vdp_addlwco0_ac;	/* carry out from low adder vector 0 */
	input	vdp_addlwov0_ac;	/* overflow from low csa vector 0 */
	input	vdp_csupco0_ac;		/* carry out from high csa vector 0 */
	input	vdp_addupco0_ac;	/* carry out from high adder vector 0 */

	input	vdp_addlwco1_ac;	/* carry out from low adder vector 1 */
	input	vdp_addlwov1_ac;	/* overflow from low csa vector 1 */
	input	vdp_csupco1_ac;		/* carry out from high csa vector 1 */
	input	vdp_addupco1_ac;	/* carry out from high adder vector 1 */

	input	vmu_co_clal0_ac;	/* carry out from 16 bit product of multiplier vector 0 */
	input	vmu_co_clal1_ac;	/* carry out from 16 bit product of multiplier vector 1 */
	input	vmu_co_clah0_ac;	/* false carry out from multiplier vector 0 */
	input	vmu_co_clah1_ac;	/* false carry out from multiplier vector 1 */



/*
*	The next group are input signals to the control block from
*	the writeback stage of the vector unit datapaths.
*/


	input	vdp_acc0bit15_wb;	/* bit 15 of accumulator used to determine sign vector 0 */
	input	vdp_acc0bit21_wb;	/* bit 21 of accumulator used for macq vector 0 */
	input	vdp_acc0bit31_wb;	/* bit 31 of accumulator used to determine sign vector 0 */
	input	vdp_acc0bit47_wb;	/* bit 47 of accumulator used to determine sign vector 0 */

	input	vdp_achizero0_wb;	/* 47:32 of accumulator equal zero vector 0 */
	input	vdp_acmizero0_wb;	/* 31:16 of accumulator equal zero vector 0 */
	input	vdp_achione0_wb;	/* 47:32 of accumulator equal one vector 0 */

	input	vdp_acc1bit15_wb;	/* bit 15 of accumulator used to determine sign vector 1*/
	input	vdp_acc1bit21_wb;	/* bit 21 of accumulator used for macq vector 1 */
	input	vdp_acc1bit31_wb;	/* bit 31 of accumulator used to determine sign vector 1 */
	input	vdp_acc1bit47_wb;	/* bit 47 of accumulator used to determine sign vector 1 */

	input	vdp_achizero1_wb;	/* 47:32 of accumulator equal zero vector 1 */
	input	vdp_acmizero1_wb;	/* 31:16 of accumulator equal zero vector 1 */
	input	vdp_achione1_wb;	/* 47:32 of accumulator equal one vector 1 */


/*
*	The following input signals are for register file address decoding
*	only.
*/

	input	[4:0]	su_vs_addr_rd;		/* register number for vs read */


/*
*	The following signals are the output signals for the 
*	vector unit control block.
*/

/*
*	The first group are output control signals for the
*	register file read stage of the vector unit datapath.
*/


/*
*	The next group are output control signals for the
*	multiply stage of the vector unit datapath.
*/

	output	[1:0]	vct_couprsl0_mu;		/* select for multiply upper carry out vector */
	output	[1:0]	vct_couprsl1_mu;		/* select for multiply upper carry out vector */

	output	[1:0]	vct_smuprsl0_mu;		/* select for multiply upper sum out vector */
	output	[1:0]	vct_smuprsl1_mu;		/* select for multiply upper sum out vector */

	output	[1:0]	vct_colwrsl0_mu;		/* selects for multiply lower carry out register */
	output	[1:0]	vct_colwrsl1_mu;		/* selects for multiply lower carry out register */

	output	[1:0]	vct_smlwrsl0_mu;	/* selects for multiply lower sum out vector 0 */
	output	[1:0]	vct_smlwrsl1_mu;	/* selects for multiply lower sum out vector 1 */

	output	vct_sgnmplr_mu;			/* signed multiplier */
	output	vct_sgnmplcnd_mu;		/* signed multiplicand */
	output	vct_shftlftone0_mu;		/* shift left by 1 for MULF, MACF, MULU, MACU */
	output	vct_shftlftone1_mu;		/* shift left by 1 for MULF, MACF, MULU, MACU */


	output	[2:0]	vct_aluctl0_mu;		/* control for alu vector 0 */
	output	vct_alucin0_mu;			/* carry in to alu vector 0 */
	output	vct_alucmpvt0_mu;		/* complement vt subtact in ALU - slice 0 */
	output	vct_cmpvt0_mu; 	/* complement vt for writing -VT for CH, CL, CR vector 0 */

	output	[2:0]	vct_aluctl1_mu;		/* control for alu vector 1 */
	output	vct_alucin1_mu;			/* carry in to alu vector 1 */
	output	vct_alucmpvt1_mu;		/* complement vt subtact in ALU - slice 1 */
	output	vct_cmpvt1_mu;		/* complement vt for writing -VT for CH, CL, CR vector 1 */


/*
*	The next group are output control signals for the
*	accumulate stage of the vector unit datapath.
*/

	output	vct_instvld_ac;			/* valid CP2 instruction in AC */

	output	[1:0]	vct_aclwsl0_ac;		/* selects input for lower mux of accumulator vector 0 */
	output	[1:0]	vct_aclwsl1_ac;		/* selects input for lower mux of accumulator vector 1 */

	output	vct_cslwcsl0_ac;		/* select for input c of lower csa slice 0 */
	output	vct_cslwcsl1_ac;		/* select for input c of lower csa slice 1 */
	output	vct_csupcen0_ac;		/* input c enable for upper csa even vectors */
	output	vct_csupcen1_ac;		/* input c enable for upper csa odd vectors */

	output	[1:0]	vct_acmisl0_ac;		/* selects input for middle mux of accumulator vector 0 */
	output	[1:0]	vct_acmisl1_ac;		/* selects input for middle mux of accumulator vector 1 */

	output	vct_incrmxsl0_ac;	/* mux select for incrementer output vector 0 */
	output	vct_incrmxsl1_ac;	/* mux select for incrementer output vector 1 */

	output	[1:0]	vct_acupsl0_ac;		/* selects input for upper mux of accumulator vector 0 */
	output	[1:0]	vct_acupsl1_ac;		/* selects input for upper mux of accumulator vector 1 */

	output	[3:0]	vct_rndvlu0_ac;		/* round value for multiplies/byte adds vector 0 */
	output	[1:0]	vct_cslwasl0_ac;	/* selects for input a of lower csa vector 0 */
	output	[1:0]	vct_cslwbsl0_ac;	/* selects for input b of lower csa vector 0 */
	output	vct_addlwci0_ac;		/* carry in to lower adder vector 0 */
	output	[1:0]	vct_csupasl0_ac;	/* selects for input a of upper csa vector 0 */
	output	[1:0]	vct_csupbsl0_ac;	/* selects for input b of upper csa vector 0 */
	output	vct_incrdwn0_ac;		/* increment/decrement control signal vector 0 */
	output	vct_incrci0_ac;			/* increment/decrement enable signal vector 0 */

	output	[3:0]	vct_rndvlu1_ac;		/* round value for multiplies/byte adds vector 1 */
	output	[1:0]	vct_cslwasl1_ac;	/* selects for input a of lower csa vector 1 */
	output	[1:0]	vct_cslwbsl1_ac;	/* selects for input b of lower csa vector 1 */
	output	vct_addlwci1_ac;		/* carry in to lower adder vector 1 */
	output	[1:0]	vct_csupasl1_ac;	/* selects for input a of upper csa vector 1 */
	output	[1:0]	vct_csupbsl1_ac;	/* selects for input b of upper csa vector 1 */
	output	vct_incrdwn1_ac;		/* increment/decrement control signal vector 1 */
	output	vct_incrci1_ac;			/* increment/decrement enable signal vector 1 */


/*
*	The next group are output control signals for the
*	write back stage of the vector unit datapath.
*/

	output	[2:0]	vct_rsltsl0_wb;		/* selects for result mux vector 0 */
	output	[2:0]	vct_rsltsl1_wb;		/* selects for result mux vector 1 */

	output	[2:0]	vct_clprslt0_wb;	/* clamp value for all clamping vector 0 */
	output	[2:0]	vct_clprslt1_wb;	/* clamp value for all clamping vector 1 */

/*
*	The following output signals are for addressing the register file only.
*/

	output	vct_dvtypop_ac;		/* divide or move type instruction in AC */
	output	[2:0]	vct_vs_addr_ac;	/* register number for vs read used as element field for div */

	inout	[3:0]	su_cont_to_from;	/* Data for moving to/from vector control registers. */



/*
*	Pipechain for instruction valid, instruction function, vs and element fields.
*/
	wire	vct_instvld_mu;		/* valid CP2 instruction in MU */

	asdff #(1, 0)	vctinstvldffmu (vct_instvld_mu, su_instvldk_rd, clk, reset_l );

	asdff #(1, 0)	vctinstvldffac (vct_instvld_ac, vct_instvld_mu, clk, reset_l );


	wire	[5:0]	vct_instfunc_mu;	/* function field of instruction in MU */
	wire	[5:0]	vct_instfunc_ac;	/* function field of instruction in AC */

	asdffen #(6, 0)	vctinstfuncffmu (vct_instfunc_mu, su_instfunc_rd, su_instvld_rd, clk, reset_l );

	asdffen #(6, 0)	vctinstfuncffac (vct_instfunc_ac, vct_instfunc_mu, vct_instvld_mu, clk, reset_l );


	wire	[2:0]	vct_vs_addr_rd;	/* vs field of instruction in RD */
	wire	[2:0]	vct_vs_addr_mu;	/* vs field of instruction in MU */
	wire	[2:0]	vct_vs_addr_ac;	/* vs field of instruction in AC */

	assign	vct_vs_addr_rd =	su_vs_addr_rd[2:0];
	asdffen #(3, 0)	vctvsaddrffmu (vct_vs_addr_mu, vct_vs_addr_rd, su_instvld_rd, clk, reset_l );
	asdffen #(3, 0)	vctvsaddrffac (vct_vs_addr_ac, vct_vs_addr_mu, vct_instvld_mu, clk, reset_l );



	wire	[3:0]	vct_instelem_mu;	/* element field of instruction in MU */
	wire	[3:0]	vct_instelem_ac;	/* element field of instruction in AC */

	asdffen #(4, 0)	vctinstelemffmu (vct_instelem_mu, su_instelem_rd, su_instvld_rd, clk, reset_l );

	asdffen #(4, 0)	vctinstelemffac (vct_instelem_ac, vct_instelem_mu, vct_instvld_mu, clk, reset_l );



	wire	vct_vseqone_mu;		/* vs field of instruction equal to 1 in MU */
	wire	vct_vseqone_ac;		/* vs field of instruction equal to 1 in AC */

	asdffen #(1, 0)	vctvseqoneffmu (vct_vseqone_mu, su_vseqone_rd, su_instvld_rd, clk, reset_l );

	asdffen #(1, 0)	vctvseqoneffac (vct_vseqone_ac, vct_vseqone_mu, vct_instvld_mu, clk, reset_l );


/*
*	Instruction decode of select instructions in the RD stage.
*/
	wire	vct_stgelcpop_rd;	/* select compare LT, EQ, NEQ ot VGE instruction in MU stage */

	assign	vct_stgelcpop_rd =	( su_instfunc_rd == `VLT ) || ( su_instfunc_rd == `VEQ ) ||
					( su_instfunc_rd == `VNE ) || ( su_instfunc_rd == `VGE ) ;

	wire	vct_stcrop_rd;		/* -VT <= VS <= VT select instruction 1's comp */

	assign	vct_stcrop_rd	=	su_instvld_rd && ( su_instfunc_rd == `VCR ) ;




/*
*	Instruction decode of add instructions in the RD stage.
*/

	wire	vct_subcop_rd;			/* SUBC instruction in RD */

	assign	vct_subcop_rd	=	( su_instfunc_rd == `VSUBC ) ;


	wire	vct_sbtypop_rd;		/* Subtract type VS-VT instruction in RD */

	assign	vct_sbtypop_rd =	(su_instfunc_rd == `VSUB) || (su_instfunc_rd == `VSUBC) ;


	wire	vct_absop_rd;		/* ABS instruction in RD stage. */
	wire	vct_absop_mu;		/* ABS instruction in MU stage. */

	assign	vct_absop_rd =	( su_instfunc_rd == `VABS ) ;

	asdffen #(1, 0)	vctabsopffmu (vct_absop_mu, vct_absop_rd, su_instvld_rd, clk, reset_l );


/*
*	Instruction decoding for logical ops in MU stage.
*/

	wire	vct_vandop_rd;		/* VAND instruction in RD */
	wire	vct_vandop_mu;		/* VAND instruction in MU */

	assign	vct_vandop_rd =		( su_instfunc_rd == `VAND ) ;

	asdffen #(1, 0)	vctvandopffmu (vct_vandop_mu, vct_vandop_rd, su_instvld_rd, clk, reset_l );


	wire	vct_vnandop_rd;		/* VNAND instruction in RD */
	wire	vct_vnandop_mu;		/* VNAND instruction in MU */

	assign	vct_vnandop_rd =	( su_instfunc_rd == `VNAND ) ;

	asdffen #(1, 0)	vctvnandopffmu (vct_vnandop_mu, vct_vnandop_rd, su_instvld_rd, clk, reset_l );


	wire	vct_vorop_rd;		/* VOR instruction in RD */
	wire	vct_vorop_mu;		/* VOR instruction in MU */

	assign	vct_vorop_rd =		( su_instfunc_rd == `VOR ) ;

	asdffen #(1, 0)	vctvoropffmu (vct_vorop_mu, vct_vorop_rd, su_instvld_rd, clk, reset_l );


	wire	vct_vnorop_rd;		/* VNOR instruction in RD */
	wire	vct_vnorop_mu;		/* VNOR instruction in MU */

	assign	vct_vnorop_rd =		( su_instfunc_rd == `VNOR ) ;

	asdffen #(1, 0)	vctvnoropffmu (vct_vnorop_mu, vct_vnorop_rd, su_instvld_rd, clk, reset_l );


	wire	vct_vxorop_rd;		/* VXOR instruction in RD */
	wire	vct_vxorop_mu;		/* VXOR instruction in MU */

	assign	vct_vxorop_rd =		( su_instfunc_rd == `VXOR ) ;

	asdffen #(1, 0)	vctvxoropffmu (vct_vxorop_mu, vct_vxorop_rd, su_instvld_rd, clk, reset_l );


	wire	vct_vxnorop_rd;		/* VXNOR instruction in RD */
	wire	vct_vxnorop_mu;		/* VXNOR instruction in MU */

	assign	vct_vxnorop_rd =	( su_instfunc_rd == `VXNOR ) ;

	asdffen #(1, 0)	vctvxnoropffmu (vct_vxnorop_mu, vct_vxnorop_rd, su_instvld_rd, clk, reset_l );



/*
*	The following is the code for the instruction decode in the
*	MU stage.
*/

/*
*	Instruction decoding for select ops in MU stage.
*/

	wire	vct_stcpop_mu;		/* select compare instruction in MU stage */

	assign	vct_stcpop_mu	=	( vct_instfunc_mu == `VLT ) || ( vct_instfunc_mu == `VEQ ) ||
					( vct_instfunc_mu == `VNE ) || ( vct_instfunc_mu == `VGE ) ||
					( vct_instfunc_mu == `VCH ) || ( vct_instfunc_mu == `VCR ) ||
					( vct_instfunc_mu == `VCL ) ;
/*
*	The data to the vector unit control register is a timing critical path therefore valid
*	is taken into account at the instruction decode level to eliminate it from the critical
*	timing of the data.
*/

	wire	vct_stltop_mu;		/* VS < VT select instruction in MU stage */

	assign	vct_stltop_mu	=	vct_instvld_mu && ( vct_instfunc_mu == `VLT ) ;


	wire	vct_steqop_mu;		/* VS == VT select instruction in MU stage */

	assign	vct_steqop_mu	=	vct_instvld_mu && ( vct_instfunc_mu == `VEQ ) ;


	wire	vct_stneop_mu;		/* VS != VT select instruction in MU stage */

	assign	vct_stneop_mu	=	vct_instvld_mu && ( vct_instfunc_mu == `VNE ) ;


	wire	vct_stgeop_mu;		/* VS >= VT select instruction in MU stage */

	assign	vct_stgeop_mu	=	vct_instvld_mu && ( vct_instfunc_mu == `VGE ) ;

/*
*	The signals vct_stchop_mu, vct_stclop_mu and vct_stcrop_mu are decoded in the 
*	RD stage and then register so that they available early in the cycle for 
*	generating the vct_aluctl_mu and vct_alucin_mu signals.	  They need to be gated 
*	with vct_instvld_mu since su_instvld_rd does not taken into account killed 
*	instructions because of timing reasons.
*/
	wire	vct_stchop_rd;		/* -VT <= VS <= VT select instruction 2's comp single precison */
	wire	vct_stchoprg_mu;	/* -VT <= VS <= VT select instruction 2's comp single precison */
	wire	vct_stchop_mu;		/* -VT <= VS <= VT select instruction 2's comp single precison */

	assign	vct_stchop_rd	=	su_instvld_rd && ( su_instfunc_rd == `VCH ) ;

	asdff #(1, 0)	vctstchopffmu (vct_stchoprg_mu, vct_stchop_rd, clk, reset_l );

	assign vct_stchop_mu	=	vct_instvld_mu && vct_stchoprg_mu ;

	wire	vct_stchrop_rd;		/* -VT <= VS <= VT select instruction 2's or 1's comp */
	wire	vct_stchroprg_mu;	/* -VT <= VS <= VT select instruction 2's or 1's comp */
	wire	vct_stchrop_mu;		/* -VT <= VS <= VT select instruction 2's or 1's comp */

	assign	vct_stchrop_rd	=	su_instvld_rd && ( vct_stchop_rd || vct_stcrop_rd ) ;

	asdff #(1, 0)	vctstchropffmu (vct_stchroprg_mu, vct_stchrop_rd, clk, reset_l );

	assign vct_stchrop_mu	=	vct_instvld_mu && vct_stchroprg_mu ;


	wire	vct_stclop_rd;		/* -VT<=VS<=VT select instruction 2's comp double precision*/
	wire	vct_stcloprg_mu;	/* -VT<=VS<=VT select instruction 2's comp double precision*/
	wire	vct_stclop_mu;		/* -VT<=VS<=VT select instruction 2's comp double precision*/

	assign	vct_stclop_rd	=	su_instvld_rd && ( su_instfunc_rd == `VCL ) ;

	asdff #(1, 0)	vctstclopffmu (vct_stcloprg_mu, vct_stclop_rd, clk, reset_l );

	assign vct_stclop_mu	=	vct_instvld_mu && vct_stcloprg_mu ;


	wire	vct_stcroprg_mu;	/* -VT<=VS<=VT select instruction 1's comp */
	wire	vct_stcrop_mu;		/* -VT<=VS<=VT select instruction 1's comp */

	asdff #(1, 0)	vctstcropffmu (vct_stcroprg_mu, vct_stcrop_rd, clk, reset_l );

	assign vct_stcrop_mu	=	vct_instvld_mu && vct_stcroprg_mu ;


	wire	vct_stmrgop_mu;		/* MERGE select instruction in MU stage */

	assign	vct_stmrgop_mu	=	( vct_instfunc_mu == `VMRG ) ;


/*
*	Instruction decoding for adds and subtracts in MU stage.
*/

	wire	vct_addcop_mu;			/* ADDC instruction in MU */

	assign	vct_addcop_mu	=	( vct_instfunc_mu == `VADDC ) ;


	wire	vct_addop_rd;			/* ADD instruction in RD */
	wire	vct_addop_mu;			/* ADD instruction in MU */
	wire	vct_addop_ac;			/* ADD instruction in AC */

	assign	vct_addop_rd	=	( su_instfunc_rd == `VADD ) ;

	asdffen #(1, 0)	vctaddopffmu (vct_addop_mu, vct_addop_rd, su_instvld_rd, clk, reset_l );

	asdffen #(1, 0)	vctaddopffac (vct_addop_ac, vct_addop_mu, vct_instvld_mu, clk, reset_l );


	wire	vct_subcop_mu;			/* SUBC instruction in MU */

	assign	vct_subcop_mu	=	( vct_instfunc_mu == `VSUBC ) ;


	wire	vct_addspop_mu;			/* Single precision add/sub instruction in MU */

	assign	vct_addspop_mu	=	( vct_instfunc_mu == `VADD ) ||
					( vct_instfunc_mu == `VSUB ) ;

	wire	vct_subop_rd;			/* SUB instruction in RD */
	wire	vct_subop_mu;			/* SUB instruction in MU */
	wire	vct_subop_ac;			/* SUB instruction in AC */

	assign	vct_subop_rd	=	( su_instfunc_rd == `VSUB ) ;

	asdffen #(1, 0)	vctsubopffmu (vct_subop_mu, vct_subop_rd, su_instvld_rd, clk, reset_l );

	asdffen #(1, 0)	vctsubopffac (vct_subop_ac, vct_subop_mu, vct_instvld_mu, clk, reset_l );

	wire	vct_substclop_rd;	/* sub or -VT<=VS<=VT select op 2's comp double precision*/
	wire	vct_substclop_mu;	/* sub or -VT<=VS<=VT select op 2's comp double precision*/

	assign	vct_substclop_rd =	vct_stclop_rd || vct_subop_rd ;

	asdffen #(1, 0)	vctsubstclopffmu (vct_substclop_mu, vct_substclop_rd, su_instvld_rd, clk, reset_l );



/*
*	Instruction decoding for multiplies in MU stage.
*/

	wire	vct_mulfop_mu ;		/* MULF instruction in MU stage. */
	wire	vct_macfop_mu ;		/* MACF instruction in MU stage. */
	wire	vct_muluop_mu ;		/* MULU instruction in MU stage. */
	wire	vct_macuop_mu ;		/* MACU instruction in MU stage. */
	wire	vct_mulqop_mu ;		/* MULQ instruction in MU stage. */
	wire	vct_macqop_mu ;		/* MACQ instruction in MU stage. */
	wire	vct_mudlop_mu ;		/* MUDL instruction in MU stage. */
	wire	vct_madlop_mu ;		/* MADL instruction in MU stage. */
	wire	vct_mudmop_mu ;		/* MUDM instruction in MU stage. */
	wire	vct_madmop_mu ;		/* MADM instruction in MU stage. */
	wire	vct_mudnop_mu ;		/* MUDN instruction in MU stage. */
	wire	vct_madnop_mu ;		/* MADN instruction in MU stage. */
	wire	vct_mudhop_mu ;		/* MUDH instruction in MU stage. */
	wire	vct_madhop_mu ;		/* MADH instruction in MU stage. */


	assign	vct_mulfop_mu =	( vct_instfunc_mu == `VMULF ) ;

	assign	vct_macfop_mu =	( vct_instfunc_mu == `VMACF ) ;

	assign	vct_muluop_mu =	( vct_instfunc_mu == `VMULU ) ;

	assign	vct_macuop_mu =	( vct_instfunc_mu == `VMACU ) ;

	assign	vct_mulqop_mu =	( vct_instfunc_mu == `VMULQ ) ;

	assign	vct_macqop_mu =	( vct_instfunc_mu == `VMACQ ) ;

	assign	vct_mudlop_mu =	( vct_instfunc_mu == `VMUDL ) ;

	assign	vct_madlop_mu =	( vct_instfunc_mu == `VMADL ) ;

	assign	vct_mudmop_mu =	( vct_instfunc_mu == `VMUDM ) ;

	assign	vct_madmop_mu =	( vct_instfunc_mu == `VMADM ) ;

	assign	vct_mudnop_mu =	( vct_instfunc_mu == `VMUDN ) ;

	assign	vct_madnop_mu =	( vct_instfunc_mu == `VMADN ) ;

	assign	vct_mudhop_mu =	( vct_instfunc_mu == `VMUDH ) ;

	assign	vct_madhop_mu =	( vct_instfunc_mu == `VMADH ) ;



	wire	vct_multtypop_mu;	/* Multiply type instruction not MACQ in MU stage. */

	assign	vct_multtypop_mu =	vct_mulfop_mu || vct_macfop_mu ||
					vct_muluop_mu || vct_macuop_mu ||
					vct_mulqop_mu ||
					vct_mudlop_mu || vct_madlop_mu ||
					vct_mudmop_mu || vct_madmop_mu ||
					vct_mudnop_mu || vct_madnop_mu ||
					vct_mudhop_mu || vct_madhop_mu ;

					
	wire	vct_vs_sgnmu_mu;		/* Multiply instruction with operand s signed */



	assign	vct_vs_sgnmu_mu	=	vct_mulfop_mu || vct_macfop_mu ||
					vct_muluop_mu || vct_macuop_mu ||
					vct_mulqop_mu || vct_macqop_mu ||
					vct_mudmop_mu || vct_madmop_mu ||
					vct_mudhop_mu || vct_madhop_mu ;


	wire	vct_vt_sgnmu_mu;		/* Multiply instruction with operand t signed */

	assign	vct_vt_sgnmu_mu	=	vct_mulfop_mu || vct_macfop_mu ||
					vct_muluop_mu || vct_macuop_mu ||
					vct_mulqop_mu || vct_macqop_mu ||
					vct_mudnop_mu || vct_madnop_mu ||
					vct_mudhop_mu || vct_madhop_mu ;


	wire	vct_rndpop_mu;		/* RNDP op in MU stage */
	wire	vct_rndnop_mu;		/* RNDN op in MU stage */
	wire	vct_rndop_mu;		/* Round op in MU stage */
	wire	vct_rndop_ac;		/* Round op in AC stage */

	assign	vct_rndpop_mu =		( vct_instfunc_mu == `VRNDP ) ;

	assign	vct_rndnop_mu =		( vct_instfunc_mu == `VRNDN ) ;

	assign	vct_rndop_mu =		vct_rndpop_mu || vct_rndnop_mu ;

	asdffen #(1, 0)	vctrndopac (vct_rndop_ac, vct_rndop_mu, vct_instvld_mu, clk, reset_l );

	wire	vct_dvnomovop_mu;	/* Divide type op other than move in MU */
	wire	vct_dvnomovop_ac;	/* Divide type op other than move in AC */
	wire	vct_divrsltsl_wb;	/* Divide type op other than move in WB */

	assign	vct_dvnomovop_mu =	( vct_instfunc_mu == `VRCP ) || ( vct_instfunc_mu == `VRCPL ) || 
					( vct_instfunc_mu == `VRCPH ) || ( vct_instfunc_mu == `VRSQ ) ||
					( vct_instfunc_mu == `VRSQL ) || ( vct_instfunc_mu == `VRSQH ) ;
	
	asdffen #(1, 0)	vctdvnomovopac (vct_dvnomovop_ac, vct_dvnomovop_mu, vct_instvld_mu, clk, reset_l );
	asdffen #(1, 0)	vctdivrsltslwb (vct_divrsltsl_wb, vct_dvnomovop_ac, vct_instvld_ac, clk, reset_l );


	wire	vct_dvmovop_mu;		/* Divide move op in MU */
	wire	vct_dvmovop_ac;		/* Divide move op in AC */

	assign	vct_dvmovop_mu =	( vct_instfunc_mu == `VMOV ) ;	

	asdffen #(1, 0)	vctdvmovopac (vct_dvmovop_ac, vct_dvmovop_mu, vct_instvld_mu, clk, reset_l );


	wire	vct_dvtypop_mu;	/* divide or move type instruction in MU */

	assign	vct_dvtypop_mu =	vct_dvnomovop_mu || vct_dvmovop_mu;

	asdffen #(1, 0)	vctdvtypopac (vct_dvtypop_ac, vct_dvtypop_mu, vct_instvld_mu, clk, reset_l );


/*
*	Instruction decoding to determine loading of Vector carry out and vector compare code
*	registers other than explicit move to control instruction.
*/
	wire	vct_cryoutld_mu;		/* Load enable for vector carry out/equal register */

	assign	vct_cryoutld_mu	=	( vct_instvld_mu &&
					  ( vct_addcop_mu || vct_subcop_mu || /* actual setting of VCO bits */
					    vct_addspop_mu || vct_stcpop_mu ||   /* Clear VCO on select instructions */
					    vct_stmrgop_mu
					  ) 
					) ||
					su_wrcryout_wb ;

	wire	vct_cmpcdld_mu;		/* Load enable for vector compare code register */

	assign	vct_cmpcdld_mu	=	( vct_instvld_mu && vct_stcpop_mu ) || su_wrcmpcd_wb ;


	wire	vct_cmpcdadld_mu;	/* Load enable for vector compare add register */

	assign	vct_cmpcdadld_mu =	( vct_instvld_mu && 
					  ( vct_stcrop_mu || vct_stchop_mu || vct_stclop_mu )
					) || 
					su_wrcmpcdad_wb ;



/*
*	The following is the code for the instruction decode in the
*	AC stage.
*/

	wire	vct_absop_ac;			/* ABS instruction in AC stage. */

	asdffen #(1, 0)	vctabsopffac (vct_absop_ac, vct_absop_mu, vct_instvld_mu, clk, reset_l );


	wire	vct_stcpop_ac;			/* select compare/merge instruction in AC stage. */

	assign	vct_stcpop_ac	=	( vct_instfunc_ac == `VLT ) || ( vct_instfunc_ac == `VEQ ) ||
					( vct_instfunc_ac == `VNE ) || ( vct_instfunc_ac == `VGE ) ||
					( vct_instfunc_ac == `VCH ) || ( vct_instfunc_ac == `VCR ) ||
					( vct_instfunc_ac == `VCL ) || ( vct_instfunc_ac == `VMRG ) ;

	wire	vct_stchop_ac;		/* -VT<=VS<=VT select op 2's comp single precison */

	asdffen #(1, 0)	vctstchopffac (vct_stchop_ac, vct_stchop_mu, vct_instvld_mu, clk, reset_l );

	wire	vct_stclop_ac;		/* -VT<=VS<=VT select op 2's comp double precision*/

	asdffen #(1, 0)	vctstclopffac (vct_stclop_ac, vct_stclop_mu, vct_instvld_mu, clk, reset_l );

	wire	vct_stnclrdop_ac;		/* Select instruction that is not CL, CLD or CR */

	assign	vct_stnclrdop_ac	=	( vct_instfunc_ac == `VLT ) || ( vct_instfunc_ac == `VEQ ) ||
						( vct_instfunc_ac == `VNE ) || ( vct_instfunc_ac == `VGE )  ||
						( vct_instfunc_ac == `VMRG ) ;


	wire	vct_stclrdop_ac;		/* Select instruction that is CL, CLD or CR */

	assign	vct_stclrdop_ac	=	( vct_instfunc_ac == `VCH ) || ( vct_instfunc_ac == `VCL ) ||
					( vct_instfunc_ac == `VCR ) ;


	wire	vct_mulfop_ac ;		/* MULF instruction in AC stage. */
	wire	vct_macfop_ac ;		/* MACF instruction in AC stage. */
	wire	vct_muluop_ac ;		/* MULU instruction in AC stage. */
	wire	vct_macuop_ac ;		/* MACU instruction in AC stage. */
	wire	vct_rndpop_ac ;		/* RNDP instruction in AC stage. */
	wire	vct_rndnop_ac ;		/* RNDN instruction in AC stage. */
	wire	vct_mulqop_ac ;		/* MULQ instruction in AC stage. */
	wire	vct_macqop_ac ;		/* MACQ instruction in AC stage. */
	wire	vct_mudlop_ac ;		/* MUDL instruction in AC stage. */
	wire	vct_madlop_ac ;		/* MADL instruction in AC stage. */
	wire	vct_mudmop_ac ;		/* MUDM instruction in AC stage. */
	wire	vct_madmop_ac ;		/* MADM instruction in AC stage. */
	wire	vct_mudnop_ac ;		/* MUDN instruction in AC stage. */
	wire	vct_madnop_ac ;		/* MADN instruction in AC stage. */
	wire	vct_mudhop_ac ;		/* MUDH instruction in AC stage. */
	wire	vct_madhop_ac ;		/* MADH instruction in AC stage. */

/*
*	To improve timing many of the instruction decode signals are decoded in
*	the multiply stage and piped along to the accumulator stage.
*/

	asdffen #(1, 0)	vctmulfopffac (vct_mulfop_ac, vct_mulfop_mu, vct_instvld_mu, clk, reset_l );

	asdffen #(1, 0)	vctmacfopffac (vct_macfop_ac, vct_macfop_mu, vct_instvld_mu, clk, reset_l );

	asdffen #(1, 0)	vctmuluopffac (vct_muluop_ac, vct_muluop_mu, vct_instvld_mu, clk, reset_l );

	asdffen #(1, 0)	vctmacuopffac (vct_macuop_ac, vct_macuop_mu, vct_instvld_mu, clk, reset_l );

	asdffen #(1, 0)	vctrndpopffac (vct_rndpop_ac, vct_rndpop_mu, vct_instvld_mu, clk, reset_l );

	asdffen #(1, 0)	vctrndnopffac (vct_rndnop_ac, vct_rndnop_mu, vct_instvld_mu, clk, reset_l );

	asdffen #(1, 0)	vctmulqopffac (vct_mulqop_ac, vct_mulqop_mu, vct_instvld_mu, clk, reset_l );

	asdffen #(1, 0)	vctmacqopffac (vct_macqop_ac, vct_macqop_mu, vct_instvld_mu, clk, reset_l );

	asdffen #(1, 0)	vctmudlopffac (vct_mudlop_ac, vct_mudlop_mu, vct_instvld_mu, clk, reset_l );

	asdffen #(1, 0)	vctmadlopffac (vct_madlop_ac, vct_madlop_mu, vct_instvld_mu, clk, reset_l );

	asdffen #(1, 0)	vctmudmopffac (vct_mudmop_ac, vct_mudmop_mu, vct_instvld_mu, clk, reset_l );

	asdffen #(1, 0)	vctmadmopffac (vct_madmop_ac, vct_madmop_mu, vct_instvld_mu, clk, reset_l );

	asdffen #(1, 0)	vctmudnopffac (vct_mudnop_ac, vct_mudnop_mu, vct_instvld_mu, clk, reset_l );

	asdffen #(1, 0)	vctmadnopffac (vct_madnop_ac, vct_madnop_mu, vct_instvld_mu, clk, reset_l );

	asdffen #(1, 0)	vctmudhopffac (vct_mudhop_ac, vct_mudhop_mu, vct_instvld_mu, clk, reset_l );

	asdffen #(1, 0)	vctmadhopffac (vct_madhop_ac, vct_madhop_mu, vct_instvld_mu, clk, reset_l );


/*
*	Use multiply type op signal from the MU stage.
*/

	wire	vct_multtypop_ac;		/* Multiply type op other than MACQ in AC */

	asdffen #(1, 0)	vctmulttypopffac (vct_multtypop_ac, vct_multtypop_mu, vct_instvld_mu, clk, reset_l );


	wire	vct_multndlop_mu;		/* Multiply type op other than MACQ in MU */
	wire	vct_multndlop_ac;		/* Multiply type op other than MACQ in AC */

	assign	vct_multndlop_mu =	vct_mulfop_mu || vct_macfop_mu ||
					vct_muluop_mu || vct_macuop_mu ||
					vct_mulqop_mu ||
					vct_mudmop_mu || vct_madmop_mu ||
					vct_mudnop_mu || vct_madnop_mu ||
					vct_mudhop_mu || vct_madhop_mu ;


	asdffen #(1, 0)	vctmultndlopffac (vct_multndlop_ac, vct_multndlop_mu, vct_instvld_mu, clk, reset_l );


	wire	vct_multactyp_mu;	/* MACF, MACU, MADL, MADM, MADN, RNDP and RNDP type ops */
	wire	vct_multactyp_ac;	/* MACF, MACU, MADL, MADM, MADN, RNDP and RNDP type ops */

	assign	vct_multactyp_mu =	( vct_macfop_mu || vct_macuop_mu ||
					  vct_madlop_mu || vct_madmop_mu ||
					  vct_madnop_mu || vct_rndpop_mu || vct_rndnop_mu
					) ;

	asdffen #(1, 0)	vctmultactypopffac (vct_multactyp_ac, vct_multactyp_mu, vct_instvld_mu, clk, reset_l );


	wire	vct_multincop_mu;	/* MACF, MACU, MADL, MADM and MADN type ops */
	wire	vct_multincop_ac;	/* MACF, MACU, MADL, MADM and MADN type ops */

	assign	vct_multincop_mu =	( vct_macfop_mu || vct_macuop_mu ||
					  vct_madlop_mu || vct_madmop_mu ||
					  vct_madnop_mu
					) ;

	asdffen #(1, 0)	vctmultincopffac (vct_multincop_ac, vct_multincop_mu, vct_instvld_mu, clk, reset_l );



	wire	vct_sarop_ac;		/* SAR instruction in AC stage. */

	assign	vct_sarop_ac =		vct_instfunc_ac == `VSAR ;



	wire	vct_addtypop_ac;	/* Add type instruction in the AC stage */

	assign	vct_addtypop_ac = ( vct_instfunc_ac == `VADD ) || ( vct_instfunc_ac == `VSUB ) || 
				  ( vct_instfunc_ac == `VADDC ) || ( vct_instfunc_ac == `VSUBC ) ||
				  ( vct_instfunc_ac == `VABS ) ;	



	wire	vct_logtypop_ac;	/* logical type instruction in the WB stage */

	assign	vct_logtypop_ac = ( vct_instfunc_ac == `VAND ) || ( vct_instfunc_ac == `VNAND ) || 
				  ( vct_instfunc_ac == `VOR ) || ( vct_instfunc_ac == `VNOR ) || 
				  ( vct_instfunc_ac == `VXOR ) || ( vct_instfunc_ac == `VXNOR ) ;



/*
*	The next group are output control signals for the
*	multiply stage of the vector unit datapath.
*/
/*
*	This code does the decoding of the instructions for generation of the selection
*	between the various logical and add functions.  The control that is data 
*	dependent such as on input signs is generated in vusl.
*/

	wire	[2:0]	vct_aluctl_mu;	/* control for selecting alu function */

	assign	vct_aluctl_mu[0] =	vct_vandop_mu || vct_vorop_mu ||
					vct_vxorop_mu || vct_rndop_mu ;

	assign	vct_aluctl_mu[1] =	vct_vnandop_mu || vct_vorop_mu ||
					vct_vxnorop_mu || vct_rndop_mu ;

	assign	vct_aluctl_mu[2] =	vct_vnorop_mu || vct_vxorop_mu ||
					vct_vxnorop_mu || vct_rndop_mu ;


	assign	vct_aluctl0_mu =	vct_aluctl_mu ;

	assign	vct_aluctl1_mu =	vct_aluctl_mu ;

/*
*	Control for complementing the VT data for ALU subtracts and compares in the MU stage.
*/

	wire	vct_alucmpvt_rd;	/* complement vt for subtact in ALU in RD stage */
	wire	vct_pralucmpvt_mu;	/* complement vt for subtact in ALU in MU stage */

	assign	vct_alucmpvt_rd =	vct_sbtypop_rd || vct_stgelcpop_rd ;

	asdffen #(1, 0)	vctalucmpvtffmu (vct_pralucmpvt_mu, vct_alucmpvt_rd, su_instvld_rd, clk, reset_l );


	wire	vct_aluprecin_rd;	/* carry in to alu decoded subtract instructions */

	assign	vct_aluprecin_rd =	vct_subcop_rd || vct_stgelcpop_rd ||
					vct_stcrop_rd ;
					/* for one's complement VS+VT+1<=0 or VS-VT>=0 */


/*
*	The next portion of code handles the move from CP2 control registers by muxing between 
*	the vector compare code register, vector carry out register and the data from the 
*	store data port of the register file of vector 0.  The store data port also provides the
*	data for the move from CP2 registers.
*/
	wire	vct_cmpcdhi0_ac;	/* high bit from Vector Compare code register - vector 0 */
	wire	vct_cmpcdhi1_ac;	/* high bit from Vector Compare code register - vector 1 */

	wire	vct_cmpcdlo0_ac;	/* low bit from Vector Compare code register - vector 0 */
	wire	vct_cmpcdlo1_ac;	/* low bit from Vector Compare code register - vector 1 */

	wire	vct_cmpcdad0_ac;	/* Flag for Vector Compare Add register - vector 0 */
	wire	vct_cmpcdad1_ac;	/* Flag for Vector Compare Add register - vector 1 */

	wire	vct_opdneql0_ac;	/* operands not equal flag from Vector Carry out register - vector 0 */
	wire	vct_opdneql1_ac;	/* operands not equal flag from Vector Carry out register - vector 1 */

	wire	vct_cryout0_ac;		/* carry out flag from Vector Carry out register - vector 0 */
	wire	vct_cryout1_ac;		/* carry out flag from Vector Carry out register - vector 1 */



	wire	su_rdcmpcd_mu;		/* read vector compare code register */
	wire	su_rdcryout_mu;		/* read vector carry out register */
	wire	su_rdcmpcdad_mu;	/* read vector compare add register */
	wire	[3:0]	vct_contbus_mu;	/* output control bus to tristate drivers */
	wire	vct_contbusen_mu;		/* output enable to tristate drivers */

	asdff #(1, 0)	vctrdcmpcdffmu (su_rdcmpcd_mu, su_rdcmpcd_rd, clk, reset_l );
	asdff #(1, 0)	vctrdcryoutffmu (su_rdcryout_mu, su_rdcryout_rd, clk, reset_l );
	asdff #(1, 0)	vctrdcmpcdadffmu (su_rdcmpcdad_mu, su_rdcmpcdad_rd, clk, reset_l );


/*	The following code was replaced with instantiated gates so that I could control
*	the 3 state output driver and timing through the mux.
*/

/*	This code was replaced by instantiated muxes for timing reasons.
*
*	assign	vct_contbus_mu =	su_rdcryout_mu ?
*					    {
*						vct_opdneql1_ac,vct_opdneql0_ac,
*						vct_cryout1_ac,vct_cryout0_ac 
*					    }
*						: su_rdcmpcdad_mu ?
*						    {
*							2'h0,
*							vct_cmpcdad1_ac,vct_cmpcdad0_ac 
*						    }
*						:
*						    {
*							vct_cmpcdhi1_ac,vct_cmpcdhi0_ac,
*							vct_cmpcdlo1_ac,vct_cmpcdlo0_ac 
*						    } ;
*
*/

	wire	[3:0]	vct_contbusin_ac;	/* output of mux selecting between VCA and VCC */

	mx21d1	vctcontbusmx0mu	(	.z		(vct_contbus_mu[0]), 
					.i0		(vct_contbusin_ac[0]), 
					.i1		(vct_cryout0_ac), 
					.s		(su_rdcryout_mu) 
				) ;
	mx21d1	vctcontbusmx1mu	(	.z		(vct_contbus_mu[1]), 
					.i0		(vct_contbusin_ac[1]), 
					.i1		(vct_cryout1_ac), 
					.s		(su_rdcryout_mu) 
				) ;
	mx21d1	vctcontbusmx2mu	(	.z		(vct_contbus_mu[2]), 
					.i0		(vct_contbusin_ac[2]), 
					.i1		(vct_opdneql0_ac), 
					.s		(su_rdcryout_mu) 
				) ;
	mx21d1	vctcontbusmx3mu	(	.z		(vct_contbus_mu[3]), 
					.i0		(vct_contbusin_ac[3]), 
					.i1		(vct_opdneql1_ac), 
					.s		(su_rdcryout_mu) 
				) ;

	mx21d1	vctcontbusin0mu	(	.z		(vct_contbusin_ac[0]), 
					.i0		(vct_cmpcdlo0_ac), 
					.i1		(vct_cmpcdad0_ac), 
					.s		(su_rdcmpcdad_mu) 
				) ;
	mx21d1	vctcontbusin1mu	(	.z		(vct_contbusin_ac[1]), 
					.i0		(vct_cmpcdlo1_ac), 
					.i1		(vct_cmpcdad1_ac), 
					.s		(su_rdcmpcdad_mu) 
				) ;


	assign	vct_contbusin_ac[2] =	vct_cmpcdhi0_ac && !su_rdcmpcdad_mu ;

	assign	vct_contbusin_ac[3] =	vct_cmpcdhi1_ac && !su_rdcmpcdad_mu ;


	assign	vct_contbusen_mu =	su_rdcryout_mu || su_rdcmpcdad_mu || su_rdcmpcd_mu ;


	nt01d5	vctcontbus0nt	(
					.z		(su_cont_to_from[0]),
					.oe		(vct_contbusen_mu),
					.i		(vct_contbus_mu[0])
				) ;

	nt01d5	vctcontbus1nt	(
					.z		(su_cont_to_from[1]),
					.oe		(vct_contbusen_mu),
					.i		(vct_contbus_mu[1])
				) ;

	nt01d5	vctcontbus2nt	(
					.z		(su_cont_to_from[2]),
					.oe		(vct_contbusen_mu),
					.i		(vct_contbus_mu[2])
				) ;

	nt01d5	vctcontbus3nt	(
					.z		(su_cont_to_from[3]),
					.oe		(vct_contbusen_mu),
					.i		(vct_contbus_mu[3])
				) ;

	wire	[1:0]	vct_couprsl_mu;		/* select for multiply upper carry out vector */

	assign	vct_couprsl_mu[0] =	!reset_l ||
					( vct_instvld_mu && vct_multtypop_mu ) ||
					( vct_instvld_mu && vct_dvtypop_mu ) ;  // zero value for MOVE

	assign	vct_couprsl_mu[1] =	!reset_l || 
					( vct_instvld_mu && !vct_multtypop_mu ) ;

	assign	vct_couprsl0_mu =	vct_couprsl_mu ;

	assign	vct_couprsl1_mu =	vct_couprsl_mu ;


	wire	[1:0]	vct_smuprsl_mu;	/* select for multiply upper sum out vector */

	assign	vct_smuprsl_mu[0] =	!reset_l ||
					( vct_instvld_mu && vct_multtypop_mu ) ||
					( vct_instvld_mu && !vct_multtypop_mu && 
					  !( vct_stcpop_mu || vct_stmrgop_mu )
					) ;

	assign	vct_smuprsl_mu[1] =	!reset_l ||
					( vct_instvld_mu && 
					  ( vct_stcpop_mu || vct_stmrgop_mu ) 
					) ||
					( vct_instvld_mu && !vct_multtypop_mu && 
					  !( vct_stcpop_mu || vct_stmrgop_mu )
					) ;

	assign	vct_smuprsl0_mu =	vct_smuprsl_mu ;

	assign	vct_smuprsl1_mu =	vct_smuprsl_mu ;


	wire	[1:0]	vct_colwrsl_mu;		/* selects for multiply lower carry out register */

	assign	vct_colwrsl_mu[0] =	!reset_l ||
					( vct_instvld_mu && vct_multtypop_mu )  ||
					( vct_instvld_mu && vct_dvtypop_mu ) ;  // zero value for MOVE

	assign	vct_colwrsl_mu[1] =	!reset_l ||
					( vct_instvld_mu && !vct_multtypop_mu ) ;  // zero value for MOVE

	assign	vct_colwrsl0_mu =	vct_colwrsl_mu ;

	assign	vct_colwrsl1_mu =	vct_colwrsl_mu ;

/*
*	We need unique selects for low sum register to handle the case 
*	of VS=0 for VABS instruction.
*/

	wire	[1:0]	vct_prsmlwrsl_mu;	/* selects for multiply lower sum out all vectors */

	assign	vct_prsmlwrsl_mu[0] =	( vct_instvld_mu &&  vct_multtypop_mu ) ;

	assign	vct_prsmlwrsl_mu[1] =	vct_stcpop_mu || vct_stmrgop_mu || vct_dvtypop_mu ;
					/* select or merge or divide op */

/*
*	Control signals for the multiplier are decoded in the RD stage and then registered for timing 
*	reasons.
*/

/*
*	Easier to figure out if operand should be unsigned and then complement to produce control signal.
*/
	wire	vct_sgnmplr_rd;			/* signed multiplier */

	assign	vct_sgnmplr_rd =	!( ( su_instfunc_rd == `VMUDL ) || ( su_instfunc_rd == `VMADL ) ||
					  ( su_instfunc_rd == `VMUDN ) || ( su_instfunc_rd == `VMADN )
					) ;

	asdffen #(1, 0)	vctsgnmplrffmu (vct_sgnmplr_mu, vct_sgnmplr_rd, su_instvld_rd, clk, reset_l );

/*
*	Easier to figure out if operand should be unsigned and then complement to produce control signal.
*/
	wire	vct_sgnmplcnd_rd;		/* signed multiplicand */

	assign	vct_sgnmplcnd_rd =	!( ( su_instfunc_rd == `VMUDL ) || ( su_instfunc_rd == `VMADL ) ||
					  ( su_instfunc_rd == `VMUDM ) || ( su_instfunc_rd == `VMADM )
					) ;

	asdffen #(1, 0)	vctsgnmplcndffmu (vct_sgnmplcnd_mu, vct_sgnmplcnd_rd, su_instvld_rd, clk, reset_l );


	wire	vct_shftlftone_rd;		/* shift left by 1 for MULF, MACF, MULU, MACU */
	wire	vct_shftlftone_mu;		/* shift left by 1 for MULF, MACF, MULU, MACU */

	assign	vct_shftlftone_rd =	( su_instfunc_rd == `VMULF ) || ( su_instfunc_rd == `VMACF ) ||
					( su_instfunc_rd == `VMULU ) || ( su_instfunc_rd == `VMACU ) ;

	asdffen #(1, 0)	vctshftlftoneffmu (vct_shftlftone_mu, vct_shftlftone_rd, su_instvld_rd, clk, reset_l );

	assign	vct_shftlftone0_mu =	vct_shftlftone_mu ;

	assign	vct_shftlftone1_mu =	vct_shftlftone_mu ;


/*
*	The next group are output control signals for the
*	accumulate stage of the vector unit datapath.
*/

	wire	[1:0]	vct_cslwasl_mu;  /* MU stage mux select signals for input a of lower CSA */
	wire	[1:0]	vct_cslwasl_ac;  /* AC stage mux select signals for input a of lower CSA */

	assign	vct_cslwasl_mu[0]	=	vct_macfop_mu || vct_macuop_mu ||
						vct_rndpop_mu || vct_rndnop_mu ||
						vct_madlop_mu || vct_madmop_mu || 
						vct_madnop_mu ||
						vct_mulfop_mu || vct_muluop_mu ||
						vct_mulqop_mu ;

	assign	vct_cslwasl_mu[1]	=	vct_macqop_mu || vct_madhop_mu ||
						vct_mulfop_mu || vct_muluop_mu ||
						vct_mulqop_mu ;


	asdffen #(2, 0)	vctprcslwaslrgac (vct_cslwasl_ac, vct_cslwasl_mu, vct_instvld_mu, clk, reset_l );

	assign	vct_cslwasl0_ac =	vct_cslwasl_ac ;

	assign	vct_cslwasl1_ac =	vct_cslwasl_ac ;

/*
*	Unless it is a multiply or round instruction then the above mux produces zero to
*	allow the data from the registers to be passed through the accumulate adder.
*/

	wire	vct_precslwb_mu;	/* MU stage mux select signals for input b of lower CSA */
	wire	[2:0]	vct_prcslwbsl_mu;	/* MU stage mux select signals for input b of lower CSA */
	wire	[2:0]	vct_prcslwbsl_ac;	/* AC stage mux select signals for input b of lower CSA */

	assign	vct_precslwb_mu	=	vct_mudlop_mu || vct_madlop_mu ||
					( !vct_macqop_mu && !vct_rndpop_mu && !vct_rndnop_mu &&
					  !vct_absop_mu && !vct_stcpop_mu && !vct_stmrgop_mu &&
					  !vct_mudlop_mu && !vct_madlop_mu 
					) ;

 	assign	vct_prcslwbsl_mu[0] =	( vct_rndpop_mu && !vct_vseqone_mu ) ||
					vct_precslwb_mu ;


 	assign	vct_prcslwbsl_mu[1] =	( vct_rndnop_mu && !vct_vseqone_mu ) ||
					vct_precslwb_mu ;
					
 	assign	vct_prcslwbsl_mu[2]	=	vct_macqop_mu || vct_mudlop_mu || vct_madlop_mu ;


	asdffen #(3, 0)	vctcslwbslrgac (vct_prcslwbsl_ac, vct_prcslwbsl_mu, vct_instvld_mu, clk, reset_l );


	wire	vct_cslwcsl_mu;			/* select for input c of lower csa all vectors */
	wire	vct_cslwcsl_ac;			/* select for input c of lower csa all vectors */

 	assign	vct_cslwcsl_mu	=	vct_mudlop_mu || vct_madlop_mu ;

	asdffen #(1, 0)	vctcslwcslffac (vct_cslwcsl_ac, vct_cslwcsl_mu, vct_instvld_mu, clk, reset_l );

	assign	vct_cslwcsl0_ac =	vct_cslwcsl_ac ;

	assign	vct_cslwcsl1_ac =	vct_cslwcsl_ac ;


	wire	[1:0]	vct_csupasl_mu;	/* MU stage mux select signals for input a of upper CSA */
	wire	[1:0]	vct_csupasl_ac;	/* AC stage mux select signals for input a of upper CSA */

	assign	vct_csupasl_mu[0] =	vct_macfop_mu || vct_macuop_mu ||
					vct_rndpop_mu || vct_rndnop_mu ||
					vct_madlop_mu || vct_madmop_mu || 
					vct_madnop_mu ;

	assign	vct_csupasl_mu[1] =	vct_macqop_mu || vct_madhop_mu ;

	asdffen #(2, 0)	vctcsupaslffac (vct_csupasl_ac, vct_csupasl_mu, vct_instvld_mu, clk, reset_l );


	assign	vct_csupasl0_ac =	vct_csupasl_ac ;

	assign	vct_csupasl1_ac =	vct_csupasl_ac ;


	wire	[1:0]	vct_prcsupbsl_ac;	/* AC stage mux select signals for input b of upper CSA */

	assign	vct_prcsupbsl_ac[0]	=	vct_multndlop_ac ;

 	assign	vct_prcsupbsl_ac[1]	=	vct_macqop_ac ;


	wire	vct_prcsupcen_ac;	/* pre decoding of input c enable for upper csa all vectors */

	assign	vct_prcsupcen_ac =	!vct_cslwcsl_ac ;

/*
*	assign	vct_prcsupcen_ac =	!(vct_mudlop_ac || vct_madlop_ac) ;
*/

	wire	[1:0]	vct_praclwsl_ac;	/* selects input for lower mux of accumulator all vectors */

	assign	vct_praclwsl_ac[0] =	!vct_sarop_ac && !vct_stcpop_ac &&
					!vct_mulqop_ac && !vct_macqop_ac &&  /* zero or hold due to << 16 */
					!vct_mudhop_ac && !vct_madhop_ac ;   /* zero or hold due to << 16 */


	assign	vct_praclwsl_ac[1] =	vct_mulqop_ac || vct_mudhop_ac ;   /* zero lower 16 bit due to << 16 */



/*
*	This change was made to prevent the accumulator updating bits 16 to 47
*	on instruction which do not load or accumulate ie. any now multiply 
*	instruction.  This was to allow the upper 32 bits of the accumulator
*	to be used for testin.
*
*	assign	vct_pracmisl_ac[0] =	vct_sarop_ac ;
*/

	wire	[1:0]	vct_acmisl_ac;  /* selects input for middle mux of accumulator  */

	assign	vct_acmisl_ac[0] =	!reset_l ||
					( vct_instvld_ac &&
					  ( vct_mulfop_ac || vct_macfop_ac ||
					    vct_muluop_ac || vct_macuop_ac ||
					    vct_rndpop_ac || vct_rndnop_ac ||
					    vct_mudlop_ac || vct_madlop_ac ||
					    vct_mudmop_ac || vct_madmop_ac ||
					    vct_mudnop_ac || vct_madnop_ac
					  )
					) ;

	assign	vct_acmisl_ac[1] =	!reset_l ||
					( vct_instvld_ac &&
					  ( vct_mulqop_ac || vct_macqop_ac ||
					    vct_mudhop_ac || vct_madhop_ac 
					  )
					) ;


	assign	vct_acmisl0_ac =	vct_acmisl_ac ;

	assign	vct_acmisl1_ac =	vct_acmisl_ac ;


	wire	[1:0]	vct_pracupsl_ac;	/* selects input for upper mux of accumulator all vectors */

/*
*	This change was made to prevent the accumulator updating bits 16 to 47
*	on instruction which do not load or accumulate ie. any now multiply 
*	instruction.  This was to allow the upper 32 bits of the accumulator
*	to be used for testin.
*
*	assign	vct_pracupsl_ac[0] =	vct_sarop_ac ;
*/

	assign	vct_pracupsl_ac[0] =	( vct_mulfop_ac || vct_muluop_ac ||
					  vct_mudlop_ac || vct_mudmop_ac ||
					  vct_mudnop_ac
					) ;

	assign	vct_pracupsl_ac[1] =	( vct_mulqop_ac || vct_macqop_ac ||
					  vct_mudhop_ac || vct_madhop_ac 
					) ;


/*
*	The next group are output control signals for the
*	write back stage of the vector unit datapath.
*/


	wire	vct_acchighsl_ac;	/* select high portion of accumulator */
	wire	vct_acchighsl_wb;	/* select high portion of accumulator */

	assign	vct_acchighsl_ac =	vct_sarop_ac && ( vct_instelem_ac == 4'h8) ;

	asdffen #(1, 0)	vctacchighslwb (vct_acchighsl_wb, vct_acchighsl_ac, vct_instvld_ac, clk, reset_l );


	wire	vct_accmidsl_ac;	/* select mid portion of accumulator */
	wire	vct_accmidsl_wb;	/* select mid portion of accumulator */

	assign	vct_accmidsl_ac =	( vct_sarop_ac && ( vct_instelem_ac == 4'h9) ) ||
					vct_mulfop_ac || vct_macfop_ac ||
					vct_muluop_ac || vct_macuop_ac ||
					vct_rndpop_ac || vct_rndnop_ac ||
					vct_mudmop_ac || vct_madmop_ac ||
					vct_mudhop_ac || vct_madhop_ac ;

	asdffen #(1, 0)	vctaccmidslwb (vct_accmidsl_wb, vct_accmidsl_ac, vct_instvld_ac, clk, reset_l );



	wire	vct_acclowsl_ac;	/* select low portion of accumulator */
	wire	vct_acclowsl_wb;	/* select low portion of accumulator */

	assign	vct_acclowsl_ac =	( vct_sarop_ac && ( vct_instelem_ac == 4'ha) ) ||
					vct_mudlop_ac || vct_madlop_ac ||
					vct_mudnop_ac || vct_madnop_ac ||
					vct_addtypop_ac || vct_stcpop_ac || 
					vct_logtypop_ac || vct_dvmovop_ac ;

	asdffen #(1, 0)	vctacclowslwb (vct_acclowsl_wb, vct_acclowsl_ac, vct_instvld_ac, clk, reset_l );

/*
*	Note that SAR instruction should be vct_sarop_wb && vct_instelem_wb[0] for
*	reading the low portion of the accumulator but this is covered within the 
*	add instructions.
*/

	wire	vct_accshftsl_ac;	/* select shifted high/mid portion of accumulator */
	wire	vct_accshftsl_wb;	/* select shifted high/mid portion of accumulator */

	assign	vct_accshftsl_ac =	( vct_mulqop_ac || vct_macqop_ac ) ;

	asdffen #(1, 0)	vctaccshftslwb (vct_accshftsl_wb, vct_accshftsl_ac, vct_instvld_ac, clk, reset_l );


	wire	vct_clpsgn16_ac;	/* instruction requiring signed clamping on 15 to 0 */
	wire	vct_clpsgn16_wb;	/* instruction requiring signed clamping on 15 to 0 */

	assign	vct_clpsgn16_ac	=	vct_mudlop_ac || vct_madlop_ac ||
					vct_mudnop_ac || vct_madnop_ac ;

	asdffen #(1, 0)	vctclpsgn16ffwb (vct_clpsgn16_wb, vct_clpsgn16_ac, vct_instvld_ac, clk, reset_l );


	wire	vct_clpsgn31_ac;	/* instruction requiring signed clamping on 31 to MSB */
	wire	vct_clpsgn31_wb;	/* instruction requiring signed clamping on 31 to MSB */

	assign	vct_clpsgn31_ac	=	vct_mulfop_ac || vct_macfop_ac ||
					vct_rndpop_ac || vct_rndnop_ac ||
					vct_mudmop_ac || vct_madmop_ac ||
					vct_mudhop_ac || vct_madhop_ac ;

	asdffen #(1, 0)	vctclpsgn31ffwb (vct_clpsgn31_wb, vct_clpsgn31_ac, vct_instvld_ac, clk, reset_l );


	wire	vct_clpsgn32_ac;	/* instruction requiring signed clamping on 32 to MSB */
	wire	vct_clpsgn32_wb;	/* instruction requiring signed clamping on 32 to MSB */

	assign	vct_clpsgn32_ac	=	vct_mulqop_ac || vct_macqop_ac ;

	asdffen #(1, 0)	vctclpsgn32ffwb (vct_clpsgn32_wb, vct_clpsgn32_ac, vct_instvld_ac, clk, reset_l );


	wire	vct_clpuns31_ac;	/* instruction requiring unsigned clamping on 31 to MSB */
	wire	vct_clpuns31_wb;	/* instruction requiring unsigned clamping on 31 to MSB */

	assign	vct_clpuns31_ac	=	vct_muluop_ac || vct_macuop_ac ;

	asdffen #(1, 0)	vctclpuns31pffwb (vct_clpuns31_wb, vct_clpuns31_ac, vct_instvld_ac, clk, reset_l );


	wire	vct_adscl16op_ac;	/* 16 bit ADD, SUB or ABS instruction in WB */
	wire	vct_adscl16op_wb;	/* 16 bit ADD, SUB or ABS instruction in WB */

	assign	vct_adscl16op_ac	=	vct_addop_ac || vct_subop_ac || vct_absop_ac ;

	asdffen #(1, 0)	vctadscl16fopffwb (vct_adscl16op_wb, vct_adscl16op_ac, vct_instvld_ac, clk, reset_l );



vuctlsl	vuctlsl0 (	.clk		(clk),
			.reset_l	(reset_l),
 
			.su_instvld_rd		(su_instvld_rd),
			.vct_pralucmpvt_mu	(vct_pralucmpvt_mu),

			.vct_instvld_mu		(vct_instvld_mu), 
			.vct_addcop_mu		(vct_addcop_mu),
			.vct_subcop_mu		(vct_subcop_mu),
			.vct_addop_mu		(vct_addop_mu),
			.vct_subop_mu		(vct_subop_mu),
			.vct_vs_sgnmu_mu	(vct_vs_sgnmu_mu),
			.vct_vt_sgnmu_mu	(vct_vt_sgnmu_mu),
			.vct_stltop_mu		(vct_stltop_mu),
			.vct_steqop_mu		(vct_steqop_mu),
			.vct_stneop_mu		(vct_stneop_mu),
			.vct_stgeop_mu		(vct_stgeop_mu),
			.vct_stchop_mu		(vct_stchop_mu),
			.vct_stclop_mu		(vct_stclop_mu),
			.vct_stcrop_mu		(vct_stcrop_mu),
			.vct_stchrop_mu		(vct_stchrop_mu),
			.vct_substclop_mu	(vct_substclop_mu),
			.vct_absop_mu		(vct_absop_mu),

			.vct_rndpop_mu		(vct_rndpop_mu),
			.vct_rndnop_mu		(vct_rndnop_mu),
			.vct_rndop_mu		(vct_rndop_mu),
			.vct_mulqop_mu		(vct_mulqop_mu),
			.vct_mulfop_mu		(vct_mulfop_mu),
			.vct_muluop_mu		(vct_muluop_mu),
			.vct_vseqone_mu		(vct_vseqone_mu),

			.vct_aluprecin_rd	(vct_aluprecin_rd),
			.vct_cryoutld_mu	(vct_cryoutld_mu),
			.vct_cmpcdld_mu		(vct_cmpcdld_mu),
			.vct_cmpcdadld_mu	(vct_cmpcdadld_mu),
			.vdp_vs_zero_mu		(vdp_vs_zero0_mu),
			.vdp_vt_zero_mu		(vdp_vt_zero0_mu),
			.vdp_vs_sign_mu		(vdp_vs_sign0_mu),
			.vdp_vt_sign_mu		(vdp_vt_sign0_mu),

			.vdp_aluovr_mu		(vdp_aluovr0_mu),
			.vdp_aluco_mu		(vdp_aluco0_mu), 
			.vdp_aluzero_mu		(vdp_aluzero0_mu),
			.vdp_aluone_mu		(vdp_aluone0_mu),
			.vct_prsmlwrsl_mu	(vct_prsmlwrsl_mu),

			.vct_instvld_ac		(vct_instvld_ac),
			.vct_prcslwbsl_ac	(vct_prcslwbsl_ac),
			.vct_prcsupbsl_ac	(vct_prcsupbsl_ac),
			.vct_prcsupcen_ac	(vct_prcsupcen_ac),

			.vct_stnclrdop_ac	(vct_stnclrdop_ac),
			.vct_stclrdop_ac	(vct_stclrdop_ac),
			.vct_stchop_ac		(vct_stchop_ac),
			.vct_stclop_ac		(vct_stclop_ac),
			.vct_macqop_ac		(vct_macqop_ac),
			.vct_mudlop_ac		(vct_mudlop_ac),
			.vct_madlop_ac		(vct_madlop_ac),
			.vct_mulfop_ac		(vct_mulfop_ac),
			.vct_muluop_ac		(vct_muluop_ac),
			.vct_rndpop_ac		(vct_rndpop_ac),
			.vct_rndnop_ac		(vct_rndnop_ac), 
			.vct_rndop_ac		(vct_rndop_ac), 
			.vct_multtypop_ac	(vct_multtypop_ac),
			.vct_absop_ac		(vct_absop_ac),
			.vct_vseqone_ac		(vct_vseqone_ac),
			.vdp_addlwco_ac		(vdp_addlwco0_ac),
			.vdp_addlwov_ac		(vdp_addlwov0_ac),
			.vdp_csupco_ac		(vdp_csupco0_ac),
			.vdp_addupco_ac		(vdp_addupco0_ac),
			.vmu_co_clal_ac		(vmu_co_clal0_ac),
			.vmu_co_clah_ac		(vmu_co_clah0_ac),
			.vct_praclwsl_ac	(vct_praclwsl_ac),
			.vct_pracupsl_ac	(vct_pracupsl_ac),
			.vct_multactyp_ac	(vct_multactyp_ac),
			.vct_multincop_ac	(vct_multincop_ac),


			.su_wrcmpcd_wb		(su_wrcmpcd_wb),
			.su_wrcryout_wb		(su_wrcryout_wb),
			.su_wrcmpcdad_wb	(su_wrcmpcdad_wb),
			.su_datainlo_wb		(su_cont_to_from[0]),
			.su_datainhi_wb		(su_cont_to_from[2]),
			.vdp_accbit15_wb	(vdp_acc0bit15_wb),
			.vdp_accbit21_wb	(vdp_acc0bit21_wb), 
			.vdp_accbit31_wb	(vdp_acc0bit31_wb), 
			.vdp_accbit47_wb	(vdp_acc0bit47_wb), 
			.vdp_acchizero_wb	(vdp_achizero0_wb),
			.vdp_accmizero_wb	(vdp_acmizero0_wb),
			.vdp_acchione_wb	(vdp_achione0_wb),
			.vct_acchighsl_wb	(vct_acchighsl_wb),
			.vct_accmidsl_wb	(vct_accmidsl_wb),
			.vct_acclowsl_wb	(vct_acclowsl_wb),
			.vct_accshftsl_wb	(vct_accshftsl_wb),
			.vct_divrsltsl_wb	(vct_divrsltsl_wb),
			.vct_clpsgn31_wb	(vct_clpsgn31_wb),
			.vct_clpsgn16_wb	(vct_clpsgn16_wb),
			.vct_clpsgn32_wb	(vct_clpsgn32_wb),
			.vct_clpuns31_wb	(vct_clpuns31_wb),
			.vct_adscl16op_wb	(vct_adscl16op_wb),

			.vct_alucin_mu		(vct_alucin0_mu), 
			.vct_alucmpvt_mu	(vct_alucmpvt0_mu),
			.vct_compvt_mu		(vct_cmpvt0_mu), 
			.vct_smlwrsl_mu		(vct_smlwrsl0_mu),

			.vct_cryout_ac		(vct_cryout0_ac),
			.vct_opdneql_ac		(vct_opdneql0_ac),
			.vct_cmpcdlo_ac		(vct_cmpcdlo0_ac),
			.vct_cmpcdhi_ac		(vct_cmpcdhi0_ac),
			.vct_cmpcdad_ac		(vct_cmpcdad0_ac),

			.vct_rndvlu_ac		(vct_rndvlu0_ac),
			.vct_cslwbsl_ac		(vct_cslwbsl0_ac),
			.vct_addlwci_ac		(vct_addlwci0_ac),
			.vct_csupbsl_ac		(vct_csupbsl0_ac),
			.vct_csupcen_ac		(vct_csupcen0_ac),
			.vct_incrdwn_ac		(vct_incrdwn0_ac),
			.vct_incrci_ac		(vct_incrci0_ac),
			.vct_incrmxsl_ac	(vct_incrmxsl0_ac),
			.vct_aclwsl_ac		(vct_aclwsl0_ac),
			.vct_acupsl_ac		(vct_acupsl0_ac),

			.vct_rsltsl_wb		(vct_rsltsl0_wb),
			.vct_clprslt_wb		(vct_clprslt0_wb)

		);



vuctlsl	vuctlsl1 (	.clk		(clk),
			.reset_l	(reset_l),
 
			.su_instvld_rd		(su_instvld_rd),
			.vct_pralucmpvt_mu	(vct_pralucmpvt_mu),

			.vct_instvld_mu		(vct_instvld_mu), 
			.vct_addcop_mu		(vct_addcop_mu),
			.vct_subcop_mu		(vct_subcop_mu),
			.vct_addop_mu		(vct_addop_mu),
			.vct_subop_mu		(vct_subop_mu),
			.vct_vs_sgnmu_mu	(vct_vs_sgnmu_mu),
			.vct_vt_sgnmu_mu	(vct_vt_sgnmu_mu),
			.vct_stltop_mu		(vct_stltop_mu),
			.vct_steqop_mu		(vct_steqop_mu),
			.vct_stneop_mu		(vct_stneop_mu),
			.vct_stgeop_mu		(vct_stgeop_mu),
			.vct_stchop_mu		(vct_stchop_mu),
			.vct_stclop_mu		(vct_stclop_mu),
			.vct_stcrop_mu		(vct_stcrop_mu),
			.vct_stchrop_mu		(vct_stchrop_mu),
			.vct_substclop_mu	(vct_substclop_mu),
			.vct_absop_mu		(vct_absop_mu),

			.vct_rndpop_mu		(vct_rndpop_mu),
			.vct_rndnop_mu		(vct_rndnop_mu),
			.vct_rndop_mu		(vct_rndop_mu),
			.vct_mulqop_mu		(vct_mulqop_mu),
			.vct_mulfop_mu		(vct_mulfop_mu),
			.vct_muluop_mu		(vct_muluop_mu),
			.vct_vseqone_mu		(vct_vseqone_mu),

			.vct_aluprecin_rd	(vct_aluprecin_rd),
			.vct_cryoutld_mu	(vct_cryoutld_mu),
			.vct_cmpcdld_mu		(vct_cmpcdld_mu),
			.vct_cmpcdadld_mu	(vct_cmpcdadld_mu),
			.vdp_vs_zero_mu		(vdp_vs_zero1_mu),
			.vdp_vt_zero_mu		(vdp_vt_zero1_mu),
			.vdp_vs_sign_mu		(vdp_vs_sign1_mu),
			.vdp_vt_sign_mu		(vdp_vt_sign1_mu),

			.vdp_aluovr_mu		(vdp_aluovr1_mu),
			.vdp_aluco_mu		(vdp_aluco1_mu), 
			.vdp_aluzero_mu		(vdp_aluzero1_mu),
			.vdp_aluone_mu		(vdp_aluone1_mu),
			.vct_prsmlwrsl_mu	(vct_prsmlwrsl_mu),


			.vct_instvld_ac		(vct_instvld_ac),
			.vct_prcslwbsl_ac	(vct_prcslwbsl_ac),
			.vct_prcsupbsl_ac	(vct_prcsupbsl_ac),
			.vct_prcsupcen_ac	(vct_prcsupcen_ac),

			.vct_stnclrdop_ac	(vct_stnclrdop_ac),
			.vct_stclrdop_ac	(vct_stclrdop_ac),
			.vct_stchop_ac		(vct_stchop_ac),
			.vct_stclop_ac		(vct_stclop_ac),
			.vct_macqop_ac		(vct_macqop_ac),
			.vct_mudlop_ac		(vct_mudlop_ac),
			.vct_madlop_ac		(vct_madlop_ac),
			.vct_mulfop_ac		(vct_mulfop_ac),
			.vct_muluop_ac		(vct_muluop_ac),
			.vct_rndpop_ac		(vct_rndpop_ac),
			.vct_rndnop_ac		(vct_rndnop_ac), 
			.vct_rndop_ac		(vct_rndop_ac), 
			.vct_multtypop_ac	(vct_multtypop_ac),
			.vct_absop_ac		(vct_absop_ac),
			.vct_vseqone_ac		(vct_vseqone_ac),
			.vdp_addlwco_ac		(vdp_addlwco1_ac),
			.vdp_addlwov_ac		(vdp_addlwov1_ac),
			.vdp_csupco_ac		(vdp_csupco1_ac),
			.vdp_addupco_ac		(vdp_addupco1_ac),
			.vmu_co_clal_ac		(vmu_co_clal1_ac),
			.vmu_co_clah_ac		(vmu_co_clah1_ac),
			.vct_praclwsl_ac	(vct_praclwsl_ac),
			.vct_pracupsl_ac	(vct_pracupsl_ac),
			.vct_multactyp_ac	(vct_multactyp_ac),
			.vct_multincop_ac	(vct_multincop_ac),

			.su_wrcmpcd_wb		(su_wrcmpcd_wb),
			.su_wrcryout_wb		(su_wrcryout_wb),
			.su_wrcmpcdad_wb	(su_wrcmpcdad_wb),
			.su_datainlo_wb		(su_cont_to_from[1]),
			.su_datainhi_wb		(su_cont_to_from[3]),
			.vdp_accbit15_wb	(vdp_acc1bit15_wb),
			.vdp_accbit21_wb	(vdp_acc1bit21_wb), 
			.vdp_accbit31_wb	(vdp_acc1bit31_wb), 
			.vdp_accbit47_wb	(vdp_acc1bit47_wb), 
			.vdp_acchizero_wb	(vdp_achizero1_wb),
			.vdp_accmizero_wb	(vdp_acmizero1_wb),
			.vdp_acchione_wb	(vdp_achione1_wb),
			.vct_acchighsl_wb	(vct_acchighsl_wb),
			.vct_accmidsl_wb	(vct_accmidsl_wb),
			.vct_acclowsl_wb	(vct_acclowsl_wb),
			.vct_accshftsl_wb	(vct_accshftsl_wb),
			.vct_divrsltsl_wb	(vct_divrsltsl_wb),
			.vct_clpsgn31_wb	(vct_clpsgn31_wb),
			.vct_clpsgn16_wb	(vct_clpsgn16_wb),
			.vct_clpsgn32_wb	(vct_clpsgn32_wb),
			.vct_clpuns31_wb	(vct_clpuns31_wb),
			.vct_adscl16op_wb	(vct_adscl16op_wb),

			.vct_alucin_mu		(vct_alucin1_mu), 
			.vct_alucmpvt_mu	(vct_alucmpvt1_mu),
			.vct_compvt_mu		(vct_cmpvt1_mu), 
			.vct_smlwrsl_mu		(vct_smlwrsl1_mu),

			.vct_cryout_ac		(vct_cryout1_ac),
			.vct_opdneql_ac		(vct_opdneql1_ac),
			.vct_cmpcdlo_ac		(vct_cmpcdlo1_ac),
			.vct_cmpcdhi_ac		(vct_cmpcdhi1_ac),
			.vct_cmpcdad_ac		(vct_cmpcdad1_ac),

			.vct_rndvlu_ac		(vct_rndvlu1_ac),
			.vct_cslwbsl_ac		(vct_cslwbsl1_ac),
			.vct_addlwci_ac		(vct_addlwci1_ac),
			.vct_csupbsl_ac		(vct_csupbsl1_ac),
			.vct_csupcen_ac		(vct_csupcen1_ac),
			.vct_incrdwn_ac		(vct_incrdwn1_ac),
			.vct_incrci_ac		(vct_incrci1_ac),
			.vct_incrmxsl_ac	(vct_incrmxsl1_ac),
			.vct_aclwsl_ac		(vct_aclwsl1_ac),
			.vct_acupsl_ac		(vct_acupsl1_ac),

			.vct_rsltsl_wb		(vct_rsltsl1_wb),
			.vct_clprslt_wb		(vct_clprslt1_wb)

		);



endmodule