Browse Source

pinout: move scripts to scripts/; use a script to read *.pins directly

H. Peter Anvin 3 years ago
parent
commit
1792b0ac94
5 changed files with 42 additions and 157 deletions
  1. 9 146
      max80.qsf
  2. 0 10
      postmodule.tcl
  3. 17 0
      scripts/pins.tcl
  4. 1 1
      scripts/post_quartus_asm.tcl
  5. 15 0
      scripts/postmodule.tcl

+ 9 - 146
max80.qsf

@@ -135,159 +135,18 @@ set_global_assignment -name EDA_TEST_BENCH_DESIGN_INSTANCE_NAME max80 -section_i
 set_instance_assignment -name CURRENT_STRENGTH_NEW "MAXIMUM CURRENT" -to led[1]
 set_global_assignment -name CYCLONEIII_CONFIGURATION_DEVICE EPCQ128A
 
-
-
-
-set_location_assignment PIN_E1 -to abc_a[6]
-set_location_assignment PIN_B1 -to abc_xm_x
-set_location_assignment PIN_C2 -to abc_a_oe
-set_location_assignment PIN_C1 -to flash_mosi
-set_location_assignment PIN_F3 -to abc_a[5]
-set_location_assignment PIN_D2 -to flash_cs_n
-set_location_assignment PIN_D1 -to abc_a[3]
-set_location_assignment PIN_G5 -to abc_a[4]
-set_location_assignment PIN_F2 -to abc_cs_n
-set_location_assignment PIN_F1 -to abc_a[7]
-set_location_assignment PIN_G2 -to abc_out_n[0]
-set_location_assignment PIN_G1 -to abc_a[8]
-set_location_assignment PIN_H1 -to flash_clk
-set_location_assignment PIN_H2 -to flash_miso
-set_location_assignment PIN_R1 -to abc_xmemw80_n
-set_location_assignment PIN_P2 -to abc_rst_n
-set_location_assignment PIN_P1 -to abc_xmemw800_n
-set_location_assignment PIN_M2 -to abc_inp_n[1]
-set_location_assignment PIN_M1 -to abc_a[13]
-set_location_assignment PIN_J2 -to abc_out_n[1]
-set_location_assignment PIN_J1 -to abc_a[9]
-set_location_assignment PIN_L3 -to abc_out_n[3]
-set_location_assignment PIN_K1 -to abc_a[11]
-set_location_assignment PIN_L2 -to abc_inp_n[0]
-set_location_assignment PIN_L1 -to abc_a[12]
-set_location_assignment PIN_K2 -to abc_out_n[4]
-set_location_assignment PIN_N2 -to abc_a[14]
-set_location_assignment PIN_N1 -to abc_a[15]
-set_location_assignment PIN_K5 -to abc_out_n[2]
-set_location_assignment PIN_L4 -to abc_a[10]
-set_location_assignment PIN_M6 -to abc_d[1]
-set_location_assignment PIN_P6 -to spi_clk
-set_location_assignment PIN_M7 -to spi_miso
-set_location_assignment PIN_R5 -to abc_d_ce_n
-set_location_assignment PIN_T5 -to abc_d_oe
-set_location_assignment PIN_R6 -to abc_resin_x
-set_location_assignment PIN_T6 -to gpio[2]
-set_location_assignment PIN_L7 -to gpio[0]
-set_location_assignment PIN_R7 -to gpio[5]
-set_location_assignment PIN_T7 -to gpio[4]
-set_location_assignment PIN_L8 -to esp_io0
-set_location_assignment PIN_M8 -to spi_mosi
-set_location_assignment PIN_N8 -to spi_cs_esp_n
-set_location_assignment PIN_P8 -to esp_int
-set_location_assignment PIN_R8 -to exth_hh
-set_location_assignment PIN_T8 -to abc_clk
-set_location_assignment PIN_N3 -to abc_xmemfl_n
-set_location_assignment PIN_P3 -to abc_d[0]
-set_location_assignment PIN_R3 -to abc_d[4]
-set_location_assignment PIN_T3 -to abc_d[5]
-set_location_assignment PIN_T2 -to abc_d[3]
-set_location_assignment PIN_R4 -to abc_d[6]
-set_location_assignment PIN_T4 -to abc_d[7]
-set_location_assignment PIN_N5 -to abc_d[2]
-set_location_assignment PIN_N6 -to spi_cs_flash_n
-set_location_assignment PIN_M11 -to hdmi_scl
-set_location_assignment PIN_T13 -to led[1]
-set_location_assignment PIN_N9 -to exth_hb
-set_location_assignment PIN_T9 -to exth_hc
-set_location_assignment PIN_R10 -to gpio[3]
-set_location_assignment PIN_T10 -to abc_master
-set_location_assignment PIN_R11 -to exth_hd
-set_location_assignment PIN_T11 -to exth_hf
-set_location_assignment PIN_R12 -to exth_he
-set_location_assignment PIN_T12 -to abc_xinpstb_n
-set_location_assignment PIN_L10 -to abc_xoutpstb_n
-set_location_assignment PIN_P9 -to gpio[1]
-set_location_assignment PIN_N12 -to exth_ha
-set_location_assignment PIN_N11 -to exth_hg
-set_location_assignment PIN_R13 -to hdmi_sda
-set_location_assignment PIN_T14 -to led[3]
-set_location_assignment PIN_T15 -to hdmi_hpd
-set_location_assignment PIN_M10 -to sd_dat[1]
-set_location_assignment PIN_P14 -to tty_dtr
-set_location_assignment PIN_R14 -to led[2]
-set_location_assignment PIN_R16 -to hdmi_d[2]
-set_location_assignment PIN_N15 -to hdmi_d[1]
-set_location_assignment PIN_K15 -to hdmi_d[0]
-set_location_assignment PIN_J15 -to hdmi_clk
-set_location_assignment PIN_M15 -to clock_48
-set_location_assignment PIN_E16 -to tty_txd
-set_location_assignment PIN_E15 -to rtc_32khz
-set_location_assignment PIN_G16 -to sd_cmd
-set_location_assignment PIN_G15 -to sd_clk
-set_location_assignment PIN_F13 -to tty_rxd
-set_location_assignment PIN_F16 -to sd_dat[3]
-set_location_assignment PIN_F15 -to sd_dat[0]
-set_location_assignment PIN_B16 -to rtc_int_n
-set_location_assignment PIN_F14 -to sd_dat[2]
-set_location_assignment PIN_D16 -to tty_rts
-set_location_assignment PIN_D15 -to tty_cts
-set_location_assignment PIN_C16 -to i2c_scl
-set_location_assignment PIN_C15 -to i2c_sda
-set_location_assignment PIN_D12 -to sr_cs_n
-set_location_assignment PIN_C11 -to sr_dq[3]
-set_location_assignment PIN_C14 -to sr_a[10]
-set_location_assignment PIN_B13 -to sr_ba[1]
-set_location_assignment PIN_D14 -to sr_a[2]
-set_location_assignment PIN_A14 -to sr_a[0]
-set_location_assignment PIN_D11 -to sr_dq[2]
-set_location_assignment PIN_B14 -to sr_a[1]
-set_location_assignment PIN_E11 -to sr_dq[1]
-set_location_assignment PIN_E10 -to sr_dqm[0]
-set_location_assignment PIN_A12 -to sr_dq[0]
-set_location_assignment PIN_B12 -to sr_ras_n
-set_location_assignment PIN_A11 -to sr_dq[5]
-set_location_assignment PIN_B11 -to sr_dq[4]
-set_location_assignment PIN_A13 -to sr_ba[0]
-set_location_assignment PIN_A15 -to sr_a[3]
-set_location_assignment PIN_F9 -to sr_we_n
-set_location_assignment PIN_A10 -to sr_dq[7]
-set_location_assignment PIN_B10 -to sr_dq[6]
-set_location_assignment PIN_C9 -to sr_a[4]
-set_location_assignment PIN_D9 -to sr_a[5]
-set_location_assignment PIN_E9 -to sr_cas_n
-set_location_assignment PIN_A9 -to abc_a[2]
-set_location_assignment PIN_D8 -to sr_dqm[1]
-set_location_assignment PIN_E8 -to sr_a[6]
-set_location_assignment PIN_A8 -to abc_a[0]
-set_location_assignment PIN_F8 -to sr_cke
-set_location_assignment PIN_B8 -to abc_a[1]
-set_location_assignment PIN_A7 -to sr_a[7]
-set_location_assignment PIN_C8 -to sr_a[11]
-set_location_assignment PIN_B7 -to sr_a[8]
-set_location_assignment PIN_C6 -to sr_dq[14]
-set_location_assignment PIN_A6 -to sr_a[9]
-set_location_assignment PIN_B6 -to sr_a[12]
-set_location_assignment PIN_E7 -to sr_dq[9]
-set_location_assignment PIN_E6 -to sr_dq[12]
-set_location_assignment PIN_A5 -to sr_dq[8]
-set_location_assignment PIN_B5 -to sr_dq[10]
-set_location_assignment PIN_D6 -to sr_dq[13]
-set_location_assignment PIN_A4 -to sr_dq[11]
-set_location_assignment PIN_B4 -to abc_rdy_x
-set_location_assignment PIN_A2 -to abc_int800_x
-set_location_assignment PIN_D5 -to sr_dq[15]
-set_location_assignment PIN_A3 -to abc_nmi_x
-set_location_assignment PIN_B3 -to abc_int80_x
-set_location_assignment PIN_D3 -to sr_clk
-
 set_global_assignment -name GENERATE_JAM_FILE ON
 set_global_assignment -name FORCE_CONFIGURATION_VCCIO ON
 set_global_assignment -name CONFIGURATION_VCCIO_LEVEL 3.3V
 
 set_global_assignment -name RESERVE_ALL_UNUSED_PINS_WEAK_PULLUP "AS OUTPUT DRIVING GROUND"
