2025年3月10日 星期一

CGD_100_IO 的實體腳位約束檔設定,以及測試檔

 CGD_100_IO


以下有兩個檔案 CGD_100_IO.v  和腳位檔


CGD_100_IO.v

  1. module CDG_100_IO (
  2.     input           clk_50M,
  3.     input   [8:1]   iKEY_n,
  4.     input   [4:1]   iSW,
  5.     output  [8:1]   oLED,    // blue LED
  6.     output  [2:0]   oGYR1_n, oGYR2_n, oGYR3_n, oGYR4_n, // GYR color LED
  7.     output  [7:0]   oSEG,   // drive  7 segment display
  8.     output  [3:0]   oSEG_s  // select 7 segment display
  9. );

  10. reg [25:0]  cn;


  11. always @(posedge clk_50M)
  12. begin
  13.     cn <= cn+1;
  14. end

  15. // input [8:1]     key;
  16. // output [8:1]    led;

  17. // assign oLED = ~iKEY_n;
  18. assign oLED = {iSW[4],iSW[4],iSW[3],iSW[3],iSW[2],iSW[2],iSW[1],iSW[1]};

  19. assign oGYR1_n = {iKEY_n[3],iKEY_n[2],iKEY_n[1]};
  20. assign oGYR2_n = {iKEY_n[3],iKEY_n[2],iKEY_n[1]};
  21. assign oGYR3_n = {iKEY_n[3],iKEY_n[2],iKEY_n[1]};
  22. assign oGYR4_n = {iKEY_n[3],iKEY_n[2],iKEY_n[1]};

  23. assign  oSEG_s = {~iSW[4], ~iSW[3], ~iSW[2], ~iSW[1]};
  24. assign  oSEG = iKEY_n;

  25. endmodule


實體腳位約束檔

