Przeglądaj źródła

fpga: infrastructure for building v1 and v2 FPGA

With two versions of the board coming up, use Quartus revisions to
be able to build multiple versions of the FPGA with changes at
the top level.

May want to change this to a higher top level rather than using a define?

Note: v2 does not yet compile, nor does it have the correct pin assignments.
H. Peter Anvin 3 lat temu
rodzic
commit
75a6dbc7fa

+ 1 - 1
Makefile

@@ -19,5 +19,5 @@ local.clean:
 local.spotless: local.clean
 
 # FPGA-specific targets
-program flash signalclean:
+program-% flash-% signalclean:
 	$(MAKE) -C fpga $@

+ 8 - 3
fpga/.gitignore

@@ -1,3 +1,8 @@
-output_files/*.jam
-output_files/*.map
-
+output/*.jam
+output/*.map
+output/*.jdi
+output/*.pof
+output/*.jbc
+output_files/
+*.cdf
+*.stp

+ 56 - 44
fpga/Makefile

@@ -1,62 +1,72 @@
-PROJECT = max80
-QU      = quartus
+MAKEFLAGS      += -R -r
 
-.SUFFIXES:
-
-.SECONDARY:
-
-.DELETE_ON_ERROR:
+PROJECT		= max80
+REVISIONS	= v1 # v2
+QU        	= quartus
 
 # Common options for all Quartus tools
-QPRI    = --lower_priority
-QCPF	= $(QU)_cpf $(QPRI)
-QSH	= $(QU)_sh  $(QPRI)
-QSTA	= $(QU)_sta $(QPRI)
-QPGM    = $(QU)_pgm $(QPRI)
+QPRI    	= --lower_priority
+QCPF		= $(QU)_cpf $(QPRI)
+QSH		= $(QU)_sh  $(QPRI)
+QSTA		= $(QU)_sta $(QPRI)
+QPGM    	= $(QU)_pgm $(QPRI)
 
 # Common options for Quartus in-flow tools
-QOPT    = --write_settings_files=off $(QPRI)
-QMAP    = $(QU)_map $(QOPT)
-QFIT    = $(QU)_fit $(QOPT)
-QCDB    = $(QU)_cdb $(QOPT)
-QASM    = $(QU)_asm $(QOPT)
-QPOW    = $(QU)_pow $(QOPT)
+QOPT    	= --write_settings_files=off $(QPRI)
+QMAP    	= $(QU)_map $(QOPT)
+QFIT    	= $(QU)_fit $(QOPT)
+QCDB    	= $(QU)_cdb $(QOPT)
+QASM    	= $(QU)_asm $(QOPT)
+QPOW    	= $(QU)_pow $(QOPT)
+
+outdir		= output
 
 PERL    = perl
 
 SUBDIRS = usb
 
-outdir = output_files
-
 alltarg := sof jic pow.rpt sta.rpt
-allout   = $(foreach p,$(1),$(foreach o,$(alltarg),$(outdir)/$(p).$(o)))
+allout   = $(foreach o,$(alltarg),$(outdir)/$(1).$(o))
+
+.SUFFIXES: .targets
+
+.SECONDARY:
+
+.DELETE_ON_ERROR:
 
 all:
 	$(MAKE) prereq
-	$(MAKE) targets
+	$(MAKE) $(foreach rev,$(REVISIONS),$(rev).targets)
+
+.PHONY: $(REVISIONS)
+$(REVISIONS):
+	$(MAKE) prereq
+	$(MAKE) $@.targets
 
-targets: $(call allout,$(PROJECT))
+.PHONY: %.targets
+%.targets:
+	$(MAKE) $(call allout,$*)
 
 $(outdir)/%.map.rpt: %.qsf
-	$(QMAP) $*
+	$(QMAP) $(PROJECT) -c $*
 
 $(outdir)/%.fit.rpt: $(outdir)/%.map.rpt
-	$(QFIT) $*
+	$(QFIT)  $(PROJECT) -c $*
 
 $(outdir)/%.mif_update.rpt: $(outdir)/%.fit.rpt
-	$(QCDB) --update_mif $*
+	$(QCDB) --update_mif $(PROJECT) -c $*
 
 $(outdir)/%.sof: $(outdir)/%.mif_update.rpt
-	$(QASM) $*
+	$(QASM) $(PROJECT) -c $*
 
 $(outdir)/%.sta.rpt: $(outdir)/%.fit.rpt | $(outdir)/%.sof
-	$(QSTA) $*
+	$(QSTA) $(PROJECT) -c $*
 
 $(outdir)/%.pow.rpt: $(outdir)/%.sta.rpt
-	$(QPOW) $*
+	$(QPOW) $(PROJECT) -c $*
 
 # XXX: do all .sof -> conversions using quartus_cpf
-$(outdir)/%.jic:  %jic.cof $(outdir)/%.sof ../rv32/dram.hex
+$(outdir)/%.jic:  $(PROJECT)-%.cof $(outdir)/%.sof ../rv32/dram.hex
 	$(QCPF) --convert $<
 
 # Prerequisite directories
@@ -65,8 +75,10 @@ prereq:
 
 # Clean out SignalTap
 signalclean:
-	$(PERL) -ne 'print unless (/(SIGNALTAP_FILE\b|\bENABLE_SIGNALTAP\b|\bSLD_FILE\b|SLD_NODE_)/);' < max80.qsf > max80.qsf.tmp
-	mv -f max80.qsf.tmp max80.qsf
+	for f in *.qsf; do \
+		$(PERL) -ne 'print unless (/(SIGNALTAP_FILE\b|\bENABLE_SIGNALTAP\b|\bSLD_FILE\b|SLD_NODE_)/);' < $$f > $$f.tmp &&
+		mv -f $$f.qsf.tmp $$f.qsf ;
+	done
 
 # Programming targets. Environment JTAG_CABLE can override the default,
 # which is otherwise the first cable found.
@@ -74,25 +86,25 @@ rpar := )
 JTAG_CABLE ?= $(shell jtagconfig --enum | sed -ne 's/^1$(rpar) //p')
 
 # Transient programming
-program:
-	$(QPGM) -c '$(JTAG_CABLE)' -m JTAG -o 'p;$(outdir)/$(PROJECT).sof'
+program-%:
+	$(QPGM) -c '$(JTAG_CABLE)' -m JTAG -o 'p;$(outdir)/$*.sof'
 
 # Permanent programming in flash
-flash:
-	$(QPGM) -c '$(JTAG_CABLE)' -m JTAG -i -o 'pvbi;$(outdir)/$(PROJECT).jic'
+flash-%:
+	$(QPGM) -c '$(JTAG_CABLE)' -m JTAG -i -o 'pvbi;$(outdir)/$*.jic'
 
 %.deps: %.qsf scripts/qsfdeps.pl
-	$(PERL) scripts/qsfdeps.pl $< $* > $@
+	$(PERL) scripts/qsfdeps.pl $* $@ $<
 
 clean:
 	for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done
 	rm -rf db incremental_db simulation/modelsim \
-	greybox_tmp */greybox_tmp iodevs.vh \
-	$(outdir)/*.rpt $(outdir)/*.rpt \
-	$(outdir)/*.summary $(outdir)/*.smsg \
-	$(outdir)/*.htm $(outdir)/*.htm_files \
-	$(outdir)/*.map $(outdir)/*.eqn $(outdir)/*.sld \
-	$(outdir)/*.done
+	greybox_tmp */greybox_tmp iodevs.vh output_files
+	for d in $(REVISIONS); do \
+		$$d/*.rpt $$d/*.rpt $$d/*.summary $$d/*.smsg  \
+		$$d/*.htm $$d/*.htm_files $$d/*.map $$d/*.eqn $$d/*.sld \
+		$$d/*.done ; \
+	done
 
 spotless:
 	for d in $(SUBDIRS); do $(MAKE) -C $$d spotless; done
@@ -104,4 +116,4 @@ iodevs.vh: ../iodevs.conf ../tools/iodevs.pl
 # Verilog header dependencies
 max80.sv: iodevs.vh
 
--include $(PROJECT).deps
+-include $(foreach rev,$(REVISIONS),$(rev).deps)

+ 0 - 0
fpga/max80_assignment_defaults.qdf → fpga/assignment_defaults.qdf


+ 2 - 2
fpga/max80jic.cof → fpga/max80-v1.cof

@@ -2,7 +2,7 @@
 <cof>
 	<eprom_name>MT25QL128</eprom_name>
 	<flash_loader_device>EP4CE15</flash_loader_device>
-	<output_filename>output_files/max80.jic</output_filename>
+	<output_filename>output/v1.jic</output_filename>
 	<n_pages>1</n_pages>
 	<width>1</width>
 	<mode>7</mode>
@@ -10,7 +10,7 @@
 		<user_name>Page_0</user_name>
 		<page_flags>1</page_flags>
 		<bit0>
-			<sof_filename>output_files/max80.sof</sof_filename> 
+			<sof_filename>output/v1.sof</sof_filename> 
 		</bit0>
 	</sof_data>
 	<hex_block>

+ 38 - 0
fpga/max80-v2.cof

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="US-ASCII" standalone="yes"?>
+<cof>
+	<eprom_name>MT25QL128</eprom_name>
+	<flash_loader_device>EP4CE15</flash_loader_device>
+	<output_filename>output/v2.jic</output_filename>
+	<n_pages>1</n_pages>
+	<width>1</width>
+	<mode>7</mode>
+	<sof_data>
+		<user_name>Page_0</user_name>
+		<page_flags>1</page_flags>
+		<bit0>
+			<sof_filename>output/v2.sof</sof_filename> 
+		</bit0>
+	</sof_data>
+	<hex_block>
+		<hex_filename>../rv32/dram.hex</hex_filename>
+		<hex_addressing>relative</hex_addressing>
+		<hex_offset>1048576</hex_offset>
+		<hex_little_endian>0</hex_little_endian>
+	</hex_block>
+	<version>10</version>
+	<create_cvp_file>0</create_cvp_file>
+	<create_hps_iocsr>0</create_hps_iocsr>
+	<auto_create_rpd>0</auto_create_rpd>
+	<rpd_little_endian>1</rpd_little_endian>
+	<options>
+		<map_file>1</map_file>
+	</options>
+	<advanced_options>
+		<ignore_epcs_id_check>1</ignore_epcs_id_check>
+		<ignore_condone_check>2</ignore_condone_check>
+		<plc_adjustment>0</plc_adjustment>
+		<post_chain_bitstream_pad_bytes>-1</post_chain_bitstream_pad_bytes>
+		<post_device_bitstream_pad_bytes>-1</post_device_bitstream_pad_bytes>
+		<bitslice_pre_padding>1</bitslice_pre_padding>
+	</advanced_options>
+</cof>

+ 0 - 192
fpga/max80.pins

@@ -1,192 +0,0 @@
-# Bank 1
-# j5	TMS
-# j3	nCE
-# j4	TDO
-# h4	TDI
-e1	abc_a[6]
-b1	abc_xm_x
-c2	abc_a_oe
-c1	flash_io[0]
-f3	abc_a[5]
-d2	flash_cs_n
-d1	abc_a[3]
-# f4	nSTATUS
-g5	abc_a[4]
-f2	abc_cs_n
-f1	abc_a[7]
-g2	abc_out_n[0]
-g1	abc_a[8]
-h1	flash_sck
-h2	flash_io[1]
-# h5	nCONFIG
-# h3	TCK
-
-# Bank 2
-r1	abc_xmemw80_n
-p2	abc_rst_n
-p1	abc_xmemw800_n
-m2	abc_inp_n[1]
-m1	abc_a[13]
-j2	abc_out_n[1]
-j1	abc_a[9]
-# k6	GPIO N/C
-l6	rngio[0]
-l3	abc_out_n[3]
-k1	abc_a[11]
-l2	abc_inp_n[0]
-l1	abc_a[12]
-k2	abc_out_n[4]
-n2	abc_a[14]
-n1	abc_a[15]
-k5	abc_out_n[2]
-l4	abc_a[10]
-
-# Bank 3
-m6	abc_d[1]
-p6	spi_clk
-m7	spi_miso
-t5	abc_d_ce_n
-r5	abc_d_oe
-r6	abc_resin_x
-t6	gpio[2]
-l7	gpio[0]
-r7	gpio[5]
-t7	gpio[4]
-l8	esp_io0
-m8	spi_mosi
-n8	spi_cs_esp_n
-p8	esp_int
-r8	exth_hh
-t8	abc_clk
-n3	abc_xmemfl_n
-p3	abc_d[0]
-r3	abc_d[4]
-t3	abc_d[5]
-t2	abc_d[3]
-r4	abc_d[6]
-t4	abc_d[7]
-n5	abc_d[2]
-n6	spi_cs_flash_n
-
-# Bank 4
-# l11	GPIO N/C
-# k9	GPIO N/C
-m11	hdmi_scl
-# l9	GPIO N/C
-t13	led[0]
-# m9	GPIO N/C
-# r9	GPI  VCC
-n9	exth_hb
-t9	exth_hc
-r10	gpio[3]
-t10	abc_host
-r11	exth_hd
-t11	exth_hf
-r12	exth_he
-t12	abc_xinpstb_n
-k10	board_id
-l10	abc_xoutpstb_n
-p9	gpio[1]
-n12	exth_ha
-n11	exth_hg
-r13	hdmi_sda
-t14	led[1]
-t15	hdmi_hpd
-m10	sd_dat[1]
-p11	rngio[1]
-p14	tty_dtr
-r14	led[2]
-
-# Bank 5 (2.5 V)
-# n14	GPIO N/C
-# p15	GPIO N/C
-p16	hdmi_d[2](n)
-r16	hdmi_d[2]
-# k12	GPIO N/C
-n16	hdmi_d[1](n)
-n15	hdmi_d[1]
-# l14	GPIO N/C
-# l13	GPIO N/C
-# l16	GPIO N/C
-# l15	GPIO N/C
-k16	hdmi_d[0](n)
-k15	hdmi_d[0]
-j16	hdmi_clk(n)
-j15	hdmi_clk
-# m16	GPI  GND
-# j14	GPIO N/C
-m15	clock_48
-# j12	GPIO N/C
-# j13	GPIO N/C
-
-# Bank 6
-e16	tty_txd		# BOARD REWORK!!!
-e15	rtc_32khz
-# h14	CONF_DONE
-# h13	MSEL[0]
-# h12	MSEL[1]
-# g12	MSEL[2]
-g16	sd_cmd
-g15	sd_clk
-f13	tty_rxd		# BOARD REWORK!!!
-f16	sd_dat[3]
-f15	sd_dat[0]
-b16	rtc_int_n
-f14	sd_dat[2]
-d16	tty_rts
-d15	tty_cts
-g11	rngio[2]
-c16	i2c_scl
-c15	i2c_sda
-
-# Bank 7
-d12	sr_cs_n
-c11	sr_dq[3]
-c14	sr_a[10]
-b13	sr_ba[1]
-d14	sr_a[2]
-a14	sr_a[0]
-d11	sr_dq[2]
-b14	sr_a[1]
-e11	sr_dq[1]
-e10	sr_dqm[0]
-a12	sr_dq[0]
-b12	sr_ras_n
-a11	sr_dq[5]
-b11	sr_dq[4]
-a13	sr_ba[0]
-a15	sr_a[3]
-f9	sr_we_n
-a10	sr_dq[7]
-b10	sr_dq[6]
-c9	sr_a[4]
-d9	sr_a[5]
-e9	sr_cas_n
-a9	abc_a[2]
-# b9	GPI  abc_a[2]
-
-# Bank 8
-d8	sr_dqm[1]
-e8	sr_a[6]
-a8	abc_a[0]
-f8	sr_cke
-b8	abc_a[1]
-a7	sr_a[7]
-c8	sr_a[11]
-b7	sr_a[8]
-c6	sr_dq[14]
-a6	sr_a[9]
-b6	sr_a[12]
-e7	sr_dq[9]
-e6	sr_dq[12]
-a5	sr_dq[8]
-b5	sr_dq[10]
-d6	sr_dq[13]
-a4	sr_dq[11]
-b4	abc_rdy_x
-a2	abc_int800_x
-d5	sr_dq[15]
-a3	abc_nmi_x
-b3	abc_int80_x
-# c3	GPIO N/C
-d3	sr_clk

+ 7 - 6
fpga/max80.qpf

@@ -1,6 +1,6 @@
 # -------------------------------------------------------------------------- #
 #
-# Copyright (C) 2019  Intel Corporation. All rights reserved.
+# Copyright (C) 2021  Intel Corporation. All rights reserved.
 # Your use of Intel Corporation's design tools, logic functions 
 # and other software and tools, and any partner logic 
 # functions, and any output files from any of the foregoing 
@@ -18,14 +18,15 @@
 # -------------------------------------------------------------------------- #
 #
 # Quartus Prime
-# Version 18.1.1 Build 646 04/11/2019 SJ Lite Edition
-# Date created = 13:01:33  February 22, 2021
+# Version 21.1.0 Build 842 10/21/2021 SJ Lite Edition
+# Date created = 18:25:05  December 22, 2021
 #
 # -------------------------------------------------------------------------- #
 
-QUARTUS_VERSION = "18.1"
-DATE = "13:01:33  February 22, 2021"
+QUARTUS_VERSION = "21.1"
+DATE = "18:25:05  December 22, 2021"
 
 # Revisions
 
-PROJECT_REVISION = "max80"
+PROJECT_REVISION = "v2"
+PROJECT_REVISION = "v1"

+ 5 - 13
fpga/max80.qsf

@@ -26,7 +26,7 @@
 # Notes:
 #
 # 1) The default values for assignments are stored in the file:
-#		max80_assignment_defaults.qdf
+#		v1_assignment_defaults.qdf
 #    If this file doesn't exist, see file:
 #		assignment_defaults.qdf
 #
@@ -40,10 +40,10 @@
 set_global_assignment -name FAMILY "Cyclone IV E"
 set_global_assignment -name DEVICE EP4CE15F17C8
 set_global_assignment -name TOP_LEVEL_ENTITY max80
-set_global_assignment -name ORIGINAL_QUARTUS_VERSION 18.1.1
-set_global_assignment -name PROJECT_CREATION_TIME_DATE "13:01:33  FEBRUARY 22, 2021"
+set_global_assignment -name ORIGINAL_QUARTUS_VERSION 21.1.0
+set_global_assignment -name PROJECT_CREATION_TIME_DATE "16:21:14  DECEMBER 22, 2021"
 set_global_assignment -name LAST_QUARTUS_VERSION "21.1.0 Lite Edition"
-set_global_assignment -name PROJECT_OUTPUT_DIRECTORY output_files
+set_global_assignment -name PROJECT_OUTPUT_DIRECTORY output
 set_global_assignment -name MIN_CORE_JUNCTION_TEMP 0
 set_global_assignment -name MAX_CORE_JUNCTION_TEMP 85
 set_global_assignment -name DEVICE_FILTER_PACKAGE EQFP
@@ -64,13 +64,11 @@ set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top
 set_global_assignment -name VCCA_USER_VOLTAGE 2.5V
 set_global_assignment -name POWER_PRESET_COOLING_SOLUTION "NO HEAT SINK WITH STILL AIR"
 set_global_assignment -name POWER_BOARD_THERMAL_MODEL "NONE (CONSERVATIVE)"
-set_global_assignment -name FLOW_ENABLE_POWER_ANALYZER OFF
 set_global_assignment -name POWER_DEFAULT_INPUT_IO_TOGGLE_RATE "12.5 %"
 set_global_assignment -name VHDL_INPUT_VERSION VHDL_2008
 set_global_assignment -name VHDL_SHOW_LMF_MAPPING_MESSAGES OFF
 set_global_assignment -name VERILOG_INPUT_VERSION SYSTEMVERILOG_2005
 set_global_assignment -name VERILOG_SHOW_LMF_MAPPING_MESSAGES OFF
-set_global_assignment -name SAFE_STATE_MACHINE OFF
 set_global_assignment -name REMOVE_REDUNDANT_LOGIC_CELLS ON
 set_global_assignment -name HDL_MESSAGE_LEVEL LEVEL3
 set_global_assignment -name SYNTH_PROTECT_SDC_CONSTRAINT ON
@@ -80,7 +78,6 @@ set_global_assignment -name WEAK_PULL_UP_RESISTOR ON
 set_global_assignment -name ENABLE_OCT_DONE OFF
 set_global_assignment -name ENABLE_CONFIGURATION_PINS OFF
 set_global_assignment -name ENABLE_BOOT_SEL_PIN OFF
-set_global_assignment -name EXTERNAL_FLASH_FALLBACK_ADDRESS 0
 set_global_assignment -name USE_CONFIGURATION_DEVICE ON
 set_global_assignment -name INTERNAL_FLASH_UPDATE_MODE "SINGLE COMP IMAGE"
 set_global_assignment -name CRC_ERROR_OPEN_DRAIN OFF
@@ -124,13 +121,11 @@ set_instance_assignment -name IO_STANDARD "2.5 V" -to clock_48
 
 
 set_global_assignment -name EDA_MAP_ILLEGAL_CHARACTERS ON -section_id eda_simulation
-set_global_assignment -name EDA_ENABLE_GLITCH_FILTERING OFF -section_id eda_simulation
 set_global_assignment -name EDA_WRITE_NODES_FOR_POWER_ESTIMATION ALL_NODES -section_id eda_simulation
 set_global_assignment -name EDA_TEST_BENCH_DESIGN_INSTANCE_NAME max80 -section_id eda_simulation
 set_instance_assignment -name CURRENT_STRENGTH_NEW "MAXIMUM CURRENT" -to led[1]
 set_global_assignment -name CYCLONEIII_CONFIGURATION_DEVICE EPCQ128A
 
-set_global_assignment -name GENERATE_JAM_FILE OFF
 set_global_assignment -name FORCE_CONFIGURATION_VCCIO ON
 set_global_assignment -name CONFIGURATION_VCCIO_LEVEL 3.3V
 
@@ -249,7 +244,6 @@ set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to rngio[1]
 set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to rngio[2]
 
 
-set_global_assignment -name MUX_RESTRUCTURE AUTO
 set_global_assignment -name VERILOG_FILE usb/usb_desc.v
 set_global_assignment -name SYSTEMVERILOG_FILE usb/usb_serial/src_v/usb_cdc_core.sv
 set_global_assignment -name SYSTEMVERILOG_FILE usb/usb_serial/src_v/usbf_device_core.sv
@@ -284,16 +278,14 @@ set_global_assignment -name SYSTEMVERILOG_FILE spirom.sv
 set_global_assignment -name VERILOG_FILE ip/ddio_out.v
 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 SYSTEMVERILOG_FILE transpose.sv
 set_global_assignment -name SYSTEMVERILOG_FILE synchro.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 SOURCE_TCL_SCRIPT_FILE scripts/pins.tcl
 set_global_assignment -name VERILOG_FILE ip/fifo.v
 set_global_assignment -name VERILOG_FILE ip/ddufifo.v
 
-set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
+set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top

+ 177 - 138
fpga/max80.sv

@@ -8,118 +8,140 @@
 // Sharing JTAG pins (via JTAGEN)
 `undef SHARED_JTAG
 
-module max80 (
-	      // Clock oscillator
-	      input	    clock_48, // 48 MHz
-	      input	    board_id,
-
-	      // ABC-bus
-	      input	    abc_clk, // ABC-bus 3 MHz clock
-	      input [15:0]  abc_a, // ABC address bus
-	      inout [7:0]   abc_d, // ABC data bus
-	      output	    abc_d_oe, // Data bus output enable
-	      input	    abc_rst_n, // ABC bus reset strobe
-	      input	    abc_cs_n, // ABC card select strobe
-	      input [4:0]   abc_out_n, // OUT, C1-C4 strobe
-	      input [1:0]   abc_inp_n, // INP, STATUS strobe
-	      input	    abc_xmemfl_n, // Memory read strobe
-	      input	    abc_xmemw800_n, // Memory write strobe (ABC800)
-	      input	    abc_xmemw80_n, // Memory write strobe (ABC80)
-	      input	    abc_xinpstb_n, // I/O read strobe (ABC800)
-	      input	    abc_xoutpstb_n, // I/O write strobe (ABC80)
-	      // The following are inverted versus the bus IF
-	      // the corresponding MOSFETs are installed
-	      output	    abc_rdy_x, // RDY = WAIT#
-	      output	    abc_resin_x, // System reset request
-	      output	    abc_int80_x, // System INT request (ABC80)
-	      output	    abc_int800_x, // System INT request (ABC800)
-	      output	    abc_nmi_x, // System NMI request (ABC800)
-	      output	    abc_xm_x, // System memory override (ABC800)
-	      // Host/device control
-	      output	    abc_host, // 1 = host, 0 = target
-	      output	    abc_a_oe,
-	      // Bus isolation
-	      output	    abc_d_ce_n,
-
-	      // ABC-bus extension header
-	      // (Note: cannot use an array here because HC and HH are
-	      // input only.)
-	      inout	    exth_ha,
-	      inout	    exth_hb,
-	      input	    exth_hc,
-	      inout	    exth_hd,
-	      inout	    exth_he,
-	      inout	    exth_hf,
-	      inout	    exth_hg,
-	      input	    exth_hh,
-
-	      // SDRAM bus
-	      output	    sr_clk,
-	      output	    sr_cke,
-	      output [1:0]  sr_ba, // Bank address
-	      output [12:0] sr_a, // Address within bank
-	      inout [15:0]  sr_dq, // Also known as D or IO
-	      output [1:0]  sr_dqm, // DQML and DQMH
-	      output	    sr_cs_n,
-	      output	    sr_we_n,
-	      output	    sr_cas_n,
-	      output	    sr_ras_n,
-
-	      // SD card
-	      output	    sd_clk,
-	      output	    sd_cmd,
-	      inout [3:0]   sd_dat,
-
-	      // USB serial (naming is FPGA as DCE)
-	      input	    tty_txd,
-	      inout	    tty_rxd,
-	      input	    tty_rts,
-	      output	    tty_cts,
-	      input	    tty_dtr,
-
-	      // SPI flash memory (also configuration)
-	      output	    flash_cs_n,
-	      output	    flash_sck,
-	      inout [1:0]   flash_io,
-
-	      // SPI bus (connected to ESP32 so can be bidirectional)
-	      inout	    spi_clk,
-	      inout	    spi_miso,
-	      inout	    spi_mosi,
-	      inout	    spi_cs_esp_n, // ESP32 IO10
-	      inout	    spi_cs_flash_n, // ESP32 IO01
-
-	      // Other ESP32 connections
-	      inout	    esp_io0, // ESP32 IO00
-	      inout	    esp_int, // ESP32 IO09
-
-	      // I2C bus (RTC and external)
-	      inout	    i2c_scl,
-	      inout	    i2c_sda,
-	      input	    rtc_32khz,
-	      input	    rtc_int_n,
-
-	      // LED (2 = D23/G, 1 = D22/R, 0 = D17/B)
-	      output [2:0]  led,
-
-	      // GPIO pins
-	      inout [5:0]   gpio,
-
-	      // HDMI
-	      output [2:0]  hdmi_d,
-	      output	    hdmi_clk,
-	      inout	    hdmi_scl,
-	      inout	    hdmi_sda,
-	      inout	    hdmi_hpd,
-
-	      // Unconnected pins with pullups, used for randomness
-	      inout [2:0]   rngio
-	      );
+module max80
+   (
+    // Clock oscillator
+    input 	  clock_48, // 48 MHz
+    input 	  board_id, // This better match the firmware
+
+    // ABC-bus
+    input 	  abc_clk, // ABC-bus 3 MHz clock
+    input [15:0]  abc_a, // ABC address bus
+    inout [7:0]   abc_d, // ABC data bus
+    output 	  abc_d_oe, // Data bus output enable
+    input 	  abc_rst_n, // ABC bus reset strobe
+    input 	  abc_cs_n, // ABC card select strobe
+    input [4:0]   abc_out_n, // OUT, C1-C4 strobe
+    input [1:0]   abc_inp_n, // INP, STATUS strobe
+    input 	  abc_xmemfl_n, // Memory read strobe
+    input 	  abc_xmemw800_n, // Memory write strobe (ABC800)
+    input 	  abc_xmemw80_n, // Memory write strobe (ABC80)
+    input 	  abc_xinpstb_n, // I/O read strobe (ABC800)
+    input 	  abc_xoutpstb_n, // I/O write strobe (ABC80)
+    // The following are inverted versus the bus IF
+    // the corresponding MOSFETs are installed
+    output 	  abc_rdy_x, // RDY = WAIT#
+    output 	  abc_resin_x, // System reset request
+    output 	  abc_int80_x, // System INT request (ABC80)
+    output 	  abc_int800_x, // System INT request (ABC800)
+    output 	  abc_nmi_x, // System NMI request (ABC800)
+    output 	  abc_xm_x, // System memory override (ABC800)
+    // Host/device control
+    output 	  abc_host, // 1 = host, 0 = target
+    output 	  abc_a_oe,
+    // Bus isolation
+    output 	  abc_d_ce_n,
+
+    // ABC-bus extension header
+    // (Note: cannot use an array here because HC and HH are
+    // input only.)
+    inout 	  exth_ha,
+    inout 	  exth_hb,
+    input 	  exth_hc,
+    inout 	  exth_hd,
+    inout 	  exth_he,
+    inout 	  exth_hf,
+    inout 	  exth_hg,
+    input 	  exth_hh,
+
+    // SDRAM bus
+    output 	  sr_clk,
+    output 	  sr_cke,
+    output [1:0]  sr_ba, // Bank address
+    output [12:0] sr_a, // Address within bank
+    inout [15:0]  sr_dq, // Also known as D or IO
+    output [1:0]  sr_dqm, // DQML and DQMH
+    output 	  sr_cs_n,
+    output 	  sr_we_n,
+    output 	  sr_cas_n,
+    output 	  sr_ras_n,
+
+    // SD card
+    output 	  sd_clk,
+    output 	  sd_di,
+    output 	  sd_cs_n,
+    input 	  sd_do,
+
+`ifdef MAX80_V1
+    inout [2:1]   sd_dat,
+`endif
+
+    // Serial console (naming is FPGA as DCE)
+`ifdef MAX80_V1
+    input 	  tty_txd,
+    inout 	  tty_rxd,
+    input 	  tty_rts,
+    output 	  tty_cts,
+    input 	  tty_dtr,
+`endif
+
+    // SPI flash memory (also configuration)
+    output 	  flash_cs_n,
+    output 	  flash_sck,
+    inout [1:0]   flash_io,
+
+    // SPI bus (connected to ESP32 so can be bidirectional)
+    inout 	  spi_clk,
+    inout 	  spi_miso,
+    inout 	  spi_mosi,
+    inout 	  spi_cs_esp_n, // ESP32 IO10
+    inout 	  spi_cs_flash_n, // ESP32 IO01
+
+    // Other ESP32 connections
+    inout 	  esp_io0, // ESP32 IO00
+    inout 	  esp_int, // ESP32 IO09
+
+    // I2C bus (RTC and external)
+    inout 	  i2c_scl,
+    inout 	  i2c_sda,
+    input 	  rtc_32khz,
+    input 	  rtc_int_n,
+
+    // LED (2 = D23/G, 1 = D22/R, 0 = D17/B)
+    output [2:0]  led,
+
+    // GPIO
+    inout 	  gpio,
+
+    // USB
+`ifndef MAX80_V1
+    inout 	  usb_dp,
+    inout 	  usb_dn,
+    output 	  usb_pu,
+    input 	  usb_rx,
+`endif
+
+    // HDMI
+    output [2:0]  hdmi_d,
+    output 	  hdmi_clk,
+    inout 	  hdmi_scl,
+    inout 	  hdmi_sda,
+    inout 	  hdmi_hpd,
 
+    // Unconnected pins with pullups, used for randomness
+    inout [2:0]   rngio
+    );
+
+`ifdef MAX80_V1
+   localparam max80_ver = 1;
+`endif
+`ifdef MAX80_V2
+   localparam max80_ver = 2;
+`endif
+   
    // -----------------------------------------------------------------------
    //   PLLs and reset
    // -----------------------------------------------------------------------
-
    reg			    rst_n      = 1'b0;	// Internal system reset
    reg			    hard_rst_n = 1'b0;	// Strict POR reset only
 
@@ -235,6 +257,7 @@ module max80 (
        end
 
    // Unused device stubs - remove when used
+   assign gpio = 6'bz;		// Unless assigned elsewhere
 
    // Reset in the video clock domain
    reg vid_rst_n;
@@ -431,9 +454,6 @@ module max80 (
 		  .sdram_wstrb ( abc_sr_wstrb )
 		  );
 
-   // GPIO
-   assign gpio    = 6'bzzzzzz;
-
    // Embedded RISC-V CPU
    parameter cpu_fast_mem_bits = SRAM_BITS-2; /* 2^[this] * 4 bytes */
 
