pad.v 36.8 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
 /************************************************************************\
 *                                                                        *
 *               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: pad.v,v 1.1 2002/03/28 00:26:13 berndt Exp $


module pad(
	bus_clk, v_ref, c_ctl_pgm,
	bus_enable_rac, bus_ctrl_rac, bus_data_rac,
	rbus_data_in, rbus_extend_in, rbus_control_in,
	rac_sel_in, rbus_data_out, rbus_extend_out,
	rbus_control_out, rbus_enable_out, rac_sel_out,
	ri_c_ctl_i, ri_c_ctl_en, ri_c_ctl_ld, ri_stop_r, ri_stop_t,
	tst_rac_reset, tst_pwr_up, tst_ext_be, tst_by_pass,
	tst_bist_mode, tst_iost_mode, tst_synclk_set,
	tst_bist_flag,

	mclk_pad,
	reset_out, reset_pad,
	test_out, test_pad,
	start_gclk, pre_clk, gclk, 

	pvalid_out, pvalid_pad,
	evalid_in, evalid_pad,
	eok_in, eok_pad,
	int_in, int_pad,

	sysad_out, sysad_in, sysad_pad,
	syscmd_out, syscmd_in, syscmd_pad, 
	sysad_en_l,

	cartaleh_in, cartaleh_pad,
	cartalel_in, cartalel_pad,
	cartrd_in, cartrd_pad,
	cartwr_in, cartwr_pad,
	cartad_out, cartad_in, cartad_pad, cartad_en_l,

	pifrsp_out, pifrsp_pad,
	pifcmd_in, pifcmd_pad,
	pifclk_in, pifclk_pad,

	auddata_in, auddata_pad,
	audclk_in, audclk_pad,
	audlrclk_in, audlrclk_pad,

	vbus_data, srgba_pad,
	vbus_sync, vsync_pad,
	vclk_out, vclk_pad,

	testckt_clk_pad, testckt_dir_pad,
	testckt_data_pad);


`include "ri.vh"

// rac interface
input bus_clk;
input v_ref;
input c_ctl_pgm;
output bus_enable_rac;
inout bus_ctrl_rac;
inout [RAMBUS_DATA_SIZE-1:0] bus_data_rac;

// rac-ri signal
output [RBUS_DATA_SIZE-1:0] rbus_data_in;
output [RBUS_EXTEND_SIZE-1:0] rbus_extend_in;
output [RBUS_CONTROL_SIZE-1:0] rbus_control_in;
input [RAC_SELECT_SIZE-1:0] rac_sel_in;
input [RBUS_DATA_SIZE-1:0] rbus_data_out;
input [RBUS_EXTEND_SIZE-1:0] rbus_extend_out;
input [RBUS_CONTROL_SIZE-1:0] rbus_control_out;
input [RBUS_ENABLE_SIZE-1:0] rbus_enable_out;
input [RAC_SELECT_SIZE-1:0] rac_sel_out;
input [RAC_CURRENT_SIZE-1:0] ri_c_ctl_i;
input ri_c_ctl_en, ri_c_ctl_ld;
input ri_stop_r, ri_stop_t;

// rac-tst signals
input tst_rac_reset, tst_pwr_up, tst_ext_be, tst_by_pass;
input tst_bist_mode, tst_iost_mode, tst_synclk_set;
output tst_bist_flag;

// System interface
output mclk_pad;

input start_gclk;
output pre_clk;
output gclk;

output reset_out;
input reset_pad;
output test_out;
input test_pad;

// SysAD interface
input pvalid_pad;
output pvalid_out;

input evalid_in;
output evalid_pad;

input eok_in;
output eok_pad;

input int_in;
output int_pad;

input  [4:0] sysad_en_l;
input  [31:0] sysad_in;
output [31:0] sysad_out;
inout  [31:0] sysad_pad;

input  [4:0] syscmd_in;
output [4:0] syscmd_out;
inout  [4:0] syscmd_pad;

// AD16 interface
input cartaleh_in;
output cartaleh_pad;
input cartalel_in;
output cartalel_pad;
input cartrd_in;
output cartrd_pad;
input cartwr_in;
output cartwr_pad;

input  [15:0] cartad_in;
output [15:0] cartad_out;
inout  [15:0] cartad_pad;
input  [1:0] cartad_en_l;

// PIF interface
input pifrsp_pad;
output pifrsp_out;
input pifcmd_in;
output pifcmd_pad;
input pifclk_in;
output pifclk_pad;

// Audio interface
input auddata_in;
output auddata_pad;
input audclk_in;
output audclk_pad;
input audlrclk_in;
output audlrclk_pad;

// Video interface
input  [6:0] vbus_data;
output [6:0] srgba_pad;
input vbus_sync;
output vsync_pad;
output vclk_out;
input vclk_pad;

// Speed test circuit
input testckt_clk_pad, testckt_dir_pad;
inout testckt_data_pad;

wire synclk_buft, synclk_bufb;

// dummy clock driver for logic simulation
dummy_gclkbuf gclk_dummy (.clkout(gclk), .clkin(synclk_bufb), .enable(start_gclk));

left_pads left_pads ( .sysad_pad25(sysad_pad[25]),
		      .sysad_pad26(sysad_pad[26]),
		      .sysad_pad27(sysad_pad[27]),
		      .sysad_pad28(sysad_pad[28]),
                      .bus_clk(bus_clk),
		      .v_ref(v_ref),
		      .c_ctl_pgm(c_ctl_pgm),
		      .bus_enable_rac(bus_enable_rac),
		      .bus_ctrl_rac(bus_ctrl_rac),
                      .bus_data_rac(bus_data_rac),
		      .sysad_out25(sysad_out[25]),
		      .sysad_out26(sysad_out[26]),
		      .sysad_out27(sysad_out[27]),
                      .sysad_out28(sysad_out[28]),
		      .sysad_in25(sysad_in[25]),
		      .sysad_in26(sysad_in[26]),
		      .sysad_in27(sysad_in[27]),
		      .sysad_in28(sysad_in[28]),
                      .sysad_en_l3(sysad_en_l[3]),
		      .rbus_data_in(rbus_data_in),
		      .rbus_extend_in(rbus_extend_in),
		      .rbus_control_in(rbus_control_in),
                      .rac_sel_in(rac_sel_in),
		      .rbus_data_out(rbus_data_out),
		      .rbus_extend_out(rbus_extend_out),
		      .rbus_control_out(rbus_control_out),
                      .rbus_enable_out(rbus_enable_out),
		      .rac_sel_out(rac_sel_out),
		      .ri_c_ctl_i(ri_c_ctl_i),
		      .ri_c_ctl_en(ri_c_ctl_en),
		      .ri_c_ctl_ld(ri_c_ctl_ld),
                      .ri_stop_r(ri_stop_r),
		      .ri_stop_t(ri_stop_t),
		      .tst_rac_reset(tst_rac_reset),
		      .tst_pwr_up(tst_pwr_up),
		      .tst_ext_be(tst_ext_be),
		      .tst_by_pass(tst_by_pass),
                      .tst_bist_mode(tst_bist_mode),
		      .tst_iost_mode(tst_iost_mode),
		      .tst_synclk_set(tst_synclk_set),
		      .tst_bist_flag(tst_bist_flag),
		      .testckt_clk_pad(testckt_clk_pad),
		      .testckt_dir_pad(testckt_dir_pad),
		      .testckt_data_pad(testckt_data_pad),
		      .synclk_buft(synclk_buft),
		      .synclk_bufb(synclk_bufb));

right_pads right_pads (  .pvalid_pad(pvalid_pad),
			 .eok_pad(eok_pad),
			 .int_pad(int_pad),
			 .cartaleh_pad(cartaleh_pad),
			 .cartrd_pad(cartrd_pad),
                         .cartalel_pad(cartalel_pad),
			 .cartwr_pad(cartwr_pad),
			 .cartad_pad0(cartad_pad[0]),
			 .cartad_pad1(cartad_pad[1]),
			 .cartad_pad2(cartad_pad[2]),
                         .cartad_pad3(cartad_pad[3]),
			 .cartad_pad12(cartad_pad[12]),
			 .cartad_pad13(cartad_pad[13]),
			 .cartad_pad14(cartad_pad[14]),
			 .cartad_pad15(cartad_pad[15]),
                         .pvalid_out(pvalid_out),
			 .eok_in(eok_in),
			 .int_in(int_in),
			 .cartaleh_in(cartaleh_in),
			 .cartrd_in(cartrd_in),
			 .cartalel_in(cartalel_in),
                         .cartwr_in(cartwr_in),
			 .cartad_in0(cartad_in[0]),
			 .cartad_in1(cartad_in[1]),
			 .cartad_in2(cartad_in[2]),
			 .cartad_in3(cartad_in[3]),
                         .cartad_in12(cartad_in[12]),
			 .cartad_in13(cartad_in[13]),
			 .cartad_in14(cartad_in[14]),
			 .cartad_in15(cartad_in[15]),
                         .cartad_en_l0(cartad_en_l[0]),
			 .cartad_en_l1(cartad_en_l[1]),
			 .cartad_out0(cartad_out[0]),
			 .cartad_out1(cartad_out[1]),
			 .cartad_out2(cartad_out[2]),
                         .cartad_out3(cartad_out[3]),
			 .cartad_out12(cartad_out[12]),
			 .cartad_out13(cartad_out[13]),
			 .cartad_out14(cartad_out[14]),
			 .cartad_out15(cartad_out[15]),
                         .sysad_out29(sysad_out[29]),
			 .sysad_out30(sysad_out[30]),
			 .sysad_out31(sysad_out[31]),
                         .sysad_pad29(sysad_pad[29]),
			 .sysad_pad30(sysad_pad[30]),
			 .sysad_pad31(sysad_pad[31]),
                         .sysad_in29(sysad_in[29]),
			 .sysad_in30(sysad_in[30]),
			 .sysad_in31(sysad_in[31]),
                         .sysad_pad0(sysad_pad[0]),
			 .sysad_pad1(sysad_pad[1]),
			 .sysad_pad2(sysad_pad[2]),
			 .sysad_pad3(sysad_pad[3]),
			 .sysad_pad4(sysad_pad[4]),
                         .sysad_pad5(sysad_pad[5]),
			 .sysad_pad6(sysad_pad[6]),
			 .sysad_pad7(sysad_pad[7]),
			 .sysad_pad8(sysad_pad[8]),
			 .sysad_pad9(sysad_pad[9]),
			 .sysad_in0(sysad_in[0]),
			 .sysad_in1(sysad_in[1]),
			 .sysad_in2(sysad_in[2]),
                         .sysad_in3(sysad_in[3]),
			 .sysad_in4(sysad_in[4]),
			 .sysad_in5(sysad_in[5]),
			 .sysad_in6(sysad_in[6]),
			 .sysad_in7(sysad_in[7]),
			 .sysad_in8(sysad_in[8]),
                         .sysad_in9(sysad_in[9]),
			 .sysad_en_l0(sysad_en_l[0]),
			 .sysad_en_l1(sysad_en_l[1]),
			 .sysad_en_l3(sysad_en_l[3]),
			 .sysad_out0(sysad_out[0]),
                         .sysad_out1(sysad_out[1]),
			 .sysad_out2(sysad_out[2]),
			 .sysad_out3(sysad_out[3]),
			 .sysad_out4(sysad_out[4]),
			 .sysad_out5(sysad_out[5]),
			 .sysad_out6(sysad_out[6]),
                         .sysad_out7(sysad_out[7]),
			 .sysad_out8(sysad_out[8]),
			 .sysad_out9(sysad_out[9]));


top_pads top_pads ( .sysad_pad10(sysad_pad[10]), 
		    .sysad_pad11(sysad_pad[11]), 
		    .sysad_pad12(sysad_pad[12]), 
		    .sysad_pad13(sysad_pad[13]), 
		    .sysad_pad14(sysad_pad[14]),
                    .sysad_pad15(sysad_pad[15]), 
		    .sysad_pad16(sysad_pad[16]), 
		    .sysad_pad17(sysad_pad[17]), 
		    .sysad_pad18(sysad_pad[18]), 
		    .sysad_pad19(sysad_pad[19]),
                    .sysad_pad20(sysad_pad[20]), 
		    .sysad_pad21(sysad_pad[21]), 
		    .sysad_pad22(sysad_pad[22]), 
		    .sysad_pad23(sysad_pad[23]), 
		    .sysad_pad24(sysad_pad[24]),
                    .syscmd_pad0(syscmd_pad[0]), 
		    .syscmd_pad1(syscmd_pad[1]), 
		    .syscmd_pad2(syscmd_pad[2]), 
		    .syscmd_pad3(syscmd_pad[3]), 
		    .syscmd_pad4(syscmd_pad[4]),
                    .mclk_pad(mclk_pad), 
		    .evalid_pad(evalid_pad),
                    .sysad_in10(sysad_in[10]), 
		    .sysad_in11(sysad_in[11]), 
		    .sysad_in12(sysad_in[12]), 
		    .sysad_in13(sysad_in[13]), 
		    .sysad_in14(sysad_in[14]),
                    .sysad_in15(sysad_in[15]), 
		    .sysad_in16(sysad_in[16]), 
		    .sysad_in17(sysad_in[17]), 
		    .sysad_in18(sysad_in[18]), 
		    .sysad_in19(sysad_in[19]),
                    .sysad_in20(sysad_in[20]), 
		    .sysad_in21(sysad_in[21]), 
		    .sysad_in22(sysad_in[22]), 
		    .sysad_in23(sysad_in[23]), 
		    .sysad_in24(sysad_in[24]),
                    .syscmd_in0(syscmd_in[0]), 
		    .syscmd_in1(syscmd_in[1]), 
		    .syscmd_in2(syscmd_in[2]), 
		    .syscmd_in3(syscmd_in[3]), 
		    .syscmd_in4(syscmd_in[4]),
		    .evalid_in(evalid_in),
                    .sysad_en_l1(sysad_en_l[1]), 
		    .sysad_en_l2(sysad_en_l[2]), 
		    .sysad_en_l3(sysad_en_l[3]), 
		    .sysad_en_l4(sysad_en_l[4]),
                    .synclk_buf(synclk_buft), 
		    .pre_clk(pre_clk),
                    .sysad_out10(sysad_out[10]), 
		    .sysad_out11(sysad_out[11]), 
		    .sysad_out12(sysad_out[12]), 
		    .sysad_out13(sysad_out[13]), 
		    .sysad_out14(sysad_out[14]),
                    .sysad_out15(sysad_out[15]), 
		    .sysad_out16(sysad_out[16]), 
		    .sysad_out17(sysad_out[17]), 
		    .sysad_out18(sysad_out[18]), 
		    .sysad_out19(sysad_out[19]),
                    .sysad_out20(sysad_out[20]), 
		    .sysad_out21(sysad_out[21]), 
		    .sysad_out22(sysad_out[22]), 
		    .sysad_out23(sysad_out[23]), 
		    .sysad_out24(sysad_out[24]),
                    .syscmd_out0(syscmd_out[0]), 
		    .syscmd_out1(syscmd_out[1]), 
		    .syscmd_out2(syscmd_out[2]), 
		    .syscmd_out3(syscmd_out[3]), 
		    .syscmd_out4(syscmd_out[4]));


bottom_pads bottom_pads ( .test_pad(test_pad), 
			  .pifrsp_pad(pifrsp_pad), 
			  .vclk_pad(vclk_pad), 
			  .reset_pad(reset_pad),
			  .pifcmd_pad(pifcmd_pad), 
			  .pifclk_pad(pifclk_pad), 
			  .audclk_pad(audclk_pad), 
			  .auddata_pad(auddata_pad), 
			  .audlrclk_pad(audlrclk_pad),
			  .vsync_pad(vsync_pad), 
			  .srgba_pad0(srgba_pad[0]), 
			  .srgba_pad1(srgba_pad[1]), 
			  .srgba_pad2(srgba_pad[2]),
			  .srgba_pad3(srgba_pad[3]), 
			  .srgba_pad4(srgba_pad[4]), 
			  .srgba_pad5(srgba_pad[5]), 
			  .srgba_pad6(srgba_pad[6]),
			  .cartad_pad4(cartad_pad[4]), 
			  .cartad_pad5(cartad_pad[5]), 
			  .cartad_pad6(cartad_pad[6]), 
			  .cartad_pad7(cartad_pad[7]),
			  .cartad_pad8(cartad_pad[8]), 
			  .cartad_pad9(cartad_pad[9]), 
			  .cartad_pad10(cartad_pad[10]), 
			  .cartad_pad11(cartad_pad[11]),
			  .synclk_buf(synclk_bufb), 
			  .pre_clk(pre_clk),
			  .cartad_in4(cartad_in[4]), 
			  .cartad_in5(cartad_in[5]), 
			  .cartad_in6(cartad_in[6]), 
			  .cartad_in7(cartad_in[7]),
			  .cartad_in8(cartad_in[8]), 
			  .cartad_in9(cartad_in[9]), 
			  .cartad_in10(cartad_in[10]), 
			  .cartad_in11(cartad_in[11]),
			  .cartad_en_l0(cartad_en_l[0]), 
			  .cartad_en_l1(cartad_en_l[1]),
			  .cartad_out4(cartad_out[4]), 
			  .cartad_out5(cartad_out[5]), 
			  .cartad_out6(cartad_out[6]), 
			  .cartad_out7(cartad_out[7]),
			  .cartad_out8(cartad_out[8]), 
			  .cartad_out9(cartad_out[9]), 
			  .cartad_out10(cartad_out[10]), 
			  .cartad_out11(cartad_out[11]),
			  .test_out(test_out), 
			  .pifrsp_out(pifrsp_out), 
			  .vclk_out(vclk_out), 
			  .reset_out(reset_out),
			  .pifcmd_in(pifcmd_in), 
			  .pifclk_in(pifclk_in), 
			  .audclk_in(audclk_in), 
			  .auddata_in(auddata_in), 
			  .audlrclk_in(audlrclk_in),
			  .vbus_sync(vbus_sync), 
			  .vbus_data(vbus_data));

endmodule




module left_pads ( sysad_pad25, sysad_pad26, sysad_pad27, sysad_pad28,
		   bus_clk, v_ref, c_ctl_pgm, bus_enable_rac, bus_ctrl_rac,
                   bus_data_rac, sysad_out25, sysad_out26, sysad_out27,
                   sysad_out28, sysad_in25, sysad_in26, sysad_in27, sysad_in28,
                   sysad_en_l3, rbus_data_in, rbus_extend_in, rbus_control_in,
                   rac_sel_in, rbus_data_out, rbus_extend_out, rbus_control_out,
                   rbus_enable_out, rac_sel_out, ri_c_ctl_i, ri_c_ctl_en, ri_c_ctl_ld,
                   ri_stop_r, ri_stop_t, tst_rac_reset, tst_pwr_up, tst_ext_be, tst_by_pass,
                   tst_bist_mode, tst_iost_mode, tst_synclk_set, tst_bist_flag,
		   synclk_buft, synclk_bufb, testckt_clk_pad, testckt_dir_pad,
	   	   testckt_data_pad);

`include "ri.vh"

// sysad pads
inout sysad_pad25;
inout sysad_pad26;
inout sysad_pad27;
inout sysad_pad28;

// rac pads
input bus_clk;
input v_ref;
input c_ctl_pgm;
output bus_enable_rac;
inout bus_ctrl_rac;
inout [RAMBUS_DATA_SIZE-1:0] bus_data_rac;

// internal signals
output synclk_buft, synclk_bufb;
output sysad_out25;
output sysad_out26;
output sysad_out27;
output sysad_out28;

input sysad_in25;
input sysad_in26;
input sysad_in27;
input sysad_in28;
input sysad_en_l3;

// rac-ri signals
output [RBUS_DATA_SIZE-1:0] rbus_data_in;
output [RBUS_EXTEND_SIZE-1:0] rbus_extend_in;
output [RBUS_CONTROL_SIZE-1:0] rbus_control_in;
input [RAC_SELECT_SIZE-1:0] rac_sel_in;

input [RBUS_DATA_SIZE-1:0] rbus_data_out;
input [RBUS_EXTEND_SIZE-1:0] rbus_extend_out;
input [RBUS_CONTROL_SIZE-1:0] rbus_control_out;
input [RBUS_ENABLE_SIZE-1:0] rbus_enable_out;
input [RAC_SELECT_SIZE-1:0] rac_sel_out;
input [RAC_CURRENT_SIZE-1:0] ri_c_ctl_i;
input ri_c_ctl_en, ri_c_ctl_ld;
input ri_stop_r, ri_stop_t;

// rac-tst signals
input tst_rac_reset, tst_pwr_up, tst_ext_be, tst_by_pass;
input tst_bist_mode, tst_iost_mode, tst_synclk_set;
output tst_bist_flag;

input testckt_clk_pad, testckt_dir_pad;
inout testckt_data_pad;

wire [RAC_RECEIVE_DATA_SIZE-1:0] r_data7, r_data6, r_data5, r_data4;
wire [RAC_RECEIVE_DATA_SIZE-1:0] r_data3, r_data2, r_data1, r_data0;
wire [RAC_TRANSMIT_DATA_SIZE-1:0] t_data7, t_data6, t_data5, t_data4;
wire [RAC_TRANSMIT_DATA_SIZE-1:0] t_data3, t_data2, t_data1, t_data0;

wire syn_clk, syn_clk_fd, syn_clk_in;
wire scan_out;



testckt_pads testckt (.clk(testckt_clk_pad), .dir_in(testckt_dir_pad),
		      .data(testckt_data_pad));


padior IOpad121 (.pad(sysad_pad25), .dout(sysad_out25),
                 .din(sysad_in25),  .oen(sysad_en_l3));
padior IOpad122 (.pad(sysad_pad26), .dout(sysad_out26),
                 .din(sysad_in26),  .oen(sysad_en_l3));
padior IOpad123 (.pad(sysad_pad27), .dout(sysad_out27),
                 .din(sysad_in27),  .oen(sysad_en_l3));
padior IOpad124 (.pad(sysad_pad28), .dout(sysad_out28),
                 .din(sysad_in28),  .oen(sysad_en_l3));
padvss    VSSpad125 (.pad(1'b0));
padvdd    VDDpad126 (.pad(1'b1));

rac rac_0(
   .BusClk(bus_clk),
   .BusCtrl(bus_ctrl_rac),
   .BusData(bus_data_rac),
   .BusEnable(bus_enable_rac),
   .Vref(v_ref),
   .CCtlPgm(c_ctl_pgm),
   .RData7(r_data7),
   .RData6(r_data6),
   .RData5(r_data5),
   .RData4(r_data4),
   .RData3(r_data3),
   .RData2(r_data2),
   .RData1(r_data1),
   .RData0(r_data0),
   .BDSel(rac_sel_out),
   .BCSel(rac_sel_out),
   .BESel(rac_sel_out),
   .RDSel(rac_sel_in),
   .RCSel(rac_sel_in),
   .TData7(t_data7),
   .TData6(t_data6),
   .TData5(t_data5),
   .TData4(t_data4),
   .TData3(t_data3),
   .TData2(t_data2),
   .TData1(t_data1),
   .TData0(t_data0),
   .SynClk(syn_clk),
   .SynClkFd(syn_clk_fd),
   .SynClkIn(syn_clk_in),
   .Reset(tst_rac_reset),
   .BISTFlag(tst_bist_flag),
   .BISTMode(tst_bist_mode),
   .IOSTMode(tst_iost_mode),
   .PwrUp(tst_pwr_up),
   .CCtlEn(ri_c_ctl_en),
   .CCtlLd(ri_c_ctl_ld),
   .CCtlI(ri_c_ctl_i),
   .ExtBE(tst_ext_be),
   .StopR(ri_stop_r),
   .StopT(ri_stop_t),
   .ByPass(tst_by_pass),
   .SCANMode(1'b0),
   .SCANClk(1'b0),
   .SCANEn(1'b0),
   .SCANIn(1'b0),
   .SCANOut(scan_out),
   .ByPSel(1'b1),
   .rclkASIC(1'b0),
   .tclkASIC(1'b0),
   .PhStall(1'b0));

padvss    VSSpad160 (.pad(1'b0));

// synclk synchronization gate
an02d1 g_0( .a1(syn_clk_fd), .a2(tst_synclk_set), .z(syn_clk_in));

// synclk buffers
synclkbuf buft( .synclkin(syn_clk), .synclkout(synclk_buft));
synclkbuf bufb( .synclkin(syn_clk), .synclkout(synclk_bufb));

// bus reassignments
assign {rbus_control_in[0], rbus_extend_in[0], rbus_data_in[ 7: 0]} = r_data7;
assign {rbus_control_in[1], rbus_extend_in[1], rbus_data_in[15: 8]} = r_data6;
assign {rbus_control_in[2], rbus_extend_in[2], rbus_data_in[23:16]} = r_data5;
assign {rbus_control_in[3], rbus_extend_in[3], rbus_data_in[31:24]} = r_data4;
assign {rbus_control_in[4], rbus_extend_in[4], rbus_data_in[39:32]} = r_data3;
assign {rbus_control_in[5], rbus_extend_in[5], rbus_data_in[47:40]} = r_data2;
assign {rbus_control_in[6], rbus_extend_in[6], rbus_data_in[55:48]} = r_data1;
assign {rbus_control_in[7], rbus_extend_in[7], rbus_data_in[63:56]} = r_data0;

assign t_data7 = {rbus_enable_out[0], rbus_control_out[0], rbus_extend_out[0],
  rbus_data_out[ 7: 0]};
assign t_data6 = {rbus_enable_out[1], rbus_control_out[1], rbus_extend_out[1],
  rbus_data_out[15: 8]};
assign t_data5 = {rbus_enable_out[2], rbus_control_out[2], rbus_extend_out[2],
  rbus_data_out[23:16]};
assign t_data4 = {rbus_enable_out[3], rbus_control_out[3], rbus_extend_out[3],
  rbus_data_out[31:24]};
assign t_data3 = {rbus_enable_out[4], rbus_control_out[4], rbus_extend_out[4],
  rbus_data_out[39:32]};
assign t_data2 = {rbus_enable_out[5], rbus_control_out[5], rbus_extend_out[5],
  rbus_data_out[47:40]};
assign t_data1 = {rbus_enable_out[6], rbus_control_out[6], rbus_extend_out[6],
  rbus_data_out[55:48]};
assign t_data0 = {rbus_enable_out[7], rbus_control_out[7], rbus_extend_out[7],
  rbus_data_out[63:56]};

endmodule


module right_pads ( pvalid_pad, eok_pad, int_pad, cartaleh_pad, cartrd_pad,
                    cartalel_pad, cartwr_pad, cartad_pad0, cartad_pad1, cartad_pad2,
                    cartad_pad3, cartad_pad12, cartad_pad13, cartad_pad14, cartad_pad15,
                    sysad_pad29, sysad_pad30, sysad_pad31,
                    sysad_pad0, sysad_pad1, sysad_pad2, sysad_pad3, sysad_pad4,
                    sysad_pad5, sysad_pad6, sysad_pad7, sysad_pad8, sysad_pad9,
                    pvalid_out, eok_in, int_in, cartaleh_in, cartrd_in, cartalel_in,
                    cartwr_in, cartad_in0, cartad_in1, cartad_in2, cartad_in3,
                    cartad_in12, cartad_in13, cartad_in14, cartad_in15,
                    cartad_en_l0, cartad_en_l1, cartad_out0, cartad_out1, cartad_out2,
                    cartad_out3, cartad_out12, cartad_out13, cartad_out14, cartad_out15,
                    sysad_in29, sysad_in30, sysad_in31, sysad_in0, sysad_in1, sysad_in2,
                    sysad_in3, sysad_in4, sysad_in5, sysad_in6, sysad_in7, sysad_in8,
                    sysad_in9, sysad_en_l0, sysad_en_l1, sysad_en_l3, sysad_out0,
                    sysad_out1, sysad_out2, sysad_out3, sysad_out4, sysad_out5, sysad_out6,
                    sysad_out7, sysad_out8, sysad_out9, sysad_out29, sysad_out30, sysad_out31);

`include "ri.vh"

// pads
input pvalid_pad;
output eok_pad;
output int_pad;
output cartaleh_pad, cartrd_pad, cartalel_pad, cartwr_pad;
inout cartad_pad0, cartad_pad1, cartad_pad2, cartad_pad3;
inout cartad_pad12, cartad_pad13, cartad_pad14, cartad_pad15;
inout sysad_pad29, sysad_pad30, sysad_pad31;
inout sysad_pad0, sysad_pad1, sysad_pad2, sysad_pad3, sysad_pad4;
inout sysad_pad5, sysad_pad6, sysad_pad7, sysad_pad8, sysad_pad9;


// internal signals
output pvalid_out;
input eok_in;
input int_in;
input cartaleh_in, cartrd_in, cartalel_in, cartwr_in;

input cartad_in0, cartad_in1, cartad_in2, cartad_in3;
input cartad_in12, cartad_in13, cartad_in14, cartad_in15;
input cartad_en_l0, cartad_en_l1;

output cartad_out0, cartad_out1, cartad_out2, cartad_out3;
output cartad_out12, cartad_out13, cartad_out14, cartad_out15;

input sysad_in29, sysad_in30, sysad_in31;
input sysad_in0, sysad_in1, sysad_in2, sysad_in3, sysad_in4;
input sysad_in5, sysad_in6, sysad_in7, sysad_in8, sysad_in9;
input sysad_en_l0, sysad_en_l1, sysad_en_l3;

output sysad_out29, sysad_out30, sysad_out31;
output sysad_out0, sysad_out1, sysad_out2, sysad_out3, sysad_out4;
output sysad_out5, sysad_out6, sysad_out7, sysad_out8, sysad_out9;


padocart    IOpad041 (.pad(cartaleh_pad), .din(cartaleh_in));
padvss      VSSpad042 (.pad(1'b0));
padvdd      VDDpad043 (.pad(1'b1));
padocart    IOpad044 (.pad(cartrd_pad),   .din(cartrd_in));
padocart    IOpad045 (.pad(cartalel_pad), .din(cartalel_in));
padocart    IOpad046 (.pad(cartwr_pad),   .din(cartwr_in));
padiorcartsl IOpad047 (.pad(cartad_pad3), .dout(cartad_out3),
                      .din(cartad_in3),  .oen(cartad_en_l0));
padvss      VSSpad048 (.pad(1'b0));
padvdd      VDDpad049 (.pad(1'b1));
padiorcartsl IOpad050 (.pad(cartad_pad12), .dout(cartad_out12),
                      .din(cartad_in12),  .oen(cartad_en_l1));
padiorcart   IOpad051 (.pad(cartad_pad2),  .dout(cartad_out2),
                      .din(cartad_in2),   .oen(cartad_en_l0));
padiorcartsl IOpad052 (.pad(cartad_pad13), .dout(cartad_out13),
                      .din(cartad_in13),  .oen(cartad_en_l1));
padiorcart   IOpad053 (.pad(cartad_pad1),  .dout(cartad_out1),
                      .din(cartad_in1),   .oen(cartad_en_l0));
padiorcartsl IOpad054 (.pad(cartad_pad14), .dout(cartad_out14),
                      .din(cartad_in14),  .oen(cartad_en_l1));
padvss      VSSpad055 (.pad(1'b0));
padvdd      VDDpad056 (.pad(1'b1));
padiorcartsl IOpad057 (.pad(cartad_pad0),  .dout(cartad_out0),
                      .din(cartad_in0),   .oen(cartad_en_l0));
padiorcart   IOpad058 (.pad(cartad_pad15), .dout(cartad_out15),
                      .din(cartad_in15),  .oen(cartad_en_l1));
padior      IOpad059 (.pad(sysad_pad29),  .dout(sysad_out29),
                      .din(sysad_in29),   .oen(sysad_en_l3));
pado        IOpad060 (.din(eok_in), .pad(eok_pad));
padior      IOpad061 (.pad(sysad_pad30),  .dout(sysad_out30),
                      .din(sysad_in30),   .oen(sysad_en_l3));
padin       IOpad062 (.dout(pvalid_out),    .pad(pvalid_pad));
padvss      VSSpad063 (.pad(1'b0));
padvdd      VDDpad064 (.pad(1'b1));
padior      IOpad065 (.pad(sysad_pad31), .dout(sysad_out31),
                      .din(sysad_in31),  .oen(sysad_en_l3));
padior      IOpad066 (.pad(sysad_pad0),  .dout(sysad_out0),
                      .din(sysad_in0),   .oen(sysad_en_l0));
padior      IOpad067 (.pad(sysad_pad1),  .dout(sysad_out1),
                      .din(sysad_in1),   .oen(sysad_en_l0));
padior      IOpad068 (.pad(sysad_pad2),  .dout(sysad_out2),
                      .din(sysad_in2),   .oen(sysad_en_l0));
padior      IOpad069 (.pad(sysad_pad3),  .dout(sysad_out3),
                      .din(sysad_in3),   .oen(sysad_en_l0));
padvss      VSSpad070 (.pad(1'b0));
padvdd      VDDpad071 (.pad(1'b1));
padior      IOpad072 (.pad(sysad_pad4),  .dout(sysad_out4),
                      .din(sysad_in4),   .oen(sysad_en_l0));
padior      IOpad073 (.pad(sysad_pad5),  .dout(sysad_out5),
                      .din(sysad_in5),   .oen(sysad_en_l0));
padior      IOpad074 (.pad(sysad_pad6),  .dout(sysad_out6),
                      .din(sysad_in6),   .oen(sysad_en_l0));
padior      IOpad075 (.pad(sysad_pad7),  .dout(sysad_out7),
                      .din(sysad_in7),   .oen(sysad_en_l0));
padvss      VSSpad076 (.pad(1'b0));
padvdd      VDDpad077 (.pad(1'b1));
padior      IOpad078 (.pad(sysad_pad8),  .dout(sysad_out8),
                      .din(sysad_in8),   .oen(sysad_en_l1));
padior      IOpad079 (.pad(sysad_pad9),  .dout(sysad_out9),
                      .din(sysad_in9),   .oen(sysad_en_l1));
pado        IOpad080 (.din(int_in), .pad(int_pad));


// cap cells for pad-ring

space_right cap00 ();
space_right cap01 ();
space_right cap02 ();
space_right cap03 ();
space_right cap04 ();
space_right cap05 ();
space_right cap06 ();
space_right cap07 ();
space_right cap08 ();
space_right cap09 ();
space_right cap10 ();
space_right cap11 ();
space_right cap12 ();
space_right cap13 ();
space_right cap14 ();
space_right cap15 ();
space_right cap16 ();
space_right cap17 ();
space_right cap18 ();
space_right cap19 ();
space_right cap20 ();
space_right cap21 ();
space_right cap22 ();
space_right cap23 ();
space_right cap24 ();
space_right cap25 ();
space_right cap26 ();
space_right cap27 ();
space_right cap28 ();

endmodule


module top_pads ( sysad_pad10, sysad_pad11, sysad_pad12, sysad_pad13, sysad_pad14,
                  sysad_pad15, sysad_pad16, sysad_pad17, sysad_pad18, sysad_pad19,
                  sysad_pad20, sysad_pad21, sysad_pad22, sysad_pad23, sysad_pad24,
                  syscmd_pad0, syscmd_pad1, syscmd_pad2, syscmd_pad3, syscmd_pad4,
                  mclk_pad, evalid_pad,
                  sysad_in10, sysad_in11, sysad_in12, sysad_in13, sysad_in14,
                  sysad_in15, sysad_in16, sysad_in17, sysad_in18, sysad_in19,
                  sysad_in20, sysad_in21, sysad_in22, sysad_in23, sysad_in24,
                  syscmd_in0, syscmd_in1, syscmd_in2, syscmd_in3, syscmd_in4,
                  evalid_in,
                  sysad_en_l1, sysad_en_l2, sysad_en_l3, sysad_en_l4,
                  synclk_buf, pre_clk,
                  sysad_out10, sysad_out11, sysad_out12, sysad_out13, sysad_out14,
                  sysad_out15, sysad_out16, sysad_out17, sysad_out18, sysad_out19,
                  sysad_out20, sysad_out21, sysad_out22, sysad_out23, sysad_out24,
                  syscmd_out0, syscmd_out1, syscmd_out2, syscmd_out3, syscmd_out4);

`include "ri.vh"

// pads
inout sysad_pad10, sysad_pad11, sysad_pad12, sysad_pad13, sysad_pad14;
inout sysad_pad15, sysad_pad16, sysad_pad17, sysad_pad18, sysad_pad19;
inout sysad_pad20, sysad_pad21, sysad_pad22, sysad_pad23, sysad_pad24;
inout syscmd_pad0, syscmd_pad1, syscmd_pad2, syscmd_pad3, syscmd_pad4;
output mclk_pad, evalid_pad;

// internal signals
input sysad_in10, sysad_in11, sysad_in12, sysad_in13, sysad_in14;
input sysad_in15, sysad_in16, sysad_in17, sysad_in18, sysad_in19;
input sysad_in20, sysad_in21, sysad_in22, sysad_in23, sysad_in24;
input syscmd_in0, syscmd_in1, syscmd_in2, syscmd_in3, syscmd_in4;
input evalid_in;
input sysad_en_l1, sysad_en_l2, sysad_en_l3, sysad_en_l4;
input synclk_buf;
output pre_clk;
output sysad_out10, sysad_out11, sysad_out12, sysad_out13, sysad_out14;
output sysad_out15, sysad_out16, sysad_out17, sysad_out18, sysad_out19;
output sysad_out20, sysad_out21, sysad_out22, sysad_out23, sysad_out24;
output syscmd_out0, syscmd_out1, syscmd_out2, syscmd_out3, syscmd_out4;

wire mclk_out;

padior  IOpad081 (.pad(sysad_pad10), .dout(sysad_out10),
                  .din(sysad_in10),  .oen(sysad_en_l1));
padvdd  VDDpad082 (.pad(1'b1));
padvss  VSSpad083 (.pad(1'b0));
padior  IOpad084 (.pad(sysad_pad11), .dout(sysad_out11),
                  .din(sysad_in11),  .oen(sysad_en_l1));
padior  IOpad085 (.pad(sysad_pad12), .dout(sysad_out12),
                  .din(sysad_in12),  .oen(sysad_en_l1));
padior  IOpad086 (.pad(sysad_pad13), .dout(sysad_out13),
                  .din(sysad_in13),  .oen(sysad_en_l1));
padior  IOpad087 (.pad(sysad_pad14), .dout(sysad_out14),
                  .din(sysad_in14),  .oen(sysad_en_l1));
padvdd  VDDpad088 (.pad(1'b1));
padvss  VSSpad089 (.pad(1'b0));

preclkbuf clkbuft1 (.preclkin(synclk_buf), .preclkout(pre_clk));

padvdd  VDDpad090 (.pad(1'b1));
padvss  VSSpad091 (.pad(1'b0));
padior  IOpad092 (.pad(sysad_pad15), .dout(sysad_out15),
                  .din(sysad_in15),  .oen(sysad_en_l1));
padior  IOpad093 (.pad(sysad_pad16), .dout(sysad_out16),
                  .din(sysad_in16),  .oen(sysad_en_l2));
padior  IOpad094 (.pad(sysad_pad17), .dout(sysad_out17),
                  .din(sysad_in17),  .oen(sysad_en_l2));
padior  IOpad095 (.pad(sysad_pad18), .dout(sysad_out18),
                  .din(sysad_in18),  .oen(sysad_en_l2));
padior  IOpad096 (.pad(sysad_pad19), .dout(sysad_out19),
                  .din(sysad_in19),  .oen(sysad_en_l2));
padvss  VSSpad097 (.pad(1'b0));
padvdd  VDDpad098 (.pad(1'b1));

mclk_buf  mclk_buft (.in(synclk_buf),    .out(mclk_out));

pado    IOpad099 (.din(mclk_out),    .pad(mclk_pad));
padvss  VSSpad100 (.pad(1'b0));
padvdd  VDDpad101 (.pad(1'b1));
padior  IOpad102 (.pad(sysad_pad20), .dout(sysad_out20),
                  .din(sysad_in20),  .oen(sysad_en_l2));
padior  IOpad103 (.pad(sysad_pad21), .dout(sysad_out21),
                  .din(sysad_in21),  .oen(sysad_en_l2));
padior  IOpad104 (.pad(sysad_pad22), .dout(sysad_out22),
                  .din(sysad_in22),  .oen(sysad_en_l2));
padvss  VSSpad105 (.pad(1'b0));
padvdd  VDDpad106 (.pad(1'b1));
padior  IOpad107 (.pad(sysad_pad23), .dout(sysad_out23),
                  .din(sysad_in23),  .oen(sysad_en_l2));
padior  IOpad108 (.pad(sysad_pad24), .dout(sysad_out24),
                  .din(sysad_in24),  .oen(sysad_en_l3));
padvss  VSSpad109 (.pad(1'b0));

preclkbuf clkbuft0 (.preclkin(synclk_buf), .preclkout(pre_clk));

padvdd  VDDpad110 (.pad(1'b1));
padior  IOpad111 (.pad(syscmd_pad4), .dout(syscmd_out4),
                  .din(syscmd_in4),  .oen(sysad_en_l4));
padior  IOpad112 (.pad(syscmd_pad3), .dout(syscmd_out3),
                  .din(syscmd_in3),  .oen(sysad_en_l4));
padvss  VSSpad113 (.pad(1'b0));
padvdd  VDDpad114 (.pad(1'b1));
padior  IOpad115 (.pad(syscmd_pad2), .dout(syscmd_out2),
                  .din(syscmd_in2),  .oen(sysad_en_l4));
pado    IOpad116 (.din(evalid_in),     .pad(evalid_pad));
padior  IOpad117 (.pad(syscmd_pad1), .dout(syscmd_out1),
                  .din(syscmd_in1),  .oen(sysad_en_l4));
padior  IOpad118 (.pad(syscmd_pad0), .dout(syscmd_out0),
                  .din(syscmd_in0),  .oen(sysad_en_l4));
padvss  VSSpad119 (.pad(1'b0));
padvdd  VDDpad120 (.pad(1'b1));


// cap cells for pad-ring

space_bot cap00 ();
space_bot cap01 ();
space_bot cap02 ();
space_bot cap03 ();
space_bot cap04 ();
space_bot cap05 ();
space_bot cap06 ();
space_bot cap07 ();
space_bot cap08 ();
space_bot cap09 ();
space_bot cap10 ();
space_bot cap11 ();
space_bot cap12 ();
space_bot cap13 ();
space_bot cap14 ();
space_bot cap15 ();
space_bot cap16 ();
space_bot cap17 ();
space_bot cap18 ();
space_bot cap19 ();
space_bot cap20 ();
space_bot cap21 ();
space_bot cap22 ();
space_bot cap23 ();
space_bot cap24 ();
space_bot cap25 ();
space_bot cap26 ();
space_bot cap27 ();
space_bot cap28 ();
space_bot cap29 ();
space_bot cap30 ();

endmodule


module bottom_pads ( test_pad, pifrsp_pad, vclk_pad, reset_pad,
                     pifcmd_pad, pifclk_pad, audclk_pad, auddata_pad, audlrclk_pad,
                     vsync_pad, srgba_pad0, srgba_pad1, srgba_pad2,
                     srgba_pad3, srgba_pad4, srgba_pad5, srgba_pad6,
                     cartad_pad4, cartad_pad5, cartad_pad6, cartad_pad7,
                     cartad_pad8, cartad_pad9, cartad_pad10, cartad_pad11,
                     synclk_buf, pre_clk,
                     cartad_in4, cartad_in5, cartad_in6, cartad_in7,
                     cartad_in8, cartad_in9, cartad_in10, cartad_in11,
                     cartad_en_l0, cartad_en_l1,
                     cartad_out4, cartad_out5, cartad_out6, cartad_out7,
                     cartad_out8, cartad_out9, cartad_out10, cartad_out11,
                     test_out, pifrsp_out, vclk_out, reset_out,
                     pifcmd_in, pifclk_in, audclk_in, auddata_in, audlrclk_in,
                     vbus_sync, vbus_data);

`include "ri.vh"

// pads
input test_pad;
input pifrsp_pad;
input vclk_pad;
input reset_pad;

output pifcmd_pad, pifclk_pad;
output audclk_pad, auddata_pad, audlrclk_pad;
output vsync_pad;
output srgba_pad0, srgba_pad1, srgba_pad2;
output srgba_pad3, srgba_pad4, srgba_pad5, srgba_pad6;

inout cartad_pad4, cartad_pad5, cartad_pad6, cartad_pad7;
inout cartad_pad8, cartad_pad9, cartad_pad10, cartad_pad11;

// internal signals
input synclk_buf;
output pre_clk;

input cartad_in4, cartad_in5, cartad_in6, cartad_in7;
input cartad_in8, cartad_in9, cartad_in10, cartad_in11;
input cartad_en_l0, cartad_en_l1;
output cartad_out4, cartad_out5, cartad_out6, cartad_out7;
output cartad_out8, cartad_out9, cartad_out10, cartad_out11;

output test_out;
output pifrsp_out;
output vclk_out;
output reset_out;

input pifcmd_in, pifclk_in;
input audclk_in, auddata_in, audlrclk_in;
input [6:0] vbus_data;
input vbus_sync;

wire vclk_in;
wire [6:0] vbus_data_reg;
wire       vbus_sync_reg;

mclk_buf  mclk_bufb (.in(synclk_buf),    .out());

padvdd 	  VDDpad001 (.pad(1'b1));
padin 	  IOpad002 (.dout(test_out),   .pad(test_pad));
padin 	  IOpad003 (.dout(pifrsp_out), .pad(pifrsp_pad));
padosl	  IOpad004 (.pad(pifcmd_pad),  .din(pifcmd_in));
padosl	  IOpad005 (.pad(pifclk_pad),  .din(pifclk_in));
padosl    IOpad006 (.pad(audclk_pad),  .din(audclk_in));
padosl    IOpad007 (.pad(auddata_pad), .din(auddata_in));
padvss    VSSpad008 (.pad(1'b0));
padvdd    VDDpad009 (.pad(1'b1));
padosl 	  IOpad010 (.pad(audlrclk_pad), .din(audlrclk_in));
padin  	  IOpad011 (.pad(vclk_pad),     .dout(vclk_in));
padvss    VSSpad012 (.pad(1'b0));

preclkbuf clkbufb0 (.preclkin(synclk_buf), .preclkout(pre_clk));

padvdd    VDDpad013 (.pad(1'b1));
pado   	  IOpad014 (.pad(vsync_pad),    .din(vbus_sync_reg));
pado   	  IOpad015 (.pad(srgba_pad6), .din(vbus_data_reg[6]));
padvss    VSSpad016 (.pad(1'b0));
padvdd    VDDpad017 (.pad(1'b1));
pado   	  IOpad018 (.pad(srgba_pad5), .din(vbus_data_reg[5]));
pado   	  IOpad019 (.pad(srgba_pad4), .din(vbus_data_reg[4]));
pado   	  IOpad020 (.pad(srgba_pad3), .din(vbus_data_reg[3]));
padvss    VSSpad021 (.pad(1'b0));
padvdd    VDDpad022 (.pad(1'b1));
pado   	  IOpad023 (.pad(srgba_pad2), .din(vbus_data_reg[2]));
pado   	  IOpad024 (.pad(srgba_pad1), .din(vbus_data_reg[1]));
pado   	  IOpad025 (.pad(srgba_pad0), .din(vbus_data_reg[0]));
padin 	  IOpad026 (.dout(reset_out),   .pad(reset_pad));
padvdd    VDDpad027 (.pad(1'b1));
padvss    VSSpad028 (.pad(1'b0));

preclkbuf clkbufb1 (.preclkin(synclk_buf), .preclkout(pre_clk));

padvdd      VDDpad029 (.pad(1'b1));
padvss      VSSpad030 (.pad(1'b0));
padiorcartsl IOpad031 (.pad(cartad_pad7), .dout(cartad_out7),
                      .din(cartad_in7),  .oen(cartad_en_l0));
padiorcart   IOpad032 (.pad(cartad_pad8), .dout(cartad_out8),
                      .din(cartad_in8),  .oen(cartad_en_l1));
padiorcartsl IOpad033 (.pad(cartad_pad6), .dout(cartad_out6),
                      .din(cartad_in6),  .oen(cartad_en_l0));
padiorcart   IOpad034 (.pad(cartad_pad9), .dout(cartad_out9),
                      .din(cartad_in9),  .oen(cartad_en_l1));
padiorcartsl IOpad035 (.pad(cartad_pad5), .dout(cartad_out5),
                      .din(cartad_in5),  .oen(cartad_en_l0));
padvss      VSSpad036 (.pad(1'b0));
padvdd      VDDpad037 (.pad(1'b1));
padiorcartsl IOpad038 (.pad(cartad_pad10), .dout(cartad_out10),
                      .din(cartad_in10),  .oen(cartad_en_l1));
padiorcart   IOpad039 (.pad(cartad_pad4),  .dout(cartad_out4),
                      .din(cartad_in4),   .oen(cartad_en_l0));
padiorcartsl IOpad040 (.pad(cartad_pad11), .dout(cartad_out11),
                      .din(cartad_in11),  .oen(cartad_en_l1));

vclk_regs vclk_regs(.reset_l(reset_out),
                    .vclk_in(vclk_in), .vclk_out(vclk_out),
                    .vbus_data(vbus_data), .vbus_sync(vbus_sync),
                    .vbus_data_reg(vbus_data_reg),
                    .vbus_sync_reg(vbus_sync_reg));


// cap cells for pad-ring

space_bot cap00 ();
space_bot cap01 ();
space_bot cap02 ();
space_bot cap03 ();
space_bot cap04 ();
space_bot cap05 ();
space_bot cap06 ();
space_bot cap07 ();
space_bot cap08 ();
space_bot cap09 ();
space_bot cap10 ();
space_bot cap11 ();
space_bot cap12 ();
space_bot cap13 ();
space_bot cap14 ();
space_bot cap15 ();
space_bot cap16 ();
space_bot cap17 ();
space_bot cap18 ();
space_bot cap19 ();
space_bot cap20 ();
space_bot cap21 ();
space_bot cap22 ();
space_bot cap23 ();
space_bot cap24 ();
space_bot cap25 ();
space_bot cap26 ();
space_bot cap27 ();
space_bot cap28 ();
space_bot cap29 ();
space_bot cap30 ();

endmodule