From e06e6d34ff630e906c0f4c84330ceee20073b315 Mon Sep 17 00:00:00 2001 From: Polprzewodnikowy Date: Tue, 9 Nov 2021 23:05:06 +0100 Subject: [PATCH] updated to quartus 21.1 --- build.sh | 2 +- build_in_docker.sh | 4 +- fw/.gitignore | 11 +-- fw/SummerCart64.qsf | 26 ++----- fw/SummerCart64.sdc | 17 +---- fw/build.sh | 13 ---- fw/rtl/SummerCart64.sv | 6 +- fw/rtl/cpu/cpu_cfg.sv | 41 ++++------ fw/rtl/cpu/cpu_soc.sv | 10 +-- fw/rtl/cpu/cpu_uart.sv | 4 +- fw/rtl/cpu/cpu_usb.sv | 37 +++++---- fw/rtl/intel/config/intel_config.qsys | 67 ---------------- fw/rtl/intel/fifo/intel_fifo_8.qip | 2 +- fw/rtl/intel/fifo/intel_fifo_8.v | 9 +-- fw/rtl/intel/flash/intel_flash.qsys | 26 +++---- fw/rtl/intel/gpio/intel_gpio_ddro.qip | 8 +- fw/rtl/intel/gpio/intel_gpio_ddro.v | 6 +- .../gpio/intel_gpio_ddro/altera_gpio_lite.sv | 2 +- fw/rtl/intel/pll/intel_pll.qip | 2 +- fw/rtl/intel/pll/intel_pll.v | 7 +- fw/rtl/intel/snp/intel_snp.qsys | 76 ------------------- fw/rtl/system/sc64.sv | 2 - fw/rtl/system/system.sv | 12 +-- fw/rtl/usb/usb_ft1248.sv | 11 ++- sw/n64/build.sh | 6 -- sw/pc/.gitignore | 12 +-- sw/riscv/build.sh | 6 -- sw/riscv/src/sys.h | 2 + sw/riscv/src/usb.c | 2 +- 29 files changed, 108 insertions(+), 321 deletions(-) delete mode 100755 fw/build.sh delete mode 100644 fw/rtl/intel/config/intel_config.qsys delete mode 100644 fw/rtl/intel/snp/intel_snp.qsys delete mode 100755 sw/n64/build.sh delete mode 100755 sw/riscv/build.sh diff --git a/build.sh b/build.sh index cc036aa..40a5558 100755 --- a/build.sh +++ b/build.sh @@ -3,8 +3,8 @@ PACKAGE_FILE_NAME="SummerCart64" FILES=( + "./fw/output_files/SC64_firmware.pof" "./fw/output_files/SC64_update.bin" - "./fw/output_files/SC64_update.pof" "./hw/ftdi-template.xml" "./sw/cic/UltraCIC-III.hex" "./LICENSE" diff --git a/build_in_docker.sh b/build_in_docker.sh index dded6f2..1bcf5a5 100755 --- a/build_in_docker.sh +++ b/build_in_docker.sh @@ -1,6 +1,6 @@ #!/bin/bash -docker run \ +docker run --rm -it \ --mount type=bind,src="$(pwd)",target="/workdir" \ - ghcr.io/polprzewodnikowy/sc64env:v1.0 \ + ghcr.io/polprzewodnikowy/sc64env:v1.1 \ /bin/bash -c "./build.sh" diff --git a/fw/.gitignore b/fw/.gitignore index 9bfa4b7..e8bfb66 100644 --- a/fw/.gitignore +++ b/fw/.gitignore @@ -3,10 +3,11 @@ /incremental_db /output_files **/.qsys_edit -*.qws -*.rpt -*.txt -*.sopcinfo -**/*.elf **/*.bin **/*.dat +**/*.elf +*.qws +*.rpt +*.sopcinfo +*.srf +*.txt diff --git a/fw/SummerCart64.qsf b/fw/SummerCart64.qsf index 2dfe7e3..cf8f2ea 100644 --- a/fw/SummerCart64.qsf +++ b/fw/SummerCart64.qsf @@ -1,6 +1,6 @@ # -------------------------------------------------------------------------- # # -# Copyright (C) 2020 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,8 +18,8 @@ # -------------------------------------------------------------------------- # # # Quartus Prime -# Version 20.1.1 Build 720 11/11/2020 SJ Lite Edition -# Date created = 23:38:22 October 28, 2021 +# Version 21.1.0 Build 842 10/21/2021 SJ Lite Edition +# Date created = 20:25:39 November 08, 2021 # # -------------------------------------------------------------------------- # # @@ -30,7 +30,7 @@ # If this file doesn't exist, see file: # assignment_defaults.qdf # -# 2) Altera recommends that you do not modify this file. This +# 2) Intel recommends that you do not modify this file. This # file is updated automatically by the Quartus Prime software # and any changes you make may be lost or overwritten. # @@ -42,13 +42,11 @@ # ======================== set_global_assignment -name ORIGINAL_QUARTUS_VERSION 20.1.1 set_global_assignment -name PROJECT_CREATION_TIME_DATE "10:53:32 AUGUST 01, 2021" -set_global_assignment -name LAST_QUARTUS_VERSION "20.1.1 Lite Edition" +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 NUM_PARALLEL_PROCESSORS ALL set_global_assignment -name FLOW_ENABLE_POWER_ANALYZER ON -set_global_assignment -name QSYS_FILE rtl/intel/config/intel_config.qsys set_global_assignment -name QSYS_FILE rtl/intel/flash/intel_flash.qsys -set_global_assignment -name QSYS_FILE rtl/intel/snp/intel_snp.qsys set_global_assignment -name QIP_FILE rtl/intel/fifo/intel_fifo_8.qip set_global_assignment -name QIP_FILE rtl/intel/gpio/intel_gpio_ddro.qip set_global_assignment -name QIP_FILE rtl/intel/pll/intel_pll.qip @@ -95,8 +93,6 @@ set_location_assignment PIN_10 -to io_usb_miosi[0] set_location_assignment PIN_11 -to io_usb_miosi[1] set_location_assignment PIN_12 -to i_uart_rxd set_location_assignment PIN_13 -to o_uart_txd -set_location_assignment PIN_14 -to i_uart_cts -set_location_assignment PIN_15 -to o_uart_rts set_location_assignment PIN_17 -to o_led set_location_assignment PIN_21 -to o_rtc_scl set_location_assignment PIN_22 -to io_rtc_sda @@ -105,8 +101,6 @@ set_location_assignment PIN_25 -to i_n64_nmi set_location_assignment PIN_26 -to i_clk set_location_assignment PIN_27 -to i_n64_reset set_location_assignment PIN_28 -to i_n64_si_clk -set_location_assignment PIN_29 -to io_n64_cic_clk -set_location_assignment PIN_30 -to io_n64_cic_dq set_location_assignment PIN_32 -to io_n64_pi_ad[7] set_location_assignment PIN_33 -to io_n64_pi_ad[8] set_location_assignment PIN_38 -to io_n64_pi_ad[6] @@ -170,13 +164,6 @@ set_location_assignment PIN_118 -to io_sd_cmd set_location_assignment PIN_119 -to io_sd_dat[3] set_location_assignment PIN_120 -to io_sd_dat[2] set_location_assignment PIN_123 -to o_n64_irq -set_location_assignment PIN_127 -to io_avr_mosi -set_location_assignment PIN_130 -to io_flash_dq[0] -set_location_assignment PIN_131 -to o_flash_clk -set_location_assignment PIN_132 -to io_flash_dq[3] -set_location_assignment PIN_134 -to o_flash_cs -set_location_assignment PIN_135 -to io_flash_dq[1] -set_location_assignment PIN_136 -to io_flash_dq[2] set_location_assignment PIN_138 -to i_usb_pwren set_location_assignment PIN_140 -to o_usb_cs set_location_assignment PIN_141 -to i_usb_miso @@ -240,7 +227,6 @@ set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" - # ========================== set_instance_assignment -name FAST_INPUT_REGISTER ON -to io_usb_miosi[*] set_instance_assignment -name FAST_INPUT_REGISTER ON -to i_uart_rxd - set_instance_assignment -name FAST_INPUT_REGISTER ON -to i_uart_cts set_instance_assignment -name FAST_INPUT_REGISTER ON -to io_rtc_sda set_instance_assignment -name FAST_INPUT_REGISTER ON -to io_n64_si_dq set_instance_assignment -name FAST_INPUT_REGISTER ON -to i_n64_nmi @@ -258,7 +244,6 @@ set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" - set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to o_usb_clk set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to io_usb_miosi[*] set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to o_uart_txd - set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to o_uart_rts set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to o_rtc_scl set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to io_rtc_sda set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to io_n64_pi_ad[*] @@ -278,7 +263,6 @@ set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" - set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to io_usb_miosi[*] set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to i_n64_nmi set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to i_uart_rxd - set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to i_uart_cts set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to io_n64_si_dq set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to i_n64_reset set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to i_n64_si_clk diff --git a/fw/SummerCart64.sdc b/fw/SummerCart64.sdc index 832c580..530e475 100644 --- a/fw/SummerCart64.sdc +++ b/fw/SummerCart64.sdc @@ -10,11 +10,6 @@ create_generated_clock -name sdram_clk -source [get_pins $sdram_pll_clk] [get_po # create_generated_clock -name sd_reg_clk -source [get_pins {sd_interface_inst|sd_clk_inst|o_sd_clk|clk}] -divide_by 2 [get_pins $sd_reg_clk] # create_generated_clock -name sd_clk -source [get_pins $sd_reg_clk] [get_ports {o_sd_clk}] -create_generated_clock -name config_clk \ - -source [get_pins {cpu_soc_inst|cpu_cfg_inst|reconfig_clk|clk}] \ - -divide_by 2 \ - [get_pins {cpu_soc_inst|cpu_cfg_inst|reconfig_clk|q}] - create_generated_clock -name flash_se_neg_reg \ -source [get_pins -compatibility_mode {*altera_onchip_flash:*onchip_flash_0|altera_onchip_flash_avmm_data_controller:avmm_data_controller|flash_se_neg_reg|clk}] \ -divide_by 2 \ @@ -54,7 +49,7 @@ set_multicycle_path -setup -end 2 -from [get_clocks {sdram_clk}] -to [get_clocks # FT1248 timings set_false_path -to [get_ports {o_usb_clk io_usb_miosi[*] o_usb_cs}] -set_false_path -from [get_ports {io_usb_miosi[*] i_usb_miso}] +set_false_path -from [get_ports {io_usb_miosi[*] i_usb_miso i_usb_pwren}] # N64, PI and SI timings @@ -76,17 +71,11 @@ set_false_path -to [get_ports {o_led}] # UART timings -set_false_path -to [get_ports {o_uart_txd o_uart_rts}] -set_false_path -from [get_ports {i_uart_rxd i_uart_cts}] +set_false_path -to [get_ports {o_uart_txd}] +set_false_path -from [get_ports {i_uart_rxd}] # I2C timings set_false_path -to [get_ports {o_rtc_scl io_rtc_sda}] set_false_path -from [get_ports {io_rtc_sda}] - - -# JTAG timings - -# set_false_path -to [get_ports {altera_reserved_tdo}] -# set_false_path -from [get_ports {altera_reserved_tdi altera_reserved_tms}] diff --git a/fw/build.sh b/fw/build.sh deleted file mode 100755 index c30bed2..0000000 --- a/fw/build.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -docker run \ - --mount type=bind,src="$(pwd)/..",target="/workdir" \ - ghcr.io/polprzewodnikowy/sc64env:v1.0 \ - /bin/bash -c " \ - cd fw && \ - quartus_sh --flow compile ./SummerCart64.qpf && \ - quartus_cpf -c ./SummerCart64.cof && \ - cp output_files/SC64_firmware.pof output_files/SC64_update.pof && \ - cat output_files/sc64_firmware_ufm_auto.rpd output_files/sc64_firmware_cfm0_auto.rpd > output_files/SC64_update_LE.bin && \ - riscv32-unknown-elf-objcopy -I binary -O binary --reverse-bytes=4 output_files/SC64_update_LE.bin output_files/SC64_update.bin - " diff --git a/fw/rtl/SummerCart64.sv b/fw/rtl/SummerCart64.sv index 48eea35..16c5769 100644 --- a/fw/rtl/SummerCart64.sv +++ b/fw/rtl/SummerCart64.sv @@ -34,8 +34,6 @@ module SummerCart64 ( input i_uart_rxd, output o_uart_txd, - input i_uart_cts, - output o_uart_rts, output o_sd_clk, inout io_sd_cmd, @@ -127,8 +125,6 @@ module SummerCart64 ( .uart_rxd(i_uart_rxd), .uart_txd(o_uart_txd), - .uart_cts(i_uart_cts), - .uart_rts(o_uart_rts), .sd_clk(o_sd_clk), .sd_cmd(io_sd_cmd), @@ -141,7 +137,7 @@ module SummerCart64 ( end always_ff @(posedge sys.clk) begin - gpio_i <= {4'b0000, i_n64_nmi, i_n64_reset, o_n64_irq, o_led}; + gpio_i <= {4'b0000, i_n64_nmi, i_n64_reset, gpio_o[1:0]}; end endmodule diff --git a/fw/rtl/cpu/cpu_cfg.sv b/fw/rtl/cpu/cpu_cfg.sv index cd1ccf7..8738529 100644 --- a/fw/rtl/cpu/cpu_cfg.sv +++ b/fw/rtl/cpu/cpu_cfg.sv @@ -134,40 +134,31 @@ module cpu_cfg ( end end - logic reconfig_clk; - logic reconfig_write; - logic [31:0] reconfig_rdata; - logic reconfig_write_done; - - const logic [31:0] TRIGGER_RECONFIGURATION = 32'h00000001; + logic [1:0] ru_clk; + logic ru_rconfig; + logic ru_regout; always_ff @(posedge sys.clk) begin if (sys.reset) begin - reconfig_clk <= 1'b0; - reconfig_write <= 1'b0; - reconfig_write_done <= 1'b0; + ru_clk <= 2'd0; + ru_rconfig <= 1'b0; end else begin - reconfig_clk <= ~reconfig_clk; + ru_clk <= ru_clk + 1'd1; - if (!reconfig_clk) begin - reconfig_write <= 1'b0; - - if (trigger_reconfiguration && !reconfig_write_done) begin - reconfig_write <= 1'b1; - reconfig_write_done <= 1'b1; - end + if (ru_clk == 2'd1) begin + ru_rconfig <= trigger_reconfiguration; end end end - intel_config intel_config_inst ( - .clk(reconfig_clk), - .nreset(~sys.reset), - .avmm_rcv_address(3'd0), - .avmm_rcv_read(1'b0), - .avmm_rcv_writedata(TRIGGER_RECONFIGURATION), - .avmm_rcv_write(reconfig_write), - .avmm_rcv_readdata(reconfig_rdata) + fiftyfivenm_rublock fiftyfivenm_rublock_inst ( + .clk(ru_clk[1]), + .shiftnld(1'b0), + .captnupdt(1'b0), + .regin(1'b0), + .rsttimer(1'b0), + .rconfig(ru_rconfig), + .regout(ru_regout) ); endmodule diff --git a/fw/rtl/cpu/cpu_soc.sv b/fw/rtl/cpu/cpu_soc.sv index 69b4050..5d77544 100644 --- a/fw/rtl/cpu/cpu_soc.sv +++ b/fw/rtl/cpu/cpu_soc.sv @@ -22,8 +22,6 @@ module cpu_soc ( input uart_rxd, output uart_txd, - input uart_cts, - output uart_rts, output sd_clk, inout sd_cmd, @@ -77,9 +75,7 @@ module cpu_soc ( .sys(sys), .bus(bus.at[sc64::ID_CPU_UART].device), .uart_rxd(uart_rxd), - .uart_txd(uart_txd), - .uart_cts(uart_cts), - .uart_rts(uart_rts) + .uart_txd(uart_txd) ); cpu_dma cpu_dma_inst ( @@ -118,4 +114,8 @@ module cpu_soc ( .flash(flash) ); + assign sd_clk = 1'bZ; + assign sd_cmd = 1'bZ; + assign sd_dat = 4'bZZZZ; + endmodule diff --git a/fw/rtl/cpu/cpu_uart.sv b/fw/rtl/cpu/cpu_uart.sv index 9e1da84..6da1ed1 100644 --- a/fw/rtl/cpu/cpu_uart.sv +++ b/fw/rtl/cpu/cpu_uart.sv @@ -3,9 +3,7 @@ module cpu_uart ( if_cpu_bus bus, input uart_rxd, - output uart_txd, - input uart_cts, - output uart_rts + output uart_txd ); localparam BAUD_GEN_VALUE = int'(sc64::CLOCK_FREQUENCY / sc64::UART_BAUD_RATE) - 1'd1; diff --git a/fw/rtl/cpu/cpu_usb.sv b/fw/rtl/cpu/cpu_usb.sv index b398fe0..442a150 100644 --- a/fw/rtl/cpu/cpu_usb.sv +++ b/fw/rtl/cpu/cpu_usb.sv @@ -23,6 +23,8 @@ module cpu_usb ( logic cpu_rx_read; logic cpu_tx_write; + logic usb_enabled; + always_comb begin dma.rx_empty = rx_empty; rx_read = cpu_rx_read || dma.rx_read; @@ -44,7 +46,7 @@ module cpu_usb ( bus.rdata = 32'd0; if (bus.ack) begin case (bus.address[2:2]) - 0: bus.rdata = {30'd0, ~tx_full, ~rx_empty}; + 0: bus.rdata = {26'd0, usb_pwren, usb_enabled, 2'b00, ~tx_full, ~rx_empty}; 1: bus.rdata = {24'd0, rx_rdata}; default: bus.rdata = 32'd0; endcase @@ -58,33 +60,38 @@ module cpu_usb ( tx_flush <= 1'b0; cpu_tx_write <= 1'b0; - if (bus.request) begin - case (bus.address[2:2]) - 2'd0: begin - if (bus.wmask[0]) begin - {tx_flush, rx_flush} <= bus.wdata[3:2]; + if (sys.reset) begin + usb_enabled <= 1'b0; + end else begin + if (bus.request) begin + case (bus.address[2:2]) + 2'd0: begin + if (bus.wmask[0]) begin + {usb_enabled, tx_flush, rx_flush} <= bus.wdata[4:2]; + end end - end - 2'd1: begin - if (bus.wmask[0]) begin - cpu_tx_write <= 1'b1; - end else begin - cpu_rx_read <= 1'b1; + 2'd1: begin + if (bus.wmask[0]) begin + cpu_tx_write <= 1'b1; + end else begin + cpu_rx_read <= 1'b1; + end end - end - endcase + endcase + end end end usb_ft1248 usb_ft1248_inst ( .sys(sys), + .usb_enabled(usb_enabled), + .usb_clk(usb_clk), .usb_cs(usb_cs), .usb_miso(usb_miso), .usb_miosi(usb_miosi), - .usb_pwren(usb_pwren), .rx_flush(rx_flush), .rx_empty(rx_empty), diff --git a/fw/rtl/intel/config/intel_config.qsys b/fw/rtl/intel/config/intel_config.qsys deleted file mode 100644 index f61edb1..0000000 --- a/fw/rtl/intel/config/intel_config.qsys +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/fw/rtl/intel/fifo/intel_fifo_8.qip b/fw/rtl/intel/fifo/intel_fifo_8.qip index a7494b6..f252a4d 100644 --- a/fw/rtl/intel/fifo/intel_fifo_8.qip +++ b/fw/rtl/intel/fifo/intel_fifo_8.qip @@ -1,4 +1,4 @@ set_global_assignment -name IP_TOOL_NAME "FIFO" -set_global_assignment -name IP_TOOL_VERSION "20.1" +set_global_assignment -name IP_TOOL_VERSION "21.1" set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{MAX 10}" set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "intel_fifo_8.v"] diff --git a/fw/rtl/intel/fifo/intel_fifo_8.v b/fw/rtl/intel/fifo/intel_fifo_8.v index dafd81e..88316a2 100644 --- a/fw/rtl/intel/fifo/intel_fifo_8.v +++ b/fw/rtl/intel/fifo/intel_fifo_8.v @@ -9,16 +9,16 @@ // scfifo // // Simulation Library Files(s): -// altera_mf +// // ============================================================ // ************************************************************ // THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE! // -// 20.1.1 Build 720 11/11/2020 SJ Lite Edition +// 21.1.0 Build 842 10/21/2021 SJ Lite Edition // ************************************************************ -//Copyright (C) 2020 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 @@ -99,7 +99,7 @@ endmodule // Retrieval info: PRIVATE: AlmostEmptyThr NUMERIC "-1" // Retrieval info: PRIVATE: AlmostFull NUMERIC "0" // Retrieval info: PRIVATE: AlmostFullThr NUMERIC "-1" -// Retrieval info: PRIVATE: CLOCKS_ARE_SYNCHRONIZED NUMERIC "0" +// Retrieval info: PRIVATE: CLOCKS_ARE_SYNCHRONIZED NUMERIC "1" // Retrieval info: PRIVATE: Clock NUMERIC "0" // Retrieval info: PRIVATE: Depth NUMERIC "1024" // Retrieval info: PRIVATE: Empty NUMERIC "1" @@ -160,4 +160,3 @@ endmodule // Retrieval info: GEN_FILE: TYPE_NORMAL intel_fifo_8.bsf FALSE // Retrieval info: GEN_FILE: TYPE_NORMAL intel_fifo_8_inst.v FALSE // Retrieval info: GEN_FILE: TYPE_NORMAL intel_fifo_8_bb.v FALSE -// Retrieval info: LIB_FILE: altera_mf diff --git a/fw/rtl/intel/flash/intel_flash.qsys b/fw/rtl/intel/flash/intel_flash.qsys index ffe595d..c1fdaf6 100644 --- a/fw/rtl/intel/flash/intel_flash.qsys +++ b/fw/rtl/intel/flash/intel_flash.qsys @@ -6,18 +6,18 @@ version="1.0" description="" tags="INTERNAL_COMPONENT=true" - categories="System" /> - + @@ -64,7 +64,7 @@ diff --git a/fw/rtl/intel/gpio/intel_gpio_ddro.qip b/fw/rtl/intel/gpio/intel_gpio_ddro.qip index 6a307ed..2cd6c78 100644 --- a/fw/rtl/intel/gpio/intel_gpio_ddro.qip +++ b/fw/rtl/intel/gpio/intel_gpio_ddro.qip @@ -1,5 +1,5 @@ set_global_assignment -entity "intel_gpio_ddro" -library "intel_gpio_ddro" -name IP_TOOL_NAME "altera_gpio_lite" -set_global_assignment -entity "intel_gpio_ddro" -library "intel_gpio_ddro" -name IP_TOOL_VERSION "20.1" +set_global_assignment -entity "intel_gpio_ddro" -library "intel_gpio_ddro" -name IP_TOOL_VERSION "21.1" set_global_assignment -entity "intel_gpio_ddro" -library "intel_gpio_ddro" -name IP_TOOL_ENV "mwpim" set_global_assignment -library "intel_gpio_ddro" -name MISC_FILE [file join $::quartus(qip_path) "intel_gpio_ddro.cmp"] set_global_assignment -entity "intel_gpio_ddro" -library "intel_gpio_ddro" -name IP_TARGETED_DEVICE_FAMILY "MAX 10" @@ -11,14 +11,14 @@ set_global_assignment -entity "intel_gpio_ddro" -library "intel_gpio_ddro" -name set_global_assignment -entity "intel_gpio_ddro" -library "intel_gpio_ddro" -name IP_COMPONENT_REPORT_HIERARCHY "Off" set_global_assignment -entity "intel_gpio_ddro" -library "intel_gpio_ddro" -name IP_COMPONENT_INTERNAL "Off" set_global_assignment -entity "intel_gpio_ddro" -library "intel_gpio_ddro" -name IP_COMPONENT_AUTHOR "SW50ZWwgQ29ycG9yYXRpb24=" -set_global_assignment -entity "intel_gpio_ddro" -library "intel_gpio_ddro" -name IP_COMPONENT_VERSION "MjAuMQ==" +set_global_assignment -entity "intel_gpio_ddro" -library "intel_gpio_ddro" -name IP_COMPONENT_VERSION "MjEuMQ==" set_global_assignment -entity "intel_gpio_ddro" -library "intel_gpio_ddro" -name IP_COMPONENT_DESCRIPTION "R1BJTyBMaXRlIEludGVsIEZQR0EgSVA=" set_global_assignment -entity "altera_gpio_lite" -library "intel_gpio_ddro" -name IP_COMPONENT_NAME "YWx0ZXJhX2dwaW9fbGl0ZQ==" set_global_assignment -entity "altera_gpio_lite" -library "intel_gpio_ddro" -name IP_COMPONENT_DISPLAY_NAME "R1BJTyBMaXRlIEludGVsIEZQR0EgSVA=" set_global_assignment -entity "altera_gpio_lite" -library "intel_gpio_ddro" -name IP_COMPONENT_REPORT_HIERARCHY "Off" set_global_assignment -entity "altera_gpio_lite" -library "intel_gpio_ddro" -name IP_COMPONENT_INTERNAL "Off" set_global_assignment -entity "altera_gpio_lite" -library "intel_gpio_ddro" -name IP_COMPONENT_AUTHOR "SW50ZWwgQ29ycG9yYXRpb24=" -set_global_assignment -entity "altera_gpio_lite" -library "intel_gpio_ddro" -name IP_COMPONENT_VERSION "MjAuMQ==" +set_global_assignment -entity "altera_gpio_lite" -library "intel_gpio_ddro" -name IP_COMPONENT_VERSION "MjEuMQ==" set_global_assignment -entity "altera_gpio_lite" -library "intel_gpio_ddro" -name IP_COMPONENT_DESCRIPTION "R1BJTyBMaXRlIEludGVsIEZQR0EgSVA=" set_global_assignment -entity "altera_gpio_lite" -library "intel_gpio_ddro" -name IP_COMPONENT_PARAMETER "REVWSUNFX0ZBTUlMWQ==::TUFYIDEw::RGV2aWNlIGZhbWlseQ==" set_global_assignment -entity "altera_gpio_lite" -library "intel_gpio_ddro" -name IP_COMPONENT_PARAMETER "UElOX1RZUEU=::b3V0cHV0::RGF0YSBkaXJlY3Rpb24=" @@ -73,5 +73,5 @@ set_global_assignment -library "intel_gpio_ddro" -name VERILOG_FILE [file join $ set_global_assignment -library "intel_gpio_ddro" -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "intel_gpio_ddro/altera_gpio_lite.sv"] set_global_assignment -entity "altera_gpio_lite" -library "intel_gpio_ddro" -name IP_TOOL_NAME "altera_gpio_lite" -set_global_assignment -entity "altera_gpio_lite" -library "intel_gpio_ddro" -name IP_TOOL_VERSION "20.1" +set_global_assignment -entity "altera_gpio_lite" -library "intel_gpio_ddro" -name IP_TOOL_VERSION "21.1" set_global_assignment -entity "altera_gpio_lite" -library "intel_gpio_ddro" -name IP_TOOL_ENV "mwpim" diff --git a/fw/rtl/intel/gpio/intel_gpio_ddro.v b/fw/rtl/intel/gpio/intel_gpio_ddro.v index 9d07b1a..66bf848 100644 --- a/fw/rtl/intel/gpio/intel_gpio_ddro.v +++ b/fw/rtl/intel/gpio/intel_gpio_ddro.v @@ -1,8 +1,8 @@ -// megafunction wizard: %GPIO Lite Intel FPGA IP v20.1% +// megafunction wizard: %GPIO Lite Intel FPGA IP v21.1% // GENERATION: XML // intel_gpio_ddro.v -// Generated using ACDS version 20.1 720 +// Generated using ACDS version 21.1 842 `timescale 1 ps / 1 ps module intel_gpio_ddro ( @@ -89,7 +89,7 @@ endmodule // their respective licensors. No other licenses, including any licenses // needed under any third party's intellectual property, are provided herein. //--> -// Retrieval info: +// Retrieval info: // Retrieval info: // Retrieval info: // Retrieval info: diff --git a/fw/rtl/intel/gpio/intel_gpio_ddro/altera_gpio_lite.sv b/fw/rtl/intel/gpio/intel_gpio_ddro/altera_gpio_lite.sv index 6d395bb..4c06935 100644 --- a/fw/rtl/intel/gpio/intel_gpio_ddro/altera_gpio_lite.sv +++ b/fw/rtl/intel/gpio/intel_gpio_ddro/altera_gpio_lite.sv @@ -1,4 +1,4 @@ -// (C) 2001-2020 Intel Corporation. All rights reserved. +// (C) 2001-2021 Intel Corporation. All rights reserved. // Your use of Intel Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files from any of the foregoing (including device programming or simulation diff --git a/fw/rtl/intel/pll/intel_pll.qip b/fw/rtl/intel/pll/intel_pll.qip index f3d15cc..b7fa58d 100644 --- a/fw/rtl/intel/pll/intel_pll.qip +++ b/fw/rtl/intel/pll/intel_pll.qip @@ -1,5 +1,5 @@ set_global_assignment -name IP_TOOL_NAME "ALTPLL" -set_global_assignment -name IP_TOOL_VERSION "20.1" +set_global_assignment -name IP_TOOL_VERSION "21.1" set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{MAX 10}" set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "intel_pll.v"] set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "intel_pll.ppf"] diff --git a/fw/rtl/intel/pll/intel_pll.v b/fw/rtl/intel/pll/intel_pll.v index 7a4bdcc..64aa37d 100644 --- a/fw/rtl/intel/pll/intel_pll.v +++ b/fw/rtl/intel/pll/intel_pll.v @@ -9,16 +9,16 @@ // altpll // // Simulation Library Files(s): -// altera_mf +// // ============================================================ // ************************************************************ // THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE! // -// 20.1.1 Build 720 11/11/2020 SJ Lite Edition +// 21.1.0 Build 842 10/21/2021 SJ Lite Edition // ************************************************************ -//Copyright (C) 2020 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 @@ -337,5 +337,4 @@ endmodule // Retrieval info: GEN_FILE: TYPE_NORMAL intel_pll.bsf FALSE // Retrieval info: GEN_FILE: TYPE_NORMAL intel_pll_inst.v FALSE // Retrieval info: GEN_FILE: TYPE_NORMAL intel_pll_bb.v FALSE -// Retrieval info: LIB_FILE: altera_mf // Retrieval info: CBX_MODULE_PREFIX: ON diff --git a/fw/rtl/intel/snp/intel_snp.qsys b/fw/rtl/intel/snp/intel_snp.qsys deleted file mode 100644 index 757e2c4..0000000 --- a/fw/rtl/intel/snp/intel_snp.qsys +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/fw/rtl/system/sc64.sv b/fw/rtl/system/sc64.sv index e8ddb03..5f63a3c 100644 --- a/fw/rtl/system/sc64.sv +++ b/fw/rtl/system/sc64.sv @@ -37,6 +37,4 @@ package sc64; parameter int UART_BAUD_RATE = 32'd1_000_000; - parameter bit DEBUG_ENABLED = 1'b0; - endpackage diff --git a/fw/rtl/system/system.sv b/fw/rtl/system/system.sv index c152083..a439629 100644 --- a/fw/rtl/system/system.sv +++ b/fw/rtl/system/system.sv @@ -38,7 +38,6 @@ endinterface module system (if_system.internal sys); logic locked; - logic external_reset; logic [1:0] n64_reset_ff; logic [1:0] n64_nmi_ff; @@ -49,22 +48,13 @@ module system (if_system.internal sys); .locked(locked) ); - generate - if (sc64::DEBUG_ENABLED) begin - intel_snp intel_snp_inst ( - .source(external_reset), - .source_clk(sys.clk) - ); - end - endgenerate - always_ff @(posedge sys.clk) begin n64_reset_ff <= {n64_reset_ff[0], sys.n64_reset}; n64_nmi_ff <= {n64_nmi_ff[0], sys.n64_nmi}; end always_comb begin - sys.reset = ~locked | external_reset; + sys.reset = ~locked; sys.n64_hard_reset = ~n64_reset_ff[1]; sys.n64_soft_reset = ~n64_nmi_ff[1]; end diff --git a/fw/rtl/usb/usb_ft1248.sv b/fw/rtl/usb/usb_ft1248.sv index 7dcb3ea..eb2720c 100644 --- a/fw/rtl/usb/usb_ft1248.sv +++ b/fw/rtl/usb/usb_ft1248.sv @@ -1,11 +1,12 @@ module usb_ft1248 ( if_system.sys sys, + input usb_enabled, + output usb_clk, output usb_cs, input usb_miso, inout [3:0] usb_miosi, - input usb_pwren, input rx_flush, output rx_empty, @@ -30,7 +31,7 @@ module usb_ft1248 ( intel_fifo_8 fifo_8_rx_inst ( .clock(sys.clk), - .sclr(rx_flush), + .sclr(rx_flush || !usb_enabled), .empty(rx_empty), .rdreq(rx_read), @@ -43,7 +44,7 @@ module usb_ft1248 ( intel_fifo_8 fifo_8_tx_inst ( .clock(sys.clk), - .sclr(tx_flush), + .sclr(tx_flush || !usb_enabled), .empty(tx_empty), .rdreq(tx_read), @@ -88,7 +89,6 @@ module usb_ft1248 ( logic usb_miosi_output_enable; logic usb_miosi_output_enable_data; logic usb_miso_input; - logic usb_pwren_input; logic is_cmd_write; logic [1:0] nibble_counter; @@ -111,7 +111,6 @@ module usb_ft1248 ( usb_miosi_output_enable <= usb_miosi_output_enable_data; usb_miso_input <= usb_miso; - usb_pwren_input <= usb_pwren; tx_buffer <= tx_rdata; end @@ -157,7 +156,7 @@ module usb_ft1248 ( nibble_counter <= nibble_counter + 1'd1; end - if (sys.reset) begin + if (sys.reset || !usb_enabled) begin state <= S_TRY_RX; end else begin case (state) diff --git a/sw/n64/build.sh b/sw/n64/build.sh deleted file mode 100755 index a048919..0000000 --- a/sw/n64/build.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -docker run \ - --mount type=bind,src="$(pwd)",target="/workdir" \ - ghcr.io/polprzewodnikowy/sc64env:v1.0 \ - /bin/bash -c "make clean all" diff --git a/sw/pc/.gitignore b/sw/pc/.gitignore index e393a9a..ffb637a 100644 --- a/sw/pc/.gitignore +++ b/sw/pc/.gitignore @@ -1,10 +1,12 @@ +/backup +/saves +*.bak +*.bin *.dat -*.srm +*.data *.eep *.fla *.n64 -*.z64 +*.srm *.v64 -*.data -*.bak -*.bin +*.z64 diff --git a/sw/riscv/build.sh b/sw/riscv/build.sh deleted file mode 100755 index 024bdf7..0000000 --- a/sw/riscv/build.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -docker run \ - --mount type=bind,src="$(pwd)",target="/workdir" \ - ghcr.io/polprzewodnikowy/sc64env:v1.0 \ - /bin/bash -c "USER_FLAGS=\"-DDEBUG\" make clean all" diff --git a/sw/riscv/src/sys.h b/sw/riscv/src/sys.h index 41d5f2e..b17f233 100644 --- a/sw/riscv/src/sys.h +++ b/sw/riscv/src/sys.h @@ -59,6 +59,8 @@ typedef volatile struct usb_regs { #define USB_SCR_TXE (1 << 1) #define USB_SCR_FLUSH_RX (1 << 2) #define USB_SCR_FLUSH_TX (1 << 3) +#define USB_SCR_ENABLED (1 << 4) +#define USB_SCR_PWREN (1 << 5) typedef volatile struct uart_regs { diff --git a/sw/riscv/src/usb.c b/sw/riscv/src/usb.c index 7c09afb..afd342f 100644 --- a/sw/riscv/src/usb.c +++ b/sw/riscv/src/usb.c @@ -181,7 +181,7 @@ static bool rx_cmd (uint32_t *data) { void usb_init (void) { - USB->SCR = USB_SCR_FLUSH_TX | USB_SCR_FLUSH_RX; + USB->SCR = USB_SCR_ENABLED | USB_SCR_FLUSH_TX | USB_SCR_FLUSH_RX; p.state = STATE_IDLE; p.debug_rx_busy = false;