@@ -572,10 +592,9 @@ module max80 (
    // Board identification
    //
    // Magic number:   "MAX8"
-   // Board revision: 1.0
+   // Board revision: 1.0/2.0
    // Board rework flags:
-   //    [0] - RTC 32 kHz pullup and serial port RxD/TxD swap
-   // [15:1] - reserved
+   //  [7:0] - reserved
    //
    wire        rtc_32khz_rework = 1'b1;
 
@@ -583,12 +602,14 @@ module max80 (
    always @(posedge sys_clk)
      board_id_q <= board_id;
 
+   wire [ 7:0] max80_fpga  = max80_ver;
    wire [ 7:0] max80_major = ~board_id_q ? 8'd2 : 8'd1;
    wire [ 7:0] max80_minor = 8'd0;
-   wire [15:0] max80_fixes = { 14'b0, rtc_32khz_rework }; // Workarounds
+   wire [ 7:0] max80_fixes = 8'b0;
 
    assign sysreg_rdata[0] = SYS_MAGIC_MAX80;
-   assign sysreg_rdata[1] = { max80_major, max80_minor, max80_fixes };
+   assign sysreg_rdata[1] = { max80_fpga, max80_major,
+			      max80_minor, max80_fixes };
 
    // System reset
    wire        usb_rxd_break;
@@ -689,9 +710,8 @@ module max80 (
 	       );
 
    //
-   // Serial port. Direct to the CP2102N for reworked
-   // boards or to GPIO for non-reworked boards, depending on
-   // whether DTR# is asserted on either.
+   // Serial port. Direct to the CP2102N for v1 boards
+   // boards or to GPIO for v2 boards.
    //
    // The GPIO numbering matches the order of pins for FT[2]232H.
    // gpio[0] - TxD
@@ -705,6 +725,19 @@ module max80 (
    wire        tty_cts_out;	// Assert CTS# externally
    wire        tty_rts_in;	// RTS# received from outside
 
+`ifdef MAX80_V1
+   assign tty_data_in      = tty_txd;
+   assign tty_rxd          = tty_dtr ? 1'bz : tty_data_out;
+   assign tty_rts_in       = tty_rts;
+   assign tty_cts          = tty_cts_out;
+`else
+   wire   tty_dtr          = gpio[4];
+   assign tty_data_in      = gpio[0];
+   assign gpio[1]          = tty_dtr ? 1'bz : tty_data_out;
+   assign tty_rts_in       = gpio[2];
+   assign gpio[3]          = tty_cts_out;
+`endif
+
    assign tty_cts_out  = 1'b0;	// Assert CTS#
    tty console (
 	    .rst_n ( hard_rst_n ),
@@ -720,22 +753,28 @@ module max80 (
 	    .tty_txd ( tty_data_out ) // DTE -> DCE
 	    );
 
-   max80_usb usb (
-		  .rst_n         ( hard_rst_n ),
-		  .clock48       ( usb_clk ),
-		  .tty_rxd       ( ),
-		  .tty_rxd_break ( usb_rxd_break ),
-		  .tty_txd       ( tty_data_out ),
-		  .usb_dp        ( gpio[3] ),
-		  .usb_dn        ( gpio[5] ),
-		  .usb_pu        ( gpio[1] )
-		  );
-
-   assign tty_data_in      = tty_txd;
-   assign tty_rxd          = tty_dtr ? 1'bz : tty_data_out;
-   assign tty_rts_in       = tty_rts;
-   assign tty_cts          = tty_cts_out;
+`ifdef MAX80_V1
+   wire   usb_rx = 1'bx;
+`endif
+   
+   max80_usb #(.have_usb_rx(max80_ver > 1))
+   usb (
+	.rst_n         ( hard_rst_n ),
+	.clock48       ( usb_clk ),
+	.tty_rxd       ( ),
+	.tty_rxd_break ( usb_rxd_break ),
+	.tty_txd       ( tty_data_out ),
+	.usb_dp        ( usb_dp ),
+	.usb_dn        ( usb_pn ),
+	.usb_pu        ( usb_pu ),
+	.usb_rx        ( usb_rx )
+	);
 
+`ifdef MAX80_V1
+   assign sd_dat[2:1] = 2'bzz;
+   wire   sd_cd_n = 1'b0;
+`endif
+   
    // SD card
    sdcard #(
 	    .with_irq_mask ( 8'b0000_0001 )
@@ -743,11 +782,11 @@ module max80 (
    sdcard (
 	   .rst_n   ( rst_n ),
 	   .clk     ( sys_clk ),
-	   .sd_cs_n ( sd_dat[3] ),
-	   .sd_di   ( sd_cmd ),
+	   .sd_cs_n ( sd_cs_n ),
+	   .sd_di   ( sd_di ),
 	   .sd_sclk ( sd_clk ),
-	   .sd_do   ( sd_dat[0] ),
-	   .sd_cd_n ( 1'b0 ),
+	   .sd_do   ( sd_do ),
+	   .sd_cd_n ( sd_cd_n ),
 	   .sd_irq_n ( 1'b1 ),
 
 	   .wdata   ( cpu_mem_wdata ),

BIN
fpga/output_files/max80.jic → fpga/output/v1.jic


+ 327 - 0
fpga/output/v1.pin

@@ -0,0 +1,327 @@
+ -- Copyright (C) 2021  Intel Corporation. All rights reserved.
+ -- Your use of Intel Corporation's design tools, logic functions 
+ -- and other software and tools, and any partner logic 
+ -- functions, and any output files from any of the foregoing 
+ -- (including device programming or simulation files), and any 
+ -- associated documentation or information are expressly subject 
+ -- to the terms and conditions of the Intel Program License 
+ -- Subscription Agreement, the Intel Quartus Prime License Agreement,
+ -- the Intel FPGA IP License Agreement, or other applicable license
+ -- agreement, including, without limitation, that your use is for
+ -- the sole purpose of programming logic devices manufactured by
+ -- Intel and sold by Intel or its authorized distributors.  Please
+ -- refer to the applicable agreement for further details, at
+ -- https://fpgasoftware.intel.com/eula.
+ -- 
+ -- This is a Quartus Prime output file. It is for reporting purposes only, and is
+ -- not intended for use as a Quartus Prime input file. This file cannot be used
+ -- to make Quartus Prime pin assignments - for instructions on how to make pin
+ -- assignments, please see Quartus Prime help.
+ ---------------------------------------------------------------------------------
+
+
+
+ ---------------------------------------------------------------------------------
+ -- NC            : No Connect. This pin has no internal connection to the device.
+ -- DNU           : Do Not Use. This pin MUST NOT be connected.
+ -- VCCINT        : Dedicated power pin, which MUST be connected to VCC  (1.2V).
+ -- VCCIO         : Dedicated power pin, which MUST be connected to VCC
+ --                 of its bank.
+ --                  Bank 1:       3.3V
+ --                  Bank 2:       3.3V
+ --                  Bank 3:       3.3V
+ --                  Bank 4:       3.3V
+ --                  Bank 5:       2.5V
+ --                  Bank 6:       3.3V
+ --                  Bank 7:       3.3V
+ --                  Bank 8:       3.3V
+ -- GND           : Dedicated ground pin. Dedicated GND pins MUST be connected to GND.
+ --                  It can also be used to report unused dedicated pins. The connection
+ --                  on the board for unused dedicated pins depends on whether this will
+ --                  be used in a future design. One example is device migration. When
+ --                  using device migration, refer to the device pin-tables. If it is a
+ --                  GND pin in the pin table or if it will not be used in a future design
+ --                  for another purpose the it MUST be connected to GND. If it is an unused
+ --                  dedicated pin, then it can be connected to a valid signal on the board
+ --                  (low, high, or toggling) if that signal is required for a different
+ --                  revision of the design.
+ -- GND+          : Unused input pin. It can also be used to report unused dual-purpose pins.
+ --                  This pin should be connected to GND. It may also be connected  to a
+ --                  valid signal  on the board  (low, high, or toggling)  if that signal
+ --                  is required for a different revision of the design.
+ -- GND*          : Unused  I/O  pin. Connect each pin marked GND* directly to GND
+ --                  or leave it unconnected.
+ -- RESERVED      : Unused I/O pin, which MUST be left unconnected.
+ -- RESERVED_INPUT    : Pin is tri-stated and should be connected to the board.
+ -- RESERVED_INPUT_WITH_WEAK_PULLUP    : Pin is tri-stated with internal weak pull-up resistor.
+ -- RESERVED_INPUT_WITH_BUS_HOLD       : Pin is tri-stated with bus-hold circuitry.
+ -- RESERVED_OUTPUT_DRIVEN_HIGH        : Pin is output driven high.
+ ---------------------------------------------------------------------------------
+
+
+
+ ---------------------------------------------------------------------------------
+ -- Pin directions (input, output or bidir) are based on device operating in user mode.
+ ---------------------------------------------------------------------------------
+
+Quartus Prime Version 21.1.0 Build 842 10/21/2021 SJ Lite Edition
+CHIP  "v1"  ASSIGNED TO AN: EP4CE15F17C8
+
+Pin Name/Usage               : Location  : Dir.   : I/O Standard      : Voltage : I/O Bank  : User Assignment
+-------------------------------------------------------------------------------------------------------------
+VCCIO8                       : A1        : power  :                   : 3.3V    : 8         :                
+abc_out_n[1]                 : A2        : input  : 3.3-V LVTTL       :         : 8         : N              
+abc_out_n[2]                 : A3        : input  : 3.3-V LVTTL       :         : 8         : N              
+sr_dq[6]                     : A4        : bidir  : 3.3-V LVTTL       :         : 8         : N              
+sr_dq[10]                    : A5        : bidir  : 3.3-V LVTTL       :         : 8         : N              
+sr_dq[12]                    : A6        : bidir  : 3.3-V LVTTL       :         : 8         : N              
+sr_dq[5]                     : A7        : bidir  : 3.3-V LVTTL       :         : 8         : N              
+GND+                         : A8        :        :                   :         : 8         :                
+GND+                         : A9        :        :                   :         : 7         :                
+abc_a[6]                     : A10       : input  : 3.3-V LVTTL       :         : 7         : N              
+abc_xinpstb_n                : A11       : input  : 3.3-V LVTTL       :         : 7         : N              
+abc_a_oe                     : A12       : output : 3.3-V LVTTL       :         : 7         : N              
+abc_int800_x                 : A13       : output : 3.3-V LVTTL       :         : 7         : N              
+spi_mosi                     : A14       : bidir  : 3.3-V LVTTL       :         : 7         : N              
+abc_int80_x                  : A15       : output : 3.3-V LVTTL       :         : 7         : N              
+VCCIO7                       : A16       : power  :                   : 3.3V    : 7         :                
+abc_out_n[4]                 : B1        : input  : 3.3-V LVTTL       :         : 1         : N              
+GND                          : B2        : gnd    :                   :         :           :                
+abc_d_oe                     : B3        : output : 3.3-V LVTTL       :         : 8         : N              
+sr_dq[15]                    : B4        : bidir  : 3.3-V LVTTL       :         : 8         : N              
+sr_dq[14]                    : B5        : bidir  : 3.3-V LVTTL       :         : 8         : N              
+sr_dq[7]                     : B6        : bidir  : 3.3-V LVTTL       :         : 8         : N              
+sr_dq[8]                     : B7        : bidir  : 3.3-V LVTTL       :         : 8         : N              
+GND+                         : B8        :        :                   :         : 8         :                
+GND+                         : B9        :        :                   :         : 7         :                
+abc_a[9]                     : B10       : input  : 3.3-V LVTTL       :         : 7         : N              
+abc_xoutpstb_n               : B11       : input  : 3.3-V LVTTL       :         : 7         : N              
+esp_io0                      : B12       : bidir  : 3.3-V LVTTL       :         : 7         : N              
+spi_clk                      : B13       : bidir  : 3.3-V LVTTL       :         : 7         : N              
+spi_cs_esp_n                 : B14       : bidir  : 3.3-V LVTTL       :         : 7         : N              
+GND                          : B15       : gnd    :                   :         :           :                
+abc_a[15]                    : B16       : input  : 3.3-V LVTTL       :         : 6         : N              
+sr_dqm[1]                    : C1        : output : 3.3-V LVTTL       :         : 1         : N              
+sr_dq[13]                    : C2        : bidir  : 3.3-V LVTTL       :         : 1         : N              
+sr_dqm[0]                    : C3        : output : 3.3-V LVTTL       :         : 8         : N              
+VCCIO8                       : C4        : power  :                   : 3.3V    : 8         :                
+GND                          : C5        : gnd    :                   :         :           :                
+abc_a[3]                     : C6        : input  : 3.3-V LVTTL       :         : 8         : N              
+VCCIO8                       : C7        : power  :                   : 3.3V    : 8         :                
+sr_a[3]                      : C8        : output : 3.3-V LVTTL       :         : 8         : N              
+abc_xmemw800_n               : C9        : input  : 3.3-V LVTTL       :         : 7         : N              
+VCCIO7                       : C10       : power  :                   : 3.3V    : 7         :                
+spi_cs_flash_n               : C11       : bidir  : 3.3-V LVTTL       :         : 7         : N              
+GND                          : C12       : gnd    :                   :         :           :                
+VCCIO7                       : C13       : power  :                   : 3.3V    : 7         :                
+abc_host                     : C14       : output : 3.3-V LVTTL       :         : 7         : N              
+GND*                         : C15       :        :                   :         : 6         :                
+hdmi_hpd                     : C16       : bidir  : 3.3-V LVTTL       :         : 6         : N              
+sr_dq[11]                    : D1        : bidir  : 3.3-V LVTTL       :         : 1         : N              
+sr_cs_n                      : D2        : output : 3.3-V LVTTL       :         : 1         : N              
+sr_clk                       : D3        : output : 3.3-V LVTTL       :         : 8         : N              
+VCCD_PLL3                    : D4        : power  :                   : 1.2V    :           :                
+sr_dq[0]                     : D5        : bidir  : 3.3-V LVTTL       :         : 8         : N              
+sr_dq[9]                     : D6        : bidir  : 3.3-V LVTTL       :         : 8         : N              
+GND                          : D7        : gnd    :                   :         :           :                
+sr_ras_n                     : D8        : output : 3.3-V LVTTL       :         : 8         : N              
+abc_a[7]                     : D9        : input  : 3.3-V LVTTL       :         : 7         : N              
+GND                          : D10       : gnd    :                   :         :           :                
+tty_rts                      : D11       : input  : 3.3-V LVTTL       :         : 7         : N              
+GND*                         : D12       :        :                   :         : 7         :                
+VCCD_PLL2                    : D13       : power  :                   : 1.2V    :           :                
+sr_cke                       : D14       : output : 3.3-V LVTTL       :         : 7         : N              
+sd_dat[2]                    : D15       : bidir  : 3.3-V LVTTL       :         : 6         : N              
+exth_ha                      : D16       : bidir  : 3.3-V LVTTL       :         : 6         : N              
+abc_a[0]                     : E1        : input  : 3.3-V LVTTL       :         : 1         : N              
+GND                          : E2        : gnd    :                   :         :           :                
+VCCIO1                       : E3        : power  :                   : 3.3V    : 1         :                
+GND                          : E4        : gnd    :                   :         :           :                
+GNDA3                        : E5        : gnd    :                   :         :           :                
+sr_a[10]                     : E6        : output : 3.3-V LVTTL       :         : 8         : N              
+sr_we_n                      : E7        : output : 3.3-V LVTTL       :         : 8         : N              
+sr_a[0]                      : E8        : output : 3.3-V LVTTL       :         : 8         : N              
+abc_a[2]                     : E9        : input  : 3.3-V LVTTL       :         : 7         : N              
+esp_int                      : E10       : bidir  : 3.3-V LVTTL       :         : 7         : N              
+rtc_int_n                    : E11       : input  : 3.3-V LVTTL       :         : 7         : N              
+GNDA2                        : E12       : gnd    :                   :         :           :                
+GND                          : E13       : gnd    :                   :         :           :                
+VCCIO6                       : E14       : power  :                   : 3.3V    : 6         :                
+clock_48                     : E15       : input  : 2.5 V             :         : 6         : N              
+rtc_32khz                    : E16       : input  : 3.3-V LVTTL       :         : 6         : N              
+sr_dq[3]                     : F1        : bidir  : 3.3-V LVTTL       :         : 1         : N              
+sr_dq[1]                     : F2        : bidir  : 3.3-V LVTTL       :         : 1         : N              
+abc_d[3]                     : F3        : bidir  : 3.3-V LVTTL       :         : 1         : N              
+nSTATUS                      : F4        :        :                   :         : 1         :                
+VCCA3                        : F5        : power  :                   : 2.5V    :           :                
+GND                          : F6        : gnd    :                   :         :           :                
+VCCINT                       : F7        : power  :                   : 1.2V    :           :                
+sr_a[1]                      : F8        : output : 3.3-V LVTTL       :         : 8         : N              
+abc_a[10]                    : F9        : input  : 3.3-V LVTTL       :         : 7         : N              
+GND                          : F10       : gnd    :                   :         :           :                
+VCCINT                       : F11       : power  :                   : 1.2V    :           :                
+VCCA2                        : F12       : power  :                   : 2.5V    :           :                
+GND*                         : F13       :        :                   :         : 6         :                
+hdmi_scl                     : F14       : bidir  : 3.3-V LVTTL       :         : 6         : N              
+GND*                         : F15       :        :                   :         : 6         :                
+GND*                         : F16       :        :                   :         : 6         :                
+abc_d[1]                     : G1        : bidir  : 3.3-V LVTTL       :         : 1         : N              
+sr_dq[4]                     : G2        : bidir  : 3.3-V LVTTL       :         : 1         : N              
+VCCIO1                       : G3        : power  :                   : 3.3V    : 1         :                
+GND                          : G4        : gnd    :                   :         :           :                
+sr_dq[2]                     : G5        : bidir  : 3.3-V LVTTL       :         : 1         : N              
+VCCINT                       : G6        : power  :                   : 1.2V    :           :                
+VCCINT                       : G7        : power  :                   : 1.2V    :           :                
+VCCINT                       : G8        : power  :                   : 1.2V    :           :                
+VCCINT                       : G9        : power  :                   : 1.2V    :           :                
+VCCINT                       : G10       : power  :                   : 1.2V    :           :                
+spi_miso                     : G11       : bidir  : 3.3-V LVTTL       :         : 6         : N              
+MSEL2                        : G12       :        :                   :         : 6         :                
+GND                          : G13       : gnd    :                   :         :           :                
+VCCIO6                       : G14       : power  :                   : 3.3V    : 6         :                
+abc_a[4]                     : G15       : input  : 3.3-V LVTTL       :         : 6         : N              
+exth_he                      : G16       : bidir  : 3.3-V LVTTL       :         : 6         : N              
+GND*                         : H1        :        :                   :         : 1         :                
+sr_cas_n                     : H2        : output : 3.3-V LVTTL       :         : 1         : N              
+TCK                          : H3        : input  :                   :         : 1         :                
+TDI                          : H4        : input  :                   :         : 1         :                
+nCONFIG                      : H5        :        :                   :         : 1         :                
+VCCINT                       : H6        : power  :                   : 1.2V    :           :                
+GND                          : H7        : gnd    :                   :         :           :                
+GND                          : H8        : gnd    :                   :         :           :                
+GND                          : H9        : gnd    :                   :         :           :                
+GND                          : H10       : gnd    :                   :         :           :                
+VCCINT                       : H11       : power  :                   : 1.2V    :           :                
+MSEL1                        : H12       :        :                   :         : 6         :                
+MSEL0                        : H13       :        :                   :         : 6         :                
+CONF_DONE                    : H14       :        :                   :         : 6         :                
+GND                          : H15       : gnd    :                   :         :           :                
+GND                          : H16       : gnd    :                   :         :           :                
+sr_a[8]                      : J1        : output : 3.3-V LVTTL       :         : 2         : N              
+sr_a[7]                      : J2        : output : 3.3-V LVTTL       :         : 2         : N              
+nCE                          : J3        :        :                   :         : 1         :                
+TDO                          : J4        : output :                   :         : 1         :                
+TMS                          : J5        : input  :                   :         : 1         :                
+VCCINT                       : J6        : power  :                   : 1.2V    :           :                
+GND                          : J7        : gnd    :                   :         :           :                
+GND                          : J8        : gnd    :                   :         :           :                
+GND                          : J9        : gnd    :                   :         :           :                
+GND                          : J10       : gnd    :                   :         :           :                
+GND                          : J11       : gnd    :                   :         :           :                
+abc_xmemw80_n                : J12       : input  : 3.3-V LVTTL       :         : 5         : N              
+abc_cs_n                     : J13       : input  : 3.3-V LVTTL       :         : 5         : N              
+abc_xmemfl_n                 : J14       : input  : 3.3-V LVTTL       :         : 5         : N              
+GND*                         : J15       :        :                   :         : 5         :                
+GND*                         : J16       :        :                   :         : 5         :                
+abc_d[4]                     : K1        : bidir  : 3.3-V LVTTL       :         : 2         : N              
+sd_do                        : K2        : input  : 3.3-V LVTTL       :         : 2         : N              
+VCCIO2                       : K3        : power  :                   : 3.3V    : 2         :                
+GND                          : K4        : gnd    :                   :         :           :                
+abc_rdy_x                    : K5        : output : 3.3-V LVTTL       :         : 2         : N              
+abc_d[5]                     : K6        : bidir  : 3.3-V LVTTL       :         : 2         : N              
+VCCINT                       : K7        : power  :                   : 1.2V    :           :                
+GND                          : K8        : gnd    :                   :         :           :                
+sr_a[11]                     : K9        : output : 3.3-V LVTTL       :         : 4         : N              
+abc_a[13]                    : K10       : input  : 3.3-V LVTTL       :         : 4         : N              
+VCCINT                       : K11       : power  :                   : 1.2V    :           :                
+GND*                         : K12       :        :                   :         : 5         :                
+GND                          : K13       : gnd    :                   :         :           :                
+VCCIO5                       : K14       : power  :                   : 2.5V    : 5         :                
+hdmi_clk                     : K15       : output : LVDS              :         : 5         : N              
+hdmi_clk(n)                  : K16       : output : LVDS              :         : 5         : N              
+abc_d[2]                     : L1        : bidir  : 3.3-V LVTTL       :         : 2         : N              
+abc_d[6]                     : L2        : bidir  : 3.3-V LVTTL       :         : 2         : N              
+abc_d[0]                     : L3        : bidir  : 3.3-V LVTTL       :         : 2         : N              
+i2c_scl                      : L4        : bidir  : 3.3-V LVTTL       :         : 2         : N              
+VCCA1                        : L5        : power  :                   : 2.5V    :           :                
+abc_d[7]                     : L6        : bidir  : 3.3-V LVTTL       :         : 2         : N              
+flash_io[1]                  : L7        : bidir  : 3.3-V LVTTL       :         : 3         : N              
+sr_ba[1]                     : L8        : output : 3.3-V LVTTL       :         : 3         : N              
+tty_rxd                      : L9        : bidir  : 3.3-V LVTTL       :         : 4         : N              
+tty_txd                      : L10       : input  : 3.3-V LVTTL       :         : 4         : N              
+exth_hd                      : L11       : bidir  : 3.3-V LVTTL       :         : 4         : N              
+VCCA4                        : L12       : power  :                   : 2.5V    :           :                
+hdmi_d[2](n)                 : L13       : output : LVDS              :         : 5         : N              
+GND*                         : L14       :        :                   :         : 5         :                
+GND*                         : L15       :        :                   :         : 5         :                
+hdmi_d[2]                    : L16       : output : LVDS              :         : 5         : N              
+exth_hh                      : M1        : input  : 3.3-V LVTTL       :         : 2         : N              
+exth_hc                      : M2        : input  : 3.3-V LVTTL       :         : 2         : N              
+VCCIO2                       : M3        : power  :                   : 3.3V    : 2         :                
+GND                          : M4        : gnd    :                   :         :           :                
+GNDA1                        : M5        : gnd    :                   :         :           :                
+sr_a[6]                      : M6        : output : 3.3-V LVTTL       :         : 3         : N              
+led[2]                       : M7        : output : 3.3-V LVTTL       :         : 3         : N              
+sr_a[12]                     : M8        : output : 3.3-V LVTTL       :         : 3         : N              
+abc_a[12]                    : M9        : input  : 3.3-V LVTTL       :         : 4         : N              
+GND*                         : M10       :        :                   :         : 4         :                
+exth_hb                      : M11       : bidir  : 3.3-V LVTTL       :         : 4         : N              
+GNDA4                        : M12       : gnd    :                   :         :           :                
+GND                          : M13       : gnd    :                   :         :           :                
+VCCIO5                       : M14       : power  :                   : 2.5V    : 5         :                
+GND+                         : M15       :        :                   :         : 5         :                
+GND+                         : M16       :        :                   :         : 5         :                
+rngio[1]                     : N1        : bidir  : 3.3-V LVTTL       :         : 2         : N              
+sd_cs_n                      : N2        : output : 3.3-V LVTTL       :         : 2         : N              
+rngio[0]                     : N3        : bidir  : 3.3-V LVTTL       :         : 3         : N              
+VCCD_PLL1                    : N4        : power  :                   : 1.2V    :           :                
+abc_out_n[3]                 : N5        : input  : 3.3-V LVTTL       :         : 3         : N              
+sr_a[2]                      : N6        : output : 3.3-V LVTTL       :         : 3         : N              
+GND                          : N7        : gnd    :                   :         :           :                
+flash_sck                    : N8        : output : 3.3-V LVTTL       :         : 3         : N              
+abc_a[5]                     : N9        : input  : 3.3-V LVTTL       :         : 4         : N              
+GND                          : N10       : gnd    :                   :         :           :                
+exth_hf                      : N11       : bidir  : 3.3-V LVTTL       :         : 4         : N              
+gpio                         : N12       : bidir  : 3.3-V LVTTL       :         : 4         : N              
+VCCD_PLL4                    : N13       : power  :                   : 1.2V    :           :                
+GND*                         : N14       :        :                   :         : 5         :                
+hdmi_d[1]                    : N15       : output : LVDS              :         : 5         : N              
+hdmi_d[1](n)                 : N16       : output : LVDS              :         : 5         : N              
+abc_nmi_x                    : P1        : output : 3.3-V LVTTL       :         : 2         : N              
+abc_out_n[0]                 : P2        : input  : 3.3-V LVTTL       :         : 2         : N              
+abc_inp_n[1]                 : P3        : input  : 3.3-V LVTTL       :         : 3         : N              
+VCCIO3                       : P4        : power  :                   : 3.3V    : 3         :                
+GND                          : P5        : gnd    :                   :         :           :                
+led[0]                       : P6        : output : 3.3-V LVTTL       :         : 3         : N              
+VCCIO3                       : P7        : power  :                   : 3.3V    : 3         :                
+sr_ba[0]                     : P8        : output : 3.3-V LVTTL       :         : 3         : N              
+abc_xm_x                     : P9        : output : 3.3-V LVTTL       :         : 4         : N              
+VCCIO4                       : P10       : power  :                   : 3.3V    : 4         :                
+tty_cts                      : P11       : output : 3.3-V LVTTL       :         : 4         : N              
+GND                          : P12       : gnd    :                   :         :           :                
+VCCIO4                       : P13       : power  :                   : 3.3V    : 4         :                
+hdmi_sda                     : P14       : bidir  : 3.3-V LVTTL       :         : 4         : N              
+GND*                         : P15       :        :                   :         : 5         :                
+hdmi_d[0](n)                 : P16       : output : LVDS              :         : 5         : N              
+i2c_sda                      : R1        : bidir  : 3.3-V LVTTL       :         : 2         : N              
+GND                          : R2        : gnd    :                   :         :           :                
+sd_di                        : R3        : output : 3.3-V LVTTL       :         : 3         : N              
+abc_resin_x                  : R4        : output : 3.3-V LVTTL       :         : 3         : N              
+sr_a[4]                      : R5        : output : 3.3-V LVTTL       :         : 3         : N              
+sr_a[5]                      : R6        : output : 3.3-V LVTTL       :         : 3         : N              
+flash_cs_n                   : R7        : output : 3.3-V LVTTL       :         : 3         : N              
+abc_clk                      : R8        : input  : 3.3-V LVTTL       :         : 3         : N              
+GND+                         : R9        :        :                   :         : 4         :                
+abc_a[14]                    : R10       : input  : 3.3-V LVTTL       :         : 4         : N              
+abc_a[1]                     : R11       : input  : 3.3-V LVTTL       :         : 4         : N              
+abc_a[11]                    : R12       : input  : 3.3-V LVTTL       :         : 4         : N              
+abc_d_ce_n                   : R13       : output : 3.3-V LVTTL       :         : 4         : N              
+exth_hg                      : R14       : bidir  : 3.3-V LVTTL       :         : 4         : N              
+GND                          : R15       : gnd    :                   :         :           :                
+hdmi_d[0]                    : R16       : output : LVDS              :         : 5         : N              
+VCCIO3                       : T1        : power  :                   : 3.3V    : 3         :                
+rngio[2]                     : T2        : bidir  : 3.3-V LVTTL       :         : 3         : N              
+abc_rst_n                    : T3        : input  : 3.3-V LVTTL       :         : 3         : N              
+abc_inp_n[0]                 : T4        : input  : 3.3-V LVTTL       :         : 3         : N              
+led[1]                       : T5        : output : 3.3-V LVTTL       :         : 3         : N              
+sr_a[9]                      : T6        : output : 3.3-V LVTTL       :         : 3         : N              
+flash_io[0]                  : T7        : bidir  : 3.3-V LVTTL       :         : 3         : N              
+GND+                         : T8        :        :                   :         : 3         :                
+GND+                         : T9        :        :                   :         : 4         :                
+sd_clk                       : T10       : output : 3.3-V LVTTL       :         : 4         : N              
+abc_a[8]                     : T11       : input  : 3.3-V LVTTL       :         : 4         : N              
+board_id                     : T12       : input  : 3.3-V LVTTL       :         : 4         : N              
+tty_dtr                      : T13       : input  : 3.3-V LVTTL       :         : 4         : N              
+sd_dat[1]                    : T14       : bidir  : 3.3-V LVTTL       :         : 4         : N              
+GND*                         : T15       :        :                   :         : 4         :                
+VCCIO4                       : T16       : power  :                   : 3.3V    : 4         :                

BIN
fpga/output/v1.sof


+ 0 - 16
fpga/output_files/max80.jdi

@@ -1,16 +0,0 @@
-<sld_project_info>
-  <project>
-    <hash md5_digest_80b="abf5fd392e1a6e33688a"/>
-  </project>
-  <file_info>
-    <file device="EP4CE15F17C8" path="max80.sof" usercode="0xFFFFFFFF"/>
-  </file_info>
-  <sld_infos>
-    <sld_info hpath="rng:rng|int_osc:int_osc" name="int_osc">
-      <assignment_values>
-        <assignment_value text="QSYS_NAME int_osc HAS_SOPCINFO 1 GENERATION_ID 1639116036"/>
-      </assignment_values>
-      <parameters/>
-    </sld_info>
-  </sld_infos>
-</sld_project_info>

+ 0 - 327
fpga/output_files/max80.pin

@@ -1,327 +0,0 @@
- -- Copyright (C) 2021  Intel Corporation. All rights reserved.
- -- Your use of Intel Corporation's design tools, logic functions 
- -- and other software and tools, and any partner logic 
- -- functions, and any output files from any of the foregoing 
- -- (including device programming or simulation files), and any 
- -- associated documentation or information are expressly subject 
- -- to the terms and conditions of the Intel Program License 
- -- Subscription Agreement, the Intel Quartus Prime License Agreement,
- -- the Intel FPGA IP License Agreement, or other applicable license
- -- agreement, including, without limitation, that your use is for
- -- the sole purpose of programming logic devices manufactured by
- -- Intel and sold by Intel or its authorized distributors.  Please
- -- refer to the applicable agreement for further details, at
- -- https://fpgasoftware.intel.com/eula.
- -- 
- -- This is a Quartus Prime output file. It is for reporting purposes only, and is
- -- not intended for use as a Quartus Prime input file. This file cannot be used
- -- to make Quartus Prime pin assignments - for instructions on how to make pin
- -- assignments, please see Quartus Prime help.
- ---------------------------------------------------------------------------------
-
-
-
- ---------------------------------------------------------------------------------
- -- NC            : No Connect. This pin has no internal connection to the device.
- -- DNU           : Do Not Use. This pin MUST NOT be connected.
- -- VCCINT        : Dedicated power pin, which MUST be connected to VCC  (1.2V).
- -- VCCIO         : Dedicated power pin, which MUST be connected to VCC
- --                 of its bank.
- --                  Bank 1:       3.3V
- --                  Bank 2:       3.3V
- --                  Bank 3:       3.3V
- --                  Bank 4:       3.3V
- --                  Bank 5:       2.5V
- --                  Bank 6:       3.3V
- --                  Bank 7:       3.3V
- --                  Bank 8:       3.3V
- -- GND           : Dedicated ground pin. Dedicated GND pins MUST be connected to GND.
- --                  It can also be used to report unused dedicated pins. The connection
- --                  on the board for unused dedicated pins depends on whether this will
- --                  be used in a future design. One example is device migration. When
- --                  using device migration, refer to the device pin-tables. If it is a
- --                  GND pin in the pin table or if it will not be used in a future design
- --                  for another purpose the it MUST be connected to GND. If it is an unused
- --                  dedicated pin, then it can be connected to a valid signal on the board
- --                  (low, high, or toggling) if that signal is required for a different
- --                  revision of the design.
- -- GND+          : Unused input pin. It can also be used to report unused dual-purpose pins.
- --                  This pin should be connected to GND. It may also be connected  to a
- --                  valid signal  on the board  (low, high, or toggling)  if that signal
- --                  is required for a different revision of the design.
- -- GND*          : Unused  I/O  pin. Connect each pin marked GND* directly to GND
- --                  or leave it unconnected.
- -- RESERVED      : Unused I/O pin, which MUST be left unconnected.
- -- RESERVED_INPUT    : Pin is tri-stated and should be connected to the board.
- -- RESERVED_INPUT_WITH_WEAK_PULLUP    : Pin is tri-stated with internal weak pull-up resistor.
- -- RESERVED_INPUT_WITH_BUS_HOLD       : Pin is tri-stated with bus-hold circuitry.
- -- RESERVED_OUTPUT_DRIVEN_HIGH        : Pin is output driven high.
- ---------------------------------------------------------------------------------
-
-
-
- ---------------------------------------------------------------------------------
- -- Pin directions (input, output or bidir) are based on device operating in user mode.
- ---------------------------------------------------------------------------------
-
-Quartus Prime Version 21.1.0 Build 842 10/21/2021 SJ Lite Edition
-CHIP  "max80"  ASSIGNED TO AN: EP4CE15F17C8
-
-Pin Name/Usage               : Location  : Dir.   : I/O Standard      : Voltage : I/O Bank  : User Assignment
--------------------------------------------------------------------------------------------------------------
-VCCIO8                       : A1        : power  :                   : 3.3V    : 8         :                
-abc_int800_x                 : A2        : output : 3.3-V LVTTL       :         : 8         : Y              
-abc_nmi_x                    : A3        : output : 3.3-V LVTTL       :         : 8         : Y              
-sr_dq[11]                    : A4        : bidir  : 3.3-V LVTTL       :         : 8         : Y              
-sr_dq[8]                     : A5        : bidir  : 3.3-V LVTTL       :         : 8         : Y              
-sr_a[9]                      : A6        : output : 3.3-V LVTTL       :         : 8         : Y              
-sr_a[7]                      : A7        : output : 3.3-V LVTTL       :         : 8         : Y              
-abc_a[0]                     : A8        : input  : 3.3-V LVTTL       :         : 8         : Y              
-abc_a[2]                     : A9        : input  : 3.3-V LVTTL       :         : 7         : Y              
-sr_dq[7]                     : A10       : bidir  : 3.3-V LVTTL       :         : 7         : Y              
-sr_dq[5]                     : A11       : bidir  : 3.3-V LVTTL       :         : 7         : Y              
-sr_dq[0]                     : A12       : bidir  : 3.3-V LVTTL       :         : 7         : Y              
-sr_ba[0]                     : A13       : output : 3.3-V LVTTL       :         : 7         : Y              
-sr_a[0]                      : A14       : output : 3.3-V LVTTL       :         : 7         : Y              
-sr_a[3]                      : A15       : output : 3.3-V LVTTL       :         : 7         : Y              
-VCCIO7                       : A16       : power  :                   : 3.3V    : 7         :                
-abc_xm_x                     : B1        : output : 3.3-V LVTTL       :         : 1         : Y              
-GND                          : B2        : gnd    :                   :         :           :                
-abc_int80_x                  : B3        : output : 3.3-V LVTTL       :         : 8         : Y              
-abc_rdy_x                    : B4        : output : 3.3-V LVTTL       :         : 8         : Y              
-sr_dq[10]                    : B5        : bidir  : 3.3-V LVTTL       :         : 8         : Y              
-sr_a[12]                     : B6        : output : 3.3-V LVTTL       :         : 8         : Y              
-sr_a[8]                      : B7        : output : 3.3-V LVTTL       :         : 8         : Y              
-abc_a[1]                     : B8        : input  : 3.3-V LVTTL       :         : 8         : Y              
-GND+                         : B9        :        :                   :         : 7         :                
-sr_dq[6]                     : B10       : bidir  : 3.3-V LVTTL       :         : 7         : Y              
-sr_dq[4]                     : B11       : bidir  : 3.3-V LVTTL       :         : 7         : Y              
-sr_ras_n                     : B12       : output : 3.3-V LVTTL       :         : 7         : Y              
-sr_ba[1]                     : B13       : output : 3.3-V LVTTL       :         : 7         : Y              
-sr_a[1]                      : B14       : output : 3.3-V LVTTL       :         : 7         : Y              
-GND                          : B15       : gnd    :                   :         :           :                
-rtc_int_n                    : B16       : input  : 3.3-V LVTTL       :         : 6         : Y              
-flash_io[0]                  : C1        : bidir  : 3.3-V LVTTL       :         : 1         : Y              
-abc_a_oe                     : C2        : output : 3.3-V LVTTL       :         : 1         : Y              
-GND*                         : C3        :        :                   :         : 8         :                
-VCCIO8                       : C4        : power  :                   : 3.3V    : 8         :                
-GND                          : C5        : gnd    :                   :         :           :                
-sr_dq[14]                    : C6        : bidir  : 3.3-V LVTTL       :         : 8         : Y              
-VCCIO8                       : C7        : power  :                   : 3.3V    : 8         :                
-sr_a[11]                     : C8        : output : 3.3-V LVTTL       :         : 8         : Y              
-sr_a[4]                      : C9        : output : 3.3-V LVTTL       :         : 7         : Y              
-VCCIO7                       : C10       : power  :                   : 3.3V    : 7         :                
-sr_dq[3]                     : C11       : bidir  : 3.3-V LVTTL       :         : 7         : Y              
-GND                          : C12       : gnd    :                   :         :           :                
-VCCIO7                       : C13       : power  :                   : 3.3V    : 7         :                
-sr_a[10]                     : C14       : output : 3.3-V LVTTL       :         : 7         : Y              
-i2c_sda                      : C15       : bidir  : 3.3-V LVTTL       :         : 6         : Y              
-i2c_scl                      : C16       : bidir  : 3.3-V LVTTL       :         : 6         : Y              
-abc_a[3]                     : D1        : input  : 3.3-V LVTTL       :         : 1         : Y              
-flash_cs_n                   : D2        : output : 3.3-V LVTTL       :         : 1         : Y              
-sr_clk                       : D3        : output : 3.3-V LVTTL       :         : 8         : Y              
-VCCD_PLL3                    : D4        : power  :                   : 1.2V    :           :                
-sr_dq[15]                    : D5        : bidir  : 3.3-V LVTTL       :         : 8         : Y              
-sr_dq[13]                    : D6        : bidir  : 3.3-V LVTTL       :         : 8         : Y              
-GND                          : D7        : gnd    :                   :         :           :                
-sr_dqm[1]                    : D8        : output : 3.3-V LVTTL       :         : 8         : Y              
-sr_a[5]                      : D9        : output : 3.3-V LVTTL       :         : 7         : Y              
-GND                          : D10       : gnd    :                   :         :           :                
-sr_dq[2]                     : D11       : bidir  : 3.3-V LVTTL       :         : 7         : Y              
-sr_cs_n                      : D12       : output : 3.3-V LVTTL       :         : 7         : Y              
-VCCD_PLL2                    : D13       : power  :                   : 1.2V    :           :                
-sr_a[2]                      : D14       : output : 3.3-V LVTTL       :         : 7         : Y              
-tty_cts                      : D15       : output : 3.3-V LVTTL       :         : 6         : Y              
-tty_rts                      : D16       : input  : 3.3-V LVTTL       :         : 6         : Y              
-abc_a[6]                     : E1        : input  : 3.3-V LVTTL       :         : 1         : Y              
-GND                          : E2        : gnd    :                   :         :           :                
-VCCIO1                       : E3        : power  :                   : 3.3V    : 1         :                
-GND                          : E4        : gnd    :                   :         :           :                
-GNDA3                        : E5        : gnd    :                   :         :           :                
-sr_dq[12]                    : E6        : bidir  : 3.3-V LVTTL       :         : 8         : Y              
-sr_dq[9]                     : E7        : bidir  : 3.3-V LVTTL       :         : 8         : Y              
-sr_a[6]                      : E8        : output : 3.3-V LVTTL       :         : 8         : Y              
-sr_cas_n                     : E9        : output : 3.3-V LVTTL       :         : 7         : Y              
-sr_dqm[0]                    : E10       : output : 3.3-V LVTTL       :         : 7         : Y              
-sr_dq[1]                     : E11       : bidir  : 3.3-V LVTTL       :         : 7         : Y              
-GNDA2                        : E12       : gnd    :                   :         :           :                
-GND                          : E13       : gnd    :                   :         :           :                
-VCCIO6                       : E14       : power  :                   : 3.3V    : 6         :                
-rtc_32khz                    : E15       : input  : 3.3-V LVTTL       :         : 6         : Y              
-tty_txd                      : E16       : input  : 3.3-V LVTTL       :         : 6         : Y              
-abc_a[7]                     : F1        : input  : 3.3-V LVTTL       :         : 1         : Y              
-abc_cs_n                     : F2        : input  : 3.3-V LVTTL       :         : 1         : Y              
-abc_a[5]                     : F3        : input  : 3.3-V LVTTL       :         : 1         : Y              
-nSTATUS                      : F4        :        :                   :         : 1         :                
-VCCA3                        : F5        : power  :                   : 2.5V    :           :                
-GND                          : F6        : gnd    :                   :         :           :                
-VCCINT                       : F7        : power  :                   : 1.2V    :           :                
-sr_cke                       : F8        : output : 3.3-V LVTTL       :         : 8         : Y              
-sr_we_n                      : F9        : output : 3.3-V LVTTL       :         : 7         : Y              
-GND                          : F10       : gnd    :                   :         :           :                
-VCCINT                       : F11       : power  :                   : 1.2V    :           :                
-VCCA2                        : F12       : power  :                   : 2.5V    :           :                
-tty_rxd                      : F13       : bidir  : 3.3-V LVTTL       :         : 6         : Y              
-sd_dat[2]                    : F14       : bidir  : 3.3-V LVTTL       :         : 6         : Y              
-sd_dat[0]                    : F15       : bidir  : 3.3-V LVTTL       :         : 6         : Y              
-sd_dat[3]                    : F16       : bidir  : 3.3-V LVTTL       :         : 6         : Y              
-abc_a[8]                     : G1        : input  : 3.3-V LVTTL       :         : 1         : Y              
-abc_out_n[0]                 : G2        : input  : 3.3-V LVTTL       :         : 1         : Y              
-VCCIO1                       : G3        : power  :                   : 3.3V    : 1         :                
-GND                          : G4        : gnd    :                   :         :           :                
-abc_a[4]                     : G5        : input  : 3.3-V LVTTL       :         : 1         : Y              
-VCCINT                       : G6        : power  :                   : 1.2V    :           :                
-VCCINT                       : G7        : power  :                   : 1.2V    :           :                
-VCCINT                       : G8        : power  :                   : 1.2V    :           :                
-VCCINT                       : G9        : power  :                   : 1.2V    :           :                
-VCCINT                       : G10       : power  :                   : 1.2V    :           :                
-rngio[2]                     : G11       : bidir  : 3.3-V LVTTL       :         : 6         : Y              
-MSEL2                        : G12       :        :                   :         : 6         :                
-GND                          : G13       : gnd    :                   :         :           :                
-VCCIO6                       : G14       : power  :                   : 3.3V    : 6         :                
-sd_clk                       : G15       : output : 3.3-V LVTTL       :         : 6         : Y              
-sd_cmd                       : G16       : output : 3.3-V LVTTL       :         : 6         : Y              
-flash_sck                    : H1        : output : 3.3-V LVTTL       :         : 1         : Y              
-flash_io[1]                  : H2        : bidir  : 3.3-V LVTTL       :         : 1         : Y              
-TCK                          : H3        : input  :                   :         : 1         :                
-TDI                          : H4        : input  :                   :         : 1         :                
-nCONFIG                      : H5        :        :                   :         : 1         :                
-VCCINT                       : H6        : power  :                   : 1.2V    :           :                
-GND                          : H7        : gnd    :                   :         :           :                
-GND                          : H8        : gnd    :                   :         :           :                
-GND                          : H9        : gnd    :                   :         :           :                
-GND                          : H10       : gnd    :                   :         :           :                
-VCCINT                       : H11       : power  :                   : 1.2V    :           :                
-MSEL1                        : H12       :        :                   :         : 6         :                
-MSEL0                        : H13       :        :                   :         : 6         :                
-CONF_DONE                    : H14       :        :                   :         : 6         :                
-GND                          : H15       : gnd    :                   :         :           :                
-GND                          : H16       : gnd    :                   :         :           :                
-abc_a[9]                     : J1        : input  : 3.3-V LVTTL       :         : 2         : Y              
-abc_out_n[1]                 : J2        : input  : 3.3-V LVTTL       :         : 2         : Y              
-nCE                          : J3        :        :                   :         : 1         :                
-TDO                          : J4        : output :                   :         : 1         :                
-TMS                          : J5        : input  :                   :         : 1         :                
-VCCINT                       : J6        : power  :                   : 1.2V    :           :                
-GND                          : J7        : gnd    :                   :         :           :                
-GND                          : J8        : gnd    :                   :         :           :                
-GND                          : J9        : gnd    :                   :         :           :                
-GND                          : J10       : gnd    :                   :         :           :                
-GND                          : J11       : gnd    :                   :         :           :                
-GND*                         : J12       :        :                   :         : 5         :                
-GND*                         : J13       :        :                   :         : 5         :                
-GND*                         : J14       :        :                   :         : 5         :                
-hdmi_clk                     : J15       : output : LVDS              :         : 5         : Y              
-hdmi_clk(n)                  : J16       : output : LVDS              :         : 5         : Y              
-abc_a[11]                    : K1        : input  : 3.3-V LVTTL       :         : 2         : Y              
-abc_out_n[4]                 : K2        : input  : 3.3-V LVTTL       :         : 2         : Y              
-VCCIO2                       : K3        : power  :                   : 3.3V    : 2         :                
-GND                          : K4        : gnd    :                   :         :           :                
-abc_out_n[2]                 : K5        : input  : 3.3-V LVTTL       :         : 2         : Y              
-GND*                         : K6        :        :                   :         : 2         :                
-VCCINT                       : K7        : power  :                   : 1.2V    :           :                
-GND                          : K8        : gnd    :                   :         :           :                
-GND*                         : K9        :        :                   :         : 4         :                
-board_id                     : K10       : input  : 3.3-V LVTTL       :         : 4         : Y              
-VCCINT                       : K11       : power  :                   : 1.2V    :           :                
-GND*                         : K12       :        :                   :         : 5         :                
-GND                          : K13       : gnd    :                   :         :           :                
-VCCIO5                       : K14       : power  :                   : 2.5V    : 5         :                
-hdmi_d[0]                    : K15       : output : LVDS              :         : 5         : Y              
-hdmi_d[0](n)                 : K16       : output : LVDS              :         : 5         : Y              
-abc_a[12]                    : L1        : input  : 3.3-V LVTTL       :         : 2         : Y              
-abc_inp_n[0]                 : L2        : input  : 3.3-V LVTTL       :         : 2         : Y              
-abc_out_n[3]                 : L3        : input  : 3.3-V LVTTL       :         : 2         : Y              
-abc_a[10]                    : L4        : input  : 3.3-V LVTTL       :         : 2         : Y              
-VCCA1                        : L5        : power  :                   : 2.5V    :           :                
-rngio[0]                     : L6        : bidir  : 3.3-V LVTTL       :         : 2         : Y              
-gpio[0]                      : L7        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-esp_io0                      : L8        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-GND*                         : L9        :        :                   :         : 4         :                
-abc_xoutpstb_n               : L10       : input  : 3.3-V LVTTL       :         : 4         : Y              
-GND*                         : L11       :        :                   :         : 4         :                
-VCCA4                        : L12       : power  :                   : 2.5V    :           :                
-GND*                         : L13       :        :                   :         : 5         :                
-GND*                         : L14       :        :                   :         : 5         :                
-GND*                         : L15       :        :                   :         : 5         :                
-GND*                         : L16       :        :                   :         : 5         :                
-abc_a[13]                    : M1        : input  : 3.3-V LVTTL       :         : 2         : Y              
-abc_inp_n[1]                 : M2        : input  : 3.3-V LVTTL       :         : 2         : Y              
-VCCIO2                       : M3        : power  :                   : 3.3V    : 2         :                
-GND                          : M4        : gnd    :                   :         :           :                
-GNDA1                        : M5        : gnd    :                   :         :           :                
-abc_d[1]                     : M6        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-spi_miso                     : M7        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-spi_mosi                     : M8        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-GND*                         : M9        :        :                   :         : 4         :                
-sd_dat[1]                    : M10       : bidir  : 3.3-V LVTTL       :         : 4         : Y              
-hdmi_scl                     : M11       : bidir  : 3.3-V LVTTL       :         : 4         : Y              
-GNDA4                        : M12       : gnd    :                   :         :           :                
-GND                          : M13       : gnd    :                   :         :           :                
-VCCIO5                       : M14       : power  :                   : 2.5V    : 5         :                
-clock_48                     : M15       : input  : 2.5 V             :         : 5         : Y              
-GND+                         : M16       :        :                   :         : 5         :                
-abc_a[15]                    : N1        : input  : 3.3-V LVTTL       :         : 2         : Y              
-abc_a[14]                    : N2        : input  : 3.3-V LVTTL       :         : 2         : Y              
-abc_xmemfl_n                 : N3        : input  : 3.3-V LVTTL       :         : 3         : Y              
-VCCD_PLL1                    : N4        : power  :                   : 1.2V    :           :                
-abc_d[2]                     : N5        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-spi_cs_flash_n               : N6        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-GND                          : N7        : gnd    :                   :         :           :                
-spi_cs_esp_n                 : N8        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-exth_hb                      : N9        : bidir  : 3.3-V LVTTL       :         : 4         : Y              
-GND                          : N10       : gnd    :                   :         :           :                
-exth_hg                      : N11       : bidir  : 3.3-V LVTTL       :         : 4         : Y              
-exth_ha                      : N12       : bidir  : 3.3-V LVTTL       :         : 4         : Y              
-VCCD_PLL4                    : N13       : power  :                   : 1.2V    :           :                
-GND*                         : N14       :        :                   :         : 5         :                
-hdmi_d[1]                    : N15       : output : LVDS              :         : 5         : Y              
-hdmi_d[1](n)                 : N16       : output : LVDS              :         : 5         : Y              
-abc_xmemw800_n               : P1        : input  : 3.3-V LVTTL       :         : 2         : Y              
-abc_rst_n                    : P2        : input  : 3.3-V LVTTL       :         : 2         : Y              
-abc_d[0]                     : P3        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-VCCIO3                       : P4        : power  :                   : 3.3V    : 3         :                
-GND                          : P5        : gnd    :                   :         :           :                
-spi_clk                      : P6        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-VCCIO3                       : P7        : power  :                   : 3.3V    : 3         :                
-esp_int                      : P8        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-gpio[1]                      : P9        : bidir  : 3.3-V LVTTL       :         : 4         : Y              
-VCCIO4                       : P10       : power  :                   : 3.3V    : 4         :                
-rngio[1]                     : P11       : bidir  : 3.3-V LVTTL       :         : 4         : Y              
-GND                          : P12       : gnd    :                   :         :           :                
-VCCIO4                       : P13       : power  :                   : 3.3V    : 4         :                
-tty_dtr                      : P14       : input  : 3.3-V LVTTL       :         : 4         : Y              
-GND*                         : P15       :        :                   :         : 5         :                
-hdmi_d[2](n)                 : P16       : output : LVDS              :         : 5         : Y              
-abc_xmemw80_n                : R1        : input  : 3.3-V LVTTL       :         : 2         : Y              
-GND                          : R2        : gnd    :                   :         :           :                
-abc_d[4]                     : R3        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-abc_d[6]                     : R4        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-abc_d_oe                     : R5        : output : 3.3-V LVTTL       :         : 3         : Y              
-abc_resin_x                  : R6        : output : 3.3-V LVTTL       :         : 3         : Y              
-gpio[5]                      : R7        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-exth_hh                      : R8        : input  : 3.3-V LVTTL       :         : 3         : Y              
-GND+                         : R9        :        :                   :         : 4         :                
-gpio[3]                      : R10       : bidir  : 3.3-V LVTTL       :         : 4         : Y              
-exth_hd                      : R11       : bidir  : 3.3-V LVTTL       :         : 4         : Y              
-exth_he                      : R12       : bidir  : 3.3-V LVTTL       :         : 4         : Y              
-hdmi_sda                     : R13       : bidir  : 3.3-V LVTTL       :         : 4         : Y              
-led[2]                       : R14       : output : 3.3-V LVTTL       :         : 4         : Y              
-GND                          : R15       : gnd    :                   :         :           :                
-hdmi_d[2]                    : R16       : output : LVDS              :         : 5         : Y              
-VCCIO3                       : T1        : power  :                   : 3.3V    : 3         :                
-abc_d[3]                     : T2        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-abc_d[5]                     : T3        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-abc_d[7]                     : T4        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-abc_d_ce_n                   : T5        : output : 3.3-V LVTTL       :         : 3         : Y              
-gpio[2]                      : T6        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-gpio[4]                      : T7        : bidir  : 3.3-V LVTTL       :         : 3         : Y              
-abc_clk                      : T8        : input  : 3.3-V LVTTL       :         : 3         : Y              
-exth_hc                      : T9        : input  : 3.3-V LVTTL       :         : 4         : Y              
-abc_host                     : T10       : output : 3.3-V LVTTL       :         : 4         : Y              
-exth_hf                      : T11       : bidir  : 3.3-V LVTTL       :         : 4         : Y              
-abc_xinpstb_n                : T12       : input  : 3.3-V LVTTL       :         : 4         : Y              
-led[0]                       : T13       : output : 3.3-V LVTTL       :         : 4         : Y              
-led[1]                       : T14       : output : 3.3-V LVTTL       :         : 4         : Y              
-hdmi_hpd                     : T15       : bidir  : 3.3-V LVTTL       :         : 4         : Y              
-VCCIO4                       : T16       : power  :                   : 3.3V    : 4         :                

BIN
fpga/output_files/max80.pof


+ 0 - 9
fpga/output_files/max80.sld

@@ -1,9 +0,0 @@
-<sld_project_info>
-  <sld_infos>
-    <sld_info hpath="rng:rng|int_osc:int_osc" name="int_osc">
-      <assignment_values>
-        <assignment_value text="QSYS_NAME int_osc HAS_SOPCINFO 1 GENERATION_ID 1639116036"/>
-      </assignment_values>
-    </sld_info>
-  </sld_infos>
-</sld_project_info>

+ 64 - 34
fpga/scripts/qsfdeps.pl

@@ -5,60 +5,90 @@
 
 use strict;
 
-my($infile,$project) = @ARGV;
+my($project,$outfile,@infiles) = @ARGV;
 
-my %map_deps = ($infile);
+my %dep_deps = ();
+my %map_deps = ();
 my %asm_deps = ();
 my %cof_list = ();
 
 my $output_dir = 'output_files';
 
-open(my $in, '<', $infile) or die;
-while (defined(my $l = <$in>)) {
-    chomp $l;
-    next unless ($l =~ /^\s*set_global_assignment\s+\-name\s+(\w+)\s+\"?(.*?)\"?\s*$/);
-    my $type = $1;
-    my $name = $2;
+sub read_file($) {
+    my($infile) = @_;
 
-    if ($type =~ /^project_output_directory$/i) {
-	$output_dir = $name;
-	next;
-    }
-    
-    next if ($type !~ /_file$/i || $type =~ /^generate_/i);
-    
-    $name =~ s/^quartus_\w+://;
-    $name =~ s/\s-.*$//;
-
-    if ($name =~ /\.cof$/i) {
-	$cof_list{$name}++;
-    } elsif ($type =~ /^(signaltap_file|use_signaltap_file|sld_file)$/i) {
-	# Skip
-    } elsif ($type =~ /^(mif|hex)_file$/i) {
-	$asm_deps{$name}++;
-    } else {
-	$map_deps{$name}++;
+    $dep_deps{$infile}++;
+    $map_deps{$infile}++;
+
+    open(my $in, '<', $infile) or die;
+    while (defined(my $l = <$in>)) {
+	chomp $l;
+
+	if ($l =~ /^\s*include\s+\"?(.*?)\"?\s*$/) {
+	    read_file($1);
+	    next;
+	}
+
+	next unless ($l =~ /^\s*set_global_assignment\s+\-name\s+(\w+)\s+\"?(.*?)\"?\s*$/);
+	my $type = lc($1);
+	my $name = $2;
+
+	if ($type =~ /^project_output_directory$/i) {
+	    $output_dir = $name;
+	    next;
+	}
+
+	next if ($type !~ /_file$/i || $type =~ /^generate_/i);
+
+	$name =~ s/^quartus_\w+://;
+	$name =~ s/\s-.*$//;
+
+	if ($name =~ /\.cof$/i) {
+	    $cof_list{$name}++;
+	} elsif ($type =~ /^(signaltap_file|use_signaltap_file|sld_file)$/i) {
+	    # Skip
+	} elsif ($type eq 'source_tcl_script_file' &&
+		 $name =~ /\.qsf$/i) {
+	    read_file($name);
+	} elsif ($type =~ /^(mif|hex)_file$/i) {
+	    $asm_deps{$name}++;
+	} else {
+	    $map_deps{$name}++;
+	}
     }
+    close($in);
 }
 
-close($in);
+sub print_deps($$%) {
+    my($out,$target,%deps) = @_;
 
-sub print_deps($%) {
-    my($target,%deps) = @_;
+    return if (!%deps);
 
-    print "\n", $target, " :";
+    print $out "\n", $target, " :";
 
     foreach my $dep (sort keys(%deps)) {
-	print " \\\n\t", $dep;
+	print $out " \\\n\t", $dep;
     }
 
-    print "\n";
+    print $out "\n";
+}
+
+unlink($outfile);
+
+foreach my $f (@infiles) {
+    read_file($f);
 }
 
+open(my $out, '>', $outfile) or die;
+
+print_deps($out, $outfile, %dep_deps);
+
 my $map_target = "$output_dir/$project.map.rpt";
-print_deps($map_target, %map_deps);
+print_deps($out, $map_target, %map_deps);
 
 my $asm_target = "$output_dir/$project.mif_update.rpt";
-print_deps($asm_target, %asm_deps);
+print_deps($out, $asm_target, %asm_deps);
+
+close($out);
 
 exit 0;

+ 11 - 8
fpga/usb/usb.sv

@@ -5,7 +5,8 @@
 // to the output of the tty
 //
 
-module max80_usb (
+module max80_usb #(parameter logic have_usb_rx = 1'b1)
+   (
 		  input  rst_n,
 		  input  clock48,
 
@@ -13,10 +14,11 @@ module max80_usb (
 		  output tty_rxd_break,
 		  input  tty_txd,
 
-		  inout  usb_dp,
-		  inout  usb_dn,
-		  output usb_pu	// driver for 1.5 kohm pullup
-		  );
+		  inout  usb_dp,	// Single ended D+
+		  inout  usb_dn,	// Single ended D-
+		  input  usb_rx,	// Differential input if available
+		  output usb_pu		// driver for 1.5 kohm pullup
+    );
 
    //
    // UTMI interface to PHY
@@ -38,9 +40,10 @@ module max80_usb (
    //
    // USB hardware interface to PHY
    //
-   wire			 usb_rx_rcv   = usb_dp & ~usb_dn;
-   wire			 usb_rx_dp    = usb_dp;
-   wire			 usb_rx_dn    = usb_dn;
+   wire 		 usb_rx_rcv =
+			 have_usb_rx ? usb_rx : usb_dp & ~usb_dn;
+   wire			 usb_rx_dp  = usb_dp;
+   wire			 usb_rx_dn  = usb_dn;
    wire			 usb_tx_dp;
    wire			 usb_tx_dn;
    wire			 usb_tx_oen;

+ 0 - 0
fpga/v1.pins


+ 4 - 0
fpga/v1.qsf

@@ -0,0 +1,4 @@
+set_global_assignment -name SOURCE_TCL_SCRIPT_FILE "max80.qsf"
+set_global_assignment -name SOURCE_FILE v1.pins
+set_global_assignment -name VERILOG_MACRO MAX80_V1
+set_global_assignment -name SOURCE_FILE max80-v1.cof

+ 1 - 0
fpga/v1_description.txt

@@ -0,0 +1 @@
+MAX80 v1

+ 0 - 0
fpga/v2.pins


+ 4 - 0
fpga/v2.qsf

@@ -0,0 +1,4 @@
+set_global_assignment -name SOURCE_TCL_SCRIPT_FILE "max80.qsf"
+set_global_assignment -name SOURCE_FILE v2.pins
+set_global_assignment -name VERILOG_MACRO MAX80_V2
+set_global_assignment -name SOURCE_FILE max80-v2.cof

+ 1 - 0
fpga/v2_description.txt

@@ -0,0 +1 @@
+MAX80 v2

+ 16 - 16
rv32/boot.mif

@@ -60,7 +60,7 @@ CONTENT BEGIN
 0035 : 43A0006F;
 0036 : 34C0006F;
 0037 : 00000000;
-0038 : 4101D970;
+0038 : 4101DA00;
 0039 : FFFFFFFF;
 003A : FFFFFFFF;
 003B : 00000958;
@@ -116,15 +116,15 @@ CONTENT BEGIN
 006D : 86631420;
 006E : 70970002;
 006F : 80E74000;
-0070 : 547D6640;
+0070 : 547D6B00;
 0071 : 0680008B;
 0072 : 0810878B;
 0073 : 14304303;
 0074 : 00030663;
 0075 : 40001097;
-0076 : 2C8080E7;
+0076 : 310080E7;
 0077 : 40002097;
-0078 : 688080E7;
+0078 : 6D2080E7;
 0079 : 0000B7C5;
 007A : 00000697;
 007B : EB468693;
@@ -255,7 +255,7 @@ CONTENT BEGIN
 00F8 : 8F374E95;
 00F9 : 24234000;
 00FA : 051381D0;
-00FB : 20959D3F;
+00FB : 2095A59F;
 00FC : C0102FF3;
 00FD : 1908B737;
 00FE : 0FF70793;
@@ -268,7 +268,7 @@ CONTENT BEGIN
 0105 : FE038CE3;
 0106 : 014140B2;
 0107 : 40001317;
-0108 : BF430067;
+0108 : C1830067;
 0109 : 95334785;
 010A : 429300A7;
 010B : 050BFFF5;
@@ -315,13 +315,13 @@ CONTENT BEGIN
 0134 : 80820665;
 0135 : 05376621;
 0136 : 06134000;
-0137 : 4581FC06;
+0137 : 45810486;
 0138 : 00050513;
 0139 : 2873BF59;
 013A : 2E03C010;
 013B : 8F371000;
 013C : 0F934000;
-013D : 0EB3FC0F;
+013D : 0EB3048F;
 013E : A02341C8;
 013F : 67B101D5;
 0140 : 99F02023;
@@ -419,7 +419,7 @@ CONTENT BEGIN
 019C : 03F5F893;
 019D : 4000FE37;
 019E : 00289A13;
-019F : E20E0E93;
+019F : EA8E0E93;
 01A0 : 014E8F33;
 01A1 : 000F2A83;
 01A2 : 0F100823;
@@ -453,7 +453,7 @@ CONTENT BEGIN
 01BE : 4000F9B7;
 01BF : B8002A23;
 01C0 : 89934401;
-01C1 : 0A13E209;
+01C1 : 0A13EA89;
 01C2 : 8E331000;
 01C3 : 25030089;
 01C4 : CD01000E;
@@ -570,9 +570,9 @@ CONTENT BEGIN
 0233 : 63654420;
 0234 : 20323220;
 0235 : 31323032;
-0236 : 3A303020;
-0237 : 303A3632;
-0238 : 00000A31;
+0236 : 3A373120;
+0237 : 323A3932;
+0238 : 00000A34;
 0239 : 00000101;
 023A : 00000000;
 023B : 00000000;
@@ -593,13 +593,13 @@ CONTENT BEGIN
 024A : 00007FBF;
 024B : 00000000;
 024C : D3030300;
-024D : 4000300C;
+024D : 40003056;
 024E : 00000000;
-024F : 40003030;
+024F : 4000307A;
 0250 : 00000000;
 0251 : 00000000;
 0252 : 00000000;
-0253 : 4000301E;
+0253 : 40003068;
 0254 : 00000000;
 0255 : 00000000;
 0256 : 00000000;

+ 4 - 5
rv32/ioregs.h

@@ -53,11 +53,10 @@
 /* Basic system registers */
 #define SYS_MAGIC		IODEVRL(SYS,0)
 #define SYS_BOARDCFG		IODEVRL(SYS,1)
-#define SYS_BOARDFIX		IODEVRH0(SYS,1)
-#define SYS_BOARDFIX_RTC32	1
-#define SYS_BOARDREV		IODEVRH1(SYS,1)
-#define SYS_BOARDMINOR		IODEVRB2(SYS,1)
-#define SYS_BOARDMAJOR		IODEVRB3(SYS,1)
+#define SYS_BOARDFIX		IODEVRB0(SYS,1)
+#define SYS_BOARDMINOR		IODEVRB1(SYS,1)
+#define SYS_BOARDMAJOR		IODEVRB2(SYS,1)
+#define SYS_BOARDFPGA		IODEVRB3(SYS,1)
 #define SYS_LED			IODEVL(SYS,2)
 #define SYS_RESET		IODEVL(SYS,3)
 #define SYS_RESET_SOFT		1

+ 10 - 5
rv32/system.c

@@ -124,16 +124,21 @@ static void __cold __noinline late_init(void)
     con_puts("Running abc_init_memmap: ");
     con_flush();
     abc_init_memmap();
+    con_puts("ok\n");
 
     if (SYS_MAGIC != SYS_MAGIC_MAX80) {
 	con_puts("Not a MAX80 board?!?!\n\n");
+	_die();
     } else {
-	uint32_t boardcfg = SYS_BOARDCFG;
-	con_printf("MAX80 ver %u.%u rework flags %04x\n\n",
-		   (uint8_t)(boardcfg >> 24),
-		   (uint8_t)(boardcfg >> 16),
-		   (uint16_t)boardcfg);
+	con_printf("MAX80 ver %u.%u rework flags %02x fpga %u\n",
+		   SYS_BOARDMAJOR, SYS_BOARDMINOR,
+		   SYS_BOARDFIX, SYS_BOARDFPGA);
+	if (SYS_BOARDMAJOR != SYS_BOARDFPGA) {
+	    con_puts("Invalid FPGA firmware for this board revision\n");
+	    _die();
+	}
     }
+    con_putc('\n');
 
     if ( MINITESTS ) {
 	con_puts("Quick DRAM test:\n");