-set_global_assignment -name POST_MODULE_SCRIPT_FILE "quartus_sh:postmodule.tcl"
+set_global_assignment -name POST_MODULE_SCRIPT_FILE "quartus_sh:scripts/postmodule.tcl"
 
 
-set_global_assignment -name TCL_SCRIPT_FILE post_quartus_asm.tcl
-set_global_assignment -name TCL_SCRIPT_FILE postmodule.tcl
+
+
+set_global_assignment -name TCL_SCRIPT_FILE scripts/post_quartus_asm.tcl
+set_global_assignment -name TCL_SCRIPT_FILE scripts/postmodule.tcl
 set_global_assignment -name SOURCE_FILE max80jic.cof
 set_global_assignment -name VERILOG_FILE ip/hdmitx.v
 set_global_assignment -name VERILOG_FILE ip/pll.v
@@ -296,4 +155,8 @@ set_global_assignment -name SYSTEMVERILOG_FILE syncho.sv
 set_global_assignment -name SYSTEMVERILOG_FILE tmdsenc.sv
 set_global_assignment -name SDC_FILE max80.sdc
 set_global_assignment -name SYSTEMVERILOG_FILE max80.sv
+set_global_assignment -name SOURCE_FILE max80.pins
+set_global_assignment -name TCL_SCRIPT_FILE scripts/pins.tcl
+set_global_assignment -name SOURCE_TCL_SCRIPT_FILE scripts/pins.tcl
+
 set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top