CGD_100.cst

  • // clock 50MHz
  •  IO_LOC "clk_50M" 11;
  •  IO_PORT "clk_50M" IO_TYPE=LVCMOS33;

  • // ==== INPUT ====
  • // iKEY: push button, normal = 1, press = 0

  •  IO_LOC "iKEY_n[1]" 58;  //k1
  •  IO_LOC "iKEY_n[2]" 59;  //k2
  •  IO_LOC "iKEY_n[3]" 60;  //k3
  •  IO_LOC "iKEY_n[4]" 61;  //k4
  •  IO_LOC "iKEY_n[5]" 62;  //k5
  •  IO_LOC "iKEY_n[6]" 63;  //k6
  •  IO_LOC "iKEY_n[7]" 64;  //k7
  •  IO_LOC "iKEY_n[8]" 65;  //k8

  •  IO_PORT "iKEY_n[1]" IO_TYPE=LVCMOS33;
  •  IO_PORT "iKEY_n[2]" IO_TYPE=LVCMOS33;
  •  IO_PORT "iKEY_n[3]" IO_TYPE=LVCMOS33;
  •  IO_PORT "iKEY_n[4]" IO_TYPE=LVCMOS33;
  •  IO_PORT "iKEY_n[5]" IO_TYPE=LVCMOS33;
  •  IO_PORT "iKEY_n[6]" IO_TYPE=LVCMOS33;
  •  IO_PORT "iKEY_n[7]" IO_TYPE=LVCMOS33;
  •  IO_PORT "iKEY_n[8]" IO_TYPE=LVCMOS33;

  • // iSW: switch button, up = ON = 1, low = OFF = 0;
  •  IO_LOC "iSW[1]" 75;
  •  IO_LOC "iSW[2]" 76;
  •  IO_LOC "iSW[3]" 78;
  •  IO_LOC "iSW[4]" 79;
  •  IO_PORT "iSW[1]" IO_TYPE=LVCMOS33 PULL_MODE=DOWN BANK_VCCIO=3.3;
  •  IO_PORT "iSW[2]" IO_TYPE=LVCMOS33 PULL_MODE=DOWN BANK_VCCIO=3.3;
  •  IO_PORT "iSW[3]" IO_TYPE=LVCMOS33 PULL_MODE=DOWN BANK_VCCIO=3.3;
  •  IO_PORT "iSW[4]" IO_TYPE=LVCMOS33 PULL_MODE=DOWN BANK_VCCIO=3.3;

  • // ==== OUTPUT ==== 
  • // oLED: blue LED, 1 = turn on, 0 = turn off
  •  IO_LOC "oLED[1]" 23;    //D1
  •  IO_LOC "oLED[2]" 24;    //D2
  •  IO_LOC "oLED[3]" 25;    //D3
  •  IO_LOC "oLED[4]" 26;    //D4
  •  IO_LOC "oLED[5]" 27;    //D5
  •  IO_LOC "oLED[6]" 28;    //D6
  •  IO_LOC "oLED[7]" 29;    //D7
  •  IO_LOC "oLED[8]" 30;    //D8
  •  IO_PORT "oLED[1]" IO_TYPE=LVCMOS33;
  •  IO_PORT "oLED[2]" IO_TYPE=LVCMOS33;
  •  IO_PORT "oLED[3]" IO_TYPE=LVCMOS33;
  •  IO_PORT "oLED[4]" IO_TYPE=LVCMOS33;
  •  IO_PORT "oLED[5]" IO_TYPE=LVCMOS33;
  •  IO_PORT "oLED[6]" IO_TYPE=LVCMOS33;
  •  IO_PORT "oLED[7]" IO_TYPE=LVCMOS33;
  •  IO_PORT "oLED[8]" IO_TYPE=LVCMOS33;

  • //  GYR1, GYR2, GYR3, GYR4: 0 = turn on, 1 = turn off;

  •  IO_LOC "oRYG1R_n" 112;
  •  IO_LOC "oRYG1Y_n" 113;
  •  IO_LOC "oRYG1G_n" 114;
  •  IO_LOC "oRYG2R_n" 106;
  •  IO_LOC "oRYG2Y_n" 110;
  •  IO_LOC "oRYG2G_n" 111;
  •  IO_LOC "oRYG3R_n" 101;
  •  IO_LOC "oRYG3Y_n" 102;
  •  IO_LOC "oRYG3G_n" 104;
  •  IO_LOC "oRYG4R_n"  98;
  •  IO_LOC "oRYG4Y_n"  99;
  •  IO_LOC "oRYG4G_n" 100;

  •  IO_PORT "oRYG1R_n" IO_TYPE=LVCMOS33;
  •  IO_PORT "oRYG1Y_n" IO_TYPE=LVCMOS33;
  •  IO_PORT "oRYG1G_n" IO_TYPE=LVCMOS33;
  •  IO_PORT "oRYG2R_n" IO_TYPE=LVCMOS33;
  •  IO_PORT "oRYG2Y_n" IO_TYPE=LVCMOS33;
  •  IO_PORT "oRYG2G_n" IO_TYPE=LVCMOS33;
  •  IO_PORT "oRYG3R_n" IO_TYPE=LVCMOS33;
  •  IO_PORT "oRYG3Y_n" IO_TYPE=LVCMOS33;
  •  IO_PORT "oRYG3G_n" IO_TYPE=LVCMOS33;
  •  IO_PORT "oRYG4R_n" IO_TYPE=LVCMOS33;
  •  IO_PORT "oRYG4Y_n" IO_TYPE=LVCMOS33;
  •  IO_PORT "oRYG4G_n" IO_TYPE=LVCMOS33;

  • // four oSEGment display, common positive
  •  IO_LOC "oSEG_s[3]" 137;
  •  IO_LOC "oSEG_s[2]" 140;
  •  IO_LOC "oSEG_s[1]" 141;
  •  IO_LOC "oSEG_s[0]" 3;
  •  IO_LOC "oSEG[0]" 138;
  •  IO_LOC "oSEG[1]" 142;
  •  IO_LOC "oSEG[2]" 9;
  •  IO_LOC "oSEG[3]" 7;
  •  IO_LOC "oSEG[4]" 12;
  •  IO_LOC "oSEG[5]" 139;
  •  IO_LOC "oSEG[6]" 8;
  •  IO_LOC "oSEG[7]" 10;

  •  IO_PORT "oSEG_s[0]" IO_TYPE=LVCMOS33;
  •  IO_PORT "oSEG_s[1]" IO_TYPE=LVCMOS33;
  •  IO_PORT "oSEG_s[2]" IO_TYPE=LVCMOS33;
  •  IO_PORT "oSEG_s[3]" IO_TYPE=LVCMOS33;
  •  IO_PORT "oSEG[0]" IO_TYPE=LVCMOS33;    //a
  •  IO_PORT "oSEG[1]" IO_TYPE=LVCMOS33;    //b
  •  IO_PORT "oSEG[2]" IO_TYPE=LVCMOS33;    //c
  •  IO_PORT "oSEG[3]" IO_TYPE=LVCMOS33;    //d
  •  IO_PORT "oSEG[4]" IO_TYPE=LVCMOS33;    //e
  •  IO_PORT "oSEG[5]" IO_TYPE=LVCMOS33;    //f
  •  IO_PORT "oSEG[6]" IO_TYPE=LVCMOS33;    //g
  •  IO_PORT "oSEG[7]" IO_TYPE=LVCMOS33;    //dot

  • /*
  •  IO_LOC "beep" 6;
  •  IO_PORT "beep" IO_TYPE=LVCMOS33;
  •  IO_LOC "rs232_rec" 49;
  •  IO_LOC "rs232_txd" 48;
  •  IO_PORT "rs232_rec" IO_TYPE=LVCMOS33;
  •  IO_PORT "rs232_txd" IO_TYPE=LVCMOS33;
  • */