+ 0 - 10
postmodule.tcl

@@ -1,10 +0,0 @@
-set module   [lindex $quartus(args) 0]
-set project  [lindex $quartus(args) 1]
-set revision [lindex $quartus(args) 1]
-
-set module_script "post_$module.tcl"
-
-if [file exists $module_script] {
-    project_open $project -revision $revision
-    source $module_script
-}

+ 17 - 0
scripts/pins.tcl

@@ -0,0 +1,17 @@
+# Read all .pins files in the project and create pin assignments
+
+set source_file_coll [get_all_global_assignments -name SOURCE_FILE]
+foreach_in_collection file_asgn $source_file_coll {
+    set file [lindex $file_asgn 2]
+    if {[string match -nocase *.pins $file]} {
+	set fd [open $file RDONLY]
+	while {[gets $fd line] >= 0} {
+	    set pin [string toupper [lindex $line 0]]
+	    set signal [lindex $line 1]
+	    if {[string match {[0-9A-Z]*} $pin]} {
+		set_location_assignment PIN_$pin -to $signal
+	    }
+	}
+	close $fd
+    }
+}

+ 1 - 1
post_quartus_asm.tcl → scripts/post_quartus_asm.tcl

@@ -4,7 +4,7 @@
 set source_file_coll [get_all_global_assignments -name SOURCE_FILE]
 foreach_in_collection file_asgn $source_file_coll {
     set file [lindex $file_asgn 2]
-    if [string match *.cof $file] {
+    if [string match -nocase *.cof $file] {
 	set cmd "quartus_cpf --convert \"$file\""
 	post_message -type info "Command: $cmd"
 	qexec "$cmd"

+ 15 - 0
scripts/postmodule.tcl

@@ -0,0 +1,15 @@
+#
+# Runs after the execution of each module in Quartus. This script
+# spawns a different script depending on which module was executed.
+#
+
+set module   [lindex $quartus(args) 0]
+set project  [lindex $quartus(args) 1]
+set revision [lindex $quartus(args) 2]
+
+set module_script [file join [file dirname $argv0] "post_$module.tcl"]
+
+if [file readable $module_script] {
+    project_open $project -revision $revision
+    source $module_script
+}