Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e58c44e93c | ||
|
|
e433c8d2c3 |
No files matched your search
@@ -10,4 +10,3 @@ jtag.cdf
|
||||
greybox_tmp/cbx_args.txt
|
||||
*/greybox_tmp/cbx_args.txt
|
||||
changes.txt
|
||||
rtl/config_inc.sv
|
||||
Binary file not shown.
@@ -28,7 +28,6 @@ set_global_assignment -name TIMEQUEST_MULTICORNER_ANALYSIS OFF
|
||||
set_global_assignment -name OPTIMIZE_POWER_DURING_FITTING OFF
|
||||
set_global_assignment -name FINAL_PLACEMENT_OPTIMIZATION ALWAYS
|
||||
set_global_assignment -name FITTER_EFFORT "STANDARD FIT"
|
||||
set_global_assignment -name OPTIMIZATION_MODE "HIGH PERFORMANCE EFFORT"
|
||||
set_global_assignment -name ALLOW_POWER_UP_DONT_CARE ON
|
||||
set_global_assignment -name QII_AUTO_PACKED_REGISTERS NORMAL
|
||||
set_global_assignment -name ROUTER_LCELL_INSERTION_AND_LOGIC_DUPLICATION ON
|
||||
@@ -55,126 +54,396 @@ set_global_assignment -name SEED 1
|
||||
#enable it only if 8bit indexed mode is used in core
|
||||
#set_global_assignment -name VERILOG_MACRO "MISTER_FB_PALETTE=1"
|
||||
|
||||
#set_global_assignment -name VERILOG_MACRO "MISTER_DUAL_SDRAM=1"
|
||||
|
||||
#do not enable DEBUG_NOHDMI in release!
|
||||
#set_global_assignment -name VERILOG_MACRO "MISTER_DEBUG_NOHDMI=1"
|
||||
|
||||
# disable bilinear filtering when downscaling
|
||||
#set_global_assignment -name VERILOG_MACRO "MISTER_DOWNSCALE_NN=1"
|
||||
|
||||
# disable adaptive scanline filtering
|
||||
#set_global_assignment -name VERILOG_MACRO "MISTER_DISABLE_ADAPTIVE=1"
|
||||
|
||||
#use only 1MB per frame for scaler to free ~21MB DDR3 RAM
|
||||
#set_global_assignment -name VERILOG_MACRO "MISTER_SMALL_VBUF=1"
|
||||
|
||||
# Disable YC / Composite output to save some resources
|
||||
#set_global_assignment -name VERILOG_MACRO "MISTER_DISABLE_YC=1"
|
||||
|
||||
# Disable ALSA audio output to save some resources
|
||||
#set_global_assignment -name VERILOG_MACRO "MISTER_DISABLE_ALSA=1"
|
||||
|
||||
source sys/sys.tcl
|
||||
set_global_assignment -name FAMILY "Cyclone V"
|
||||
set_global_assignment -name DEVICE 5CSEBA6U23I7
|
||||
set_global_assignment -name DEVICE_FILTER_PACKAGE UFBGA
|
||||
set_global_assignment -name DEVICE_FILTER_PIN_COUNT 672
|
||||
set_global_assignment -name DEVICE_FILTER_SPEED_GRADE 7
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to ADC_CONVST
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to ADC_SCK
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to ADC_SDI
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to ADC_SDO
|
||||
set_location_assignment PIN_U9 -to ADC_CONVST
|
||||
set_location_assignment PIN_V10 -to ADC_SCK
|
||||
set_location_assignment PIN_AC4 -to ADC_SDI
|
||||
set_location_assignment PIN_AD4 -to ADC_SDO
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to ARDUINO_IO[*]
|
||||
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to ARDUINO_IO[*]
|
||||
set_instance_assignment -name CURRENT_STRENGTH_NEW "MAXIMUM CURRENT" -to ARDUINO_IO[*]
|
||||
set_location_assignment PIN_U14 -to IO_SCL
|
||||
set_location_assignment PIN_AG9 -to IO_SDA
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to IO_S*
|
||||
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to IO_S*
|
||||
set_instance_assignment -name CURRENT_STRENGTH_NEW "MAXIMUM CURRENT" -to IO_S*
|
||||
set_location_assignment PIN_AF17 -to USER_IO[6]
|
||||
set_location_assignment PIN_AF15 -to USER_IO[5]
|
||||
set_location_assignment PIN_AG16 -to USER_IO[4]
|
||||
set_location_assignment PIN_AH11 -to USER_IO[3]
|
||||
set_location_assignment PIN_AH12 -to USER_IO[2]
|
||||
set_location_assignment PIN_AH9 -to USER_IO[1]
|
||||
set_location_assignment PIN_AG11 -to USER_IO[0]
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to USER_IO[*]
|
||||
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to USER_IO[*]
|
||||
set_instance_assignment -name CURRENT_STRENGTH_NEW "MAXIMUM CURRENT" -to USER_IO[*]
|
||||
set_location_assignment PIN_AH7 -to SDCD_SPDIF
|
||||
set_instance_assignment -name CURRENT_STRENGTH_NEW "MAXIMUM CURRENT" -to SDCD_SPDIF
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SDCD_SPDIF
|
||||
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to SDCD_SPDIF
|
||||
set_location_assignment PIN_Y11 -to SDRAM_A[0]
|
||||
set_location_assignment PIN_AA26 -to SDRAM_A[1]
|
||||
set_location_assignment PIN_AA13 -to SDRAM_A[2]
|
||||
set_location_assignment PIN_AA11 -to SDRAM_A[3]
|
||||
set_location_assignment PIN_W11 -to SDRAM_A[4]
|
||||
set_location_assignment PIN_Y19 -to SDRAM_A[5]
|
||||
set_location_assignment PIN_AB23 -to SDRAM_A[6]
|
||||
set_location_assignment PIN_AC23 -to SDRAM_A[7]
|
||||
set_location_assignment PIN_AC22 -to SDRAM_A[8]
|
||||
set_location_assignment PIN_C12 -to SDRAM_A[9]
|
||||
set_location_assignment PIN_AB26 -to SDRAM_A[10]
|
||||
set_location_assignment PIN_AD17 -to SDRAM_A[11]
|
||||
set_location_assignment PIN_D12 -to SDRAM_A[12]
|
||||
set_location_assignment PIN_Y17 -to SDRAM_BA[0]
|
||||
set_location_assignment PIN_AB25 -to SDRAM_BA[1]
|
||||
set_location_assignment PIN_E8 -to SDRAM_DQ[0]
|
||||
set_location_assignment PIN_V12 -to SDRAM_DQ[1]
|
||||
set_location_assignment PIN_D11 -to SDRAM_DQ[2]
|
||||
set_location_assignment PIN_W12 -to SDRAM_DQ[3]
|
||||
set_location_assignment PIN_AH13 -to SDRAM_DQ[4]
|
||||
set_location_assignment PIN_D8 -to SDRAM_DQ[5]
|
||||
set_location_assignment PIN_AH14 -to SDRAM_DQ[6]
|
||||
set_location_assignment PIN_AF7 -to SDRAM_DQ[7]
|
||||
set_location_assignment PIN_AE24 -to SDRAM_DQ[8]
|
||||
set_location_assignment PIN_AD23 -to SDRAM_DQ[9]
|
||||
set_location_assignment PIN_AE6 -to SDRAM_DQ[10]
|
||||
set_location_assignment PIN_AE23 -to SDRAM_DQ[11]
|
||||
set_location_assignment PIN_AG14 -to SDRAM_DQ[12]
|
||||
set_location_assignment PIN_AD5 -to SDRAM_DQ[13]
|
||||
set_location_assignment PIN_AF4 -to SDRAM_DQ[14]
|
||||
set_location_assignment PIN_AH3 -to SDRAM_DQ[15]
|
||||
set_location_assignment PIN_AG13 -to SDRAM_DQML
|
||||
set_location_assignment PIN_AF13 -to SDRAM_DQMH
|
||||
set_location_assignment PIN_AD20 -to SDRAM_CLK
|
||||
set_location_assignment PIN_AG10 -to SDRAM_CKE
|
||||
set_location_assignment PIN_AA19 -to SDRAM_nWE
|
||||
set_location_assignment PIN_AA18 -to SDRAM_nCAS
|
||||
set_location_assignment PIN_Y18 -to SDRAM_nCS
|
||||
set_location_assignment PIN_W14 -to SDRAM_nRAS
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SDRAM_*
|
||||
set_instance_assignment -name CURRENT_STRENGTH_NEW "MAXIMUM CURRENT" -to SDRAM_*
|
||||
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to SDRAM_*
|
||||
set_instance_assignment -name FAST_OUTPUT_ENABLE_REGISTER ON -to SDRAM_DQ[*]
|
||||
set_instance_assignment -name FAST_INPUT_REGISTER ON -to SDRAM_DQ[*]
|
||||
set_instance_assignment -name ALLOW_SYNCH_CTRL_USAGE OFF -to *|SDRAM_*
|
||||
set_location_assignment PIN_AE15 -to SD_SPI_CS
|
||||
set_location_assignment PIN_AH8 -to SD_SPI_MISO
|
||||
set_location_assignment PIN_AG8 -to SD_SPI_CLK
|
||||
set_location_assignment PIN_U13 -to SD_SPI_MOSI
|
||||
set_instance_assignment -name CURRENT_STRENGTH_NEW "MAXIMUM CURRENT" -to SD_SPI*
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SD_SPI*
|
||||
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to SD_SPI*
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to FPGA_CLK1_50
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to FPGA_CLK2_50
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to FPGA_CLK3_50
|
||||
set_location_assignment PIN_V11 -to FPGA_CLK1_50
|
||||
set_location_assignment PIN_Y13 -to FPGA_CLK2_50
|
||||
set_location_assignment PIN_E11 -to FPGA_CLK3_50
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to HDMI_I2C_*
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to HDMI_I2S
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to HDMI_LRCLK
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to HDMI_MCLK
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to HDMI_SCLK
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to HDMI_TX_*
|
||||
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to HDMI_TX_D[*]
|
||||
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to HDMI_TX_DE
|
||||
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to HDMI_TX_HS
|
||||
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to HDMI_TX_VS
|
||||
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to HDMI_TX_CLK
|
||||
set_location_assignment PIN_U10 -to HDMI_I2C_SCL
|
||||
set_location_assignment PIN_AA4 -to HDMI_I2C_SDA
|
||||
set_location_assignment PIN_T13 -to HDMI_I2S
|
||||
set_location_assignment PIN_T11 -to HDMI_LRCLK
|
||||
set_location_assignment PIN_U11 -to HDMI_MCLK
|
||||
set_location_assignment PIN_T12 -to HDMI_SCLK
|
||||
set_location_assignment PIN_AG5 -to HDMI_TX_CLK
|
||||
set_location_assignment PIN_AD19 -to HDMI_TX_DE
|
||||
set_location_assignment PIN_AD12 -to HDMI_TX_D[0]
|
||||
set_location_assignment PIN_AE12 -to HDMI_TX_D[1]
|
||||
set_location_assignment PIN_W8 -to HDMI_TX_D[2]
|
||||
set_location_assignment PIN_Y8 -to HDMI_TX_D[3]
|
||||
set_location_assignment PIN_AD11 -to HDMI_TX_D[4]
|
||||
set_location_assignment PIN_AD10 -to HDMI_TX_D[5]
|
||||
set_location_assignment PIN_AE11 -to HDMI_TX_D[6]
|
||||
set_location_assignment PIN_Y5 -to HDMI_TX_D[7]
|
||||
set_location_assignment PIN_AF10 -to HDMI_TX_D[8]
|
||||
set_location_assignment PIN_Y4 -to HDMI_TX_D[9]
|
||||
set_location_assignment PIN_AE9 -to HDMI_TX_D[10]
|
||||
set_location_assignment PIN_AB4 -to HDMI_TX_D[11]
|
||||
set_location_assignment PIN_AE7 -to HDMI_TX_D[12]
|
||||
set_location_assignment PIN_AF6 -to HDMI_TX_D[13]
|
||||
set_location_assignment PIN_AF8 -to HDMI_TX_D[14]
|
||||
set_location_assignment PIN_AF5 -to HDMI_TX_D[15]
|
||||
set_location_assignment PIN_AE4 -to HDMI_TX_D[16]
|
||||
set_location_assignment PIN_AH2 -to HDMI_TX_D[17]
|
||||
set_location_assignment PIN_AH4 -to HDMI_TX_D[18]
|
||||
set_location_assignment PIN_AH5 -to HDMI_TX_D[19]
|
||||
set_location_assignment PIN_AH6 -to HDMI_TX_D[20]
|
||||
set_location_assignment PIN_AG6 -to HDMI_TX_D[21]
|
||||
set_location_assignment PIN_AF9 -to HDMI_TX_D[22]
|
||||
set_location_assignment PIN_AE8 -to HDMI_TX_D[23]
|
||||
set_location_assignment PIN_T8 -to HDMI_TX_HS
|
||||
set_location_assignment PIN_AF11 -to HDMI_TX_INT
|
||||
set_location_assignment PIN_V13 -to HDMI_TX_VS
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to KEY[0]
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to KEY[1]
|
||||
set_location_assignment PIN_AH17 -to KEY[0]
|
||||
set_location_assignment PIN_AH16 -to KEY[1]
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED[0]
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED[1]
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED[2]
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED[3]
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED[4]
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED[5]
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED[6]
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED[7]
|
||||
set_location_assignment PIN_W15 -to LED[0]
|
||||
set_location_assignment PIN_AA24 -to LED[1]
|
||||
set_location_assignment PIN_V16 -to LED[2]
|
||||
set_location_assignment PIN_V15 -to LED[3]
|
||||
set_location_assignment PIN_AF26 -to LED[4]
|
||||
set_location_assignment PIN_AE26 -to LED[5]
|
||||
set_location_assignment PIN_Y16 -to LED[6]
|
||||
set_location_assignment PIN_AA23 -to LED[7]
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SW[0]
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SW[1]
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SW[2]
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SW[3]
|
||||
set_location_assignment PIN_Y24 -to SW[0]
|
||||
set_location_assignment PIN_W24 -to SW[1]
|
||||
set_location_assignment PIN_W21 -to SW[2]
|
||||
set_location_assignment PIN_W20 -to SW[3]
|
||||
set_hps_location_assignment HPSINTERFACEPERIPHERALSPIMASTER_X52_Y72_N111 -to spi
|
||||
set_hps_location_assignment HPSINTERFACEPERIPHERALUART_X52_Y67_N111 -to uart
|
||||
set_hps_location_assignment HPSINTERFACEPERIPHERALI2C_X52_Y60_N111 -to hdmi_i2c
|
||||
set_global_assignment -name PRE_FLOW_SCRIPT_FILE "quartus_sh:sys/build_id.tcl"
|
||||
set_global_assignment -name CDF_FILE jtag.cdf
|
||||
set_global_assignment -name QIP_FILE sys/sys.qip
|
||||
source sys/sys_analog.tcl
|
||||
set_location_assignment PIN_AF25 -to SDIO_DAT[0]
|
||||
set_location_assignment PIN_AF23 -to SDIO_DAT[1]
|
||||
set_location_assignment PIN_AD26 -to SDIO_DAT[2]
|
||||
set_location_assignment PIN_AF28 -to SDIO_DAT[3]
|
||||
set_location_assignment PIN_AF27 -to SDIO_CMD
|
||||
set_location_assignment PIN_AH26 -to SDIO_CLK
|
||||
set_instance_assignment -name CURRENT_STRENGTH_NEW "MAXIMUM CURRENT" -to SDIO_*
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SDIO_*
|
||||
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to SDIO_DAT[*]
|
||||
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to SDIO_CMD
|
||||
set_location_assignment PIN_AE17 -to VGA_R[0]
|
||||
set_location_assignment PIN_AE20 -to VGA_R[1]
|
||||
set_location_assignment PIN_AF20 -to VGA_R[2]
|
||||
set_location_assignment PIN_AH18 -to VGA_R[3]
|
||||
set_location_assignment PIN_AH19 -to VGA_R[4]
|
||||
set_location_assignment PIN_AF21 -to VGA_R[5]
|
||||
set_location_assignment PIN_AE19 -to VGA_G[0]
|
||||
set_location_assignment PIN_AG15 -to VGA_G[1]
|
||||
set_location_assignment PIN_AF18 -to VGA_G[2]
|
||||
set_location_assignment PIN_AG18 -to VGA_G[3]
|
||||
set_location_assignment PIN_AG19 -to VGA_G[4]
|
||||
set_location_assignment PIN_AG20 -to VGA_G[5]
|
||||
set_location_assignment PIN_AG21 -to VGA_B[0]
|
||||
set_location_assignment PIN_AA20 -to VGA_B[1]
|
||||
set_location_assignment PIN_AE22 -to VGA_B[2]
|
||||
set_location_assignment PIN_AF22 -to VGA_B[3]
|
||||
set_location_assignment PIN_AH23 -to VGA_B[4]
|
||||
set_location_assignment PIN_AH21 -to VGA_B[5]
|
||||
set_location_assignment PIN_AH22 -to VGA_HS
|
||||
set_location_assignment PIN_AG24 -to VGA_VS
|
||||
set_location_assignment PIN_AH27 -to VGA_EN
|
||||
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to VGA_EN
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to VGA_*
|
||||
set_instance_assignment -name CURRENT_STRENGTH_NEW 8MA -to VGA_*
|
||||
set_location_assignment PIN_AC24 -to AUDIO_L
|
||||
set_location_assignment PIN_AE25 -to AUDIO_R
|
||||
set_location_assignment PIN_AG26 -to AUDIO_SPDIF
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to AUDIO_*
|
||||
set_instance_assignment -name CURRENT_STRENGTH_NEW 8MA -to AUDIO_*
|
||||
set_location_assignment PIN_Y15 -to LED_USER
|
||||
set_location_assignment PIN_AA15 -to LED_HDD
|
||||
set_location_assignment PIN_AG28 -to LED_POWER
|
||||
set_location_assignment PIN_AH24 -to BTN_USER
|
||||
set_location_assignment PIN_AG25 -to BTN_OSD
|
||||
set_location_assignment PIN_AG23 -to BTN_RESET
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED_*
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to BTN_*
|
||||
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to BTN_*
|
||||
source files.qip
|
||||
set_global_assignment -name VHDL_FILE rtl/sram/coco_ram.vhd
|
||||
set_global_assignment -name VHDL_FILE rtl/rom/coco_rom_cart.vhd
|
||||
set_global_assignment -name VHDL_FILE rtl/rom/coco3_char_rom.vhd
|
||||
set_global_assignment -name VERILOG_FILE rtl/PS2_Key/ps2_keyboard.v
|
||||
set_global_assignment -name MIF_FILE rtl/VDAC.mif
|
||||
set_global_assignment -name VERILOG_FILE rtl/VDAC.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/Mister_Video.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/cocokey.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/UART_6551/uart_6551.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/UART_6551/6551tx.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/UART_6551/6551rx.v
|
||||
set_global_assignment -name VHDL_FILE rtl/CPU09/cpu09l_128a.vhd
|
||||
set_global_assignment -name SYSTEMVERILOG_FILE rtl/coco3fpga.sv
|
||||
set_global_assignment -name VERILOG_FILE rtl/cassette.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/rtc.sv
|
||||
set_global_assignment -name VERILOG_FILE rtl/AMW.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/square_gen.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/config.v
|
||||
set_global_assignment -name SYSTEMVERILOG_FILE rtl/fdc.sv
|
||||
set_global_assignment -name SYSTEMVERILOG_FILE rtl/sdc.sv
|
||||
set_global_assignment -name SYSTEMVERILOG_FILE rtl/sdc_top.sv
|
||||
set_global_assignment -name SYSTEMVERILOG_FILE rtl/ps2_mouse.v
|
||||
set_global_assignment -name SYSTEMVERILOG_FILE rtl/sdram/sdram2.sv
|
||||
set_global_assignment -name SYSTEMVERILOG_FILE rtl/wd1793.sv
|
||||
set_global_assignment -name SYSTEMVERILOG_FILE CoCo3.sv
|
||||
set_global_assignment -name VHDL_FILE rtl/sram/coco_vid_ram_buf.vhd
|
||||
set_global_assignment -name SYSTEMVERILOG_FILE rtl/coco_mem_fetch.sv
|
||||
set_global_assignment -name VERILOG_FILE rtl/EE_Cold_Bt.v
|
||||
set_global_assignment -name VHDL_FILE rtl/rom/coco_rom_32K.vhd
|
||||
set_global_assignment -name VHDL_FILE rtl/rom/coco_rom_8K.vhd
|
||||
set_global_assignment -name VHDL_FILE rtl/rom/coco_rom_16.vhd
|
||||
set_global_assignment -name SDC_FILE rtl/CoCo3FPGA.sdc
|
||||
|
||||
set_global_assignment -name SIGNALTAP_FILE Video_Explorer.stp
|
||||
set_global_assignment -name SIGNALTAP_FILE rom_Exploror.stp1
|
||||
set_global_assignment -name SOURCE_FILE rom_Exploror.stp1
|
||||
set_global_assignment -name SIGNALTAP_FILE Serial.stp
|
||||
set_global_assignment -name SIGNALTAP_FILE AMW.stp
|
||||
set_global_assignment -name SIGNALTAP_FILE HD.stp
|
||||
set_global_assignment -name SIGNALTAP_FILE reset.stp
|
||||
set_global_assignment -name SIGNALTAP_FILE Vsync.stp
|
||||
set_global_assignment -name ENABLE_SIGNALTAP ON
|
||||
set_global_assignment -name USE_SIGNALTAP_FILE Video1.stp
|
||||
set_global_assignment -name SLD_NODE_CREATOR_ID 110 -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_ENTITY_NAME sld_signaltap -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_clk -to "emu:emu|video_mixer:video_mixer|CLK_VIDEO" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[0] -to "emu:emu|VGA_DE" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[1] -to "emu:emu|VGA_F1" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[2] -to "emu:emu|VGA_G[7]" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[3] -to "emu:emu|VGA_HS" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[4] -to "emu:emu|VGA_VS" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[5] -to "emu:emu|video_mixer:video_mixer|HBlank" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[6] -to "emu:emu|video_mixer:video_mixer|HSync" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[7] -to "emu:emu|video_mixer:video_mixer|VBlank" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[8] -to "emu:emu|video_mixer:video_mixer|VSync" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[9] -to "emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ce_pix" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[10] -to "emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[0]" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[11] -to "emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[1]" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[12] -to "emu:emu|video_mixer:video_mixer|gamma_corr:gamma|hb" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[13] -to "emu:emu|video_mixer:video_mixer|gamma_corr:gamma|hs" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[14] -to "emu:emu|video_mixer:video_mixer|gamma_corr:gamma|old_ce" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[15] -to "emu:emu|video_mixer:video_mixer|gamma_corr:gamma|vb" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[16] -to "emu:emu|video_mixer:video_mixer|gamma_corr:gamma|vs" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[17] -to "emu:emu|video_mixer:video_mixer|video_freezer:freezer|hs_out" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[18] -to "emu:emu|video_mixer:video_mixer|video_freezer:freezer|vs_out" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[0] -to "emu:emu|VGA_DE" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[1] -to "emu:emu|VGA_F1" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[2] -to "emu:emu|VGA_G[7]" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[3] -to "emu:emu|VGA_HS" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[4] -to "emu:emu|VGA_VS" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[5] -to "emu:emu|video_mixer:video_mixer|HBlank" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[6] -to "emu:emu|video_mixer:video_mixer|HSync" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[7] -to "emu:emu|video_mixer:video_mixer|VBlank" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[8] -to "emu:emu|video_mixer:video_mixer|VSync" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[9] -to "emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ce_pix" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[10] -to "emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[0]" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[11] -to "emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[1]" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[12] -to "emu:emu|video_mixer:video_mixer|gamma_corr:gamma|hb" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[13] -to "emu:emu|video_mixer:video_mixer|gamma_corr:gamma|hs" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[14] -to "emu:emu|video_mixer:video_mixer|gamma_corr:gamma|old_ce" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[15] -to "emu:emu|video_mixer:video_mixer|gamma_corr:gamma|vb" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[16] -to "emu:emu|video_mixer:video_mixer|gamma_corr:gamma|vs" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[17] -to "emu:emu|video_mixer:video_mixer|video_freezer:freezer|hs_out" -section_id Video1
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[18] -to "emu:emu|video_mixer:video_mixer|video_freezer:freezer|vs_out" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_RAM_BLOCK_TYPE=AUTO" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_DATA_BITS=19" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_TRIGGER_BITS=19" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_STORAGE_QUALIFIER_BITS=19" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_NODE_INFO=805334528" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_POWER_UP_TRIGGER=0" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_INVERSION_MASK=000000000000000000000000000000000000000000000000000000000000000000000000000000000000" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_INVERSION_MASK_LENGTH=84" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_STORAGE_QUALIFIER_INVERSION_MASK_LENGTH=0" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_SEGMENT_SIZE=8192" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_ATTRIBUTE_MEM_MODE=OFF" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_STATE_FLOW_USE_GENERATED=0" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_STATE_BITS=11" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_BUFFER_FULL_STOP=1" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_CURRENT_RESOURCE_WIDTH=1" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_INCREMENTAL_ROUTING=1" -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[0] -to Video1|vcc -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[1] -to Video1|gnd -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[2] -to Video1|vcc -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[3] -to Video1|gnd -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[4] -to Video1|vcc -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[5] -to Video1|vcc -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[6] -to Video1|gnd -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[7] -to Video1|gnd -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[8] -to Video1|gnd -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[9] -to Video1|gnd -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[10] -to Video1|vcc -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[11] -to Video1|vcc -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[12] -to Video1|vcc -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[13] -to Video1|gnd -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[14] -to Video1|vcc -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[15] -to Video1|gnd -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[16] -to Video1|vcc -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[17] -to Video1|vcc -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[18] -to Video1|gnd -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[19] -to Video1|gnd -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[20] -to Video1|vcc -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[21] -to Video1|vcc -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[22] -to Video1|gnd -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[23] -to Video1|vcc -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[24] -to Video1|gnd -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[25] -to Video1|gnd -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[26] -to Video1|vcc -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[27] -to Video1|gnd -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[28] -to Video1|vcc -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[29] -to Video1|vcc -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[30] -to Video1|vcc -section_id Video1
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[31] -to Video1|gnd -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_TRIGGER_LEVEL=1" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_SAMPLE_DEPTH=8192" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_TRIGGER_IN_ENABLED=0" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_TRIGGER_PIPELINE=0" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_RAM_PIPELINE=0" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_COUNTER_PIPELINE=0" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_ADVANCED_TRIGGER_ENTITY=basic,1," -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_TRIGGER_LEVEL_PIPELINE=1" -section_id Video1
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_ENABLE_ADVANCED_TRIGGER=0" -section_id Video1
|
||||
set_global_assignment -name SLD_FILE db/Video1_auto_stripped.stp
|
||||
set_global_assignment -name OPTIMIZATION_MODE "HIGH PERFORMANCE EFFORT"
|
||||
set_global_assignment -name USE_SIGNALTAP_FILE Video_Explorer2.stp
|
||||
set_global_assignment -name VERILOG_FILE rtl/mc6809glb/mc6809glb.v
|
||||
set_global_assignment -name SIGNALTAP_FILE Video_Explorer2.stp
|
||||
set_global_assignment -name SLD_NODE_CREATOR_ID 110 -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_ENTITY_NAME sld_signaltap -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_RAM_BLOCK_TYPE=AUTO" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_NODE_INFO=805334528" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_POWER_UP_TRIGGER=0" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_STORAGE_QUALIFIER_INVERSION_MASK_LENGTH=0" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_ATTRIBUTE_MEM_MODE=OFF" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_STATE_FLOW_USE_GENERATED=0" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_STATE_BITS=11" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_BUFFER_FULL_STOP=1" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_CURRENT_RESOURCE_WIDTH=1" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_INCREMENTAL_ROUTING=1" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[0] -to auto_signaltap_0|gnd -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[3] -to auto_signaltap_0|gnd -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[5] -to auto_signaltap_0|vcc -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[16] -to auto_signaltap_0|vcc -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[28] -to auto_signaltap_0|vcc -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[31] -to auto_signaltap_0|gnd -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_TRIGGER_LEVEL=3" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_TRIGGER_IN_ENABLED=0" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_TRIGGER_PIPELINE=0" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_COUNTER_PIPELINE=0" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_ADVANCED_TRIGGER_ENTITY=basic,1,basic,1,basic,1," -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_TRIGGER_LEVEL_PIPELINE=1" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_ENABLE_ADVANCED_TRIGGER=0" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[2] -to auto_signaltap_0|gnd -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[21] -to auto_signaltap_0|gnd -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[22] -to auto_signaltap_0|gnd -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[30] -to auto_signaltap_0|gnd -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_clk -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|clk_sample" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[0] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|CASS_REWIND_RECORD" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[0] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|CASS_REWIND_RECORD" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[6] -to auto_signaltap_0|vcc -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[12] -to auto_signaltap_0|gnd -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[17] -to auto_signaltap_0|gnd -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[18] -to auto_signaltap_0|gnd -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_RAM_PIPELINE=1" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_SEGMENT_SIZE=2048" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[13] -to auto_signaltap_0|vcc -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[19] -to auto_signaltap_0|vcc -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_SAMPLE_DEPTH=2048" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[8] -to auto_signaltap_0|gnd -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[25] -to auto_signaltap_0|vcc -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[1] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|MOTOR_ON" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[2] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|blk_type[0]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[3] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|blk_type[1]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[4] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|blk_type[2]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[5] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|blk_type[3]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[6] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|blk_type[4]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[7] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|blk_type[5]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[8] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|blk_type[6]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[9] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|blk_type[7]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[10] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_address[0]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[11] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_address[1]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[12] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_address[2]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[13] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_address[3]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[14] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_address[4]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[15] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_address[5]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[16] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_address[6]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[17] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_address[7]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[18] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_address[8]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[19] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_data_in[0]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[20] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_data_in[1]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[21] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_data_in[2]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[22] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_data_in[3]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[23] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_data_in[4]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[24] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_data_in[5]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[25] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_data_in[6]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[26] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_data_in[7]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_trigger_in[27] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|look_for_sync" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[1] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|MOTOR_ON" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[2] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|blk_type[0]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[3] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|blk_type[1]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[4] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|blk_type[2]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[5] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|blk_type[3]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[6] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|blk_type[4]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[7] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|blk_type[5]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[8] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|blk_type[6]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[9] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|blk_type[7]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[10] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_address[0]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[11] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_address[1]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[12] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_address[2]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[13] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_address[3]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[14] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_address[4]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[15] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_address[5]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[16] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_address[6]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[17] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_address[7]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[18] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_address[8]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[19] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_data_in[0]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[20] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_data_in[1]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[21] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_data_in[2]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[22] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_data_in[3]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[23] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_data_in[4]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[24] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_data_in[5]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[25] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_data_in[6]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[26] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|buf_data_in[7]" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name CONNECT_TO_SLD_NODE_ENTITY_PORT acq_data_in[27] -to "emu:emu|coco3fpga:coco3|Cassette_Write:CoCo3_Cassette_Write|look_for_sync" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_DATA_BITS=28" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_TRIGGER_BITS=28" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_STORAGE_QUALIFIER_BITS=28" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_INVERSION_MASK=0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_INVERSION_MASK_LENGTH=277" -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[1] -to auto_signaltap_0|gnd -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[4] -to auto_signaltap_0|vcc -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[7] -to auto_signaltap_0|vcc -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[9] -to auto_signaltap_0|vcc -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[10] -to auto_signaltap_0|vcc -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[11] -to auto_signaltap_0|gnd -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[14] -to auto_signaltap_0|gnd -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[15] -to auto_signaltap_0|vcc -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[20] -to auto_signaltap_0|vcc -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[23] -to auto_signaltap_0|vcc -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[24] -to auto_signaltap_0|vcc -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[26] -to auto_signaltap_0|gnd -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[27] -to auto_signaltap_0|vcc -section_id auto_signaltap_0
|
||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[29] -to auto_signaltap_0|vcc -section_id auto_signaltap_0
|
||||
set_global_assignment -name SLD_FILE db/Video_Explorer2_auto_stripped.stp
|
||||
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
|
||||
@@ -1,6 +1,6 @@
|
||||
//============================================================================
|
||||
// CoCo3 port to MiSTer
|
||||
// Copyright (c) 2019 Alan Steremberg - alanswx, Stan Hodge - MasterS3263827
|
||||
// Copyright (c) 2019 Alan Steremberg - alanswx
|
||||
//
|
||||
//
|
||||
//============================================================================
|
||||
@@ -43,8 +43,6 @@ module emu
|
||||
input [11:0] HDMI_WIDTH,
|
||||
input [11:0] HDMI_HEIGHT,
|
||||
output HDMI_FREEZE,
|
||||
output HDMI_BLACKOUT,
|
||||
output HDMI_BOB_DEINT,
|
||||
|
||||
`ifdef MISTER_FB
|
||||
// Use framebuffer in DDRAM
|
||||
@@ -182,8 +180,6 @@ assign LED_POWER = 0;
|
||||
|
||||
assign VGA_SCALER = 0;
|
||||
assign HDMI_FREEZE = 0;
|
||||
assign HDMI_BLACKOUT = 0;
|
||||
assign HDMI_BOB_DEINT = 0;
|
||||
|
||||
wire [1:0] ar = status[9:8];
|
||||
|
||||
@@ -193,8 +189,6 @@ assign VIDEO_ARY = (!ar) ? 12'd3 : 12'd0;
|
||||
|
||||
|
||||
`include "build_id.v"
|
||||
`include "build_id_num.v"
|
||||
|
||||
localparam CONF_STR = {
|
||||
"COCO3;UART19200:9600:4800:2400:1200:300;",
|
||||
"-;",
|
||||
@@ -241,10 +235,7 @@ localparam CONF_STR = {
|
||||
"P2-, -= Debug Menu =-;",
|
||||
"P2-;",
|
||||
"P2F3,BIN,Load COCO Font;",
|
||||
"P2OG,Swap MiSTer Uart,RS CART,Default;",
|
||||
"P2OU,Swap Uart to IO,RS IO,MiSTer;",
|
||||
"P2OT,Display Debug,Off,On;",
|
||||
"P2OJ,Cart Interrupt Disabled,OFF,ON;",
|
||||
"P2OG,Cart Interrupt Disabled,OFF,ON;",
|
||||
"-;",
|
||||
"ON,D-Pad Joystick emu,No,Yes;",
|
||||
"O6,Swap Joysticks,Off,On;",
|
||||
@@ -261,7 +252,7 @@ localparam CONF_STR = {
|
||||
"J,Button1,Button2;",
|
||||
"jn,A,B;",
|
||||
"v,51;",
|
||||
"V,v",{`BUILD_DATE,"-",`BUILD_NUMBER}
|
||||
"V,v",`BUILD_DATE
|
||||
};
|
||||
|
||||
// Status bits Directory
|
||||
@@ -273,7 +264,7 @@ localparam CONF_STR = {
|
||||
// 0123456789ABCDEFGHIJKLMNOPQRSTUV 0123456789ABCDEFGHIJKLMNOPQRSTUV
|
||||
//
|
||||
|
||||
// R OOOO OOR OOOTOOOOOOROOOOOOOO ooo oo oo
|
||||
// R OOOO OOR OOOTOOOOOOROOOOOO ooo oo oo
|
||||
//F FF
|
||||
//S SSSSSSS
|
||||
|
||||
@@ -286,7 +277,7 @@ assign clk_sys=CLK_57;
|
||||
wire pll_locked, pll2_locked;
|
||||
wire CLK_114, CLK_57, CLK_28, CLK_14;
|
||||
|
||||
assign VGA_DISABLE = 1'b0;
|
||||
|
||||
|
||||
pll pll
|
||||
(
|
||||
@@ -326,7 +317,6 @@ wire [21:0] gamma_bus;
|
||||
assign CLK_VIDEO = clk_sys;
|
||||
|
||||
wire [64:0] RTC;
|
||||
wire [15:0] sdram_sz;
|
||||
|
||||
// SD - 7 drives [4 fdc, 2 sdc and 1 cass_wr] 512 size blocks [the wd1793 translates to a 256 byte sector size]
|
||||
hps_io #(.CONF_STR(CONF_STR),.PS2DIV(2400), .VDNUM(7), .BLKSZ(2)) hps_io
|
||||
@@ -352,8 +342,6 @@ hps_io #(.CONF_STR(CONF_STR),.PS2DIV(2400), .VDNUM(7), .BLKSZ(2)) hps_io
|
||||
.ioctl_dout(ioctl_data),
|
||||
.ioctl_index(ioctl_index),
|
||||
|
||||
.sdram_sz(sdram_sz),
|
||||
|
||||
// SD block level interface
|
||||
|
||||
.img_mounted(img_mounted), // signaling that new image has been mounted
|
||||
@@ -467,9 +455,7 @@ wire Programmed_EE;
|
||||
|
||||
EE_Cold_Bt COCO3_EE_Cold_Bt (
|
||||
.CLK(CLK_14),
|
||||
.RESET(1'b0),
|
||||
|
||||
// .Display_EE(1'b0), // from MISTer subsystem
|
||||
.Display_EE(easter_egg), // from MISTer subsystem
|
||||
.Cold_Boot(AMW_ACK), // from AMW system
|
||||
|
||||
@@ -488,16 +474,10 @@ wire [7:0] r;
|
||||
wire [7:0] g;
|
||||
wire [7:0] b;
|
||||
|
||||
wire easter_egg = status[10];
|
||||
wire [6:0] probe_o;
|
||||
wire [6:0] probe_i;
|
||||
wire easter_egg = ~status[10];
|
||||
wire [31:0] probe;
|
||||
|
||||
assign USER_OUT[6:0] = probe_o[6:0];
|
||||
assign probe_i[6:0] = USER_IN[6:0];
|
||||
|
||||
wire [71:0] Config_Data;
|
||||
|
||||
assign Config_Data = {`BUILD_DATE, `BUILD_NUMBER};
|
||||
assign USER_OUT[6:0] = probe[6:0];
|
||||
|
||||
coco3fpga coco3 (
|
||||
// CLOCKS
|
||||
@@ -511,9 +491,9 @@ coco3fpga coco3 (
|
||||
// Reset
|
||||
.COCO_RESET_N((~reset & Programmed_RESET_N)),
|
||||
|
||||
.RED_O(r),
|
||||
.GREEN_O(g),
|
||||
.BLUE_O(b),
|
||||
.RED(r),
|
||||
.GREEN(g),
|
||||
.BLUE(b),
|
||||
|
||||
.EE_N(Programmed_EE),
|
||||
.PHASE(PHASE),
|
||||
@@ -542,7 +522,7 @@ coco3fpga coco3 (
|
||||
// R1, L2, R2, L1
|
||||
.P_SWITCH(~{coco_joy2[4],coco_joy1[5],coco_joy2[5],coco_joy1[4]}),
|
||||
.SWITCH(switch),
|
||||
// .SOUND_OUT(cocosound),
|
||||
.SOUND_OUT(cocosound),
|
||||
.SOUND_LEFT(audio_left),
|
||||
.SOUND_RIGHT(AUDIO_R),
|
||||
|
||||
@@ -553,9 +533,6 @@ coco3fpga coco3 (
|
||||
.ioctl_index(ioctl_index),
|
||||
.ioctl_wr(ioctl_wr),
|
||||
|
||||
// SDRAM Info
|
||||
.sdram_sz(sdram_sz),
|
||||
|
||||
// SD block level interface
|
||||
|
||||
.img_mounted(img_mounted), // signaling that new image has been mounted
|
||||
@@ -575,8 +552,7 @@ coco3fpga coco3 (
|
||||
.sd_buff_din(sd_buff_din),
|
||||
.sd_buff_wr(sd_buff_wr),
|
||||
|
||||
.PROBE_O(probe_o),
|
||||
.PROBE_I(probe_i),
|
||||
.PROBE(probe[31:0]),
|
||||
.clk_Q_out(clk_Q_out),
|
||||
.casdout( casdout),
|
||||
.cas_relay(cas_relay),
|
||||
@@ -604,7 +580,6 @@ coco3fpga coco3 (
|
||||
.RTC(RTC),
|
||||
|
||||
.AMW_Trigger(coldboot | mpi_reset | mem_reset),
|
||||
// .AMW_Trigger(coldboot),
|
||||
.AMW_ACK(AMW_ACK),
|
||||
|
||||
.F_Turbo(F_Turbo),
|
||||
@@ -613,9 +588,6 @@ coco3fpga coco3 (
|
||||
|
||||
.AUTO_MODE(Auto_Mode),
|
||||
|
||||
.Config_Data(Config_Data),
|
||||
.Display_Debug(display_debug),
|
||||
|
||||
.UART_TXD(UART_TXD),
|
||||
.UART_RXD(UART_RXD),
|
||||
.UART_RTS(UART_RTS),
|
||||
@@ -626,7 +598,7 @@ coco3fpga coco3 (
|
||||
|
||||
assign status_set = 1'b0;
|
||||
|
||||
//wire [5:0] cocosound;
|
||||
wire [5:0] cocosound;
|
||||
|
||||
wire [2:0] turbo_speed = status[34:32];
|
||||
wire [2:0] assigned_turbo_speed;
|
||||
@@ -640,7 +612,7 @@ wire AMW_ACK;
|
||||
wire [1:0] mpi = status[13:12] + 1'b1;
|
||||
//wire video=status[14];
|
||||
wire CASS_REW_RECORD=status[14];
|
||||
wire rs_swap=status[16];
|
||||
wire cartint=status[16];
|
||||
wire sg4v6 = status[21];
|
||||
|
||||
wire PHASE = status[18];
|
||||
@@ -650,9 +622,7 @@ wire coldboot = status[22];
|
||||
wire F_Turbo = status[24];
|
||||
wire [2:0] Mem_Size = status[27:25];
|
||||
wire SWAP_M_J = status[28];
|
||||
wire display_debug = status[29];
|
||||
wire UART_INPUT = status[30];
|
||||
wire cartint = status[19];
|
||||
|
||||
wire digitalJoy = status[23];
|
||||
reg [2:0] mpi_d = 2'b00;
|
||||
reg first_mpi_chg = 1'b0;
|
||||
@@ -689,7 +659,7 @@ begin
|
||||
end
|
||||
|
||||
// Set bit 9 to swap serial ports...
|
||||
wire [9:0] switch = { cartint,UART_INPUT,art,sg4v6,rs_swap,CASS_REW_RECORD,mpi,1'b0};
|
||||
wire [9:0] switch = { 2'b10,art,sg4v6,cartint,CASS_REW_RECORD,mpi,1'b0};
|
||||
|
||||
|
||||
wire reset = RESET | status[0] | buttons[1];
|
||||
@@ -771,7 +741,7 @@ cassette cassette(
|
||||
|
||||
.sdram_addr(ram_addr),
|
||||
.sdram_data(ram_data_o),
|
||||
// .sdram_rd(ram_rd), // Not connected for sram
|
||||
.sdram_rd(ram_rd), // Not connected for sram
|
||||
|
||||
.data(casdout)
|
||||
);
|
||||
|
||||
-214
@@ -1,214 +0,0 @@
|
||||
<session jtag_chain="DE-SoC on yoda [USB-1]" jtag_device="@2: 5CSEBA6(.|ES)/5CSEMA6/.. (0x02D020DD)" sof_file="">
|
||||
<display_tree gui_logging_enabled="0">
|
||||
<display_branch instance="Video1" log="USE_GLOBAL_TEMP" signal_set="USE_GLOBAL_TEMP" trigger="USE_GLOBAL_TEMP"/>
|
||||
</display_tree>
|
||||
<instance enabled="true" entity_name="sld_signaltap" is_auto_node="yes" is_expanded="true" name="Video1" source_file="sld_signaltap.vhd">
|
||||
<node_ip_info instance_id="0" mfg_id="110" node_id="0" version="6"/>
|
||||
<signal_set global_temp="1" is_expanded="true" name="signal_set: 2026/01/10 19:34:25 #0">
|
||||
<clock name="emu:emu|video_mixer:video_mixer|CLK_VIDEO" polarity="posedge" tap_mode="classic"/>
|
||||
<config pipeline_level="0" ram_type="AUTO" reserved_data_nodes="0" reserved_storage_qualifier_nodes="0" reserved_trigger_nodes="0" sample_depth="8192" trigger_in_enable="no" trigger_out_enable="no"/>
|
||||
<top_entity/>
|
||||
<signal_vec>
|
||||
<trigger_input_vec>
|
||||
<wire name="emu:emu|VGA_DE" tap_mode="classic"/>
|
||||
<wire name="emu:emu|VGA_F1" tap_mode="classic"/>
|
||||
<wire name="emu:emu|VGA_G[7]" tap_mode="classic"/>
|
||||
<wire name="emu:emu|VGA_HS" tap_mode="classic"/>
|
||||
<wire name="emu:emu|VGA_VS" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|HBlank" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|HSync" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|VBlank" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|VSync" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ce_pix" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[0]" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[1]" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|hb" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|hs" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|old_ce" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|vb" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|vs" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|video_freezer:freezer|hs_out" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|video_freezer:freezer|vs_out" tap_mode="classic"/>
|
||||
</trigger_input_vec>
|
||||
<data_input_vec>
|
||||
<wire name="emu:emu|VGA_DE" tap_mode="classic"/>
|
||||
<wire name="emu:emu|VGA_F1" tap_mode="classic"/>
|
||||
<wire name="emu:emu|VGA_G[7]" tap_mode="classic"/>
|
||||
<wire name="emu:emu|VGA_HS" tap_mode="classic"/>
|
||||
<wire name="emu:emu|VGA_VS" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|HBlank" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|HSync" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|VBlank" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|VSync" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ce_pix" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[0]" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[1]" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|hb" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|hs" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|old_ce" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|vb" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|vs" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|video_freezer:freezer|hs_out" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|video_freezer:freezer|vs_out" tap_mode="classic"/>
|
||||
</data_input_vec>
|
||||
<storage_qualifier_input_vec>
|
||||
<wire name="emu:emu|VGA_DE" tap_mode="classic"/>
|
||||
<wire name="emu:emu|VGA_F1" tap_mode="classic"/>
|
||||
<wire name="emu:emu|VGA_G[7]" tap_mode="classic"/>
|
||||
<wire name="emu:emu|VGA_HS" tap_mode="classic"/>
|
||||
<wire name="emu:emu|VGA_VS" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|HBlank" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|HSync" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|VBlank" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|VSync" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ce_pix" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[0]" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[1]" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|hb" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|hs" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|old_ce" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|vb" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|vs" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|video_freezer:freezer|hs_out" tap_mode="classic"/>
|
||||
<wire name="emu:emu|video_mixer:video_mixer|video_freezer:freezer|vs_out" tap_mode="classic"/>
|
||||
</storage_qualifier_input_vec>
|
||||
</signal_vec>
|
||||
<presentation>
|
||||
<unified_setup_data_view>
|
||||
<node data_index="2" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="rising edge" name="emu:emu|VGA_G[7]" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="2" tap_mode="classic" trigger_index="2" type="unknown"/>
|
||||
<node data_index="4" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|VGA_VS" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="4" tap_mode="classic" trigger_index="4" type="unknown"/>
|
||||
<node data_index="3" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|VGA_HS" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="3" tap_mode="classic" trigger_index="3" type="unknown"/>
|
||||
<node data_index="0" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|VGA_DE" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="0" tap_mode="classic" trigger_index="0" type="unknown"/>
|
||||
<node data_index="1" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|VGA_F1" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="1" tap_mode="classic" trigger_index="1" type="unknown"/>
|
||||
<node data_index="8" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|VSync" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="8" tap_mode="classic" trigger_index="8" type="unknown"/>
|
||||
<node data_index="6" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|HSync" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="6" tap_mode="classic" trigger_index="6" type="unknown"/>
|
||||
<node data_index="7" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|VBlank" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="7" tap_mode="classic" trigger_index="7" type="unknown"/>
|
||||
<node data_index="5" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|HBlank" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="5" tap_mode="classic" trigger_index="5" type="unknown"/>
|
||||
<node data_index="17" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|video_freezer:freezer|hs_out" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="17" tap_mode="classic" trigger_index="17" type="unknown"/>
|
||||
<node data_index="18" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|video_freezer:freezer|vs_out" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="18" tap_mode="classic" trigger_index="18" type="unknown"/>
|
||||
<node data_index="14" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|old_ce" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="14" tap_mode="classic" trigger_index="14" type="unknown"/>
|
||||
<node data_index="13" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|hs" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="13" tap_mode="classic" trigger_index="13" type="unknown"/>
|
||||
<node data_index="16" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|vs" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="16" tap_mode="classic" trigger_index="16" type="unknown"/>
|
||||
<node data_index="12" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|hb" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="12" tap_mode="classic" trigger_index="12" type="unknown"/>
|
||||
<node data_index="15" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|vb" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="15" tap_mode="classic" trigger_index="15" type="unknown"/>
|
||||
<node data_index="9" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ce_pix" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="9" tap_mode="classic" trigger_index="9" type="unknown"/>
|
||||
<node is_selected="false" level-0="alt_or" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[1..0]" order="msb_to_lsb" storage-0="alt_or" storage-1="alt_or" storage-2="alt_or" type="register">
|
||||
<node data_index="11" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[1]" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="11" tap_mode="classic" trigger_index="11" type="unknown"/>
|
||||
<node data_index="10" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[0]" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="10" tap_mode="classic" trigger_index="10" type="unknown"/>
|
||||
</node>
|
||||
</unified_setup_data_view>
|
||||
<data_view>
|
||||
<net data_index="2" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="rising edge" name="emu:emu|VGA_G[7]" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="2" tap_mode="classic" trigger_index="2" type="unknown"/>
|
||||
<net data_index="4" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|VGA_VS" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="4" tap_mode="classic" trigger_index="4" type="unknown"/>
|
||||
<net data_index="3" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|VGA_HS" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="3" tap_mode="classic" trigger_index="3" type="unknown"/>
|
||||
<net data_index="0" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|VGA_DE" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="0" tap_mode="classic" trigger_index="0" type="unknown"/>
|
||||
<net data_index="1" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|VGA_F1" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="1" tap_mode="classic" trigger_index="1" type="unknown"/>
|
||||
<net data_index="8" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|VSync" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="8" tap_mode="classic" trigger_index="8" type="unknown"/>
|
||||
<net data_index="6" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|HSync" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="6" tap_mode="classic" trigger_index="6" type="unknown"/>
|
||||
<net data_index="7" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|VBlank" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="7" tap_mode="classic" trigger_index="7" type="unknown"/>
|
||||
<net data_index="5" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|HBlank" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="5" tap_mode="classic" trigger_index="5" type="unknown"/>
|
||||
<net data_index="17" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|video_freezer:freezer|hs_out" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="17" tap_mode="classic" trigger_index="17" type="unknown"/>
|
||||
<net data_index="18" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|video_freezer:freezer|vs_out" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="18" tap_mode="classic" trigger_index="18" type="unknown"/>
|
||||
<net data_index="14" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|old_ce" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="14" tap_mode="classic" trigger_index="14" type="unknown"/>
|
||||
<net data_index="13" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|hs" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="13" tap_mode="classic" trigger_index="13" type="unknown"/>
|
||||
<net data_index="16" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|vs" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="16" tap_mode="classic" trigger_index="16" type="unknown"/>
|
||||
<net data_index="12" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|hb" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="12" tap_mode="classic" trigger_index="12" type="unknown"/>
|
||||
<net data_index="15" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|vb" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="15" tap_mode="classic" trigger_index="15" type="unknown"/>
|
||||
<net data_index="9" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ce_pix" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="9" tap_mode="classic" trigger_index="9" type="unknown"/>
|
||||
<bus is_selected="false" level-0="alt_or" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[1..0]" order="msb_to_lsb" storage-0="alt_or" storage-1="alt_or" storage-2="alt_or" type="register">
|
||||
<net data_index="11" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[1]" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="11" tap_mode="classic" trigger_index="11" type="unknown"/>
|
||||
<net data_index="10" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[0]" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="10" tap_mode="classic" trigger_index="10" type="unknown"/>
|
||||
</bus>
|
||||
</data_view>
|
||||
<setup_view>
|
||||
<net data_index="2" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="rising edge" name="emu:emu|VGA_G[7]" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="2" tap_mode="classic" trigger_index="2" type="unknown"/>
|
||||
<net data_index="4" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|VGA_VS" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="4" tap_mode="classic" trigger_index="4" type="unknown"/>
|
||||
<net data_index="3" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|VGA_HS" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="3" tap_mode="classic" trigger_index="3" type="unknown"/>
|
||||
<net data_index="0" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|VGA_DE" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="0" tap_mode="classic" trigger_index="0" type="unknown"/>
|
||||
<net data_index="1" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|VGA_F1" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="1" tap_mode="classic" trigger_index="1" type="unknown"/>
|
||||
<net data_index="8" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|VSync" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="8" tap_mode="classic" trigger_index="8" type="unknown"/>
|
||||
<net data_index="6" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|HSync" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="6" tap_mode="classic" trigger_index="6" type="unknown"/>
|
||||
<net data_index="7" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|VBlank" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="7" tap_mode="classic" trigger_index="7" type="unknown"/>
|
||||
<net data_index="5" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|HBlank" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="5" tap_mode="classic" trigger_index="5" type="unknown"/>
|
||||
<net data_index="17" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|video_freezer:freezer|hs_out" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="17" tap_mode="classic" trigger_index="17" type="unknown"/>
|
||||
<net data_index="18" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|video_freezer:freezer|vs_out" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="18" tap_mode="classic" trigger_index="18" type="unknown"/>
|
||||
<net data_index="14" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|old_ce" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="14" tap_mode="classic" trigger_index="14" type="unknown"/>
|
||||
<net data_index="13" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|hs" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="13" tap_mode="classic" trigger_index="13" type="unknown"/>
|
||||
<net data_index="16" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|vs" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="16" tap_mode="classic" trigger_index="16" type="unknown"/>
|
||||
<net data_index="12" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|hb" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="12" tap_mode="classic" trigger_index="12" type="unknown"/>
|
||||
<net data_index="15" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|vb" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="15" tap_mode="classic" trigger_index="15" type="unknown"/>
|
||||
<net data_index="9" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ce_pix" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="9" tap_mode="classic" trigger_index="9" type="unknown"/>
|
||||
<bus is_selected="false" level-0="alt_or" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[1..0]" order="msb_to_lsb" storage-0="alt_or" storage-1="alt_or" storage-2="alt_or" type="register">
|
||||
<net data_index="11" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[1]" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="11" tap_mode="classic" trigger_index="11" type="unknown"/>
|
||||
<net data_index="10" duplicate_name_allowed="false" is_data_input="true" is_node_valid="true" is_selected="false" is_storage_input="true" is_trigger_input="true" level-0="dont_care" name="emu:emu|video_mixer:video_mixer|gamma_corr:gamma|ctr[0]" pwr_level-0="dont_care" pwr_storage-0="dont_care" pwr_storage-1="dont_care" pwr_storage-2="dont_care" storage-0="dont_care" storage-1="dont_care" storage-2="dont_care" storage_index="10" tap_mode="classic" trigger_index="10" type="unknown"/>
|
||||
</bus>
|
||||
</setup_view>
|
||||
<trigger_in_editor/>
|
||||
<trigger_out_editor/>
|
||||
</presentation>
|
||||
<trigger CRC="74B35C35" attribute_mem_mode="false" gap_record="true" global_temp="1" name="trigger: 2026/01/13 02:01:16 #0" position="pre" power_up_trigger_mode="false" record_data_gap="true" segment_size="2048" storage_mode="off" storage_qualifier_disabled="no" storage_qualifier_port_is_pin="true" storage_qualifier_port_name="auto_stp_external_storage_qualifier" storage_qualifier_port_tap_mode="classic" trigger_type="circular">
|
||||
<power_up_trigger position="pre" storage_qualifier_disabled="no"/>
|
||||
<events use_custom_flow_control="no">
|
||||
<level enabled="yes" name="condition1" type="basic">'emu:emu|VGA_G[7]' == rising edge
|
||||
<power_up enabled="yes">
|
||||
</power_up>
|
||||
<op_node>
|
||||
<op_node left="452" top="174" type="Advanced Trigger Level Result"/>
|
||||
</op_node>
|
||||
</level>
|
||||
</events>
|
||||
<storage_qualifier_events>
|
||||
<transitional>1111111111111111111
|
||||
<pwr_up_transitional>1111111111111111111</pwr_up_transitional>
|
||||
</transitional>
|
||||
<storage_qualifier_level type="basic">
|
||||
<power_up>
|
||||
</power_up>
|
||||
<op_node/>
|
||||
</storage_qualifier_level>
|
||||
<storage_qualifier_level type="basic">
|
||||
<power_up>
|
||||
</power_up>
|
||||
<op_node/>
|
||||
</storage_qualifier_level>
|
||||
<storage_qualifier_level type="basic">
|
||||
<power_up>
|
||||
</power_up>
|
||||
<op_node/>
|
||||
</storage_qualifier_level>
|
||||
</storage_qualifier_events>
|
||||
<log>
|
||||
<data global_temp="1" name="log: Trig @ 2026/01/13 02:05:12 (0:0:0.2 elapsed)" power_up_mode="false" sample_depth="8192" trigger_position="1024">10000000000100100001000000000110000000100000000100000000010000000011000100001000000000010010000100000000011000000010000000010000000001000000001100010000100000000001001000010000000001100000001000000001000000000100000000110001000010000000000100100001000000000110000000100000000100000000010000000011000100001000000000010010000100000000011000000010000000010000000001000000001100010000100000000001001000010000000001100000001000000001000000000100000000110001000010000000000100100001000000000110000000100000000100000000010000000011000100001000000000010010000100000000011000000010000000010000000001000000001100010000100000000001001000010000000001100000001000000001000000000100000000110001000010000000000100100001000000000110000000100000000100000000010000000011000100001000000000010010000100000000011000000010000000010000000001000000001100010000100000000001001000010000000001100000001000000001000000000100000000110001000010000000000100100001000000000110000000100000000100000000010000000011000100001000000000010010000100000000011000000010000000010000000001000000001100010000100000000001001000010000000001100000001000000001000000000100000000110001000010000000000100100001000000000110000000100000000100000000010000000011000100001000000000010010000100000000011000000010000000010000000001000000001100010000100000000001001000010000000001100000001000000001000000000100000000110001000010000000000100100001000000000110000000100000000100000000010000000011000100001000000000010010000100000000011000000010000000010000000001000000001100010000100000000001001000010000000001100000001000000001000000000100000000110001000010000000000100100001000000000110000000100000000100000000010000000011000100001000000000010010000100000000011000000010000000010000000001000000001100010000100000000001001000010000000001100000001000000001000000000100000000110001000010000000000100100001000000000110000000100000000100000000010000000011000100001000000000010010000100000000011000000010000000010000000001000000001100010000100000000001001000010000000001100000001000000001000000000100000000110001000010000000000100100001000000000110000000100000000100000000010000000011000100001000000000010010000100000000011000000010000000010000000001000000001100010000100000000001001000010000000001100000001000000001000000000100000000110001000010000000000100100001000000000110000000100000000100000000010000000011000100001000000000010010000100000000011000000010000000010000000001000000001100010000100000000001001000010000000001100000001000000001000000000100000000110001000010000000000100100001000000000110000000100000000100000000010000000011000100001000000000010010000100000000011000000010000000010000000001000000001100010000100000000001001000010000000001100000001000000001000000000100000000110001000010000000000100100001000000000110000000100000000100000000010000000011000100001000000000010010000100000000011000000010000000010000000001000000001100010000100000000001001000010000000001100000001000000001000000000100000000110001000010000000000100100001000000000110000000100000000100000000010000000011000100001000000000010010000100000000011000000010000000010000000001000000001100010000100000000001001000010000000001100000001000000001000000000100000000110001000010000000000100100001000000000110000000100000000100000000010000000011000100001000000000010010000100000000011000000010000000010000000001000000001100010000100000000001001000010000000001100000001000000001000000000100000000110001000010000000000100100001000000000110000000100000000100000000010000000011000100001000000000010010000100000000011000000010000000010000000001000000001100010000100000000001001000010000000001100000001000000001000000000100000000110001000010000000000100100001000000000110000000100000000100000000010000000011000100001000000000010010000100000000011000000010000100010000000001000010001101010000100001000001101000010000100001110000001000010001001000000100001000110101000010000100000110100001000010000111000000100001000100100000010000100011010100000000010000011010000000001000011100000000000100010010000000000010001101010000000001000001101000000000100001110000000000010001001000000000001000110101000000000100000110100000000010000111000000000001000100100000000000100011010100000000010000011010000000001000011100000000000100010010000000000010001101010000000001000001101000000000100001110000000000010001001000000000001000110101000000000100000110100000000010000111000000000001000100100000000000100011010100000000010000011010000000001000011100000000000100010010000000000010001101010000000001000001101000000000100001110000000000010001001000000000001000110101000000000100000110100000000010000111000000000001000100100000000000100011010100000000010000011010000000001000011100000000000100010010000000000010001101010000000001000001101000000000100001110000000000010001001000000000001000110101000000000100000110100000000010000111000000000001000100100000Line truncated
|
||||
<extradata>1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111T11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111Line truncated
|
||||
</log>
|
||||
</trigger>
|
||||
</signal_set>
|
||||
<position_info>
|
||||
<single attribute="active tab" value="0"/>
|
||||
<single attribute="data horizontal scroll position" value="0"/>
|
||||
<single attribute="data vertical scroll position" value="0"/>
|
||||
<single attribute="setup horizontal scroll position" value="0"/>
|
||||
<single attribute="setup vertical scroll position" value="0"/>
|
||||
<single attribute="zoom level denominator" value="1"/>
|
||||
<single attribute="zoom level numerator" value="1"/>
|
||||
<single attribute="zoom offset denominator" value="1"/>
|
||||
<single attribute="zoom offset numerator" value="122880"/>
|
||||
<multi attribute="timebars" size="2" value="1626,4678"/>
|
||||
</position_info>
|
||||
</instance>
|
||||
<mnemonics/>
|
||||
<static_plugin_mnemonics/>
|
||||
<global_info>
|
||||
<single attribute="active instance" value="0"/>
|
||||
<single attribute="config widget visible" value="1"/>
|
||||
<single attribute="data log widget visible" value="0"/>
|
||||
<single attribute="hierarchy widget height" value="96"/>
|
||||
<single attribute="hierarchy widget visible" value="0"/>
|
||||
<single attribute="instance widget visible" value="1"/>
|
||||
<single attribute="jtag widget visible" value="1"/>
|
||||
<single attribute="lock mode" value="0"/>
|
||||
<multi attribute="column width" size="23" value="34,34,443,74,68,78,95,96,98,98,88,88,110,101,101,101,101,101,101,101,101,107,66"/>
|
||||
<multi attribute="frame size" size="2" value="1204,686"/>
|
||||
<multi attribute="jtag widget size" size="2" value="348,135"/>
|
||||
</global_info>
|
||||
</session>
|
||||
+1
-1
@@ -277,7 +277,7 @@ trigger;]]>
|
||||
</storage_qualifier_level>
|
||||
</storage_qualifier_events>
|
||||
<log>
|
||||
<data global_temp="1" name="log: Trig @ 2024/03/24 16:48:19 (0:0:12.7 elapsed)" power_up_mode="false" sample_depth="2048" trigger_position="256">11100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000101101001101010101111000000010110100110101010111100000001011010011010101011110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000111000000001110100100111100011100000000111010010011110001110000000011101001001111000Line truncated
|
||||
<data global_temp="1" name="log: Trig @ 2024/03/24 15:50:41 (0:0:14.0 elapsed)" power_up_mode="false" sample_depth="2048" trigger_position="256">11100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000011100101010101010111100000001110010101010101011110000000111001010101010101111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000111000000000010101000111100011100000000001010100011110001110000000000101010001111000Line truncated
|
||||
<extradata>1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111T111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111</extradata>
|
||||
</log>
|
||||
</trigger>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
`define BUILD_NUMBER "001"
|
||||
-54
@@ -1,57 +1,3 @@
|
||||
1. Overlay support for the detection of no rom loading on power up AND misc
|
||||
debugging. [done]
|
||||
2. Fix video HSCREEN 4 mode which is used in some demos and rs-232 terminal
|
||||
programs. [done]
|
||||
3. Reworked sound output to faithfully emulate the analog muxing in the coco.
|
||||
[done]
|
||||
4. Routing RS-232 tx/rx lines to the SNAC port for initial serial debugging
|
||||
of Fuji-Net interface. [done - untested]
|
||||
|
||||
|
||||
To Do...
|
||||
1. Add Fuji-Net port.
|
||||
2. Add Speech / Music cart
|
||||
3. Fix Castle of Tharoggad
|
||||
|
||||
|
||||
|
||||
|
||||
1. Added support for cassette save. To use: A) You have to have a file [anyname.cas]
|
||||
which is larger than needed. B) Select the file through the UI Menu 'Save
|
||||
Cassette'. C)Set 'Cass Rwd=0 / Rec=1' to 1. D) Issue your 'CSAVE "NAME"'
|
||||
E) When done, set 'Cass Rwd=0 / Rec=1' to 0 to complete the write. The file can
|
||||
now be loaded or copied. Note a dummy file of a specific size can be created in
|
||||
the MiSTer SSH shell in the /media/fat/games/coco3 with the command:
|
||||
'truncate -s 65536 tapefileame.cas'. [Note do NOT use over 65536 file length]
|
||||
2. Fixed serial interrupt [6551] to not be functional on slot 3 [carts].
|
||||
3. Modification of sys_top.v to override use of USER_IO for HDMI - so it can be used
|
||||
for logic analyzer debug. This will only occur when `define Config_Debug is
|
||||
enabled in config.v.
|
||||
4. Fixed MUGS of powerup issue occurring on some MiSTer units.
|
||||
5. Fixed incorrect application of GIME_IRQ on legacy interrupts. Fixed race condition
|
||||
on reading IRQ status vs clearing the interrupt.
|
||||
6. Improved Castle of Tharoggad. App now loads but locks as the graphics animate. This
|
||||
change improved mmu usage through to CARTS.
|
||||
7. Builds now keep track of multiple builds in the same date. It shows as V240512-001 in
|
||||
the menus. Its also exposed to BASIC and a boot.vhd which can be enabled to autorun is
|
||||
supplied in the archive to show how it works.
|
||||
8. Additionally, on the boot.vhd disk, is a program which demonstrated how to load a font -
|
||||
IBMFONT.BAS. Run it and it maps a font much like the IBM font to the 80 column format.
|
||||
Also, a file called TESTRTC.BAS pulls the MiSTer RTC values exposed in BASIC to display
|
||||
a clock.
|
||||
9. Large improvement in the Timer function. Code closer emulates COCO3 Timer. Fixes
|
||||
Sliphead cart.
|
||||
10. In the 20231023 release the wd1773 instances were reduced to 1 for the FDC and one for
|
||||
the FDC. This saved space but introduced a bug when using multiple drives at the same
|
||||
time - like a copy command. This change was removed and the copy command works again.
|
||||
|
||||
To Do...
|
||||
1. Add Speech / Music cart
|
||||
2. Fix Castle of Tharoggad
|
||||
|
||||
|
||||
|
||||
|
||||
1. Changed PIA 2 addressing to align with real CoCo3 hardware and end at FF2F.
|
||||
2. Re-arranged MiSTer drive LUNs to support future auto-boot from SDC drive 0.
|
||||
3. Added 'Auto Run' feature. You must use slot 2 [SDC]. Take your floppy or HD
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,6 +5,7 @@ set_global_assignment -name VERILOG_FILE rtl/PS2_Key/ps2_keyboard.v
|
||||
set_global_assignment -name MIF_FILE rtl/VDAC.mif
|
||||
set_global_assignment -name VERILOG_FILE rtl/VDAC.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/Mister_Video.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/Mister_Video_GIMEX.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/cocokey.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/UART_6551/uart_6551.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/UART_6551/6551tx.v
|
||||
@@ -20,7 +21,7 @@ set_global_assignment -name SYSTEMVERILOG_FILE rtl/Cassette_Write.sv
|
||||
set_global_assignment -name VERILOG_FILE rtl/rtc.sv
|
||||
set_global_assignment -name VERILOG_FILE rtl/AMW.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/square_gen.v
|
||||
set_global_assignment -name SYSTEMVERILOG_FILE rtl/config.sv
|
||||
set_global_assignment -name VERILOG_FILE rtl/config.v
|
||||
set_global_assignment -name SYSTEMVERILOG_FILE rtl/fdc.sv
|
||||
set_global_assignment -name SYSTEMVERILOG_FILE rtl/sdc.sv
|
||||
set_global_assignment -name SYSTEMVERILOG_FILE rtl/sdc_top.sv
|
||||
@@ -35,5 +36,4 @@ set_global_assignment -name VERILOG_FILE rtl/EE_Cold_Bt.v
|
||||
set_global_assignment -name VHDL_FILE rtl/rom/coco_rom_32K.vhd
|
||||
set_global_assignment -name VHDL_FILE rtl/rom/coco_rom_8K.vhd
|
||||
set_global_assignment -name VHDL_FILE rtl/rom/coco_rom_16.vhd
|
||||
set_global_assignment -name VHDL_FILE rtl/OVO.vhd
|
||||
set_global_assignment -name SDC_FILE rtl/CoCo3FPGA.sdc
|
||||
@@ -1,204 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<instance entity-name="altera_pll" version="17.0" >
|
||||
<generic name="debug_print_output" value="false" />
|
||||
<generic name="debug_use_rbc_taf_method" value="false" />
|
||||
<generic name="device_family" value="Cyclone V" />
|
||||
<generic name="device" value="5CEBA2F17A7" />
|
||||
<generic name="gui_device_speed_grade" value="1" />
|
||||
<generic name="gui_pll_mode" value="Integer-N PLL" />
|
||||
<generic name="gui_reference_clock_frequency" value="50.0" />
|
||||
<generic name="gui_channel_spacing" value="0.0" />
|
||||
<generic name="gui_operation_mode" value="direct" />
|
||||
<generic name="gui_feedback_clock" value="Global Clock" />
|
||||
<generic name="gui_fractional_cout" value="32" />
|
||||
<generic name="gui_dsm_out_sel" value="1st_order" />
|
||||
<generic name="gui_use_locked" value="true" />
|
||||
<generic name="gui_en_adv_params" value="false" />
|
||||
<generic name="gui_number_of_clocks" value="4" />
|
||||
<generic name="gui_multiply_factor" value="1" />
|
||||
<generic name="gui_frac_multiply_factor" value="1" />
|
||||
<generic name="gui_divide_factor_n" value="1" />
|
||||
<generic name="gui_cascade_counter0" value="false" />
|
||||
<generic name="gui_output_clock_frequency0" value="114.545454" />
|
||||
<generic name="gui_divide_factor_c0" value="1" />
|
||||
<generic name="gui_actual_output_clock_frequency0" value="0 MHz" />
|
||||
<generic name="gui_ps_units0" value="ps" />
|
||||
<generic name="gui_phase_shift0" value="0" />
|
||||
<generic name="gui_phase_shift_deg0" value="0.0" />
|
||||
<generic name="gui_actual_phase_shift0" value="0" />
|
||||
<generic name="gui_duty_cycle0" value="50" />
|
||||
<generic name="gui_cascade_counter1" value="false" />
|
||||
<generic name="gui_output_clock_frequency1" value="57.272727" />
|
||||
<generic name="gui_divide_factor_c1" value="1" />
|
||||
<generic name="gui_actual_output_clock_frequency1" value="0 MHz" />
|
||||
<generic name="gui_ps_units1" value="ps" />
|
||||
<generic name="gui_phase_shift1" value="0" />
|
||||
<generic name="gui_phase_shift_deg1" value="0.0" />
|
||||
<generic name="gui_actual_phase_shift1" value="0" />
|
||||
<generic name="gui_duty_cycle1" value="50" />
|
||||
<generic name="gui_cascade_counter2" value="false" />
|
||||
<generic name="gui_output_clock_frequency2" value="28.636363" />
|
||||
<generic name="gui_divide_factor_c2" value="1" />
|
||||
<generic name="gui_actual_output_clock_frequency2" value="0 MHz" />
|
||||
<generic name="gui_ps_units2" value="ps" />
|
||||
<generic name="gui_phase_shift2" value="0" />
|
||||
<generic name="gui_phase_shift_deg2" value="0.0" />
|
||||
<generic name="gui_actual_phase_shift2" value="0" />
|
||||
<generic name="gui_duty_cycle2" value="50" />
|
||||
<generic name="gui_cascade_counter3" value="false" />
|
||||
<generic name="gui_output_clock_frequency3" value="14.318181" />
|
||||
<generic name="gui_divide_factor_c3" value="1" />
|
||||
<generic name="gui_actual_output_clock_frequency3" value="0 MHz" />
|
||||
<generic name="gui_ps_units3" value="ps" />
|
||||
<generic name="gui_phase_shift3" value="0" />
|
||||
<generic name="gui_phase_shift_deg3" value="0.0" />
|
||||
<generic name="gui_actual_phase_shift3" value="0" />
|
||||
<generic name="gui_duty_cycle3" value="50" />
|
||||
<generic name="gui_cascade_counter4" value="false" />
|
||||
<generic name="gui_output_clock_frequency4" value="100.0" />
|
||||
<generic name="gui_divide_factor_c4" value="1" />
|
||||
<generic name="gui_actual_output_clock_frequency4" value="0 MHz" />
|
||||
<generic name="gui_ps_units4" value="ps" />
|
||||
<generic name="gui_phase_shift4" value="0" />
|
||||
<generic name="gui_phase_shift_deg4" value="0.0" />
|
||||
<generic name="gui_actual_phase_shift4" value="0" />
|
||||
<generic name="gui_duty_cycle4" value="50" />
|
||||
<generic name="gui_cascade_counter5" value="false" />
|
||||
<generic name="gui_output_clock_frequency5" value="100.0" />
|
||||
<generic name="gui_divide_factor_c5" value="1" />
|
||||
<generic name="gui_actual_output_clock_frequency5" value="0 MHz" />
|
||||
<generic name="gui_ps_units5" value="ps" />
|
||||
<generic name="gui_phase_shift5" value="0" />
|
||||
<generic name="gui_phase_shift_deg5" value="0.0" />
|
||||
<generic name="gui_actual_phase_shift5" value="0" />
|
||||
<generic name="gui_duty_cycle5" value="50" />
|
||||
<generic name="gui_cascade_counter6" value="false" />
|
||||
<generic name="gui_output_clock_frequency6" value="100.0" />
|
||||
<generic name="gui_divide_factor_c6" value="1" />
|
||||
<generic name="gui_actual_output_clock_frequency6" value="0 MHz" />
|
||||
<generic name="gui_ps_units6" value="ps" />
|
||||
<generic name="gui_phase_shift6" value="0" />
|
||||
<generic name="gui_phase_shift_deg6" value="0.0" />
|
||||
<generic name="gui_actual_phase_shift6" value="0" />
|
||||
<generic name="gui_duty_cycle6" value="50" />
|
||||
<generic name="gui_cascade_counter7" value="false" />
|
||||
<generic name="gui_output_clock_frequency7" value="100.0" />
|
||||
<generic name="gui_divide_factor_c7" value="1" />
|
||||
<generic name="gui_actual_output_clock_frequency7" value="0 MHz" />
|
||||
<generic name="gui_ps_units7" value="ps" />
|
||||
<generic name="gui_phase_shift7" value="0" />
|
||||
<generic name="gui_phase_shift_deg7" value="0.0" />
|
||||
<generic name="gui_actual_phase_shift7" value="0" />
|
||||
<generic name="gui_duty_cycle7" value="50" />
|
||||
<generic name="gui_cascade_counter8" value="false" />
|
||||
<generic name="gui_output_clock_frequency8" value="100.0" />
|
||||
<generic name="gui_divide_factor_c8" value="1" />
|
||||
<generic name="gui_actual_output_clock_frequency8" value="0 MHz" />
|
||||
<generic name="gui_ps_units8" value="ps" />
|
||||
<generic name="gui_phase_shift8" value="0" />
|
||||
<generic name="gui_phase_shift_deg8" value="0.0" />
|
||||
<generic name="gui_actual_phase_shift8" value="0" />
|
||||
<generic name="gui_duty_cycle8" value="50" />
|
||||
<generic name="gui_cascade_counter9" value="false" />
|
||||
<generic name="gui_output_clock_frequency9" value="100.0" />
|
||||
<generic name="gui_divide_factor_c9" value="1" />
|
||||
<generic name="gui_actual_output_clock_frequency9" value="0 MHz" />
|
||||
<generic name="gui_ps_units9" value="ps" />
|
||||
<generic name="gui_phase_shift9" value="0" />
|
||||
<generic name="gui_phase_shift_deg9" value="0.0" />
|
||||
<generic name="gui_actual_phase_shift9" value="0" />
|
||||
<generic name="gui_duty_cycle9" value="50" />
|
||||
<generic name="gui_cascade_counter10" value="false" />
|
||||
<generic name="gui_output_clock_frequency10" value="100.0" />
|
||||
<generic name="gui_divide_factor_c10" value="1" />
|
||||
<generic name="gui_actual_output_clock_frequency10" value="0 MHz" />
|
||||
<generic name="gui_ps_units10" value="ps" />
|
||||
<generic name="gui_phase_shift10" value="0" />
|
||||
<generic name="gui_phase_shift_deg10" value="0.0" />
|
||||
<generic name="gui_actual_phase_shift10" value="0" />
|
||||
<generic name="gui_duty_cycle10" value="50" />
|
||||
<generic name="gui_cascade_counter11" value="false" />
|
||||
<generic name="gui_output_clock_frequency11" value="100.0" />
|
||||
<generic name="gui_divide_factor_c11" value="1" />
|
||||
<generic name="gui_actual_output_clock_frequency11" value="0 MHz" />
|
||||
<generic name="gui_ps_units11" value="ps" />
|
||||
<generic name="gui_phase_shift11" value="0" />
|
||||
<generic name="gui_phase_shift_deg11" value="0.0" />
|
||||
<generic name="gui_actual_phase_shift11" value="0" />
|
||||
<generic name="gui_duty_cycle11" value="50" />
|
||||
<generic name="gui_cascade_counter12" value="false" />
|
||||
<generic name="gui_output_clock_frequency12" value="100.0" />
|
||||
<generic name="gui_divide_factor_c12" value="1" />
|
||||
<generic name="gui_actual_output_clock_frequency12" value="0 MHz" />
|
||||
<generic name="gui_ps_units12" value="ps" />
|
||||
<generic name="gui_phase_shift12" value="0" />
|
||||
<generic name="gui_phase_shift_deg12" value="0.0" />
|
||||
<generic name="gui_actual_phase_shift12" value="0" />
|
||||
<generic name="gui_duty_cycle12" value="50" />
|
||||
<generic name="gui_cascade_counter13" value="false" />
|
||||
<generic name="gui_output_clock_frequency13" value="100.0" />
|
||||
<generic name="gui_divide_factor_c13" value="1" />
|
||||
<generic name="gui_actual_output_clock_frequency13" value="0 MHz" />
|
||||
<generic name="gui_ps_units13" value="ps" />
|
||||
<generic name="gui_phase_shift13" value="0" />
|
||||
<generic name="gui_phase_shift_deg13" value="0.0" />
|
||||
<generic name="gui_actual_phase_shift13" value="0" />
|
||||
<generic name="gui_duty_cycle13" value="50" />
|
||||
<generic name="gui_cascade_counter14" value="false" />
|
||||
<generic name="gui_output_clock_frequency14" value="100.0" />
|
||||
<generic name="gui_divide_factor_c14" value="1" />
|
||||
<generic name="gui_actual_output_clock_frequency14" value="0 MHz" />
|
||||
<generic name="gui_ps_units14" value="ps" />
|
||||
<generic name="gui_phase_shift14" value="0" />
|
||||
<generic name="gui_phase_shift_deg14" value="0.0" />
|
||||
<generic name="gui_actual_phase_shift14" value="0" />
|
||||
<generic name="gui_duty_cycle14" value="50" />
|
||||
<generic name="gui_cascade_counter15" value="false" />
|
||||
<generic name="gui_output_clock_frequency15" value="100.0" />
|
||||
<generic name="gui_divide_factor_c15" value="1" />
|
||||
<generic name="gui_actual_output_clock_frequency15" value="0 MHz" />
|
||||
<generic name="gui_ps_units15" value="ps" />
|
||||
<generic name="gui_phase_shift15" value="0" />
|
||||
<generic name="gui_phase_shift_deg15" value="0.0" />
|
||||
<generic name="gui_actual_phase_shift15" value="0" />
|
||||
<generic name="gui_duty_cycle15" value="50" />
|
||||
<generic name="gui_cascade_counter16" value="false" />
|
||||
<generic name="gui_output_clock_frequency16" value="100.0" />
|
||||
<generic name="gui_divide_factor_c16" value="1" />
|
||||
<generic name="gui_actual_output_clock_frequency16" value="0 MHz" />
|
||||
<generic name="gui_ps_units16" value="ps" />
|
||||
<generic name="gui_phase_shift16" value="0" />
|
||||
<generic name="gui_phase_shift_deg16" value="0.0" />
|
||||
<generic name="gui_actual_phase_shift16" value="0" />
|
||||
<generic name="gui_duty_cycle16" value="50" />
|
||||
<generic name="gui_cascade_counter17" value="false" />
|
||||
<generic name="gui_output_clock_frequency17" value="100.0" />
|
||||
<generic name="gui_divide_factor_c17" value="1" />
|
||||
<generic name="gui_actual_output_clock_frequency17" value="0 MHz" />
|
||||
<generic name="gui_ps_units17" value="ps" />
|
||||
<generic name="gui_phase_shift17" value="0" />
|
||||
<generic name="gui_phase_shift_deg17" value="0.0" />
|
||||
<generic name="gui_actual_phase_shift17" value="0" />
|
||||
<generic name="gui_duty_cycle17" value="50" />
|
||||
<generic name="gui_pll_auto_reset" value="Off" />
|
||||
<generic name="gui_pll_bandwidth_preset" value="Auto" />
|
||||
<generic name="gui_en_reconf" value="false" />
|
||||
<generic name="gui_en_dps_ports" value="false" />
|
||||
<generic name="gui_en_phout_ports" value="false" />
|
||||
<generic name="gui_phout_division" value="1" />
|
||||
<generic name="gui_mif_generate" value="false" />
|
||||
<generic name="gui_enable_mif_dps" value="false" />
|
||||
<generic name="gui_dps_cntr" value="C0" />
|
||||
<generic name="gui_dps_num" value="1" />
|
||||
<generic name="gui_dps_dir" value="Positive" />
|
||||
<generic name="gui_refclk_switch" value="false" />
|
||||
<generic name="gui_refclk1_frequency" value="100.0" />
|
||||
<generic name="gui_switchover_mode" value="Automatic Switchover" />
|
||||
<generic name="gui_switchover_delay" value="0" />
|
||||
<generic name="gui_active_clk" value="false" />
|
||||
<generic name="gui_clk_bad" value="false" />
|
||||
<generic name="gui_enable_cascade_out" value="false" />
|
||||
<generic name="gui_cascade_outclk_index" value="0" />
|
||||
<generic name="gui_enable_cascade_in" value="false" />
|
||||
<generic name="gui_pll_cascading_mode" value="Create an adjpllin signal to connect with an upstream PLL" />
|
||||
</instance>
|
||||
Binary file not shown.
Binary file not shown.
+2
-2
@@ -233,7 +233,7 @@ begin
|
||||
|
||||
st_2:
|
||||
begin
|
||||
if (timer[17] == 1'b1) // 300ms time passed
|
||||
if (timer[18] == 1'b1) // 300ms time passed
|
||||
begin
|
||||
key_up_down <= RELEASE_KEY;
|
||||
state <= st_3;
|
||||
@@ -242,7 +242,7 @@ begin
|
||||
|
||||
st_3:
|
||||
begin
|
||||
if (timer[17] == 1'b0) // 300ms time passed
|
||||
if (timer[18] == 1'b0) // 300ms time passed
|
||||
begin
|
||||
shift <= 1'b0;
|
||||
timer_enable <= 1'b0;
|
||||
|
||||
+31
-26
@@ -82,6 +82,8 @@ module Cassette_Write(
|
||||
|
||||
);
|
||||
|
||||
assign sd_blk_cnt = 6'd0;
|
||||
|
||||
|
||||
// Create 16x sample clock for the 2400 Baud rate...
|
||||
// ~26us based on 1.78Mhz [562 ns]- divide by 46....
|
||||
@@ -114,19 +116,15 @@ begin
|
||||
end
|
||||
|
||||
// Mounted SD Image [for the cass]
|
||||
// This is not used and only here for completeness
|
||||
|
||||
//reg drive_wp;
|
||||
//reg [31:0] drive_size;
|
||||
reg drive_wp;
|
||||
reg [31:0] drive_size;
|
||||
|
||||
//always @(negedge img_mounted)
|
||||
//begin
|
||||
// drive_wp <= img_readonly;
|
||||
// drive_size <= img_size[31:0]; //Size / 256 on [31:8]
|
||||
//end
|
||||
|
||||
// Set to 1 512 byte block per r/w
|
||||
assign sd_blk_cnt = 6'd0;
|
||||
always @(negedge img_mounted)
|
||||
begin
|
||||
drive_wp <= img_readonly;
|
||||
drive_size <= img_size[31:0]; //Size / 256 on [31:8]
|
||||
end
|
||||
|
||||
|
||||
// Byte Receiver
|
||||
@@ -140,6 +138,7 @@ reg wave_negative;
|
||||
localparam time_out = 6'h3f;
|
||||
localparam wave_zero_level = 6'd32;
|
||||
localparam bit_time_1 = 6'd22;
|
||||
//localparam sync = 15'b010_1010_1001_1110; // Pre shift $553C
|
||||
localparam sync = 15'b0111_1000_1010_101; // Pre shift $553C [L -> R]
|
||||
localparam sync_proper = 8'h3C;
|
||||
localparam leader = 8'h55;
|
||||
@@ -152,22 +151,21 @@ reg flush_end, flush_end_que;
|
||||
reg sd_hold;
|
||||
reg pre_roll;
|
||||
reg [7:0] blk_type;
|
||||
reg [7:0] protocol_data_count;
|
||||
reg gap;
|
||||
|
||||
// Buffer interface
|
||||
wire [8:0] buf_address;
|
||||
wire [7:0] buf_data_in;
|
||||
wire [7:0] buf_data_out;
|
||||
wire buf_write;
|
||||
|
||||
// State Mach states
|
||||
reg [7:0] protocol_data_count;
|
||||
|
||||
localparam st_beg0 = 4'd0;
|
||||
localparam st_start = 4'd1;
|
||||
localparam st_st1 = 4'd2;
|
||||
localparam st_st2 = 4'd3;
|
||||
localparam st_wr = 4'd4;
|
||||
localparam st_wr1 = 4'd5;
|
||||
localparam st_st3 = 4'd4;
|
||||
localparam st_wr = 4'd5;
|
||||
localparam st_wr1 = 4'd6;
|
||||
|
||||
reg [3:0] st_state;
|
||||
reg [3:0] state_stack;
|
||||
@@ -212,7 +210,6 @@ begin
|
||||
sd_wr_state <= sd_wr_st;
|
||||
sd_hold <= 1'b0;
|
||||
pre_roll <= 1'b0;
|
||||
gap <= 1'b0;
|
||||
end
|
||||
else
|
||||
begin
|
||||
@@ -251,7 +248,6 @@ begin
|
||||
sd_wr_state <= sd_wr_st;
|
||||
sd_hold <= 1'b0;
|
||||
pre_roll <= 1'b0;
|
||||
gap <= 1'b0;
|
||||
end
|
||||
|
||||
byte_clk <= 1'b0;
|
||||
@@ -269,7 +265,7 @@ begin
|
||||
if ((DTOA_CODE >= wave_zero_level) && wave_negative)
|
||||
begin
|
||||
// Initially we are not collecting the leader bytes just collecting them and
|
||||
// waiting for the sync $3C55. The write to file stage will automatically
|
||||
// waiting for the sync $$553C. The write to file stage will automatically
|
||||
// write the 128 leader bytes befor we start transfering data.
|
||||
if (!look_for_sync)
|
||||
begin
|
||||
@@ -305,7 +301,7 @@ begin
|
||||
begin
|
||||
buf_address <= 9'b000000000;
|
||||
buf_data_in <= leader;
|
||||
protocol_data_count <= 8'h80; // We will use this to count the 128 bytes
|
||||
protocol_data_count <= 8'h7f; // We will use this to count the 128 bytes
|
||||
|
||||
st_state <= st_start;
|
||||
end
|
||||
@@ -367,8 +363,6 @@ begin
|
||||
state_stack <= st_st1; // We come back here
|
||||
st_state <= st_wr; // Write a byte
|
||||
p_state <= p_dta;
|
||||
if ((blk_type == 8'h00) & (protocol_data_count == 8'h05) & (incomming_reg[15:8] == 8'hff))
|
||||
gap <= 1'b1;
|
||||
if (protocol_data_count == 8'h01)
|
||||
p_state <= p_cksum;
|
||||
end
|
||||
@@ -396,13 +390,24 @@ begin
|
||||
st_st2:
|
||||
begin
|
||||
buf_data_in <= leader;
|
||||
if ((blk_type == 8'h00) || gap)
|
||||
protocol_data_count <= 8'h80; // We will use this to count the 128 bytes
|
||||
if (blk_type == 8'h00)
|
||||
protocol_data_count <= 8'h7f; // We will use this to count the 128 bytes
|
||||
else
|
||||
protocol_data_count <= 8'h02; // We will use this to count the 2 bytes
|
||||
protocol_data_count <= 8'h01; // We will use this to count the 128 bytes
|
||||
st_state <= st_start; // No, don't write any more - were done
|
||||
end
|
||||
|
||||
st_st3:
|
||||
begin
|
||||
state_stack <= st_st3; // We come back here
|
||||
st_state <= st_wr; // Write a byte
|
||||
protocol_data_count <= protocol_data_count - 1'b1;
|
||||
if (protocol_data_count == 8'h00) // 128 bytes
|
||||
begin
|
||||
st_state <= st_st1; // No, don't write any more - were done
|
||||
end
|
||||
end
|
||||
|
||||
// Perform the byte writes to the buffer
|
||||
// This acts like a sub routine....
|
||||
st_wr:
|
||||
|
||||
@@ -5,7 +5,6 @@ create_clock -period 1000.000 -name img_mounted[2] [get_nodes emu:emu|hps_io:hps
|
||||
create_clock -period 1000.000 -name img_mounted[1] [get_nodes emu:emu|hps_io:hps_io|img_mounted[1]]
|
||||
create_clock -period 1000.000 -name img_mounted[0] [get_nodes emu:emu|hps_io:hps_io|img_mounted[0]]
|
||||
create_clock -period 1000.000 -name RESET_N [get_nodes emu:emu|coco3fpga:coco3|RESET_N]
|
||||
create_clock -period 1000.000 -name NMISample2 [get_nodes emu:emu|coco3fpga:coco3|mc6809x:GLBCPU09|NMISample2]
|
||||
#set_false_path -from [get_nodes sysmem_lite:sysmem|sysmem_HPS_fpga_interfaces:fpga_interfaces|clocks_resets~FF_4365]
|
||||
#create_clock -period 17.46 -name PH_2 [get_nodes emu:emu|coco3fpga:coco3|PH_2_RAW]
|
||||
#create_clock -period 1000.000 -name CLK_6551[4] [get_nodes emu:emu|coco3fpga:coco3|CLK_6551[4]]
|
||||
|
||||
+2
-15
@@ -55,7 +55,6 @@
|
||||
|
||||
module EE_Cold_Bt(
|
||||
input CLK,
|
||||
input RESET,
|
||||
|
||||
input Display_EE, // from MISTer subsystem
|
||||
input Cold_Boot, // from MISTer subsystem
|
||||
@@ -107,20 +106,9 @@ assign Start_Display_EE = ((Display_EE == 1'b1) & (Display_EE_D == 1'b0));
|
||||
assign Start_Cold_Boot = ((Cold_Boot == 1'b1) & (Cold_Boot_D == 1'b0));
|
||||
|
||||
|
||||
always @ (posedge CLK or posedge RESET)
|
||||
begin
|
||||
if(RESET)
|
||||
begin
|
||||
Display_EE_D <= 1'b0;
|
||||
Cold_Boot_D <= 1'b0;
|
||||
EE <= 1'b1;
|
||||
N_RESET <= 1'b1;
|
||||
prog <= 48'h000000000000;
|
||||
next_instruction <= 1'b0;
|
||||
timer <= 24'h000000;
|
||||
end
|
||||
else
|
||||
always @(posedge CLK)
|
||||
begin
|
||||
|
||||
Display_EE_D <= Display_EE;
|
||||
Cold_Boot_D <= Cold_Boot;
|
||||
|
||||
@@ -218,6 +206,5 @@ begin
|
||||
|
||||
endcase
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
+29
-82
@@ -88,7 +88,6 @@ HSYNC_N,
|
||||
VSYNC_N,
|
||||
HBLANKING,
|
||||
VBLANKING,
|
||||
VBLANK_PRIME,
|
||||
|
||||
// RAM / Buffer
|
||||
RAM_ADDRESS,
|
||||
@@ -125,21 +124,13 @@ HBORDER,
|
||||
VBORDER,
|
||||
HBORDER_INT,
|
||||
VBORDER_INT,
|
||||
art,
|
||||
PIXEL_COUNT,
|
||||
LINE
|
||||
art
|
||||
);
|
||||
|
||||
input MASTER_CLK;
|
||||
output PIX_CLK;
|
||||
reg PIX_CLK;
|
||||
input PIX_CLK;
|
||||
input RESET_N;
|
||||
|
||||
output [10:0] PIXEL_COUNT;
|
||||
reg [10:0] PIXEL_COUNT;
|
||||
output [9:0] LINE;
|
||||
reg [9:0] LINE;
|
||||
|
||||
output [9:0] COLOR;
|
||||
reg [9:0] COLOR;
|
||||
output HSYNC_N;
|
||||
@@ -147,8 +138,6 @@ reg HSYNC_N;
|
||||
output VSYNC_N;
|
||||
output HBLANKING;
|
||||
reg HBLANKING;
|
||||
output VBLANK_PRIME;
|
||||
reg VBLANK_PRIME;
|
||||
output VBLANKING;
|
||||
reg VBLANKING;
|
||||
|
||||
@@ -191,8 +180,10 @@ reg VBORDER_INT;
|
||||
input [1:0] art;
|
||||
|
||||
//reg HBLANKING;
|
||||
reg [9:0] LINE;
|
||||
reg [3:0] VLPR;
|
||||
//reg [3:0] COCO_VLPR;
|
||||
reg [10:0] PIXEL_COUNT;
|
||||
reg [15:0] CHAR_LATCH_0_TMP;
|
||||
reg [15:0] CHAR_LATCH_1_TMP;
|
||||
reg [15:0] CHAR_LATCH_2_TMP;
|
||||
@@ -246,7 +237,7 @@ wire [8:0] BUF_ADD_BASE;
|
||||
//reg [353:0] VSYNC_DELAY;
|
||||
//reg VBLANKING;
|
||||
//wire [3:0] SG_VLPR;
|
||||
//reg [139:0] VSYNC_DELAY;
|
||||
reg [139:0] VSYNC_DELAY;
|
||||
reg VBORDER;
|
||||
reg VSYNC_FLAG;
|
||||
reg HBORDER_DELAY;
|
||||
@@ -1513,40 +1504,21 @@ assign PIXEL_X =
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b11110101001) ? {6'h00,CHAR_LATCH_0[9:8]}:
|
||||
|
||||
//4 Color 512/640 = 640/4 = 160
|
||||
//({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b00000101101) ? {6'h00,CHAR_LATCH_0[7:6]}:
|
||||
//({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b00010101101) ? {6'h00,CHAR_LATCH_0[7:6]}:
|
||||
//({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b00100101101) ? {6'h00,CHAR_LATCH_0[5:4]}:
|
||||
//({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b00110101101) ? {6'h00,CHAR_LATCH_0[5:4]}:
|
||||
//({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b01000101101) ? {6'h00,CHAR_LATCH_0[3:2]}:
|
||||
//({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b01010101101) ? {6'h00,CHAR_LATCH_0[3:2]}:
|
||||
//({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b01100101101) ? {6'h00,CHAR_LATCH_0[1:0]}:
|
||||
//({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b01110101101) ? {6'h00,CHAR_LATCH_0[1:0]}:
|
||||
//({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b10000101101) ? {6'h00,CHAR_LATCH_0[15:14]}:
|
||||
//({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b10010101101) ? {6'h00,CHAR_LATCH_0[15:14]}:
|
||||
//({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b10100101101) ? {6'h00,CHAR_LATCH_0[13:12]}:
|
||||
//({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b10110101101) ? {6'h00,CHAR_LATCH_0[13:12]}:
|
||||
//({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b11000101101) ? {6'h00,CHAR_LATCH_0[11:10]}:
|
||||
//({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b11010101101) ? {6'h00,CHAR_LATCH_0[11:10]}:
|
||||
//({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b11100101101) ? {6'h00,CHAR_LATCH_0[9:8]}:
|
||||
//({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b11110101101) ? {6'h00,CHAR_LATCH_1[9:8]}:
|
||||
|
||||
// Update by G. Becker on 4/18/26 to fix HSCREEN 4 mode (640 x 192) 4 color mode.
|
||||
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b00000101101) ? {6'h00,CHAR_LATCH_0[7:6]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b00010101101) ? {6'h00,CHAR_LATCH_0[5:4]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b00100101101) ? {6'h00,CHAR_LATCH_0[3:2]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b00110101101) ? {6'h00,CHAR_LATCH_0[1:0]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b01000101101) ? {6'h00,CHAR_LATCH_0[15:14]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b01010101101) ? {6'h00,CHAR_LATCH_0[13:12]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b01100101101) ? {6'h00,CHAR_LATCH_0[11:10]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b01110101101) ? {6'h00,CHAR_LATCH_0[9:8]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b10000101101) ? {6'h00,CHAR_LATCH_1[7:6]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b10010101101) ? {6'h00,CHAR_LATCH_1[5:4]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b10100101101) ? {6'h00,CHAR_LATCH_1[3:2]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b10110101101) ? {6'h00,CHAR_LATCH_1[1:0]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b11000101101) ? {6'h00,CHAR_LATCH_1[15:14]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b11010101101) ? {6'h00,CHAR_LATCH_1[13:12]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b11100101101) ? {6'h00,CHAR_LATCH_1[11:10]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b00010101101) ? {6'h00,CHAR_LATCH_0[7:6]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b00100101101) ? {6'h00,CHAR_LATCH_0[5:4]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b00110101101) ? {6'h00,CHAR_LATCH_0[5:4]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b01000101101) ? {6'h00,CHAR_LATCH_0[3:2]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b01010101101) ? {6'h00,CHAR_LATCH_0[3:2]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b01100101101) ? {6'h00,CHAR_LATCH_0[1:0]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b01110101101) ? {6'h00,CHAR_LATCH_0[1:0]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b10000101101) ? {6'h00,CHAR_LATCH_0[15:14]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b10010101101) ? {6'h00,CHAR_LATCH_0[15:14]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b10100101101) ? {6'h00,CHAR_LATCH_0[13:12]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b10110101101) ? {6'h00,CHAR_LATCH_0[13:12]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b11000101101) ? {6'h00,CHAR_LATCH_0[11:10]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b11010101101) ? {6'h00,CHAR_LATCH_0[11:10]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b11100101101) ? {6'h00,CHAR_LATCH_0[9:8]}:
|
||||
({PIXEL_COUNT[3:0],COCO1,BP,HRES[3:1],CRES} == 11'b11110101101) ? {6'h00,CHAR_LATCH_1[9:8]}:
|
||||
|
||||
//16 Color 32/40 = 40/2 = 20
|
||||
@@ -1813,15 +1785,6 @@ HBlanking has to be 1 for border
|
||||
HBORDER has to be 1 for main display
|
||||
HBlanking has to be 0 for main display
|
||||
******************************************************************************/
|
||||
always @ (posedge MASTER_CLK)
|
||||
begin
|
||||
reg [1:0] div;
|
||||
PIX_CLK <= 1'b0;
|
||||
div <= div + 1'b1;
|
||||
if ((div == 2'd1) || (div == 2'd2))
|
||||
PIX_CLK <= 1'b1;
|
||||
end
|
||||
|
||||
always @ (negedge MASTER_CLK)
|
||||
if(PIX_CLK == 1'b0 && PIX_CLK_DELAY == 1'b1)
|
||||
begin
|
||||
@@ -1857,10 +1820,6 @@ always @ (negedge MASTER_CLK)
|
||||
11'd724: // End of right border 720 + 44 - 1 (+ 64) start of back porch
|
||||
begin
|
||||
HBORDER <= 1'b0; // 736 - 28
|
||||
if (LINE == 9'd262)
|
||||
VBLANK_PRIME <= 1'b0;
|
||||
if (LINE == 9'd5)
|
||||
VBLANK_PRIME <= 1'b1;
|
||||
PIXEL_COUNT <= 11'd725;
|
||||
end
|
||||
|
||||
@@ -1868,25 +1827,15 @@ always @ (negedge MASTER_CLK)
|
||||
// Adjust HSYNC here
|
||||
**************************************************************************************/
|
||||
// Width from 87 GIME 5.08 uS = 73 clocks
|
||||
// 11'd751: // 824 - 751 = 73 (approx 5.09 uS)
|
||||
// begin
|
||||
// HSYNC_N <= 1'b0; // Turn on Sync
|
||||
// PIXEL_COUNT <= 11'd752;
|
||||
// end
|
||||
// 11'd810: // End of SYNC start of front porch 804 + 80 - 1, End of Sync to Video = 167 816 + 167 =
|
||||
// begin
|
||||
// HSYNC_N <= 1'b1; // SYNC OFF
|
||||
// PIXEL_COUNT <= 11'd811;
|
||||
// end
|
||||
11'd752: // 824 - 751 = 73 (approx 5.09 uS)
|
||||
11'd751: // 824 - 751 = 73 (approx 5.09 uS)
|
||||
begin
|
||||
HSYNC_N <= 1'b0; // Turn on Sync
|
||||
PIXEL_COUNT <= 11'd753;
|
||||
PIXEL_COUNT <= 11'd752;
|
||||
end
|
||||
11'd811: // End of SYNC start of front porch 804 + 80 - 1, End of Sync to Video = 167 816 + 167 =
|
||||
11'd810: // End of SYNC start of front porch 804 + 80 - 1, End of Sync to Video = 167 816 + 167 =
|
||||
begin
|
||||
HSYNC_N <= 1'b1; // SYNC OFF
|
||||
PIXEL_COUNT <= 11'd812;
|
||||
PIXEL_COUNT <= 11'd811;
|
||||
end
|
||||
/**************************************************************************************
|
||||
* End of HSYNC adjustment
|
||||
@@ -1968,14 +1917,12 @@ assign SG6 = VLPR[3:2];
|
||||
* Generate clock for VSYNC_N by
|
||||
* Delaying VSYNC_FLAG by 137 pixels
|
||||
*************************************/
|
||||
//assign VSYNC_N = VSYNC_DELAY[137];
|
||||
//always @ (negedge MASTER_CLK)
|
||||
// if(PIX_CLK == 1'b0 && PIX_CLK_DELAY == 1'b1)
|
||||
// begin
|
||||
// VSYNC_DELAY <= {VSYNC_DELAY[138:0], VSYNC_FLAG};
|
||||
// end
|
||||
|
||||
assign VSYNC_N = VSYNC_FLAG;
|
||||
assign VSYNC_N = VSYNC_DELAY[137];
|
||||
always @ (negedge MASTER_CLK)
|
||||
if(PIX_CLK == 1'b0 && PIX_CLK_DELAY == 1'b1)
|
||||
begin
|
||||
VSYNC_DELAY <= {VSYNC_DELAY[138:0], VSYNC_FLAG};
|
||||
end
|
||||
|
||||
/*****************************************************************************
|
||||
* Keeps track of how many lines are in each row.
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
-195
@@ -1,195 +0,0 @@
|
||||
--------------------------------------------------------------------------------
|
||||
-- Overlay
|
||||
--------------------------------------------------------------------------------
|
||||
-- DO 10/2017
|
||||
-- SH 5/15/26 Modified for COCO3
|
||||
--------------------------------------------------------------------------------
|
||||
LIBRARY ieee;
|
||||
USE ieee.std_logic_1164.ALL;
|
||||
USE ieee.numeric_std.ALL;
|
||||
|
||||
ENTITY ovo IS
|
||||
GENERIC (
|
||||
COLS : natural :=32;
|
||||
LINES : natural :=2;
|
||||
RGB : unsigned(23 DOWNTO 0) :=x"FFFFFF";
|
||||
H_OFFSET : natural :=4;
|
||||
V_OFFSET : natural :=45
|
||||
);
|
||||
|
||||
PORT (
|
||||
-- VGA IN
|
||||
i_r : IN unsigned(7 DOWNTO 0);
|
||||
i_g : IN unsigned(7 DOWNTO 0);
|
||||
i_b : IN unsigned(7 DOWNTO 0);
|
||||
-- i_hs : IN std_logic;
|
||||
-- i_vs : IN std_logic;
|
||||
-- i_de : IN std_logic;
|
||||
-- i_en : IN std_logic;
|
||||
i_clk : IN std_logic;
|
||||
|
||||
i_Hcount : IN unsigned(10 DOWNTO 0);
|
||||
i_VCount : IN unsigned(9 DOWNTO 0);
|
||||
|
||||
-- VGA_OUT
|
||||
o_r : OUT unsigned(7 DOWNTO 0);
|
||||
o_g : OUT unsigned(7 DOWNTO 0);
|
||||
o_b : OUT unsigned(7 DOWNTO 0);
|
||||
-- o_hs : OUT std_logic;
|
||||
-- o_vs : OUT std_logic;
|
||||
-- o_de : OUT std_logic;
|
||||
|
||||
-- Control
|
||||
ena : IN std_logic; -- Overlay ON/OFF
|
||||
|
||||
-- Probes
|
||||
in0 : IN unsigned(COLS*5-1 downto 0);
|
||||
in1 : IN unsigned(COLS*5-1 downto 0)
|
||||
);
|
||||
END ENTITY ovo;
|
||||
|
||||
--##############################################################################
|
||||
ARCHITECTURE rtl OF ovo IS
|
||||
TYPE arr_slv8 IS ARRAY (natural RANGE <>) OF unsigned(7 DOWNTO 0);
|
||||
CONSTANT chars : arr_slv8 :=(
|
||||
x"3E", x"63", x"73", x"7B", x"6F", x"67", x"3E", x"00", -- 0
|
||||
x"0C", x"0E", x"0C", x"0C", x"0C", x"0C", x"3F", x"00", -- 1
|
||||
x"1E", x"33", x"30", x"1C", x"06", x"33", x"3F", x"00", -- 2
|
||||
x"1E", x"33", x"30", x"1C", x"30", x"33", x"1E", x"00", -- 3
|
||||
x"38", x"3C", x"36", x"33", x"7F", x"30", x"78", x"00", -- 4
|
||||
x"3F", x"03", x"1F", x"30", x"30", x"33", x"1E", x"00", -- 5
|
||||
x"1C", x"06", x"03", x"1F", x"33", x"33", x"1E", x"00", -- 6
|
||||
x"3F", x"33", x"30", x"18", x"0C", x"0C", x"0C", x"00", -- 7
|
||||
x"1E", x"33", x"33", x"1E", x"33", x"33", x"1E", x"00", -- 8
|
||||
x"1E", x"33", x"33", x"3E", x"30", x"18", x"0E", x"00", -- 9
|
||||
x"0C", x"1E", x"33", x"33", x"3F", x"33", x"33", x"00", -- A
|
||||
x"3F", x"66", x"66", x"3E", x"66", x"66", x"3F", x"00", -- B
|
||||
x"3C", x"66", x"03", x"03", x"03", x"66", x"3C", x"00", -- C
|
||||
x"1F", x"36", x"66", x"66", x"66", x"36", x"1F", x"00", -- D
|
||||
x"7F", x"46", x"16", x"1E", x"16", x"46", x"7F", x"00", -- E
|
||||
x"7F", x"46", x"16", x"1E", x"16", x"06", x"0F", x"00", -- F
|
||||
x"00", x"00", x"00", x"00", x"00", x"00", x"00", x"00", --' ' 10
|
||||
x"00", x"00", x"3F", x"00", x"00", x"3F", x"00", x"00", -- = 11
|
||||
x"00", x"0C", x"0C", x"3F", x"0C", x"0C", x"00", x"00", -- + 12
|
||||
x"00", x"00", x"00", x"3F", x"00", x"00", x"00", x"00", -- - 13
|
||||
x"18", x"0C", x"06", x"03", x"06", x"0C", x"18", x"00", -- < 14
|
||||
x"06", x"0C", x"18", x"30", x"18", x"0C", x"06", x"00", -- > 15
|
||||
x"08", x"1C", x"36", x"63", x"41", x"00", x"00", x"00", -- ^ 16
|
||||
x"08", x"1C", x"36", x"63", x"41", x"00", x"00", x"00", -- v 17
|
||||
x"18", x"0C", x"06", x"06", x"06", x"0C", x"18", x"00", -- ( 18
|
||||
x"06", x"0C", x"18", x"18", x"18", x"0C", x"06", x"00", -- ) 19
|
||||
x"00", x"0C", x"0C", x"00", x"00", x"0C", x"0C", x"00", -- : 1A
|
||||
-- x"00", x"00", x"00", x"00", x"00", x"0C", x"0C", x"00", -- . 1B
|
||||
-- x"00", x"00", x"00", x"00", x"00", x"0C", x"0C", x"06", -- , 1C
|
||||
-- x"1E", x"33", x"30", x"18", x"0C", x"00", x"0C", x"00", -- ? 1D
|
||||
-- x"18", x"18", x"18", x"00", x"18", x"18", x"18", x"00", -- | 1E
|
||||
x"41", x"43", x"45", x"49", x"51", x"61", x"41", x"00", -- N 1B
|
||||
x"3E", x"41", x"41", x"41", x"41", x"41", x"3E", x"00", -- O 1C
|
||||
x"3F", x"41", x"41", x"3F", x"11", x"21", x"41", x"00", -- R 1D
|
||||
x"41", x"63", x"55", x"49", x"41", x"41", x"41", x"00", -- M 1E
|
||||
x"36", x"36", x"7F", x"36", x"7F", x"36", x"36", x"00"); -- # 1F
|
||||
SIGNAL vcpt,hcpt,hcpt2 : natural RANGE 0 TO 4095;
|
||||
SIGNAL vin0,vin1 : unsigned(0 TO COLS*5-1);
|
||||
SIGNAL t_r,t_g,t_b : unsigned(7 DOWNTO 0);
|
||||
SIGNAL t_hs,t_vs,t_de : std_logic;
|
||||
SIGNAL col : unsigned(7 DOWNTO 0);
|
||||
SIGNAL de : std_logic;
|
||||
|
||||
SIGNAL in0s,in1s : unsigned(in0'range);
|
||||
BEGIN
|
||||
|
||||
in0s<=in0 WHEN rising_edge(i_clk);
|
||||
in1s<=in1 WHEN rising_edge(i_clk);
|
||||
----------------------------------------------------------
|
||||
Megamix:PROCESS(i_clk) IS
|
||||
VARIABLE vin_v : unsigned(0 TO 32*5-1);
|
||||
VARIABLE char_v : unsigned(4 DOWNTO 0);
|
||||
BEGIN
|
||||
IF rising_edge(i_clk) THEN
|
||||
--IF i_en='1' THEN
|
||||
----------------------------------
|
||||
-- Propagate VGA signals. 2 cycles delay
|
||||
t_r<=i_r;
|
||||
t_g<=i_g;
|
||||
t_b<=i_b;
|
||||
-- t_hs<=i_hs;
|
||||
-- t_vs<=i_vs;
|
||||
-- t_de<=i_de;
|
||||
|
||||
o_r<=t_r;
|
||||
o_g<=t_g;
|
||||
o_b<=t_b;
|
||||
-- o_hs<=t_hs;
|
||||
-- o_vs<=t_vs;
|
||||
-- o_de<=t_de;
|
||||
|
||||
----------------------------------
|
||||
-- Latch sampled values during vertical sync
|
||||
-- IF i_vs='1' THEN
|
||||
IF (i_Hcount="000000000" and i_VCount="000000000") THEN
|
||||
vin0<=in0s;
|
||||
vin1<=in1s;
|
||||
END IF;
|
||||
|
||||
----------------------------------
|
||||
-- IF i_vs='1' THEN
|
||||
-- vcpt<=0;
|
||||
-- de<='0';
|
||||
-- ELSIF i_hs='1' AND t_hs='0' AND de='1' THEN
|
||||
-- vcpt<=(vcpt+1) MOD 4096;
|
||||
-- END IF;
|
||||
-- if (i_Hcount < 148) then -- 148 = video left border
|
||||
-- if (i_Hcount < 148) then -- 148 = video left border
|
||||
if (i_Hcount < H_OFFSET) then -- 4 = video left border
|
||||
hcpt <= COLS*8;
|
||||
else
|
||||
hcpt <= to_integer(i_Hcount)-H_OFFSET;
|
||||
end if;
|
||||
-- if (i_Vcount < 16) then
|
||||
-- if (i_Vcount < 16) then
|
||||
if (i_Vcount < V_OFFSET) then
|
||||
vcpt <= 512;
|
||||
else
|
||||
vcpt <= to_integer(i_Vcount)-V_OFFSET;
|
||||
end if;
|
||||
|
||||
----------------------------------
|
||||
IF (vcpt/8) MOD 2=0 THEN
|
||||
vin_v:=vin0;
|
||||
ELSE
|
||||
vin_v:=vin1;
|
||||
END IF;
|
||||
|
||||
-- IF i_hs='1' THEN
|
||||
-- hcpt<=0;
|
||||
-- ELSIF i_de='1' THEN
|
||||
-- hcpt<=(hcpt+1) MOD 4096;
|
||||
-- de<='1';
|
||||
-- END IF;
|
||||
hcpt2<=hcpt;
|
||||
|
||||
----------------------------------
|
||||
-- Pick characters
|
||||
IF hcpt<COLS * 8 AND vcpt<LINES * 8 THEN
|
||||
-- no=> need to reverse string so 0-4 is left (not right!)
|
||||
char_v:=vin_v((hcpt/8)*5 TO (hcpt/8)*5+4);
|
||||
-- char_v:=vin_v(((COLS-1) - (hcpt/8))*5 TO ((COLS-1) - (hcpt/8))*5+4);
|
||||
ELSE
|
||||
char_v:="10000"; -- " " : Blank character
|
||||
END IF;
|
||||
|
||||
col<=chars(to_integer(char_v)*8+(vcpt MOD 8));
|
||||
|
||||
----------------------------------
|
||||
-- Insert Overlay
|
||||
IF ena='1' THEN
|
||||
IF col(hcpt2 MOD 8)='1' THEN
|
||||
o_r<=RGB(23 DOWNTO 16);
|
||||
o_g<=RGB(15 DOWNTO 8);
|
||||
o_b<=RGB( 7 DOWNTO 0);
|
||||
END IF;
|
||||
END IF;
|
||||
--END IF;
|
||||
END IF;
|
||||
END PROCESS Megamix;
|
||||
END ARCHITECTURE rtl;
|
||||
@@ -308,12 +308,8 @@ end
|
||||
assign TX_CLK = (CTL_REG[3:0] == 4'h0) ? XTAL_CLK_IN:
|
||||
TX_CLK_REG;
|
||||
|
||||
// Receiver clock. CTL bit 4 = 0 selects the external RxC input, which used to
|
||||
// be the fixed 1.8475 MHz enable (115,200 baud): a program writing CTL=$0F
|
||||
// (19,200, bit 4 clear -- the FujiNet HDB-DOS L3 cart) then transmitted at
|
||||
// 19,200 but received at 115,200. RxC is taken from the baud generator
|
||||
// instead; for CTL[3:0]=0 that is the same 1.8475 MHz clock as before.
|
||||
assign RX_CLK = TX_CLK;
|
||||
assign RX_CLK = (CTL_REG[4] == 1'b0) ? RX_CLK_IN:
|
||||
TX_CLK;
|
||||
|
||||
assign RESET_X = RESET_NX ? 1'b0:
|
||||
RESET_N;
|
||||
|
||||
+11
-11
@@ -6,16 +6,16 @@ module cassette(
|
||||
input rewind,
|
||||
input en,
|
||||
|
||||
output reg [15:0] sdram_addr,
|
||||
output reg [24:0] sdram_addr,
|
||||
input [7:0] sdram_data,
|
||||
// output reg sdram_rd,
|
||||
output reg sdram_rd,
|
||||
|
||||
output data
|
||||
// output [2:0] status
|
||||
output data,
|
||||
output [2:0] status
|
||||
|
||||
);
|
||||
|
||||
//assign status = state;
|
||||
assign status = state;
|
||||
|
||||
reg old_en;
|
||||
reg ffrewind;
|
||||
@@ -60,25 +60,25 @@ always @(posedge clk) begin
|
||||
end
|
||||
NEXT: begin
|
||||
state <= READ1;
|
||||
// sdram_rd <= 1'b0;
|
||||
sdram_rd <= 1'b0;
|
||||
if (seq == 24'h553c00) name <= 1'd1;
|
||||
if (seq == 24'h555555 && name) begin
|
||||
name <= 1'd0;
|
||||
state <= WAIT;
|
||||
hold <= 19'd445000; // 0.5s
|
||||
sdram_addr <= sdram_addr - 16'd3;
|
||||
sdram_addr <= sdram_addr - 25'd3;
|
||||
end
|
||||
if (seq == 24'h553cff) eof <= 2'd1;
|
||||
if (seq == 24'h00ff55 && eof == 2'd1) eof <= 2'd2;
|
||||
if (~en) state <= IDLE;
|
||||
end
|
||||
READ1: begin
|
||||
// sdram_rd <= 1'b1;
|
||||
sdram_rd <= 1'b1;
|
||||
state <= READ2;
|
||||
end
|
||||
READ2: begin
|
||||
ibyte <= sdram_data;
|
||||
// sdram_rd <= 1'b0;
|
||||
sdram_rd <= 1'b0;
|
||||
state <= READ3;
|
||||
sq_start <= 1'b1;
|
||||
end
|
||||
@@ -88,14 +88,14 @@ always @(posedge clk) begin
|
||||
end
|
||||
READ4: begin
|
||||
seq <= { seq[15:0], sdram_data };
|
||||
sdram_addr <= sdram_addr + 16'd1;
|
||||
sdram_addr <= sdram_addr + 25'd1;
|
||||
state <= eof == 2'd2 ? IDLE : NEXT;
|
||||
end
|
||||
endcase
|
||||
|
||||
if (ffrewind ^ rewind) begin
|
||||
seq <= 24'd0;
|
||||
sdram_addr <= 16'd0;
|
||||
sdram_addr <= 25'd0;
|
||||
state <= IDLE;
|
||||
eof <= 2'd0;
|
||||
end
|
||||
|
||||
+345
-699
File diff suppressed because it is too large.
Load diff
@@ -84,11 +84,6 @@ reg [8:0] read_count;
|
||||
reg [4:0] state;
|
||||
reg second_write;
|
||||
reg init_offset_a0;
|
||||
// End-of-line test for the fetch being requested, registered in state_start.
|
||||
// read_count only changes on SDRAM_VID_ACK, so this equals the old in-line
|
||||
// compare; it takes the 9-bit compare off the ACK -> VID_READ_OFFSET path,
|
||||
// which missed timing at 114 MHz.
|
||||
reg last_fetch;
|
||||
reg [4:0] a0_delay;
|
||||
|
||||
localparam state_pre_start = 4'd0;
|
||||
@@ -166,7 +161,6 @@ begin
|
||||
SDRAM_VID_REQ <= 1'b1;
|
||||
state <= state_wait_accept;
|
||||
init_offset_a0 <= PHY_VID_ADD[1];
|
||||
last_fetch <= (read_count >= WORD_END_COUNT);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -176,7 +170,7 @@ begin
|
||||
begin
|
||||
SDRAM_VID_REQ <= 1'b0;
|
||||
|
||||
if (last_fetch)
|
||||
if (read_count >= WORD_END_COUNT)
|
||||
begin
|
||||
read_count <= 9'h000;
|
||||
state <= state_done;
|
||||
|
||||
@@ -61,47 +61,23 @@
|
||||
// This file is a configuration definition file. The CoCo3FPGA for MiSTer source files
|
||||
// can be built into multiple objects which have mutually exclusive features.
|
||||
|
||||
`define Config_Debug_FLAG 4'hA
|
||||
localparam [7:0] FEATURE_1 = 8'h01;
|
||||
localparam [7:0] FEATURE_2 = 8'h02;
|
||||
localparam [7:0] FEATURE_3 = 8'h04;
|
||||
localparam [7:0] FEATURE_4 = 8'h08;
|
||||
localparam [7:0] FEATURE_5 = 8'h10;
|
||||
localparam [7:0] FEATURE_6 = 8'h20;
|
||||
localparam [7:0] FEATURE_7 = 8'h40;
|
||||
localparam [7:0] FEATURE_8 = 8'h80;
|
||||
`include "../rtl/config_inc.v"
|
||||
|
||||
// This is used for hardware debugging - it overrides the USER_IO to be user_out direct.
|
||||
// It should be commented out for release
|
||||
// If defined the Config_Debug sets the FEATURE MASKS all OR'd together which appears on COCO space at FFF1 & (FFF0 = 0x55 as a debug flag)
|
||||
//`define Config_Debug
|
||||
|
||||
// Feature list - note only FEATURE_1 - FEATURE_8 are supported
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// `set_feature(CoCo3_Horz_INT_FIX,Feat_1) // Connection of the horz int to the Mister CoCo3 V5 rasterizer
|
||||
`define CoCo3_Horz_INT_FIX
|
||||
`define Feat_1
|
||||
`set_feature(CoCo3_Horz_INT_FIX, FEATURE_1) // Connection of the horz int to the Mister CoCo3 V5 rasterizer
|
||||
|
||||
// `set_feature(CoCo3_Vert_INT_FIX,Feat_2) // Connection of the vert int to the Mister CoCo3 V5 rasterizer
|
||||
// `define CoCo3_Vert_INT_FIX
|
||||
// `define Feat_2
|
||||
//`set_feature(CoCo3_Vert_INT_FIX, FEATURE_2) // Connection of the vert int to the Mister CoCo3 V5 rasterizer
|
||||
|
||||
// `set_feature(CoCo3_CYC_ACC_6809,Feat_3) // Use cycle accurate 6809
|
||||
`define CoCo3_CYC_ACC_6809
|
||||
`define Feat_3
|
||||
`set_feature(CoCo3_CYC_ACC_6809, FEATURE_3) // Use cycle accurate 6809
|
||||
|
||||
// `set_feature(CoCo3_sdc_override_size,Feat_4) // Define static size value
|
||||
`define CoCo3_sdc_override_size
|
||||
`define Feat_4
|
||||
`set_feature(CoCo3_sdc_override_size, FEATURE_4) // Define static size value
|
||||
|
||||
// `set_feature(CoCo3_sdc_fix_os9_driver,Feat_5) // fix sdc query disk size issue in llcocosdc driver in multipak enviroment
|
||||
`define CoCo3_sdc_fix_os9_driver
|
||||
`define Feat_5
|
||||
`set_feature(CoCo3_sdc_fix_os9_driver, FEATURE_5) // fix sdc query disk size issue in llcocosdc driver in multipak enviroment
|
||||
|
||||
// `set_feature(CoCo3_disable_GART_in_GIMEX,Feat_6) // Disable GIMEX ram transfers [GIMEX detection in OS9 EOU]
|
||||
`define CoCo3_disable_GART_in_GIMEX
|
||||
`define Feat_6
|
||||
|
||||
// `set_feature(,Feat_7) // Open Feature
|
||||
// `define New_Feature...
|
||||
// `define Feat_7
|
||||
`set_feature(CoCo3_disable_GART_in_GIMEX, FEATURE_6)// Disable GIMEX ram transfers [GIMEX detection in OS( EOU]
|
||||
|
||||
//`set_feature(CoCo3_Select_GIMEX_RAST, FEATURE_7) // Use GIMEX Rasterizer Engine
|
||||
@@ -0,0 +1,123 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Project Name: CoCo3FPGA Version 5.x.x
|
||||
// File Name: config_inc.v
|
||||
//
|
||||
// CoCo3 in an FPGA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CPU section copyrighted by John Kent
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Color Computer 3 compatible system on a chip
|
||||
//
|
||||
// Version : 5.x
|
||||
//
|
||||
// Copyright (c) 2008 Gary Becker ([email protected])
|
||||
//
|
||||
// All rights reserved
|
||||
//
|
||||
// Redistribution and use in source and synthezised forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in synthesized form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// Neither the name of the author nor the names of other contributors may
|
||||
// be used to endorse or promote products derived from this software without
|
||||
// specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Please report bugs to the author, but before you do so, please
|
||||
// make sure that this is not a derivative work and that
|
||||
// you have the latest version of this file.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Gary Becker
|
||||
// [email protected]
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// MISTer Conversion by Stan Hodge and Alan Steremberg (& Gary Becker)
|
||||
// [email protected]
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is a configuration definition include file. The CoCo3FPGA for MiSTer source files
|
||||
// can be built into multiple objects which have mutually exclusive features.
|
||||
|
||||
`define Config_Debug_Value (`config_num_1 | `config_num_2 | `config_num_3 | `config_num_4 | `config_num_5 | `config_num_6 | `config_num_7 | `config_num_8)
|
||||
`define Config_Debug_FLAG 8'h55
|
||||
`define FEATURE_1 8'h01
|
||||
`define FEATURE_2 8'h02
|
||||
`define FEATURE_3 8'h04
|
||||
`define FEATURE_4 8'h08
|
||||
`define FEATURE_5 8'h10
|
||||
`define FEATURE_6 8'h20
|
||||
`define FEATURE_7 8'h40
|
||||
`define FEATURE_8 8'h80
|
||||
`define config_num_1 8'h00
|
||||
`define config_num_2 8'h00
|
||||
`define config_num_3 8'h00
|
||||
`define config_num_4 8'h00
|
||||
`define config_num_5 8'h00
|
||||
`define config_num_6 8'h00
|
||||
`define config_num_7 8'h00
|
||||
`define config_num_8 8'h00
|
||||
|
||||
`define set_feature(Feat_Name, Feat_Mask) \
|
||||
`define Feat_Name \
|
||||
`ifndef config_value_1 \
|
||||
`define config_value_1 Feat_Mask \
|
||||
`define config_num_1 Feat_Mask \
|
||||
`else \
|
||||
`ifndef config_value_2 \
|
||||
`define config_value_2 Feat_Mask \
|
||||
`define config_num_2 Feat_Mask \
|
||||
`else \
|
||||
`ifndef config_value_3 \
|
||||
`define config_value_3 Feat_Mask \
|
||||
`define config_num_3 Feat_Mask \
|
||||
`else \
|
||||
`ifndef config_value_4 \
|
||||
`define config_value_4 Feat_Mask \
|
||||
`define config_num_4 Feat_Mask \
|
||||
`else \
|
||||
`ifndef config_value_5 \
|
||||
`define config_value_5 Feat_Mask \
|
||||
`define config_num_5 Feat_Mask \
|
||||
`else \
|
||||
`ifndef config_value_6 \
|
||||
`define config_value_6 Feat_Mask \
|
||||
`define config_num_6 Feat_Mask \
|
||||
`else \
|
||||
`ifndef config_value_7 \
|
||||
`define config_value_7 Feat_Mask \
|
||||
`define config_num_7 Feat_Mask \
|
||||
`else \
|
||||
`ifndef config_value_8 \
|
||||
`define config_value_8 Feat_Mask \
|
||||
`define config_num_8 Feat_Mask \
|
||||
`endif \
|
||||
`endif \
|
||||
`endif \
|
||||
`endif \
|
||||
`endif \
|
||||
`endif \
|
||||
`endif \
|
||||
`endif
|
||||
+89
-213
@@ -135,10 +135,6 @@ wire [3:0] DRIVE_SEL_EXT_PRE = {DATA_IN[6], DATA_IN[2:0]};
|
||||
reg [2:0] drive_index;
|
||||
|
||||
// SD blk system is a array of 4 systems - one for each drive.
|
||||
// To keep disk track memory, we created 4 wd1793's to match the sd block interfaces
|
||||
// For the interface back to the coco - we need to isolate the wd1793 the computer is talking
|
||||
// to and route those feedback signals back to the coco. This is accomplished via the drive
|
||||
// select. 'drive_index' identifies which controller is addressd.
|
||||
|
||||
|
||||
always @(negedge FF40_CLK or negedge RESET_N)
|
||||
@@ -182,7 +178,7 @@ begin
|
||||
4'b1001:
|
||||
drive_index <= 3'd1;
|
||||
default:
|
||||
drive_index <= 3'd1; // Illegal
|
||||
drive_index <= 3'd0; // Illegal
|
||||
endcase
|
||||
end
|
||||
end
|
||||
@@ -212,13 +208,12 @@ wire DRQ[4];
|
||||
wire selected_DRQ;
|
||||
wire selected_INTRQ;
|
||||
|
||||
wire WR[4];
|
||||
wire RD[4];
|
||||
wire RD_E[4];
|
||||
wire WR;
|
||||
wire RD;
|
||||
wire RD_E;
|
||||
//wire CE;
|
||||
wire HALT_EN_RST;
|
||||
wire [7:0] DATA_1793;
|
||||
wire [7:0] dout[4];
|
||||
reg read;
|
||||
reg write;
|
||||
reg read_d;
|
||||
@@ -230,11 +225,7 @@ reg read1;
|
||||
reg write1;
|
||||
reg [1:0] ADDRESS_L;
|
||||
|
||||
|
||||
assign RD[0] = (read || RD_E[0]) && (drive_index == 2'd1);
|
||||
assign RD[1] = (read || RD_E[1]) && (drive_index == 3'd2);
|
||||
assign RD[2] = (read || RD_E[2]) && (drive_index == 3'd3);
|
||||
assign RD[3] = (read || RD_E[3]) && (drive_index == 3'd4);
|
||||
assign RD = read || RD_E;
|
||||
|
||||
// The idea here is to "stretch" the CPU read and write signals to ensure we catch a 8 mhz enable.
|
||||
// For writes we will buffer the data out to ensure it does not go away.
|
||||
@@ -253,14 +244,8 @@ begin
|
||||
write_d <= 1'b0;
|
||||
r_w_active <= 1'b0;
|
||||
clk_8Mhz_enable_found <= 1'b0;
|
||||
WR[0] <= 1'b0;
|
||||
WR[1] <= 1'b0;
|
||||
WR[2] <= 1'b0;
|
||||
WR[3] <= 1'b0;
|
||||
RD_E[0] <= 1'b0;
|
||||
RD_E[1] <= 1'b0;
|
||||
RD_E[2] <= 1'b0;
|
||||
RD_E[3] <= 1'b0;
|
||||
WR <= 1'b0;
|
||||
RD_E <= 1'b0;
|
||||
read1 <= 1'b0;
|
||||
write1 <= 1'b0;
|
||||
read <= 1'b0;
|
||||
@@ -293,32 +278,14 @@ begin
|
||||
begin
|
||||
// Set Writes
|
||||
r_w_active <= 1'b1;
|
||||
case (drive_index)
|
||||
3'd1:
|
||||
WR[0] <= 1'b1;
|
||||
3'd2:
|
||||
WR[1] <= 1'b1;
|
||||
3'd3:
|
||||
WR[2] <= 1'b1;
|
||||
3'd4:
|
||||
WR[3] <= 1'b1;
|
||||
endcase
|
||||
WR <= 1'b1;
|
||||
end
|
||||
|
||||
// Synchronus rising edge of read
|
||||
if ((read == 1'b1) && (read_d == 1'b0))
|
||||
begin
|
||||
r_w_active <= 1'b1;
|
||||
case (drive_index)
|
||||
3'd1:
|
||||
RD_E[0] <= 1'b1;
|
||||
3'd2:
|
||||
RD_E[1] <= 1'b1;
|
||||
3'd3:
|
||||
RD_E[2] <= 1'b1;
|
||||
3'd4:
|
||||
RD_E[3] <= 1'b1;
|
||||
endcase
|
||||
RD_E <= 1'b1;
|
||||
end
|
||||
|
||||
// Clears
|
||||
@@ -331,48 +298,54 @@ begin
|
||||
clk_8Mhz_enable_found <= 1'b0;
|
||||
r_w_active <= 1'b0;
|
||||
|
||||
WR[0] <= 1'b0;
|
||||
WR[1] <= 1'b0;
|
||||
WR[2] <= 1'b0;
|
||||
WR[3] <= 1'b0;
|
||||
WR <= 1'b0;
|
||||
|
||||
RD_E[0] <= 1'b0;
|
||||
RD_E[1] <= 1'b0;
|
||||
RD_E[2] <= 1'b0;
|
||||
RD_E[3] <= 1'b0;
|
||||
RD_E <= 1'b0;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
// NMI from disk controller
|
||||
// Selected INTRQ
|
||||
assign selected_INTRQ = (drive_index == 3'd1) ? INTRQ[0]:
|
||||
(drive_index == 3'd2) ? INTRQ[1]:
|
||||
(drive_index == 3'd3) ? INTRQ[2]:
|
||||
(drive_index == 3'd4) ? INTRQ[3]:
|
||||
1'b0;
|
||||
|
||||
|
||||
assign NMI_09 = DENSITY & selected_INTRQ; // Send NMI if Double Density (Halt Mode)
|
||||
|
||||
// HALT from disk controller
|
||||
// Selected DRQ
|
||||
assign selected_DRQ = (drive_index == 3'd1) ? DRQ[0]:
|
||||
(drive_index == 3'd2) ? DRQ[1]:
|
||||
(drive_index == 3'd3) ? DRQ[2]:
|
||||
(drive_index == 3'd4) ? DRQ[3]:
|
||||
1'b1;
|
||||
|
||||
|
||||
assign HALT = (HALT_EN & ~selected_DRQ);
|
||||
|
||||
assign HALT_EN_RST = RESET_N & ~selected_INTRQ; // From controller schematic
|
||||
|
||||
// Data bus selection
|
||||
assign DATA_1793 = (drive_index == 3'd1) ? dout[0]:
|
||||
(drive_index == 3'd2) ? dout[1]:
|
||||
(drive_index == 3'd3) ? dout[2]:
|
||||
(drive_index == 3'd4) ? dout[3]:
|
||||
8'd0;
|
||||
assign sd_lba[0] = wd1793_sd_lba;
|
||||
assign sd_lba[1] = wd1793_sd_lba;
|
||||
assign sd_lba[2] = wd1793_sd_lba;
|
||||
assign sd_lba[3] = wd1793_sd_lba;
|
||||
|
||||
assign sd_rd[0] = (drive_index == 3'd1) ? wd1793_sd_rd:
|
||||
1'b0;
|
||||
assign sd_rd[1] = (drive_index == 3'd2) ? wd1793_sd_rd:
|
||||
1'b0;
|
||||
assign sd_rd[2] = (drive_index == 3'd3) ? wd1793_sd_rd:
|
||||
1'b0;
|
||||
assign sd_rd[3] = (drive_index == 3'd4) ? wd1793_sd_rd:
|
||||
1'b0;
|
||||
|
||||
assign sd_wr[0] = (drive_index == 3'd1) ? wd1793_sd_wr:
|
||||
1'b0;
|
||||
assign sd_wr[1] = (drive_index == 3'd2) ? wd1793_sd_wr:
|
||||
1'b0;
|
||||
assign sd_wr[2] = (drive_index == 3'd3) ? wd1793_sd_wr:
|
||||
1'b0;
|
||||
assign sd_wr[3] = (drive_index == 3'd4) ? wd1793_sd_wr:
|
||||
1'b0;
|
||||
|
||||
assign wd1793_sd_ack = (drive_index == 3'd1) ? sd_ack[0]:
|
||||
(drive_index == 3'd2) ? sd_ack[1]:
|
||||
(drive_index == 3'd3) ? sd_ack[2]:
|
||||
(drive_index == 3'd4) ? sd_ack[3]:
|
||||
sd_ack[0]; // default is drive 1
|
||||
|
||||
assign sd_buff_din[0] = wd1793_sd_buff_din;
|
||||
assign sd_buff_din[1] = wd1793_sd_buff_din;
|
||||
assign sd_buff_din[2] = wd1793_sd_buff_din;
|
||||
assign sd_buff_din[3] = wd1793_sd_buff_din;
|
||||
|
||||
|
||||
// The SD_BLK interface and thus the wd1793 will allways transfer 1 blk. This is blk qty - 1 per spec.
|
||||
@@ -385,6 +358,13 @@ reg drive_wp[4];
|
||||
reg [3:0] drive_ready = 4'B0000;
|
||||
reg [3:0] double_sided = 4'B0000;
|
||||
reg [23:0] drive_size[4];
|
||||
wire [23:0] selected_drive_size;
|
||||
wire [31:0] wd1793_sd_lba;
|
||||
wire wd1793_sd_rd;
|
||||
wire wd1793_sd_wr;
|
||||
wire wd1793_sd_ack;
|
||||
wire [7:0] wd1793_sd_buff_din;
|
||||
wire selected_drive_ready, selected_drive_wp, selected_double_sided;
|
||||
|
||||
|
||||
// As drives are mounted in MISTer this logic saves the write protect and generates ready for
|
||||
@@ -433,6 +413,28 @@ begin
|
||||
//double_sided[3]<= img_size > 20'd368600;//20'd368640;
|
||||
end
|
||||
|
||||
assign selected_drive_size = (drive_index == 3'd1) ? drive_size[0]:
|
||||
(drive_index == 3'd2) ? drive_size[1]:
|
||||
(drive_index == 3'd3) ? drive_size[2]:
|
||||
(drive_index == 3'd4) ? drive_size[3]:
|
||||
drive_size[0]; // default is drive 1
|
||||
|
||||
assign selected_drive_wp = (drive_index == 3'd1) ? drive_wp[0]:
|
||||
(drive_index == 3'd2) ? drive_wp[1]:
|
||||
(drive_index == 3'd3) ? drive_wp[2]:
|
||||
(drive_index == 3'd4) ? drive_wp[3]:
|
||||
drive_wp[0]; // default is drive 1
|
||||
|
||||
assign selected_double_sided= (drive_index == 3'd1) ? double_sided[0]:
|
||||
(drive_index == 3'd2) ? double_sided[1]:
|
||||
(drive_index == 3'd3) ? double_sided[2]:
|
||||
double_sided[0]; // default is drive 1
|
||||
|
||||
assign selected_drive_ready = (drive_index == 3'd1) ? drive_ready[0]:
|
||||
(drive_index == 3'd2) ? drive_ready[1]:
|
||||
(drive_index == 3'd3) ? drive_ready[2]:
|
||||
(drive_index == 3'd4) ? drive_ready[3]:
|
||||
1'b0; // default is not ready
|
||||
|
||||
wd1793 #(1,0) coco_wd1793_0
|
||||
(
|
||||
@@ -440,160 +442,34 @@ wd1793 #(1,0) coco_wd1793_0
|
||||
.ce(ena_8Mhz),
|
||||
.reset(~RESET_N),
|
||||
.io_en(1'b1),
|
||||
.rd(RD[0]),
|
||||
.wr(WR[0]),
|
||||
.rd(RD),
|
||||
.wr(WR),
|
||||
.addr(ADDRESS_L[1:0]),
|
||||
.din(DATA_IN_L),
|
||||
.dout(dout[0]),
|
||||
.drq(DRQ[0]),
|
||||
.intrq(INTRQ[0]),
|
||||
.dout(DATA_1793),
|
||||
.drq(selected_DRQ),
|
||||
.intrq(selected_INTRQ),
|
||||
|
||||
.img_mounted(1'b0),
|
||||
.img_mounted_overide(1'b1),
|
||||
.img_size(drive_size[0]),
|
||||
.img_size(selected_drive_size[19:0]),
|
||||
|
||||
.sd_lba(sd_lba[0]),
|
||||
.sd_rd(sd_rd[0]),
|
||||
.sd_wr(sd_wr[0]),
|
||||
.sd_ack(sd_ack[0]),
|
||||
.sd_lba(wd1793_sd_lba),
|
||||
.sd_rd(wd1793_sd_rd),
|
||||
.sd_wr(wd1793_sd_wr),
|
||||
.sd_ack(wd1793_sd_ack),
|
||||
|
||||
.sd_buff_addr(sd_buff_addr),
|
||||
.sd_buff_dout(sd_buff_dout),
|
||||
.sd_buff_din(sd_buff_din[0]),
|
||||
.sd_buff_din(wd1793_sd_buff_din),
|
||||
.sd_buff_wr(sd_buff_wr),
|
||||
|
||||
.wp(drive_wp[0]),
|
||||
.wp(selected_drive_wp),
|
||||
|
||||
.size_code(3'd5), // 5 is 18 sector x 256 bits COCO standard
|
||||
.layout(~double_sided[0]), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
|
||||
.side(double_sided[0] & DRIVE_SEL_EXT[3]),
|
||||
.ready(drive_ready[0]),
|
||||
|
||||
.input_active(0), // Section not used
|
||||
.input_addr(0),
|
||||
.input_data(0),
|
||||
.input_wr(0),
|
||||
.buff_din(0)
|
||||
);
|
||||
|
||||
wd1793 #(1,0) coco_wd1793_1
|
||||
(
|
||||
.clk_sys(~CLK),
|
||||
.ce(ena_8Mhz),
|
||||
.reset(~RESET_N),
|
||||
.io_en(1'b1),
|
||||
.rd(RD[1]),
|
||||
.wr(WR[1]),
|
||||
.addr(ADDRESS_L[1:0]),
|
||||
.din(DATA_IN_L),
|
||||
.dout(dout[1]),
|
||||
.drq(DRQ[1]),
|
||||
.intrq(INTRQ[1]),
|
||||
|
||||
.img_mounted(1'b0),
|
||||
.img_mounted_overide(1'b1),
|
||||
.img_size(drive_size[1]),
|
||||
|
||||
.sd_lba(sd_lba[1]),
|
||||
.sd_rd(sd_rd[1]),
|
||||
.sd_wr(sd_wr[1]),
|
||||
.sd_ack(sd_ack[1]),
|
||||
|
||||
.sd_buff_addr(sd_buff_addr),
|
||||
.sd_buff_dout(sd_buff_dout),
|
||||
.sd_buff_din(sd_buff_din[1]),
|
||||
.sd_buff_wr(sd_buff_wr),
|
||||
|
||||
.wp(drive_wp[1]),
|
||||
|
||||
.size_code(3'd5), // 5 is 18 sector x 256 bits COCO standard
|
||||
.layout(~double_sided[1]), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
|
||||
.side(double_sided[1] & DRIVE_SEL_EXT[3]),
|
||||
.ready(drive_ready[1]),
|
||||
|
||||
.input_active(0), // Section not used
|
||||
.input_addr(0),
|
||||
.input_data(0),
|
||||
.input_wr(0),
|
||||
.buff_din(0)
|
||||
);
|
||||
|
||||
wd1793 #(1,0) coco_wd1793_2
|
||||
(
|
||||
.clk_sys(~CLK),
|
||||
.ce(ena_8Mhz),
|
||||
.reset(~RESET_N),
|
||||
.io_en(1'b1),
|
||||
.rd(RD[2]),
|
||||
.wr(WR[2]),
|
||||
.addr(ADDRESS_L[1:0]),
|
||||
.din(DATA_IN_L),
|
||||
.dout(dout[2]),
|
||||
.drq(DRQ[2]),
|
||||
.intrq(INTRQ[2]),
|
||||
|
||||
.img_mounted(1'b0),
|
||||
.img_mounted_overide(1'b1),
|
||||
.img_size(drive_size[2]),
|
||||
|
||||
.sd_lba(sd_lba[2]),
|
||||
.sd_rd(sd_rd[2]),
|
||||
.sd_wr(sd_wr[2]),
|
||||
.sd_ack(sd_ack[2]),
|
||||
|
||||
.sd_buff_addr(sd_buff_addr),
|
||||
.sd_buff_dout(sd_buff_dout),
|
||||
.sd_buff_din(sd_buff_din[2]),
|
||||
.sd_buff_wr(sd_buff_wr),
|
||||
|
||||
.wp(drive_wp[2]),
|
||||
|
||||
.size_code(3'd5), // 5 is 18 sector x 256 bits COCO standard
|
||||
.layout(~double_sided[2]), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
|
||||
.side(double_sided[2] & DRIVE_SEL_EXT[3]),
|
||||
.ready(drive_ready[2]),
|
||||
|
||||
.input_active(0), // Section not used
|
||||
.input_addr(0),
|
||||
.input_data(0),
|
||||
.input_wr(0),
|
||||
.buff_din(0)
|
||||
);
|
||||
|
||||
wd1793 #(1,0) coco_wd1793_3
|
||||
(
|
||||
.clk_sys(~CLK),
|
||||
.ce(ena_8Mhz),
|
||||
.reset(~RESET_N),
|
||||
.io_en(1'b1),
|
||||
.rd(RD[3]),
|
||||
.wr(WR[3]),
|
||||
.addr(ADDRESS_L[1:0]),
|
||||
.din(DATA_IN_L),
|
||||
.dout(dout[3]),
|
||||
.drq(DRQ[3]),
|
||||
.intrq(INTRQ[3]),
|
||||
|
||||
.img_mounted(1'b0),
|
||||
.img_mounted_overide(1'b1),
|
||||
.img_size(drive_size[3]),
|
||||
|
||||
.sd_lba(sd_lba[3]),
|
||||
.sd_rd(sd_rd[3]),
|
||||
.sd_wr(sd_wr[3]),
|
||||
.sd_ack(sd_ack[3]),
|
||||
|
||||
.sd_buff_addr(sd_buff_addr),
|
||||
.sd_buff_dout(sd_buff_dout),
|
||||
.sd_buff_din(sd_buff_din[3]),
|
||||
.sd_buff_wr(sd_buff_wr),
|
||||
|
||||
.wp(drive_wp[3]),
|
||||
|
||||
.size_code(3'd5), // 5 is 18 sector x 256 bits COCO standard
|
||||
.layout(1'b1), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
|
||||
.side(1'b0),
|
||||
.ready(drive_ready[3]),
|
||||
.layout(~selected_double_sided), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
|
||||
.side(selected_double_sided & DRIVE_SEL_EXT[3]),
|
||||
.ready(selected_drive_ready),
|
||||
|
||||
.input_active(0), // Section not used
|
||||
.input_addr(0),
|
||||
|
||||
+2
-3
@@ -47,6 +47,8 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Define Config features
|
||||
`include "../RTL/config.v"
|
||||
|
||||
module sdc(
|
||||
input CLK, // clock
|
||||
@@ -87,9 +89,6 @@ module sdc(
|
||||
|
||||
);
|
||||
|
||||
// Define Config features
|
||||
`include "../rtl/config.sv"
|
||||
|
||||
reg [23:0] LSN;
|
||||
reg [7:0] command;
|
||||
reg [7:0] transfer_address;
|
||||
|
||||
+74
-107
@@ -146,27 +146,54 @@ assign DATA_HDD =
|
||||
|
||||
wire [31:0] sdc_sd_lba[2];
|
||||
wire [31:0] fdc_sd_lba[2];
|
||||
wire [31:0] wd1793_sd_lba;
|
||||
wire [1:0] sdc_sd_rd;
|
||||
wire wd1793_sd_rd;
|
||||
wire [1:0] fdc_sd_rd;
|
||||
wire [1:0] sdc_sd_wr;
|
||||
wire [1:0] fdc_sd_wr;
|
||||
wire wd1793_sd_wr;
|
||||
wire [7:0] sdc_sd_buff_din[2];
|
||||
wire [7:0] fdc_sd_buff_din[2];
|
||||
wire [7:0] wd1793_sd_buff_din;
|
||||
wire wd1793_sd_ack;
|
||||
wire sdc_HALT;
|
||||
|
||||
assign sd_lba[0:1] = SDC_EN ? sdc_sd_lba[0:1]:
|
||||
fdc_sd_lba[0:1];
|
||||
|
||||
assign fdc_sd_lba[0] = wd1793_sd_lba;
|
||||
assign fdc_sd_lba[1] = wd1793_sd_lba;
|
||||
|
||||
assign sd_rd[1:0] = SDC_EN ? sdc_sd_rd[1:0]:
|
||||
fdc_sd_rd[1:0];
|
||||
|
||||
assign fdc_sd_rd[0] = (drive_index == 3'd1) ? wd1793_sd_rd:
|
||||
1'b0;
|
||||
|
||||
assign fdc_sd_rd[1] = (drive_index == 3'd2) ? wd1793_sd_rd:
|
||||
1'b0;
|
||||
|
||||
assign sd_wr[1:0] = SDC_EN ? sdc_sd_wr[1:0]:
|
||||
fdc_sd_wr[1:0];
|
||||
|
||||
assign fdc_sd_wr[0] = (drive_index == 3'd1) ? wd1793_sd_wr:
|
||||
1'b0;
|
||||
|
||||
assign fdc_sd_wr[1] = (drive_index == 3'd2) ? wd1793_sd_wr:
|
||||
1'b0;
|
||||
|
||||
assign sd_buff_din[0:1] = SDC_EN ? sdc_sd_buff_din[0:1]:
|
||||
fdc_sd_buff_din[0:1];
|
||||
|
||||
assign fdc_sd_buff_din[0] = wd1793_sd_buff_din;
|
||||
assign fdc_sd_buff_din[1] = wd1793_sd_buff_din;
|
||||
|
||||
|
||||
assign wd1793_sd_ack = (drive_index == 3'd1) ? sd_ack[0]:
|
||||
(drive_index == 3'd2) ? sd_ack[1]:
|
||||
sd_ack[0]; // default is drive 1
|
||||
|
||||
|
||||
sdc coco_sdc(
|
||||
.CLK(CLK), // clock
|
||||
@@ -250,13 +277,13 @@ begin
|
||||
drive_index <= 3'd1;
|
||||
|
||||
4'b1011: // This is what the Magic Number $43 does so we select a non-active drive
|
||||
drive_index <= 3'd1;
|
||||
drive_index <= 3'd0;
|
||||
4'b1000: // This is no drive with DS = illegal drive
|
||||
drive_index <= 3'd1;
|
||||
drive_index <= 3'd0;
|
||||
4'b0000: // This is no drive (maybe 0 in ff40) = illegal drive
|
||||
drive_index <= 3'd1;
|
||||
drive_index <= 3'd0;
|
||||
default:
|
||||
drive_index <= 3'd1;
|
||||
drive_index <= 3'd0;
|
||||
endcase
|
||||
end
|
||||
end
|
||||
@@ -283,17 +310,14 @@ end
|
||||
|
||||
// Control signals for the wd1793
|
||||
|
||||
wire INTRQ[2];
|
||||
wire DRQ[2];
|
||||
wire selected_DRQ;
|
||||
wire selected_INTRQ;
|
||||
|
||||
wire WR[2];
|
||||
wire RD[2];
|
||||
wire RD_E[2];
|
||||
wire WR;
|
||||
wire RD;
|
||||
wire RD_E;
|
||||
wire HALT_EN_RST;
|
||||
wire [7:0] DATA_1793;
|
||||
wire [7:0] dout[2];
|
||||
reg read;
|
||||
reg write;
|
||||
reg read_d;
|
||||
@@ -305,8 +329,7 @@ reg read1;
|
||||
reg write1;
|
||||
reg [1:0] ADDRESS_L;
|
||||
|
||||
assign RD[0] = (read || RD_E[0]) && (drive_index == 2'd1);
|
||||
assign RD[1] = (read || RD_E[1]) && (drive_index == 3'd2);
|
||||
assign RD = (read || RD_E); // Even with no drive selected allow read to the controller
|
||||
|
||||
// The idea here is to "stretch" the CPU read and write signals to ensure we catch a 8 mhz enable.
|
||||
// For writes we will buffer the data out to ensure it does not go away.
|
||||
@@ -327,10 +350,8 @@ begin
|
||||
write_d <= 1'b0;
|
||||
r_w_active <= 1'b0;
|
||||
clk_8Mhz_enable_found <= 1'b0;
|
||||
WR[0] <= 1'b0;
|
||||
WR[1] <= 1'b0;
|
||||
RD_E[0] <= 1'b0;
|
||||
RD_E[1] <= 1'b0;
|
||||
WR <= 1'b0;
|
||||
RD_E <= 1'b0;
|
||||
read1 <= 1'b0;
|
||||
write1 <= 1'b0;
|
||||
read <= 1'b0;
|
||||
@@ -362,24 +383,14 @@ begin
|
||||
begin
|
||||
// Set Write
|
||||
r_w_active <= 1'b1;
|
||||
case (drive_index)
|
||||
3'd1:
|
||||
WR[0] <= 1'b1;
|
||||
3'd2:
|
||||
WR[1] <= 1'b1;
|
||||
endcase
|
||||
WR <= 1'b1;
|
||||
end
|
||||
|
||||
// Synchronus rising edge of read
|
||||
if ((read == 1'b1) && (read_d == 1'b0))
|
||||
begin
|
||||
r_w_active <= 1'b1;
|
||||
case (drive_index)
|
||||
3'd1:
|
||||
RD_E[0] <= 1'b1;
|
||||
3'd2:
|
||||
RD_E[1] <= 1'b1;
|
||||
endcase
|
||||
RD_E <= 1'b1;
|
||||
end
|
||||
|
||||
// Clears
|
||||
@@ -391,42 +402,23 @@ begin
|
||||
begin
|
||||
clk_8Mhz_enable_found <= 1'b0;
|
||||
r_w_active <= 1'b0;
|
||||
WR[0] <= 1'b0;
|
||||
WR[1] <= 1'b0;
|
||||
|
||||
RD_E[0] <= 1'b0;
|
||||
RD_E[1] <= 1'b0;
|
||||
WR <= 1'b0;
|
||||
RD_E <= 1'b0;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
// NMI from disk controller
|
||||
// Selected INTRQ
|
||||
assign selected_INTRQ = (drive_index == 3'd1) ? INTRQ[0]:
|
||||
(drive_index == 3'd2) ? INTRQ[1]:
|
||||
1'b0;
|
||||
|
||||
assign NMI_09 = ~SDC_EN & DENSITY & selected_INTRQ; // Send NMI if Double Density (Halt Mode)
|
||||
|
||||
|
||||
|
||||
// HALT from disk controller
|
||||
|
||||
// Selected DRQ
|
||||
assign selected_DRQ = (drive_index == 3'd1) ? DRQ[0]:
|
||||
(drive_index == 3'd2) ? DRQ[1]:
|
||||
1'b1;
|
||||
|
||||
assign HALT = (~SDC_EN & HALT_EN & ~selected_DRQ) | sdc_HALT;
|
||||
|
||||
assign HALT_EN_RST = RESET_N & ~selected_INTRQ; // From controller schematic
|
||||
|
||||
// Data bus selection
|
||||
assign DATA_1793 = (drive_index == 3'd1) ? dout[0]:
|
||||
(drive_index == 3'd2) ? dout[1]:
|
||||
8'd0;
|
||||
|
||||
|
||||
// The SD_BLK interface and thus the wd1793 will allways transfer 1 blk. This is blk qty - 1 per spec.
|
||||
assign sd_blk_cnt[1] = 6'd0;
|
||||
@@ -436,6 +428,8 @@ reg drive_wp[2];
|
||||
reg [1:0] drive_ready = 2'b00;
|
||||
reg [1:0] double_sided = 2'b00;
|
||||
reg [31:0] drive_size[2];
|
||||
wire [31:0] selected_drive_size;
|
||||
wire selected_drive_ready, selected_drive_wp, selected_double_sided;
|
||||
|
||||
// As drives are mounted in MISTer this logic saves the write protect and generates ready for
|
||||
// changing drives to the wd1793.
|
||||
@@ -463,83 +457,56 @@ begin
|
||||
double_sided[1]<= (img_size > 64'd368600) & (img_size < 64'd740000);//20'd368640;
|
||||
end
|
||||
|
||||
assign selected_drive_size = (drive_index == 3'd1) ? drive_size[0]:
|
||||
(drive_index == 3'd2) ? drive_size[1]:
|
||||
drive_size[0]; // default is drive 1
|
||||
|
||||
wd1793 #(1,0) coco_wd1793_sdc_0
|
||||
assign selected_drive_wp = (drive_index == 3'd1) ? drive_wp[0]:
|
||||
(drive_index == 3'd2) ? drive_wp[1]:
|
||||
drive_wp[0]; // default is drive 1
|
||||
|
||||
assign selected_double_sided= (drive_index == 3'd1) ? double_sided[0]:
|
||||
(drive_index == 3'd2) ? double_sided[1]:
|
||||
double_sided[0]; // default is drive 1
|
||||
|
||||
assign selected_drive_ready = (drive_index == 3'd1) ? drive_ready[0]:
|
||||
(drive_index == 3'd2) ? drive_ready[1]:
|
||||
drive_ready[0]; // default is drive 1
|
||||
|
||||
wd1793 #(1,0) coco_wd1793_sdc
|
||||
(
|
||||
.clk_sys(~CLK),
|
||||
.ce(ena_8Mhz),
|
||||
.reset(~RESET_N),
|
||||
.io_en(1'b1),
|
||||
.rd(RD[0]),
|
||||
.wr(WR[0]),
|
||||
.rd(RD),
|
||||
.wr(WR),
|
||||
.addr(ADDRESS_L[1:0]),
|
||||
.din(DATA_IN_L),
|
||||
.dout(dout[0]),
|
||||
.drq(DRQ[0]),
|
||||
.intrq(INTRQ[0]),
|
||||
.dout(DATA_1793),
|
||||
.drq(selected_DRQ),
|
||||
.intrq(selected_INTRQ),
|
||||
|
||||
.img_mounted(1'b0), // Not used when using _override
|
||||
.img_mounted_overide(1'b1), // Load img_size and layout on each clock
|
||||
.img_size(drive_size[0]),
|
||||
.img_size(selected_drive_size[19:0]),
|
||||
|
||||
.sd_lba(fdc_sd_lba[0]),
|
||||
.sd_rd(fdc_sd_rd[0]),
|
||||
.sd_wr(fdc_sd_wr[0]),
|
||||
.sd_ack(sd_ack[0]),
|
||||
.sd_lba(wd1793_sd_lba),
|
||||
.sd_rd(wd1793_sd_rd),
|
||||
.sd_wr(wd1793_sd_wr),
|
||||
.sd_ack(wd1793_sd_ack),
|
||||
|
||||
.sd_buff_addr(sd_buff_addr),
|
||||
.sd_buff_dout(sd_buff_dout),
|
||||
.sd_buff_din(fdc_sd_buff_din[0]),
|
||||
.sd_buff_din(wd1793_sd_buff_din),
|
||||
.sd_buff_wr(sd_buff_wr),
|
||||
|
||||
.wp(drive_wp[0]),
|
||||
.wp(selected_drive_wp),
|
||||
|
||||
.size_code(3'd5), // 5 is 18 sector x 256 bits COCO standard
|
||||
.layout(~double_sided[0]), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
|
||||
.side(double_sided[0] & DRIVE_SEL_EXT[3]),
|
||||
.ready(drive_ready[0]),
|
||||
|
||||
.input_active(0), // Section not used
|
||||
.input_addr(0),
|
||||
.input_data(0),
|
||||
.input_wr(0),
|
||||
.buff_din(0)
|
||||
);
|
||||
|
||||
wd1793 #(1,0) coco_wd1793_sdc_1
|
||||
(
|
||||
.clk_sys(~CLK),
|
||||
.ce(ena_8Mhz),
|
||||
.reset(~RESET_N),
|
||||
.io_en(1'b1),
|
||||
.rd(RD[1]),
|
||||
.wr(WR[1]),
|
||||
.addr(ADDRESS_L[1:0]),
|
||||
.din(DATA_IN_L),
|
||||
.dout(dout[1]),
|
||||
.drq(DRQ[1]),
|
||||
.intrq(INTRQ[1]),
|
||||
|
||||
.img_mounted(1'b0), // Not used when using _override
|
||||
.img_mounted_overide(1'b1), // Load img_size and layout on each clock
|
||||
.img_size(drive_size[1]),
|
||||
|
||||
.sd_lba(fdc_sd_lba[1]),
|
||||
.sd_rd(fdc_sd_rd[1]),
|
||||
.sd_wr(fdc_sd_wr[1]),
|
||||
.sd_ack(sd_ack[1]),
|
||||
|
||||
.sd_buff_addr(sd_buff_addr),
|
||||
.sd_buff_dout(sd_buff_dout),
|
||||
.sd_buff_din(fdc_sd_buff_din[1]),
|
||||
.sd_buff_wr(sd_buff_wr),
|
||||
|
||||
.wp(drive_wp[1]),
|
||||
|
||||
.size_code(3'd5), // 5 is 18 sector x 256 bits COCO standard
|
||||
.layout(~double_sided[1]), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
|
||||
.side(double_sided[1] & DRIVE_SEL_EXT[3]),
|
||||
.ready(drive_ready[1]),
|
||||
.layout(~selected_double_sided), // 0 = Track-Side-Sector, 1 - Side-Track-Sector
|
||||
.side(selected_double_sided & DRIVE_SEL_EXT[3]),
|
||||
.ready(selected_drive_ready),
|
||||
|
||||
.input_active(0), // Section not used
|
||||
.input_addr(0),
|
||||
|
||||
+2
-11
@@ -99,11 +99,6 @@ reg [1:0] wd_size_code;
|
||||
wire [7:0] buff_dout;
|
||||
reg [1:0] sd_block = 0;
|
||||
reg format;
|
||||
// buff_wr is assigned from always blocks outside the `generate if(RWMODE)`
|
||||
// block it used to be declared in (after the wd1793_dpram that reads it). Those
|
||||
// assignments then resolve to a separate implicit net in Verilator, so the
|
||||
// sector-buffer write strobe never reached the RAM. Declared here instead.
|
||||
reg buff_wr;
|
||||
generate
|
||||
if(RWMODE) begin
|
||||
wd1793_dpram sbuf
|
||||
@@ -120,6 +115,7 @@ generate
|
||||
.wren_b(wre & buff_wr & (addr == A_DATA) & ~scan_active),
|
||||
.q_b(buff_dout)
|
||||
);
|
||||
reg buff_wr;
|
||||
end else begin
|
||||
assign buff_dout = 0;
|
||||
assign sd_buff_din = 0;
|
||||
@@ -792,18 +788,13 @@ wire[10:0] edsk_next = ((edsk_addr + 1'd1) >= edsk_size) ? 11'd0 : edsk_addr + 1
|
||||
|
||||
reg [7:0] spt_size = 0;
|
||||
|
||||
// spt_addr is assigned from the always block above, outside the
|
||||
// `generate if(EDSK)` scope it used to be declared in. Quartus tolerates that,
|
||||
// but Verilator rejects it ("Can't find definition of variable: 'spt_addr'"),
|
||||
// so it lives at module scope, next to spt_size. No behavioural change.
|
||||
reg [7:0] spt_addr;
|
||||
|
||||
generate
|
||||
if(EDSK) begin
|
||||
wire [7:0] scan_data = RWMODE ? buff_dout : input_data;
|
||||
reg [53:0] edsk[1992];
|
||||
reg [7:0] spt[166];
|
||||
|
||||
reg [7:0] spt_addr;
|
||||
always @(posedge clk_sys) begin
|
||||
{edsk_track,edsk_side,edsk_trackf,edsk_sidef,edsk_sector,edsk_sizecode,edsk_offset} <= edsk[edsk_addr];
|
||||
edsk_spt <= spt[spt_addr];
|
||||
|
||||
@@ -99,11 +99,6 @@ generate
|
||||
assign G = {RGB_fix[7:4],RGB_fix[7:4]};
|
||||
assign B = {RGB_fix[3:0],RGB_fix[3:0]};
|
||||
end
|
||||
else if(DW == 18) begin
|
||||
assign R = {RGB_fix[17:12],RGB_fix[17:16]};
|
||||
assign G = {RGB_fix[11: 6],RGB_fix[11:10]};
|
||||
assign B = {RGB_fix[ 5: 0],RGB_fix[ 5: 4]};
|
||||
end
|
||||
else begin // 24
|
||||
assign R = RGB_fix[23:16];
|
||||
assign G = RGB_fix[15:8];
|
||||
|
||||
+40
-159
@@ -103,7 +103,7 @@ USE ieee.numeric_std.ALL;
|
||||
-- DOWNSCALE : True=Support downscaling False=Downscaling disabled
|
||||
-- BYTESWAP : Little/Big endian byte swap
|
||||
-- FRAC : Fractional bits, subpixel resolution
|
||||
-- OHRES : Max. output horizontal resolution. 1024, 2048, 2304, 2560, 4096
|
||||
-- OHRES : Max. output horizontal resolution. Must be a power of two.
|
||||
-- (Used for sizing line buffers)
|
||||
-- IHRES : Max. input horizontal resolution. Must be a power of two.
|
||||
-- (Used for sizing line buffers)
|
||||
@@ -125,7 +125,7 @@ ENTITY ascal IS
|
||||
ADAPTIVE : boolean := true;
|
||||
DOWNSCALE_NN : boolean := false;
|
||||
FRAC : natural RANGE 4 TO 8 :=4;
|
||||
OHRES : natural RANGE 1 TO 4096 :=2304;
|
||||
OHRES : natural RANGE 1 TO 4096 :=2048;
|
||||
IHRES : natural RANGE 1 TO 2048 :=2048;
|
||||
N_DW : natural RANGE 64 TO 128 := 128;
|
||||
N_AW : natural RANGE 8 TO 32 := 32;
|
||||
@@ -204,7 +204,6 @@ ENTITY ascal IS
|
||||
run : IN std_logic :='1'; -- 1=Enable output image. 0=No image
|
||||
freeze : IN std_logic :='0'; -- 1=Disable framebuffer writes
|
||||
mode : IN unsigned(4 DOWNTO 0);
|
||||
bob_deint : IN std_logic := '0';
|
||||
-- SYNC |_________________________/"""""""""\_______|
|
||||
-- DE |""""""""""""""""""\________________________|
|
||||
-- RGB | <#IMAGE#> ^HDISP |
|
||||
@@ -223,7 +222,6 @@ ENTITY ascal IS
|
||||
vmax : IN natural RANGE 0 TO 4095; -- 0 <= vmin < vmax < vdisp
|
||||
vrr : IN std_logic := '0';
|
||||
vrrmax : IN natural RANGE 0 TO 4095 := 0;
|
||||
swblack : IN std_logic := '0'; -- will output 3 black frame on every resolution switch
|
||||
|
||||
-- Scaler format. 00=16bpp 565, 01=24bpp 10=32bpp
|
||||
format : IN unsigned(1 DOWNTO 0) :="01";
|
||||
@@ -259,9 +257,6 @@ ENTITY ascal IS
|
||||
BEGIN
|
||||
ASSERT N_DW=64 OR N_DW=128 REPORT "DW" SEVERITY failure;
|
||||
|
||||
ASSERT OHRES = 1024 OR OHRES = 2048 OR OHRES = 2304 OR
|
||||
OHRES = 2560 OR OHRES = 4096 REPORT "OHRES" SEVERITY failure;
|
||||
|
||||
END ENTITY ascal;
|
||||
|
||||
--##############################################################################
|
||||
@@ -292,35 +287,6 @@ ARCHITECTURE rtl OF ascal IS
|
||||
END IF;
|
||||
END FUNCTION to_std_logic;
|
||||
|
||||
----------------------------------------------------------
|
||||
FUNCTION ohres_h(CONSTANT r : natural) RETURN natural IS
|
||||
BEGIN
|
||||
CASE r IS
|
||||
WHEN 1024 => RETURN 1024;
|
||||
WHEN 2048 => RETURN 2048;
|
||||
WHEN OTHERS => RETURN 4096;
|
||||
END CASE;
|
||||
END FUNCTION;
|
||||
FUNCTION ohres_l(CONSTANT r : natural) RETURN natural IS
|
||||
BEGIN
|
||||
CASE r IS
|
||||
WHEN 1024 => RETURN 1024;
|
||||
WHEN 2048 | 2304 | 2560 => RETURN 2048;
|
||||
WHEN OTHERS => RETURN 4096;
|
||||
END CASE;
|
||||
END FUNCTION;
|
||||
FUNCTION ohres_m(CONSTANT r : natural) RETURN natural IS
|
||||
BEGIN
|
||||
CASE r IS
|
||||
WHEN 1024 | 2048 | 2304 => RETURN 256;
|
||||
WHEN OTHERS => RETURN 512;
|
||||
END CASE;
|
||||
END FUNCTION;
|
||||
|
||||
CONSTANT OHRESH : natural := ohres_h(OHRES);
|
||||
CONSTANT OHRESL : natural := ohres_l(OHRES);
|
||||
CONSTANT OHRESM : natural := ohres_m(OHRES);
|
||||
|
||||
----------------------------------------------------------
|
||||
CONSTANT NB_BURST : natural :=ilog2(N_BURST);
|
||||
CONSTANT NB_LA : natural :=ilog2(N_DW/8); -- Low address bits
|
||||
@@ -352,7 +318,6 @@ ARCHITECTURE rtl OF ascal IS
|
||||
SIGNAL i_pvs,i_pfl,i_pde,i_pce : std_logic;
|
||||
SIGNAL i_ppix : type_pix;
|
||||
SIGNAL i_freeze : std_logic;
|
||||
SIGNAL i_bob_deint : std_logic;
|
||||
SIGNAL i_count : unsigned(2 DOWNTO 0);
|
||||
SIGNAL i_hsize,i_hmin,i_hmax,i_hcpt : uint12;
|
||||
SIGNAL i_hrsize,i_vrsize : uint12;
|
||||
@@ -368,7 +333,6 @@ ARCHITECTURE rtl OF ascal IS
|
||||
SIGNAL i_de_delay : natural RANGE 0 TO 31;
|
||||
SIGNAL i_intercnt : natural RANGE 0 TO 3;
|
||||
SIGNAL i_inter,i_half,i_flm : std_logic;
|
||||
SIGNAL i_wfl : std_logic_vector(2 DOWNTO 0);
|
||||
SIGNAL i_write,i_wreq,i_alt,i_line,i_wline,i_wline_mem : std_logic;
|
||||
SIGNAL i_walt,i_walt_mem,i_wreq_mem : std_logic;
|
||||
SIGNAL i_wdelay : natural RANGE 0 TO 7;
|
||||
@@ -398,7 +362,7 @@ ARCHITECTURE rtl OF ascal IS
|
||||
SIGNAL i_hacc,i_vacc : uint13;
|
||||
SIGNAL i_hdown,i_vdown : std_logic;
|
||||
SIGNAL i_divcpt : natural RANGE 0 TO 36;
|
||||
SIGNAL i_lwad,i_lrad : natural RANGE 0 TO OHRESH-1;
|
||||
SIGNAL i_lwad,i_lrad : natural RANGE 0 TO OHRES-1;
|
||||
SIGNAL i_lwr,i_bil : std_logic;
|
||||
SIGNAL i_ldw,i_ldrm : type_pix;
|
||||
SIGNAL i_hpixp,i_hpix0,i_hpix1,i_hpix2,i_hpix3,i_hpix4 : type_pix;
|
||||
@@ -446,8 +410,6 @@ ARCHITECTURE rtl OF ascal IS
|
||||
-- Output
|
||||
SIGNAL o_run : std_logic;
|
||||
SIGNAL o_freeze : std_logic;
|
||||
SIGNAL o_bob_deint : std_logic;
|
||||
SIGNAL o_iwfl : std_logic_vector(2 DOWNTO 0);
|
||||
SIGNAL o_mode,o_hmode,o_vmode : unsigned(4 DOWNTO 0);
|
||||
SIGNAL o_format : unsigned(5 DOWNTO 0);
|
||||
SIGNAL o_fb_pal_dr : unsigned(23 DOWNTO 0);
|
||||
@@ -494,21 +456,13 @@ ARCHITECTURE rtl OF ascal IS
|
||||
SIGNAL o_reset_na : std_logic;
|
||||
SIGNAL o_dpram : arr_dw(0 TO BLEN*2-1);
|
||||
ATTRIBUTE ramstyle OF o_dpram : SIGNAL IS "no_rw_check";
|
||||
SIGNAL o_line0,o_line1,o_line2,o_line3 : arr_pix(0 TO OHRESL-1);
|
||||
SIGNAL o_linf0,o_linf1,o_linf2,o_linf3 : arr_pix(0 TO OHRESM-1);
|
||||
|
||||
SIGNAL o_line0,o_line1,o_line2,o_line3 : arr_pix(0 TO OHRES-1);
|
||||
ATTRIBUTE ramstyle OF o_line0 : SIGNAL IS "no_rw_check";
|
||||
ATTRIBUTE ramstyle OF o_line1 : SIGNAL IS "no_rw_check";
|
||||
ATTRIBUTE ramstyle OF o_line2 : SIGNAL IS "no_rw_check";
|
||||
ATTRIBUTE ramstyle OF o_line3 : SIGNAL IS "no_rw_check";
|
||||
ATTRIBUTE ramstyle OF o_linf0 : SIGNAL IS "no_rw_check";
|
||||
ATTRIBUTE ramstyle OF o_linf1 : SIGNAL IS "no_rw_check";
|
||||
ATTRIBUTE ramstyle OF o_linf2 : SIGNAL IS "no_rw_check";
|
||||
ATTRIBUTE ramstyle OF o_linf3 : SIGNAL IS "no_rw_check";
|
||||
SIGNAL o_wadl,o_radl0,o_radl1,o_radl2,o_radl3 : natural RANGE 0 TO OHRESH-1;
|
||||
SIGNAL o_ldr0,o_ldr1,o_ldr2,o_ldr3,o_ldw : type_pix;
|
||||
SIGNAL o_ler0,o_ler1,o_ler2,o_ler3 : type_pix;
|
||||
SIGNAL o_lex0,o_lex1,o_lex2,o_lex3 : std_logic;
|
||||
SIGNAL o_wadl,o_radl0,o_radl1,o_radl2,o_radl3 : natural RANGE 0 TO OHRES-1;
|
||||
SIGNAL o_ldw,o_ldr0,o_ldr1,o_ldr2,o_ldr3 : type_pix;
|
||||
SIGNAL o_wr : unsigned(3 DOWNTO 0);
|
||||
SIGNAL o_hcpt,o_vcpt,o_vcpt_pre,o_vcpt_pre2,o_vcpt_pre3,o_vcpt2 : uint12;
|
||||
SIGNAL o_ihsize,o_ihsizem,o_ivsize : uint12;
|
||||
@@ -518,7 +472,7 @@ ARCHITECTURE rtl OF ascal IS
|
||||
SIGNAL o_hfrac : arr_frac(0 TO 9);
|
||||
ATTRIBUTE ramstyle OF o_hfrac : SIGNAL IS "logic"; -- avoid blockram shift register
|
||||
|
||||
SIGNAL o_hacc,o_hacc_ini,o_hacc_next,o_vacc,o_vacc_next,o_vacc_ini : natural RANGE 0 TO 4*OHRESH-1;
|
||||
SIGNAL o_hacc,o_hacc_ini,o_hacc_next,o_vacc,o_vacc_next,o_vacc_ini : natural RANGE 0 TO 4*OHRES-1;
|
||||
SIGNAL o_hsv,o_vsv,o_dev,o_pev,o_end : unsigned(0 TO 11);
|
||||
SIGNAL o_hsp,o_vss : std_logic;
|
||||
SIGNAL o_vcarrym,o_prim : boolean;
|
||||
@@ -536,9 +490,8 @@ ARCHITECTURE rtl OF ascal IS
|
||||
TYPE arr_uint4 IS ARRAY (natural RANGE <>) OF natural RANGE 0 TO 15;
|
||||
SIGNAL o_off : arr_uint4(0 TO 2);
|
||||
SIGNAL o_bibu : std_logic :='0';
|
||||
SIGNAL o_dcptv : arr_uint12(13 TO 14);
|
||||
SIGNAL o_dcpt_clr, o_dcpt_inc : std_logic;
|
||||
SIGNAL o_dcptv_clr, o_dcptv_inc : std_logic_vector(1 TO 12);
|
||||
SIGNAL o_dcptv : arr_uint12(1 TO 14);
|
||||
SIGNAL o_dcpt : uint12;
|
||||
SIGNAL o_hpixs,o_hpix0,o_hpix1,o_hpix2,o_hpix3 : type_pix;
|
||||
SIGNAL o_hpixq : arr_pixq(2 TO 8);
|
||||
ATTRIBUTE ramstyle OF o_hpixq : SIGNAL IS "logic"; -- avoid blockram shift register
|
||||
@@ -546,6 +499,7 @@ ARCHITECTURE rtl OF ascal IS
|
||||
SIGNAL o_vpix_outer : arr_pix(0 TO 2);
|
||||
SIGNAL o_vpix_inner : arr_pix(0 TO 6);
|
||||
|
||||
|
||||
SIGNAL o_vpe : std_logic;
|
||||
SIGNAL o_div : arr_div(0 TO 2); --uint12;
|
||||
SIGNAL o_dir : arr_frac(0 TO 2);
|
||||
@@ -556,7 +510,6 @@ ARCHITECTURE rtl OF ascal IS
|
||||
SIGNAL o_divrun : std_logic;
|
||||
SIGNAL o_hacpt,o_vacpt : unsigned(11 DOWNTO 0);
|
||||
SIGNAL o_vacptl : unsigned(1 DOWNTO 0);
|
||||
signal o_newres : integer range 0 to 3;
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
FUNCTION shift_ishift(shift : unsigned(0 TO 119);
|
||||
@@ -1177,7 +1130,6 @@ BEGIN
|
||||
i_pushhead<='0';
|
||||
i_eol<='0'; -- End Of Line
|
||||
i_freeze <=freeze; -- <ASYNC>
|
||||
i_bob_deint <= bob_deint;
|
||||
i_iauto<=iauto; -- <ASYNC>
|
||||
i_wreq<='0';
|
||||
i_wr<='0';
|
||||
@@ -1238,13 +1190,11 @@ BEGIN
|
||||
i_vcpt<=0;
|
||||
IF i_inter='1' AND i_flm='0' AND i_half='0' AND INTER THEN
|
||||
i_line<='1';
|
||||
i_wfl(o_ibuf1) <= '0';
|
||||
i_adrsi<=to_unsigned(N_BURST * i_hburst,32) +
|
||||
to_unsigned(N_BURST * to_integer(
|
||||
unsigned'("00") & to_std_logic(HEADER)),32);
|
||||
ELSE
|
||||
i_line<='0';
|
||||
i_wfl(o_ibuf0) <= '1';
|
||||
i_adrsi<=to_unsigned(N_BURST * to_integer(
|
||||
unsigned'("00") & to_std_logic(HEADER)),32);
|
||||
END IF;
|
||||
@@ -1254,8 +1204,8 @@ BEGIN
|
||||
i_vcpt>=i_vmin AND i_vcpt<=i_vmax);
|
||||
|
||||
-- Detects end of frame for triple buffering.
|
||||
i_endframe0<=i_vs AND (NOT i_inter OR i_flm OR i_bob_deint);
|
||||
i_endframe1<=i_vs AND (NOT i_inter OR NOT i_flm OR i_bob_deint);
|
||||
i_endframe0<=i_vs AND (NOT i_inter OR i_flm);
|
||||
i_endframe1<=i_vs AND (NOT i_inter OR NOT i_flm);
|
||||
|
||||
i_vss<=to_std_logic(i_vcpt>=i_vmin AND i_vcpt<=i_vmax);
|
||||
|
||||
@@ -1503,12 +1453,12 @@ BEGIN
|
||||
-- Push pixels to downscaling line buffer
|
||||
i_lwr<=i_hnp4 AND i_ven5 AND i_pce;
|
||||
IF i_lwr='1' THEN
|
||||
i_lwad<=(i_lwad+1) MOD OHRESH;
|
||||
i_lwad<=(i_lwad+1) MOD OHRES;
|
||||
END IF;
|
||||
i_ldw<=i_hpix;
|
||||
|
||||
IF i_hnp3='1' AND i_ven4='1' AND i_pce='1' THEN
|
||||
i_lrad<=(i_lrad+1) MOD OHRESH;
|
||||
i_lrad<=(i_lrad+1) MOD OHRES;
|
||||
END IF;
|
||||
|
||||
------------------------------------------------------
|
||||
@@ -1867,7 +1817,7 @@ BEGIN
|
||||
VARIABLE shift_v : unsigned(0 TO N_DW+15);
|
||||
VARIABLE hpix_v : type_pix;
|
||||
VARIABLE hcarry_v,vcarry_v : boolean;
|
||||
VARIABLE dif_v : natural RANGE 0 TO 8*OHRESH-1;
|
||||
VARIABLE dif_v : natural RANGE 0 TO 8*OHRES-1;
|
||||
VARIABLE off_v : natural RANGE 0 TO 15;
|
||||
BEGIN
|
||||
IF o_reset_na='0' THEN
|
||||
@@ -1912,8 +1862,6 @@ BEGIN
|
||||
o_isync <= '0';
|
||||
o_isync2 <= o_isync;
|
||||
o_freeze <= freeze;
|
||||
o_bob_deint <= bob_deint;
|
||||
o_iwfl <= i_wfl;
|
||||
o_inter <=i_inter; -- <ASYNC>
|
||||
o_iendframe0<=i_endframe0; -- <ASYNC>
|
||||
o_iendframe02<=o_iendframe0;
|
||||
@@ -1942,14 +1890,6 @@ BEGIN
|
||||
o_ivsize<=i_vrsize; -- <ASYNC>
|
||||
o_hdown<=i_hdown; -- <ASYNC>
|
||||
o_vdown<=i_vdown; -- <ASYNC>
|
||||
|
||||
IF (o_newres > 0) then
|
||||
o_newres <= o_newres- 1;
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
IF (swblack = '1' and o_fb_ena = '0' and (o_ihsize /= i_hrsize or o_ivsize /= i_vrsize)) then
|
||||
o_newres <= 3;
|
||||
END IF;
|
||||
|
||||
-- Simultaneous change of input and output framebuffers
|
||||
@@ -2146,26 +2086,7 @@ BEGIN
|
||||
o_read<=o_read_pre AND o_run;
|
||||
o_rline<=o_vacpt(0); -- Even/Odd line for interlaced video
|
||||
|
||||
----
|
||||
-- When bob deinterlacing we read lines from one buffer (the most current) but we read them twice
|
||||
-- (in contrast to weave deinterlacing where we read each 480p line from alternating buffers)
|
||||
-- To counteract the severe vibrating/motion with bob deinterlacing, we need to offset one field
|
||||
-- by a half-line. This is done by only reading the first line of the 'even' frame once
|
||||
|
||||
IF o_inter='1' AND o_bob_deint='1' THEN
|
||||
IF o_iwfl(o_obuf0)='0' THEN
|
||||
IF o_vacpt=0 OR o_rline='1' THEN
|
||||
o_adrs_pre<=to_integer(o_vacpt) * to_integer(o_stride);
|
||||
ELSE
|
||||
o_adrs_pre <= (to_integer(o_vacpt)-1) * to_integer(o_stride);
|
||||
END IF;
|
||||
ELSE
|
||||
o_adrs_pre <= to_integer(o_vacpt(11 DOWNTO 1) & "0") * to_integer(o_stride);
|
||||
END IF;
|
||||
ELSE
|
||||
o_adrs_pre<=to_integer(o_vacpt) * to_integer(o_stride);
|
||||
END IF;
|
||||
|
||||
IF o_adrsa='1' THEN
|
||||
IF o_fload=2 THEN
|
||||
o_adrs<=to_unsigned(o_hbcpt * N_BURST,32);
|
||||
@@ -2182,9 +2103,6 @@ BEGIN
|
||||
------------------------------------------------------
|
||||
-- Copy from buffered memory to pixel lines
|
||||
o_sh<='0';
|
||||
o_dcpt_clr <= '0';
|
||||
o_dcpt_inc <= '0';
|
||||
|
||||
CASE o_copy IS
|
||||
WHEN sWAIT =>
|
||||
o_copyv(0)<='0';
|
||||
@@ -2203,7 +2121,7 @@ BEGIN
|
||||
o_hacc <=o_hacc_ini;
|
||||
o_hacc_next<=o_hacc_ini + 2*o_ihsize;
|
||||
o_hacpt <=x"000";
|
||||
o_dcpt_clr <= '1';
|
||||
o_dcpt<=0;
|
||||
o_dshi<=2;
|
||||
o_acpt<=0;
|
||||
o_first<='1';
|
||||
@@ -2231,17 +2149,17 @@ BEGIN
|
||||
WHEN sCOPY =>
|
||||
-- dshi : Force shift first two or three pixels of each line
|
||||
IF o_dshi=0 THEN
|
||||
dif_v:=(o_hacc_next - 2*o_hsize + (8*OHRESH)) MOD (8*OHRESH);
|
||||
IF dif_v>=4*OHRESH THEN
|
||||
dif_v:=(o_hacc_next - 2*o_hsize + (8*OHRES)) MOD (8*OHRES);
|
||||
IF dif_v>=4*OHRES THEN
|
||||
o_hacc<=o_hacc_next;
|
||||
o_hacc_next<=o_hacc_next + 2*o_ihsize;
|
||||
hcarry_v:=false;
|
||||
ELSE
|
||||
o_hacc<=dif_v;
|
||||
o_hacc_next<=(dif_v + 2*o_ihsize + (4*OHRESH)) MOD (4*OHRESH);
|
||||
o_hacc_next<=(dif_v + 2*o_ihsize + (4*OHRES)) MOD (4*OHRES);
|
||||
hcarry_v:=true;
|
||||
END IF;
|
||||
o_dcpt_inc <= '1';
|
||||
o_dcpt<=(o_dcpt+1) MOD 4096;
|
||||
ELSE
|
||||
o_dshi<=o_dshi-1;
|
||||
hcarry_v:=false;
|
||||
@@ -2301,9 +2219,6 @@ BEGIN
|
||||
hpix_v:=(r=>o_fb_pal_dr(23 DOWNTO 16),g=>o_fb_pal_dr(15 DOWNTO 8),
|
||||
b=>o_fb_pal_dr(7 DOWNTO 0));
|
||||
END IF;
|
||||
IF (o_newres > 0) then
|
||||
hpix_v := (others => (others => '0'));
|
||||
END IF;
|
||||
o_hpix0<=hpix_v;
|
||||
o_hpix1<=o_hpix0;
|
||||
o_hpix2<=o_hpix1;
|
||||
@@ -2611,19 +2526,13 @@ BEGIN
|
||||
o_hfrac(2 TO 9) <= o_hfrac(1 TO 8);
|
||||
|
||||
o_copyv(1 TO 14)<=o_copyv(0 TO 13);
|
||||
o_dcptv_clr(1 TO 12)<=o_dcpt_clr & o_dcptv_clr(1 TO 11);
|
||||
o_dcptv_inc(1 TO 12)<=o_dcpt_inc & o_dcptv_inc(1 TO 11);
|
||||
|
||||
IF o_dcptv_clr(12)='1' THEN
|
||||
o_dcptv(13) <= 0;
|
||||
ELSIF o_dcptv_inc(12)='1' THEN
|
||||
o_dcptv(13) <= (o_dcptv(13) + 1) MOD OHRESH;
|
||||
END IF;
|
||||
o_dcptv(14)<=o_dcptv(13);
|
||||
|
||||
IF o_dcptv(13)>=o_hsize THEN
|
||||
o_copyv(14)<='0';
|
||||
o_dcptv(1)<=o_dcpt;
|
||||
IF o_dcptv(1)>=o_hsize THEN
|
||||
o_copyv(2)<='0';
|
||||
END IF;
|
||||
o_dcptv(2)<=o_dcptv(1) MOD OHRES;
|
||||
o_dcptv(3 TO 14)<=o_dcptv(2 TO 13);
|
||||
|
||||
-- C2
|
||||
o_hpixq(2)<=(o_hpix3,o_hpix2,o_hpix1,o_hpix0);
|
||||
@@ -2716,39 +2625,17 @@ BEGIN
|
||||
OLBUF:PROCESS(o_clk) IS
|
||||
BEGIN
|
||||
IF rising_edge(o_clk) THEN
|
||||
-----------------------------------------------
|
||||
-- WRITES
|
||||
IF o_wr(0)='1' AND o_wadl < OHRESL THEN o_line0(o_wadl MOD OHRESL)<=o_ldw; END IF;
|
||||
IF o_wr(1)='1' AND o_wadl < OHRESL THEN o_line1(o_wadl MOD OHRESL)<=o_ldw; END IF;
|
||||
IF o_wr(2)='1' AND o_wadl < OHRESL THEN o_line2(o_wadl MOD OHRESL)<=o_ldw; END IF;
|
||||
IF o_wr(3)='1' AND o_wadl < OHRESL THEN o_line3(o_wadl MOD OHRESL)<=o_ldw; END IF;
|
||||
IF OHRES = 2304 OR OHRES = 2560 THEN
|
||||
IF o_wr(0)='1' AND o_wadl >= OHRESL THEN o_linf0(o_wadl MOD OHRESM)<=o_ldw; END IF;
|
||||
IF o_wr(1)='1' AND o_wadl >= OHRESL THEN o_linf1(o_wadl MOD OHRESM)<=o_ldw; END IF;
|
||||
IF o_wr(2)='1' AND o_wadl >= OHRESL THEN o_linf2(o_wadl MOD OHRESM)<=o_ldw; END IF;
|
||||
IF o_wr(3)='1' AND o_wadl >= OHRESL THEN o_linf3(o_wadl MOD OHRESM)<=o_ldw; END IF;
|
||||
END IF;
|
||||
IF o_wr(0)='1' THEN o_line0(o_wadl)<=o_ldw; END IF;
|
||||
IF o_wr(1)='1' THEN o_line1(o_wadl)<=o_ldw; END IF;
|
||||
IF o_wr(2)='1' THEN o_line2(o_wadl)<=o_ldw; END IF;
|
||||
IF o_wr(3)='1' THEN o_line3(o_wadl)<=o_ldw; END IF;
|
||||
|
||||
-----------------------------------------------
|
||||
-- READS
|
||||
o_ldr0<=o_line0(o_radl0 MOD OHRESL);
|
||||
o_ldr1<=o_line1(o_radl1 MOD OHRESL);
|
||||
o_ldr2<=o_line2(o_radl2 MOD OHRESL);
|
||||
o_ldr3<=o_line3(o_radl3 MOD OHRESL);
|
||||
|
||||
IF OHRES = 2304 OR OHRES = 2560 THEN
|
||||
o_ler0<=o_linf0(o_radl0 MOD OHRESM);
|
||||
o_ler1<=o_linf1(o_radl1 MOD OHRESM);
|
||||
o_ler2<=o_linf2(o_radl2 MOD OHRESM);
|
||||
o_ler3<=o_linf3(o_radl3 MOD OHRESM);
|
||||
END IF;
|
||||
|
||||
o_lex0 <= to_std_logic(o_radl0 >= OHRESL);
|
||||
o_lex1 <= to_std_logic(o_radl1 >= OHRESL);
|
||||
o_lex2 <= to_std_logic(o_radl2 >= OHRESL);
|
||||
o_lex3 <= to_std_logic(o_radl3 >= OHRESL);
|
||||
-----------------------------------------------
|
||||
|
||||
o_ldr0<=o_line0(o_radl0);
|
||||
o_ldr1<=o_line1(o_radl1);
|
||||
o_ldr2<=o_line2(o_radl2);
|
||||
o_ldr3<=o_line3(o_radl3);
|
||||
END IF;
|
||||
END PROCESS OLBUF;
|
||||
|
||||
@@ -2834,17 +2721,16 @@ BEGIN
|
||||
VSCAL:PROCESS(o_clk) IS
|
||||
VARIABLE pixq_v : arr_pix(0 TO 3);
|
||||
VARIABLE vlumpix_v : type_pix;
|
||||
VARIABLE r1_v, r2_v : natural RANGE 0 TO OHRESH-1;
|
||||
VARIABLE r1_v, r2_v : natural RANGE 0 TO OHRES-1;
|
||||
VARIABLE fracnn_v : std_logic;
|
||||
VARIABLE o_l0_v, o_l1_v, o_l2_v, o_l3_v : type_pix;
|
||||
BEGIN
|
||||
IF rising_edge(o_clk) THEN
|
||||
IF o_ce='1' THEN
|
||||
o_v_hmin_adj<=o_hmin + 5;
|
||||
|
||||
fracnn_v := o_vfrac(o_vfrac'left);
|
||||
r1_v := (o_hcpt - o_v_hmin_adj + OHRESH) MOD OHRESH;
|
||||
r2_v := (o_hcpt - o_hmin + OHRESH) MOD OHRESH;
|
||||
r1_v := (o_hcpt - o_v_hmin_adj + OHRES) MOD OHRES;
|
||||
r2_v := (o_hcpt - o_hmin + OHRES) MOD OHRES;
|
||||
|
||||
-- CYCLE 1 -----------------------------------------
|
||||
-- Read mem
|
||||
@@ -2871,16 +2757,11 @@ BEGIN
|
||||
|
||||
-- CYCLE 2 -----------------------------------------
|
||||
-- Lines reordering
|
||||
IF o_lex0='0' THEN o_l0_v := o_ldr0; ELSE o_l0_v := o_ler0; END IF;
|
||||
IF o_lex1='0' THEN o_l1_v := o_ldr1; ELSE o_l1_v := o_ler1; END IF;
|
||||
IF o_lex2='0' THEN o_l2_v := o_ldr2; ELSE o_l2_v := o_ler2; END IF;
|
||||
IF o_lex3='0' THEN o_l3_v := o_ldr3; ELSE o_l3_v := o_ler3; END IF;
|
||||
|
||||
CASE o_vacptl IS
|
||||
WHEN "10" => pixq_v:=(o_l0_v,o_l1_v,o_l2_v,o_l3_v);
|
||||
WHEN "11" => pixq_v:=(o_l1_v,o_l2_v,o_l3_v,o_l0_v);
|
||||
WHEN "00" => pixq_v:=(o_l2_v,o_l3_v,o_l0_v,o_l1_v);
|
||||
WHEN OTHERS => pixq_v:=(o_l3_v,o_l0_v,o_l1_v,o_l2_v);
|
||||
WHEN "10" => pixq_v:=(o_ldr0,o_ldr1,o_ldr2,o_ldr3);
|
||||
WHEN "11" => pixq_v:=(o_ldr1,o_ldr2,o_ldr3,o_ldr0);
|
||||
WHEN "00" => pixq_v:=(o_ldr2,o_ldr3,o_ldr0,o_ldr1);
|
||||
WHEN OTHERS => pixq_v:=(o_ldr3,o_ldr0,o_ldr1,o_ldr2);
|
||||
END CASE;
|
||||
|
||||
IF fracnn_v = '0' THEN
|
||||
|
||||
+1
-26
@@ -2,16 +2,13 @@
|
||||
# Build TimeStamp Verilog Module
|
||||
# Jeff Wiencrot - 8/1/2011
|
||||
# Sorgelig - 02/11/2019
|
||||
# Stan Hodge - 04/22/2024
|
||||
|
||||
proc generateBuildID_Verilog {} {
|
||||
|
||||
# Get the timestamp (see: http://www.altera.com/support/examples/tcl/tcl-date-time-stamp.html)
|
||||
set buildDate "`define BUILD_DATE \"[clock format [ clock seconds ] -format %y%m%d]\""
|
||||
|
||||
# Create a Verilog file(s) for output
|
||||
# Create a Verilog file for output
|
||||
set outputFileName "build_id.v"
|
||||
set outputFileNameNum "build_id_num.v"
|
||||
|
||||
set fileData ""
|
||||
if { [file exists $outputFileName]} {
|
||||
@@ -20,35 +17,13 @@ proc generateBuildID_Verilog {} {
|
||||
close $outputFile
|
||||
}
|
||||
|
||||
set fileData_num ""
|
||||
if { [file exists $outputFileNameNum]} {
|
||||
set outputFile [open $outputFileNameNum "r"]
|
||||
set fileData_num [read $outputFile]
|
||||
close $outputFile
|
||||
}
|
||||
|
||||
|
||||
if {$buildDate ne $fileData} {
|
||||
set outputFile [open $outputFileName "w"]
|
||||
puts -nonewline $outputFile $buildDate
|
||||
close $outputFile
|
||||
|
||||
set buildnumbervar 1
|
||||
|
||||
# Send confirmation message to the Messages window
|
||||
post_message "Generated: [pwd]/$outputFileName: $buildDate"
|
||||
} else {
|
||||
scan $fileData_num "`define BUILD_NUMBER \"%d" buildnumbervar
|
||||
incr buildnumbervar
|
||||
}
|
||||
|
||||
set buildnumber "`define BUILD_NUMBER \"[format "%03d" $buildnumbervar]\""
|
||||
set outputFile [open $outputFileNameNum "w"]
|
||||
puts -nonewline $outputFile $buildnumber
|
||||
close $outputFile
|
||||
|
||||
post_message "Generated: [pwd]/$outputFileNameNum: $buildnumber"
|
||||
|
||||
}
|
||||
|
||||
# Build CDF file
|
||||
|
||||
+5
-11
@@ -27,7 +27,7 @@
|
||||
// VDNUM 1..10
|
||||
// BLKSZ 0..7: 0 = 128, 1 = 256, 2 = 512(default), .. 7 = 16384
|
||||
//
|
||||
module hps_io #(parameter CONF_STR, CONF_STR_BRAM=0, PS2DIV=0, WIDE=0, VDNUM=1, BLKSZ=2, PS2WE=0, STRLEN=$size(CONF_STR)>>3)
|
||||
module hps_io #(parameter CONF_STR, CONF_STR_BRAM=1, PS2DIV=0, WIDE=0, VDNUM=1, BLKSZ=2, PS2WE=0)
|
||||
(
|
||||
input clk_sys,
|
||||
inout [48:0] HPS_BUS,
|
||||
@@ -232,7 +232,8 @@ video_calc video_calc
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
localparam MAX_W = $clog2((64 > (STRLEN+2)) ? 64 : (STRLEN+2))-1;
|
||||
localparam STRLEN = $size(CONF_STR)>>3;
|
||||
localparam MAX_W = $clog2((32 > (STRLEN+2)) ? 32 : (STRLEN+2))-1;
|
||||
|
||||
wire [7:0] conf_byte;
|
||||
generate
|
||||
@@ -1031,15 +1032,8 @@ module confstr_rom #(parameter CONF_STR, STRLEN)
|
||||
output reg [7:0] conf_byte
|
||||
);
|
||||
|
||||
reg [7:0] rom[STRLEN];
|
||||
|
||||
initial begin
|
||||
if( CONF_STR=="" )
|
||||
$readmemh("cfgstr.hex",rom);
|
||||
else
|
||||
for(int i = 0; i < STRLEN; i++) rom[i] = CONF_STR[((STRLEN-i)*8)-1 -:8];
|
||||
end
|
||||
|
||||
wire [7:0] rom[STRLEN];
|
||||
initial for(int i = 0; i < STRLEN; i++) rom[i] = CONF_STR[((STRLEN-i)*8)-1 -:8];
|
||||
always @ (posedge clk_sys) conf_byte <= rom[conf_addr];
|
||||
|
||||
endmodule
|
||||
@@ -75,7 +75,7 @@ always @(posedge CLK) begin
|
||||
END <= 0;
|
||||
rd <= READ;
|
||||
len <= I2C_WLEN;
|
||||
if(READ) SD <= {2'b10, I2C_ADDR, 1'b1, 1'b1, 8'b11111111, 1'b1, 3'b011, 9'b111111111};
|
||||
if(READ) SD <= {2'b10, I2C_ADDR, 1'b1, 1'b1, 8'b11111111, 1'b0, 3'b011, 9'b111111111};
|
||||
else SD <= {2'b10, I2C_ADDR, 1'b0, 1'b1, I2C_WDATA1, 1'b1, I2C_WDATA2, 4'b1011};
|
||||
SD_COUNTER <= 0;
|
||||
end else begin
|
||||
|
||||
+3
-10
@@ -8,9 +8,7 @@ module mcp23009
|
||||
|
||||
output reg [2:0] btn,
|
||||
input [2:0] led,
|
||||
output reg flg_sd_cd,
|
||||
output reg flg_present,
|
||||
output reg flg_mode,
|
||||
output reg sd_cd,
|
||||
|
||||
output scl,
|
||||
inout sda
|
||||
@@ -52,9 +50,7 @@ always@(posedge clk) begin
|
||||
idx <= 0;
|
||||
btn <= 0;
|
||||
rw <= 0;
|
||||
flg_sd_cd <= 1;
|
||||
flg_present <= 0;
|
||||
flg_mode <= 1;
|
||||
sd_cd <= 1;
|
||||
end
|
||||
else begin
|
||||
if(~&init_data[idx]) begin
|
||||
@@ -88,10 +84,7 @@ always@(posedge clk) begin
|
||||
state <= 0;
|
||||
rw <= 0;
|
||||
if(!error) begin
|
||||
if(rw) begin
|
||||
{flg_sd_cd, flg_mode, btn} <= {dout[7:3]};
|
||||
flg_present <= 1;
|
||||
end
|
||||
if(rw) {sd_cd, btn} <= {dout[7], dout[5:3]};
|
||||
rw <= ~rw;
|
||||
end
|
||||
end
|
||||
|
||||
+41
-2
@@ -1,5 +1,44 @@
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_TOOL_NAME "altera_pll_reconfig"
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_TOOL_VERSION "17.0"
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_TOOL_ENV "mwpim"
|
||||
set_global_assignment -library "pll_cfg" -name MISC_FILE [file join $::quartus(qip_path) "pll_cfg.cmp"]
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_TARGETED_DEVICE_FAMILY "Cyclone V"
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_GENERATED_DEVICE_FAMILY "{Cyclone V}"
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_QSYS_MODE "UNKNOWN"
|
||||
set_global_assignment -name SYNTHESIS_ONLY_QIP ON
|
||||
set_global_assignment -library "pll_cfg" -name VERILOG_FILE [file join $::quartus(qip_path) "pll_cfg/pll_cfg.v"]
|
||||
set_global_assignment -library "pll_cfg" -name VERILOG_FILE [file join $::quartus(qip_path) "pll_cfg/pll_cfg_hdmi.v"]
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_NAME "cGxsX2hkbWlfY2Zn"
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_DISPLAY_NAME "QWx0ZXJhIFBMTCBSZWNvbmZpZw=="
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_REPORT_HIERARCHY "Off"
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_INTERNAL "Off"
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_AUTHOR "QWx0ZXJhIENvcnBvcmF0aW9u"
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_VERSION "MTcuMA=="
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_DESCRIPTION "QWx0ZXJhIFBoYXNlLUxvY2tlZCBMb29wIFJlY29uZmlndXJhdGlvbiBCbG9jayhBTFRFUkFfUExMX1JFQ09ORklHKQ=="
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "RU5BQkxFX0JZVEVFTkFCTEU=::ZmFsc2U=::QWRkIGJ5dGVlbmFibGUgcG9ydA=="
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "QllURUVOQUJMRV9XSURUSA==::NA==::QllURUVOQUJMRV9XSURUSA=="
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "UkVDT05GSUdfQUREUl9XSURUSA==::Ng==::UkVDT05GSUdfQUREUl9XSURUSA=="
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "UkVDT05GSUdfREFUQV9XSURUSA==::MzI=::UkVDT05GSUdfREFUQV9XSURUSA=="
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "cmVjb25mX3dpZHRo::NjQ=::cmVjb25mX3dpZHRo"
|
||||
set_global_assignment -entity "pll_cfg" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "V0FJVF9GT1JfTE9DSw==::dHJ1ZQ==::V0FJVF9GT1JfTE9DSw=="
|
||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_NAME "YWx0ZXJhX3BsbF9yZWNvbmZpZ190b3A="
|
||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_DISPLAY_NAME "QWx0ZXJhIFBMTCBSZWNvbmZpZw=="
|
||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_REPORT_HIERARCHY "Off"
|
||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_INTERNAL "Off"
|
||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_AUTHOR "QWx0ZXJhIENvcnBvcmF0aW9u"
|
||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_VERSION "MTcuMA=="
|
||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_DESCRIPTION "QWx0ZXJhIFBoYXNlLUxvY2tlZCBMb29wIFJlY29uZmlndXJhdGlvbiBCbG9jayhBTFRFUkFfUExMX1JFQ09ORklHKQ=="
|
||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "ZGV2aWNlX2ZhbWlseQ==::Q3ljbG9uZSBW::ZGV2aWNlX2ZhbWlseQ=="
|
||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "RU5BQkxFX01JRg==::ZmFsc2U=::RW5hYmxlIE1JRiBTdHJlYW1pbmc="
|
||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "RU5BQkxFX0JZVEVFTkFCTEU=::ZmFsc2U=::QWRkIGJ5dGVlbmFibGUgcG9ydA=="
|
||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "QllURUVOQUJMRV9XSURUSA==::NA==::QllURUVOQUJMRV9XSURUSA=="
|
||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "UkVDT05GSUdfQUREUl9XSURUSA==::Ng==::UkVDT05GSUdfQUREUl9XSURUSA=="
|
||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "UkVDT05GSUdfREFUQV9XSURUSA==::MzI=::UkVDT05GSUdfREFUQV9XSURUSA=="
|
||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "cmVjb25mX3dpZHRo::NjQ=::cmVjb25mX3dpZHRo"
|
||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_COMPONENT_PARAMETER "V0FJVF9GT1JfTE9DSw==::dHJ1ZQ==::V0FJVF9GT1JfTE9DSw=="
|
||||
|
||||
set_global_assignment -library "pll_cfg" -name VERILOG_FILE [file join $::quartus(qip_path) "pll_cfg.v"]
|
||||
set_global_assignment -library "pll_cfg" -name VERILOG_FILE [file join $::quartus(qip_path) "pll_cfg/altera_pll_reconfig_top.v"]
|
||||
set_global_assignment -library "pll_cfg" -name VERILOG_FILE [file join $::quartus(qip_path) "pll_cfg/altera_pll_reconfig_core.v"]
|
||||
|
||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_TOOL_NAME "altera_pll_reconfig"
|
||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_TOOL_VERSION "17.0"
|
||||
set_global_assignment -entity "altera_pll_reconfig_top" -library "pll_cfg" -name IP_TOOL_ENV "mwpim"
|
||||
@@ -16,7 +16,7 @@
|
||||
module altera_pll_reconfig_core
|
||||
#(
|
||||
parameter reconf_width = 64,
|
||||
parameter device_family = "Cyclone V",
|
||||
parameter device_family = "Stratix V",
|
||||
// MIF Streaming parameters
|
||||
parameter RECONFIG_ADDR_WIDTH = 6,
|
||||
parameter RECONFIG_DATA_WIDTH = 32,
|
||||
@@ -1883,7 +1883,7 @@ module fpll_dprio_init (
|
||||
endmodule
|
||||
module dyn_phase_shift
|
||||
#(
|
||||
parameter device_family = "Cyclone V"
|
||||
parameter device_family = "Stratix V"
|
||||
) (
|
||||
|
||||
input wire clk,
|
||||
@@ -2112,7 +2112,7 @@ endmodule
|
||||
module generic_lcell_comb
|
||||
#(
|
||||
//parameter
|
||||
parameter family = "Cyclone V",
|
||||
parameter family = "Stratix V",
|
||||
parameter lut_mask = 64'hAAAAAAAAAAAAAAAA,
|
||||
parameter dont_touch = "on"
|
||||
) (
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
module altera_pll_reconfig_top
|
||||
#(
|
||||
parameter reconf_width = 64,
|
||||
parameter device_family = "Cyclone V",
|
||||
parameter device_family = "Stratix V",
|
||||
parameter RECONFIG_ADDR_WIDTH = 6,
|
||||
parameter RECONFIG_DATA_WIDTH = 32,
|
||||
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
// megafunction wizard: %Altera PLL Reconfig v17.0%
|
||||
// GENERATION: XML
|
||||
// pll_cfg.v
|
||||
|
||||
// Generated using ACDS version 17.0 598
|
||||
|
||||
`timescale 1 ps / 1 ps
|
||||
module pll_cfg #(
|
||||
parameter ENABLE_BYTEENABLE = 0,
|
||||
parameter BYTEENABLE_WIDTH = 4,
|
||||
parameter RECONFIG_ADDR_WIDTH = 6,
|
||||
parameter RECONFIG_DATA_WIDTH = 32,
|
||||
parameter reconf_width = 64,
|
||||
parameter WAIT_FOR_LOCK = 1
|
||||
) (
|
||||
input wire mgmt_clk, // mgmt_clk.clk
|
||||
input wire mgmt_reset, // mgmt_reset.reset
|
||||
output wire mgmt_waitrequest, // mgmt_avalon_slave.waitrequest
|
||||
input wire mgmt_read, // .read
|
||||
input wire mgmt_write, // .write
|
||||
output wire [31:0] mgmt_readdata, // .readdata
|
||||
input wire [5:0] mgmt_address, // .address
|
||||
input wire [31:0] mgmt_writedata, // .writedata
|
||||
output wire [63:0] reconfig_to_pll, // reconfig_to_pll.reconfig_to_pll
|
||||
input wire [63:0] reconfig_from_pll // reconfig_from_pll.reconfig_from_pll
|
||||
);
|
||||
|
||||
altera_pll_reconfig_top #(
|
||||
.device_family ("Cyclone V"),
|
||||
.ENABLE_MIF (0),
|
||||
.MIF_FILE_NAME ("sys/pll_cfg.mif"),
|
||||
.ENABLE_BYTEENABLE (ENABLE_BYTEENABLE),
|
||||
.BYTEENABLE_WIDTH (BYTEENABLE_WIDTH),
|
||||
.RECONFIG_ADDR_WIDTH (RECONFIG_ADDR_WIDTH),
|
||||
.RECONFIG_DATA_WIDTH (RECONFIG_DATA_WIDTH),
|
||||
.reconf_width (reconf_width),
|
||||
.WAIT_FOR_LOCK (WAIT_FOR_LOCK)
|
||||
) pll_cfg_inst (
|
||||
.mgmt_clk (mgmt_clk), // mgmt_clk.clk
|
||||
.mgmt_reset (mgmt_reset), // mgmt_reset.reset
|
||||
.mgmt_waitrequest (mgmt_waitrequest), // mgmt_avalon_slave.waitrequest
|
||||
.mgmt_read (mgmt_read), // .read
|
||||
.mgmt_write (mgmt_write), // .write
|
||||
.mgmt_readdata (mgmt_readdata), // .readdata
|
||||
.mgmt_address (mgmt_address), // .address
|
||||
.mgmt_writedata (mgmt_writedata), // .writedata
|
||||
.reconfig_to_pll (reconfig_to_pll), // reconfig_to_pll.reconfig_to_pll
|
||||
.reconfig_from_pll (reconfig_from_pll), // reconfig_from_pll.reconfig_from_pll
|
||||
.mgmt_byteenable (4'b0000) // (terminated)
|
||||
);
|
||||
|
||||
endmodule
|
||||
// Retrieval info: <?xml version="1.0"?>
|
||||
//<!--
|
||||
// Generated by Altera MegaWizard Launcher Utility version 1.0
|
||||
// ************************************************************
|
||||
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
// ************************************************************
|
||||
// Copyright (C) 1991-2018 Altera Corporation
|
||||
// Any megafunction design, and related net list (encrypted or decrypted),
|
||||
// support information, device programming or simulation file, and any other
|
||||
// associated documentation or information provided by Altera or a partner
|
||||
// under Altera's Megafunction Partnership Program may be used only to
|
||||
// program PLD devices (but not masked PLD devices) from Altera. Any other
|
||||
// use of such megafunction design, net list, support information, device
|
||||
// programming or simulation file, or any other related documentation or
|
||||
// information is prohibited for any other purpose, including, but not
|
||||
// limited to modification, reverse engineering, de-compiling, or use with
|
||||
// any other silicon devices, unless such use is explicitly licensed under
|
||||
// a separate agreement with Altera or a megafunction partner. Title to
|
||||
// the intellectual property, including patents, copyrights, trademarks,
|
||||
// trade secrets, or maskworks, embodied in any such megafunction design,
|
||||
// net list, support information, device programming or simulation file, or
|
||||
// any other related documentation or information provided by Altera or a
|
||||
// megafunction partner, remains with Altera, the megafunction partner, or
|
||||
// their respective licensors. No other licenses, including any licenses
|
||||
// needed under any third party's intellectual property, are provided herein.
|
||||
//-->
|
||||
// Retrieval info: <instance entity-name="altera_pll_reconfig" version="17.0" >
|
||||
// Retrieval info: <generic name="device_family" value="Cyclone V" />
|
||||
// Retrieval info: <generic name="ENABLE_MIF" value="false" />
|
||||
// Retrieval info: <generic name="MIF_FILE_NAME" value="sys/pll_cfg.mif" />
|
||||
// Retrieval info: <generic name="ENABLE_BYTEENABLE" value="false" />
|
||||
// Retrieval info: </instance>
|
||||
// IPFS_FILES : pll_cfg.vo
|
||||
// RELATED_FILES: pll_cfg.v, altera_pll_reconfig_top.v, altera_pll_reconfig_core.v, altera_std_synchronizer.v
|
||||
File diff suppressed because it is too large.
Load diff
+4
-1
@@ -1,4 +1,7 @@
|
||||
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll.13.qip ]
|
||||
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll_hdmi.13.qip ]
|
||||
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll_audio.13.qip ]
|
||||
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll_cfg.qip ]
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) pll_cfg.v ]
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) pll_cfg/altera_pll_reconfig_core.v ]
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) pll_cfg/altera_pll_reconfig_top.v ]
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) pll_cfg_hdmi.v ]
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
set_global_assignment -name QIP_FILE rtl/pll.qip
|
||||
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll_hdmi.qip ]
|
||||
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll_audio.qip ]
|
||||
set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll_cfg.qip ]
|
||||
#set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) pll_cfg.qip ]
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) pll_cfg_hdmi.v ]
|
||||
+4
-4
@@ -58,10 +58,10 @@ localparam DW = WIDE ? 15 : 7;
|
||||
localparam SZ = OCTAL ? 8 : 1;
|
||||
localparam SW = SZ-1;
|
||||
|
||||
localparam DATA_TOKEN_CMD25 = 8'hfc;
|
||||
localparam STOP_TRAN = 8'hfd;
|
||||
localparam DATA_TOKEN = 8'hfe;
|
||||
localparam WRITE_DATA_RESPONSE = 8'he5;
|
||||
wire [7:0] DATA_TOKEN_CMD25 = 8'hfc;
|
||||
wire [7:0] STOP_TRAN = 8'hfd;
|
||||
wire [7:0] DATA_TOKEN = 8'hfe;
|
||||
wire [7:0] WRITE_DATA_RESPONSE = 8'h05;
|
||||
|
||||
// number of bytes to wait after a command before sending the reply
|
||||
localparam NCR = 5+3; // 5 bytes are required (command length)
|
||||
|
||||
+9
-2
@@ -16,6 +16,13 @@ set_location_assignment PIN_V10 -to ADC_SCK
|
||||
set_location_assignment PIN_AC4 -to ADC_SDI
|
||||
set_location_assignment PIN_AD4 -to ADC_SDO
|
||||
|
||||
#============================================================
|
||||
# ARDUINO
|
||||
#============================================================
|
||||
set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to ARDUINO_IO[*]
|
||||
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to ARDUINO_IO[*]
|
||||
set_instance_assignment -name CURRENT_STRENGTH_NEW "MAXIMUM CURRENT" -to ARDUINO_IO[*]
|
||||
|
||||
#============================================================
|
||||
# I2C LEDS/BUTTONS
|
||||
#============================================================
|
||||
@@ -65,8 +72,8 @@ set_location_assignment PIN_AD17 -to SDRAM_A[11]
|
||||
set_location_assignment PIN_D12 -to SDRAM_A[12]
|
||||
set_location_assignment PIN_Y17 -to SDRAM_BA[0]
|
||||
set_location_assignment PIN_AB25 -to SDRAM_BA[1]
|
||||
set_location_assignment PIN_V12 -to SDRAM_DQ[0]
|
||||
set_location_assignment PIN_E8 -to SDRAM_DQ[1]
|
||||
set_location_assignment PIN_E8 -to SDRAM_DQ[0]
|
||||
set_location_assignment PIN_V12 -to SDRAM_DQ[1]
|
||||
set_location_assignment PIN_D11 -to SDRAM_DQ[2]
|
||||
set_location_assignment PIN_W12 -to SDRAM_DQ[3]
|
||||
set_location_assignment PIN_AH13 -to SDRAM_DQ[4]
|
||||
|
||||
+1
-5
@@ -25,7 +25,6 @@ set_false_path -from [get_ports {KEY*}]
|
||||
set_false_path -from [get_ports {BTN_*}]
|
||||
set_false_path -to [get_ports {LED_*}]
|
||||
set_false_path -to [get_ports {VGA_*}]
|
||||
set_false_path -from [get_ports {VGA_EN}]
|
||||
set_false_path -to [get_ports {AUDIO_SPDIF}]
|
||||
set_false_path -to [get_ports {AUDIO_L}]
|
||||
set_false_path -to [get_ports {AUDIO_R}]
|
||||
@@ -35,7 +34,6 @@ set_false_path -from {cfg[*]}
|
||||
set_false_path -from {VSET[*]}
|
||||
set_false_path -to {wcalc[*] hcalc[*]}
|
||||
set_false_path -to {hdmi_width[*] hdmi_height[*]}
|
||||
set_false_path -to {deb_* btn_en btn_up}
|
||||
|
||||
set_multicycle_path -to {*_osd|osd_vcnt*} -setup 2
|
||||
set_multicycle_path -to {*_osd|osd_vcnt*} -hold 1
|
||||
@@ -60,7 +58,6 @@ set_false_path -from {vol_att[*] scaler_flt[*] led_overtake[*] led_state[*]}
|
||||
set_false_path -from {aflt_* acx* acy* areset* arc*}
|
||||
set_false_path -from {arx* ary*}
|
||||
set_false_path -from {vs_line*}
|
||||
set_false_path -from {ColorBurst_Range* PhaseInc* pal_en cvbs yc_en}
|
||||
|
||||
set_false_path -from {ascal|o_ihsize*}
|
||||
set_false_path -from {ascal|o_ivsize*}
|
||||
@@ -73,5 +70,4 @@ set_false_path -from {ascal|o_htotal* ascal|o_vtotal*}
|
||||
set_false_path -from {ascal|o_hsstart* ascal|o_vsstart* ascal|o_hsend* ascal|o_vsend*}
|
||||
set_false_path -from {ascal|o_hsize* ascal|o_vsize*}
|
||||
|
||||
set_false_path -from {mcp23009|flg_*}
|
||||
set_false_path -to {sysmem|fpga_interfaces|clocks_resets|f2h*}
|
||||
set_false_path -from {mcp23009|sd_cd}
|
||||
+88
-183
@@ -72,7 +72,7 @@ module sys_top
|
||||
output [5:0] VGA_R,
|
||||
output [5:0] VGA_G,
|
||||
output [5:0] VGA_B,
|
||||
inout VGA_HS,
|
||||
inout VGA_HS, // VGA_HS is secondary SD card detect when VGA_EN = 1 (inactive)
|
||||
output VGA_VS,
|
||||
input VGA_EN, // active low
|
||||
|
||||
@@ -125,23 +125,27 @@ module sys_top
|
||||
);
|
||||
|
||||
////////////////////// Secondary SD ///////////////////////////////////
|
||||
wire SD_CS, SD_CLK, SD_MOSI, SD_MISO, SD_CD;
|
||||
wire SD_CS, SD_CLK, SD_MOSI;
|
||||
|
||||
`ifndef MISTER_DUAL_SDRAM
|
||||
wire sd_cd = SDCD_SPDIF & ~SW[2]; // SW[2]=ON workaround for faulty boards without SD card detect pin.
|
||||
assign SD_CD = mcp_en ? mcp_sdcd : sd_cd;
|
||||
assign SD_MISO = SD_CD | (mcp_en ? SD_SPI_MISO : (VGA_EN | SDIO_DAT[0]));
|
||||
assign SD_SPI_CS = mcp_en ? (mcp_sdcd ? 1'bZ : SD_CS) : (sog & ~cs1 & ~VGA_EN) ? 1'b1 : 1'bZ;
|
||||
assign SD_SPI_CLK = (~mcp_en | mcp_sdcd) ? 1'bZ : SD_CLK;
|
||||
assign SD_SPI_MOSI = (~mcp_en | mcp_sdcd) ? 1'bZ : SD_MOSI;
|
||||
assign {SDIO_CLK,SDIO_CMD,SDIO_DAT} = av_dis ? 6'bZZZZZZ : (mcp_en | sd_cd) ? {vga_g,vga_r,vga_b} : {SD_CLK,SD_MOSI,SD_CS,3'bZZZ};
|
||||
wire sd_miso = SW[3] | SDIO_DAT[0];
|
||||
`else
|
||||
wire sd_miso = 1;
|
||||
`endif
|
||||
wire SD_MISO = mcp_sdcd ? sd_miso : SD_SPI_MISO;
|
||||
|
||||
`ifndef MISTER_DUAL_SDRAM
|
||||
assign SDIO_DAT[2:1]= 2'bZZ;
|
||||
assign SDIO_DAT[3] = SW[3] ? 1'bZ : SD_CS;
|
||||
assign SDIO_CLK = SW[3] ? 1'bZ : SD_CLK;
|
||||
assign SDIO_CMD = SW[3] ? 1'bZ : SD_MOSI;
|
||||
assign SD_SPI_CS = mcp_sdcd ? ((~VGA_EN & sog & ~cs1) ? 1'b1 : 1'bZ) : SD_CS;
|
||||
`else
|
||||
assign SD_CD = mcp_sdcd;
|
||||
assign SD_MISO = mcp_sdcd | SD_SPI_MISO;
|
||||
assign SD_SPI_CS = mcp_sdcd ? 1'bZ : SD_CS;
|
||||
`endif
|
||||
|
||||
assign SD_SPI_CLK = mcp_sdcd ? 1'bZ : SD_CLK;
|
||||
assign SD_SPI_MOSI = mcp_sdcd ? 1'bZ : SD_MOSI;
|
||||
`endif
|
||||
|
||||
////////////////////// LEDs/Buttons ///////////////////////////////////
|
||||
|
||||
@@ -153,59 +157,36 @@ wire led_d = led_disk[1] ? ~led_disk[0] : ~(led_disk[0] | gp_out[29]);
|
||||
wire led_u = ~led_user;
|
||||
wire led_locked;
|
||||
|
||||
//LEDs on de10-nano board
|
||||
`ifndef MISTER_DUAL_SDRAM
|
||||
assign LED_POWER = (SW[3] | led_p) ? 1'bZ : 1'b0;
|
||||
assign LED_HDD = (SW[3] | led_d) ? 1'bZ : 1'b0;
|
||||
assign LED_USER = (SW[3] | led_u) ? 1'bZ : 1'b0;
|
||||
`endif
|
||||
|
||||
//LEDs on main board
|
||||
assign LED = (led_overtake & led_state) | (~led_overtake & {1'b0,led_locked,1'b0, ~led_p, 1'b0, ~led_d, 1'b0, ~led_u});
|
||||
|
||||
wire btn_r, btn_o, btn_u;
|
||||
`ifdef MISTER_DUAL_SDRAM
|
||||
assign {btn_r,btn_o,btn_u} = SW[3] ? {mcp_btn[1],mcp_btn[2],mcp_btn[0]} : ~{SDRAM2_DQ[9],SDRAM2_DQ[13],SDRAM2_DQ[11]};
|
||||
`else
|
||||
assign {btn_r,btn_o,btn_u} = ~{BTN_RESET,BTN_OSD,BTN_USER} | {mcp_btn[1],mcp_btn[2],mcp_btn[0]};
|
||||
`endif
|
||||
|
||||
wire [2:0] mcp_btn;
|
||||
wire mcp_sdcd;
|
||||
wire mcp_en;
|
||||
wire mcp_mode;
|
||||
mcp23009 mcp23009
|
||||
(
|
||||
.clk(FPGA_CLK2_50),
|
||||
|
||||
.btn(mcp_btn),
|
||||
.led({led_p, led_d, led_u}),
|
||||
.flg_sd_cd(mcp_sdcd),
|
||||
.flg_present(mcp_en),
|
||||
.flg_mode(mcp_mode),
|
||||
.sd_cd(mcp_sdcd),
|
||||
|
||||
.scl(IO_SCL),
|
||||
.sda(IO_SDA)
|
||||
);
|
||||
|
||||
wire io_dig = mcp_en ? mcp_mode : SW[3];
|
||||
|
||||
`ifndef MISTER_DUAL_SDRAM
|
||||
wire av_dis = io_dig | VGA_EN;
|
||||
assign LED_POWER = av_dis ? 1'bZ : mcp_en ? de1 : led_p ? 1'bZ : 1'b0;
|
||||
assign LED_HDD = av_dis ? 1'bZ : mcp_en ? (sog & ~cs1) : led_d ? 1'bZ : 1'b0;
|
||||
//assign LED_USER = av_dis ? 1'bZ : mcp_en ? ~vga_tx_clk : led_u ? 1'bZ : 1'b0;
|
||||
assign LED_USER = VGA_TX_CLK;
|
||||
wire BTN_DIS = VGA_EN;
|
||||
`else
|
||||
wire BTN_RESET = 1'b1;
|
||||
wire BTN_OSD = 1'b1;
|
||||
wire BTN_USER = 1'b1;
|
||||
wire BTN_DIS = 1'b1;
|
||||
`endif
|
||||
|
||||
reg BTN_EN = 0;
|
||||
reg [25:0] btn_timeout = 0;
|
||||
initial btn_timeout = 0;
|
||||
always @(posedge FPGA_CLK2_50) begin
|
||||
reg btn_up = 0;
|
||||
reg btn_en = 0;
|
||||
|
||||
btn_up <= BTN_RESET & BTN_OSD & BTN_USER;
|
||||
if(~reset & btn_up & ~&btn_timeout) btn_timeout <= btn_timeout + 1'd1;
|
||||
btn_en <= ~BTN_DIS;
|
||||
BTN_EN <= &btn_timeout & btn_en;
|
||||
end
|
||||
|
||||
wire btn_r = (mcp_en | SW[3]) ? mcp_btn[1] : (BTN_EN & ~BTN_RESET);
|
||||
wire btn_o = (mcp_en | SW[3]) ? mcp_btn[2] : (BTN_EN & ~BTN_OSD );
|
||||
wire btn_u = (mcp_en | SW[3]) ? mcp_btn[0] : (BTN_EN & ~BTN_USER );
|
||||
|
||||
reg btn_user, btn_osd;
|
||||
always @(posedge FPGA_CLK2_50) begin
|
||||
@@ -231,7 +212,7 @@ end
|
||||
|
||||
// gp_in[31] = 0 - quick flag that FPGA is initialized (HPS reads 1 when FPGA is not in user mode)
|
||||
// used to avoid lockups while JTAG loading
|
||||
wire [31:0] gp_in = {1'b0, btn_user | btn[1], btn_osd | btn[0], io_dig, 8'd0, io_ver, io_ack, io_wide, io_dout | io_dout_sys};
|
||||
wire [31:0] gp_in = {1'b0, btn_user | btn[1], btn_osd | btn[0], SW[3], 8'd0, io_ver, io_ack, io_wide, io_dout | io_dout_sys};
|
||||
wire [31:0] gp_out;
|
||||
|
||||
wire [1:0] io_ver = 1; // 0 - obsolete. 1 - optimized HPS I/O. 2,3 - reserved for future.
|
||||
@@ -286,13 +267,13 @@ cyclonev_hps_interface_mpu_general_purpose h2f_gp
|
||||
|
||||
|
||||
reg [15:0] cfg;
|
||||
|
||||
reg cfg_set = 0;
|
||||
wire vga_fb = cfg[12] | vga_force_scaler;
|
||||
|
||||
`ifdef MISTER_DEBUG_NOHDMI
|
||||
wire vga_fb = 0;
|
||||
wire direct_video = 1;
|
||||
`else
|
||||
wire vga_fb = cfg[12] | vga_force_scaler;
|
||||
wire direct_video = cfg[10];
|
||||
`endif
|
||||
|
||||
@@ -300,15 +281,10 @@ wire audio_96k = cfg[6];
|
||||
wire csync_en = cfg[3];
|
||||
wire io_osd_vga = io_ss1 & ~io_ss2;
|
||||
`ifndef MISTER_DUAL_SDRAM
|
||||
wire forced_scandoubler = cfg[4];
|
||||
wire ypbpr_en = cfg[5];
|
||||
wire sog = cfg[9];
|
||||
`ifdef MISTER_DEBUG_NOHDMI
|
||||
wire vga_scaler = 0;
|
||||
`else
|
||||
wire vga_scaler = cfg[2] | vga_force_scaler;
|
||||
`endif
|
||||
`endif
|
||||
|
||||
reg cfg_custom_t = 0;
|
||||
reg [5:0] cfg_custom_p1;
|
||||
@@ -333,7 +309,6 @@ reg [11:0] vs_line = 0;
|
||||
|
||||
reg scaler_out = 0;
|
||||
reg vrr_mode = 0;
|
||||
wire hdmi_blackout;
|
||||
|
||||
reg [31:0] aflt_rate = 7056000;
|
||||
reg [39:0] acx = 4258969;
|
||||
@@ -395,7 +370,6 @@ always@(posedge clk_sys) begin
|
||||
`ifndef MISTER_DEBUG_NOHDMI
|
||||
if(io_din[7:0] == 'h40) io_dout_sys <= fb_crc;
|
||||
`endif
|
||||
if(io_din[7:0] == 'h42) io_dout_sys <= {1'b1, frame_cnt};
|
||||
end
|
||||
else begin
|
||||
cnt <= cnt + 1'd1;
|
||||
@@ -502,22 +476,18 @@ always@(posedge clk_sys) begin
|
||||
endcase
|
||||
end
|
||||
`endif
|
||||
`ifndef MISTER_DISABLE_YC
|
||||
if(cmd == 'h41) begin
|
||||
case(cnt[3:0])
|
||||
`ifndef MISTER_DISABLE_YC
|
||||
0: {pal_en,cvbs,yc_en} <= io_din[2:0];
|
||||
4: ColorBurst_Range[15:0] <= io_din;
|
||||
5: ColorBurst_Range[16] <= io_din[0];
|
||||
`endif
|
||||
// Subcarrier commands (independent of YC module)
|
||||
1: PhaseInc[15:0] <= io_din;
|
||||
2: PhaseInc[31:16] <= io_din;
|
||||
3: PhaseInc[39:32] <= io_din[7:0];
|
||||
`ifndef MISTER_DUAL_SDRAM
|
||||
6: subcarrier <= io_din[0];
|
||||
`endif
|
||||
4: ColorBurst_Range[15:0] <= io_din;
|
||||
5: ColorBurst_Range[16] <= io_din[0];
|
||||
endcase
|
||||
end
|
||||
`endif
|
||||
end
|
||||
end
|
||||
|
||||
@@ -536,15 +506,6 @@ always@(posedge clk_sys) begin
|
||||
if(~vs_d2 & vs_d1) vs_wait <= 0;
|
||||
end
|
||||
|
||||
reg [7:0] frame_cnt;
|
||||
always @(posedge clk_sys) begin
|
||||
reg vs_r, vs_old;
|
||||
|
||||
vs_r <= vs_fix;
|
||||
if(vs_r == vs_fix) vs_old <= vs_r;
|
||||
if(~vs_old & vs_r) frame_cnt <= frame_cnt + 1'd1;
|
||||
end
|
||||
|
||||
cyclonev_hps_interface_peripheral_uart uart
|
||||
(
|
||||
.ri(0),
|
||||
@@ -694,7 +655,6 @@ wire vbuf_write;
|
||||
wire [23:0] hdmi_data;
|
||||
wire hdmi_vs, hdmi_hs, hdmi_de, hdmi_vbl, hdmi_brd;
|
||||
wire freeze;
|
||||
wire bob_deint;
|
||||
|
||||
`ifndef MISTER_DEBUG_NOHDMI
|
||||
wire clk_hdmi = hdmi_clk_out;
|
||||
@@ -729,7 +689,6 @@ wire bob_deint;
|
||||
.reset_na (~reset_req),
|
||||
.run (1),
|
||||
.freeze (freeze),
|
||||
.bob_deint (bob_deint),
|
||||
|
||||
.i_clk (clk_ihdmi),
|
||||
.i_ce (ce_hpix),
|
||||
@@ -771,7 +730,6 @@ wire bob_deint;
|
||||
.vmax (vmax),
|
||||
.vrr (vrr_mode),
|
||||
.vrrmax (HEIGHT + VBP + VS[11:0] + 12'd1),
|
||||
.swblack (hdmi_blackout),
|
||||
|
||||
.mode ({~lowlat,LFB_EN ? LFB_FLT : |scaler_flt,2'b00}),
|
||||
.poly_clk (clk_sys),
|
||||
@@ -1107,8 +1065,11 @@ reg [31:0] adj_data;
|
||||
old_wait <= adj_waitrequest;
|
||||
if(old_wait & ~adj_waitrequest & gotd) cfg_ready <= 1;
|
||||
end
|
||||
|
||||
`else
|
||||
|
||||
wire cfg_ready = 1;
|
||||
|
||||
`endif
|
||||
|
||||
assign HDMI_I2C_SCL = hdmi_scl_en ? 1'b0 : 1'bZ;
|
||||
@@ -1124,6 +1085,7 @@ cyclonev_hps_interface_peripheral_i2c hdmi_i2c
|
||||
);
|
||||
|
||||
`ifndef MISTER_DEBUG_NOHDMI
|
||||
|
||||
`ifdef MISTER_FB
|
||||
reg dis_output;
|
||||
always @(posedge clk_hdmi) begin
|
||||
@@ -1184,10 +1146,10 @@ cyclonev_hps_interface_peripheral_i2c hdmi_i2c
|
||||
.vs_out(hdmi_vs_osd),
|
||||
.de_out(hdmi_de_osd)
|
||||
);
|
||||
`endif
|
||||
|
||||
wire hdmi_cs_osd;
|
||||
csync csync_hdmi(clk_hdmi, hdmi_hs_osd, hdmi_vs_osd, hdmi_cs_osd);
|
||||
`endif
|
||||
|
||||
reg [23:0] dv_data;
|
||||
reg dv_hs, dv_vs, dv_de;
|
||||
@@ -1298,17 +1260,10 @@ always @(posedge hdmi_tx_clk) begin
|
||||
hdmi_dv_vs <= dv_vs;
|
||||
hdmi_dv_de <= dv_de;
|
||||
|
||||
`ifndef MISTER_DEBUG_NOHDMI
|
||||
hs <= (~vga_fb & direct_video) ? hdmi_dv_hs : (direct_video & csync_en) ? hdmi_cs_osd : hdmi_hs_osd;
|
||||
vs <= (~vga_fb & direct_video) ? hdmi_dv_vs : hdmi_vs_osd;
|
||||
de <= (~vga_fb & direct_video) ? hdmi_dv_de : hdmi_de_osd;
|
||||
d <= (~vga_fb & direct_video) ? hdmi_dv_data : hdmi_data_osd;
|
||||
`else
|
||||
hs <= hdmi_dv_hs;
|
||||
vs <= hdmi_dv_vs;
|
||||
de <= hdmi_dv_de;
|
||||
d <= hdmi_dv_data;
|
||||
`endif
|
||||
|
||||
hdmi_out_hs <= hs;
|
||||
hdmi_out_vs <= vs;
|
||||
@@ -1323,46 +1278,6 @@ assign HDMI_TX_D = hdmi_out_d;
|
||||
|
||||
///////////////////////// VGA output //////////////////////////////////
|
||||
|
||||
`ifndef MISTER_DUAL_SDRAM
|
||||
wire vga_tx_clk;
|
||||
`ifndef MISTER_DEBUG_NOHDMI
|
||||
cyclonev_clkselect vga_clk_sw
|
||||
(
|
||||
.clkselect({1'b1, ~vga_fb & ~vga_scaler}),
|
||||
.inclk({clk_vid, hdmi_clk_out, 2'b00}),
|
||||
.outclk(vga_tx_clk)
|
||||
);
|
||||
`else
|
||||
assign vga_tx_clk = clk_vid;
|
||||
`endif
|
||||
|
||||
wire VGA_TX_CLK;
|
||||
altddio_out
|
||||
#(
|
||||
.extend_oe_disable("OFF"),
|
||||
.intended_device_family("Cyclone V"),
|
||||
.invert_output("OFF"),
|
||||
.lpm_hint("UNUSED"),
|
||||
.lpm_type("altddio_out"),
|
||||
.oe_reg("UNREGISTERED"),
|
||||
.power_up_high("OFF"),
|
||||
.width(1)
|
||||
)
|
||||
vgaclk_ddr
|
||||
(
|
||||
.datain_h(1'b0),
|
||||
.datain_l(1'b1),
|
||||
.outclock(vga_tx_clk),
|
||||
.dataout(VGA_TX_CLK),
|
||||
.aclr(~mcp_en & ~av_dis),
|
||||
.aset(1'b0),
|
||||
.oe(~av_dis & (mcp_en | ~led_u)),
|
||||
.outclocken(1'b1),
|
||||
.sclr(1'b0),
|
||||
.sset(1'b0)
|
||||
);
|
||||
`endif
|
||||
|
||||
wire [23:0] vga_data_sl;
|
||||
wire vga_de_sl, vga_ce_sl, vga_vs_sl, vga_hs_sl;
|
||||
scanlines #(0) VGA_scanlines
|
||||
@@ -1384,7 +1299,7 @@ scanlines #(0) VGA_scanlines
|
||||
);
|
||||
|
||||
wire [23:0] vga_data_osd;
|
||||
wire vga_vs_osd, vga_hs_osd, vga_de_osd;
|
||||
wire vga_vs_osd, vga_hs_osd;
|
||||
osd vga_osd
|
||||
(
|
||||
.clk_sys(clk_sys),
|
||||
@@ -1402,8 +1317,7 @@ osd vga_osd
|
||||
|
||||
.dout(vga_data_osd),
|
||||
.hs_out(vga_hs_osd),
|
||||
.vs_out(vga_vs_osd),
|
||||
.de_out(vga_de_osd)
|
||||
.vs_out(vga_vs_osd)
|
||||
);
|
||||
|
||||
wire vga_cs_osd;
|
||||
@@ -1414,8 +1328,9 @@ csync csync_vga(clk_vid, vga_hs_osd, vga_vs_osd, vga_cs_osd);
|
||||
reg yc_en;
|
||||
reg cvbs;
|
||||
reg [16:0] ColorBurst_Range;
|
||||
reg [39:0] PhaseInc;
|
||||
wire [23:0] yc_o;
|
||||
wire yc_hs, yc_vs, yc_cs, yc_de;
|
||||
wire yc_hs, yc_vs, yc_cs;
|
||||
|
||||
yc_out yc_out
|
||||
(
|
||||
@@ -1427,34 +1342,18 @@ csync csync_vga(clk_vid, vga_hs_osd, vga_vs_osd, vga_cs_osd);
|
||||
.hsync(vga_hs_osd),
|
||||
.vsync(vga_vs_osd),
|
||||
.csync(vga_cs_osd),
|
||||
.de(vga_de_osd),
|
||||
.dout(yc_o),
|
||||
.din(vga_data_osd),
|
||||
.hsync_o(yc_hs),
|
||||
.vsync_o(yc_vs),
|
||||
.csync_o(yc_cs),
|
||||
.de_o(yc_de)
|
||||
.csync_o(yc_cs)
|
||||
);
|
||||
`endif
|
||||
|
||||
reg [39:0] PhaseInc;
|
||||
|
||||
`ifndef MISTER_DUAL_SDRAM
|
||||
// Subcarrier generation for external encoders (independent of YC module)
|
||||
reg subcarrier;
|
||||
|
||||
reg [39:0] sub_accum;
|
||||
always @(posedge clk_vid) sub_accum <= sub_accum + PhaseInc;
|
||||
|
||||
// 1-bit output for positive/negative of wave, no LUT required. Output 1 if disabled for further logic
|
||||
reg subcarrier_out;
|
||||
always @(posedge clk_vid) subcarrier_out <= ~(subcarrier & csync_en & ~ypbpr_en & ~forced_scandoubler & ~vgas_en) | sub_accum[39];
|
||||
|
||||
|
||||
wire VGA_DISABLE;
|
||||
wire [23:0] vgas_o;
|
||||
wire vgas_hs, vgas_vs, vgas_cs, vgas_de;
|
||||
`ifndef MISTER_DEBUG_NOHDMI
|
||||
wire vgas_hs, vgas_vs, vgas_cs;
|
||||
vga_out vga_scaler_out
|
||||
(
|
||||
.clk(clk_hdmi),
|
||||
@@ -1462,20 +1361,15 @@ reg [39:0] PhaseInc;
|
||||
.hsync(hdmi_hs_osd),
|
||||
.vsync(hdmi_vs_osd),
|
||||
.csync(hdmi_cs_osd),
|
||||
.de(hdmi_de_osd),
|
||||
.dout(vgas_o),
|
||||
.din({24{hdmi_de_osd}} & hdmi_data_osd),
|
||||
.hsync_o(vgas_hs),
|
||||
.vsync_o(vgas_vs),
|
||||
.csync_o(vgas_cs),
|
||||
.de_o(vgas_de)
|
||||
.csync_o(vgas_cs)
|
||||
);
|
||||
`else
|
||||
assign {vgas_o, vgas_hs, vgas_vs, vgas_cs, vgas_de} = 0;
|
||||
`endif
|
||||
|
||||
wire [23:0] vga_o, vga_o_t;
|
||||
wire vga_hs, vga_vs, vga_cs, vga_de, vga_hs_t, vga_vs_t, vga_cs_t, vga_de_t;
|
||||
wire vga_hs, vga_vs, vga_cs, vga_hs_t, vga_vs_t, vga_cs_t;
|
||||
vga_out vga_out
|
||||
(
|
||||
.clk(clk_vid),
|
||||
@@ -1483,35 +1377,26 @@ reg [39:0] PhaseInc;
|
||||
.hsync(vga_hs_osd),
|
||||
.vsync(vga_vs_osd),
|
||||
.csync(vga_cs_osd),
|
||||
.de(vga_de_osd),
|
||||
.dout(vga_o_t),
|
||||
.din(vga_data_osd),
|
||||
.hsync_o(vga_hs_t),
|
||||
.vsync_o(vga_vs_t),
|
||||
.csync_o(vga_cs_t),
|
||||
.de_o(vga_de_t)
|
||||
.csync_o(vga_cs_t)
|
||||
);
|
||||
|
||||
`ifndef MISTER_DISABLE_YC
|
||||
assign {vga_o, vga_hs, vga_vs, vga_cs, vga_de } = ~yc_en ? {vga_o_t, vga_hs_t, vga_vs_t, vga_cs_t, vga_de_t } : {yc_o, yc_hs, yc_vs, yc_cs, yc_de };
|
||||
assign {vga_o, vga_hs, vga_vs, vga_cs } = ~yc_en ? {vga_o_t, vga_hs_t, vga_vs_t, vga_cs_t } : {yc_o, yc_hs, yc_vs, yc_cs };
|
||||
`else
|
||||
assign {vga_o, vga_hs, vga_vs, vga_cs, vga_de } = {vga_o_t, vga_hs_t, vga_vs_t, vga_cs_t, vga_de_t } ;
|
||||
assign {vga_o, vga_hs, vga_vs, vga_cs } = {vga_o_t, vga_hs_t, vga_vs_t, vga_cs_t } ;
|
||||
`endif
|
||||
|
||||
wire vgas_en = vga_fb | vga_scaler;
|
||||
wire cs1 = (vga_fb | vga_scaler) ? vgas_cs : vga_cs;
|
||||
|
||||
wire cs1 = vgas_en ? vgas_cs : vga_cs;
|
||||
wire de1 = vgas_en ? vgas_de : vga_de;
|
||||
|
||||
assign VGA_VS = av_dis ? 1'bZ :(((vgas_en ? (~vgas_vs ^ VS[12]) : VGA_DISABLE ? 1'd1 : ~vga_vs) | csync_en) & subcarrier_out);
|
||||
assign VGA_HS = av_dis ? 1'bZ : (vgas_en ? ((csync_en ? ~vgas_cs : ~vgas_hs) ^ HS[12]) : VGA_DISABLE ? 1'd1 : (csync_en ? ~vga_cs : ~vga_hs));
|
||||
assign VGA_R = av_dis ? 6'bZZZZZZ : vgas_en ? vgas_o[23:18] : VGA_DISABLE ? 6'd0 : vga_o[23:18];
|
||||
assign VGA_G = av_dis ? 6'bZZZZZZ : vgas_en ? vgas_o[15:10] : VGA_DISABLE ? 6'd0 : vga_o[15:10];
|
||||
assign VGA_B = av_dis ? 6'bZZZZZZ : vgas_en ? vgas_o[7:2] : VGA_DISABLE ? 6'd0 : vga_o[7:2] ;
|
||||
|
||||
wire [1:0] vga_r = vgas_en ? vgas_o[17:16] : VGA_DISABLE ? 2'd0 : vga_o[17:16];
|
||||
wire [1:0] vga_g = vgas_en ? vgas_o[9:8] : VGA_DISABLE ? 2'd0 : vga_o[9:8];
|
||||
wire [1:0] vga_b = vgas_en ? vgas_o[1:0] : VGA_DISABLE ? 2'd0 : vga_o[1:0];
|
||||
assign VGA_VS = (VGA_EN | SW[3]) ? 1'bZ : (((vga_fb | vga_scaler) ? (~vgas_vs ^ VS[12]) : VGA_DISABLE ? 1'd1 : ~vga_vs) | csync_en);
|
||||
assign VGA_HS = (VGA_EN | SW[3]) ? 1'bZ : ((vga_fb | vga_scaler) ? ((csync_en ? ~vgas_cs : ~vgas_hs) ^ HS[12]) : VGA_DISABLE ? 1'd1 : (csync_en ? ~vga_cs : ~vga_hs));
|
||||
assign VGA_R = (VGA_EN | SW[3]) ? 6'bZZZZZZ : (vga_fb | vga_scaler) ? vgas_o[23:18] : VGA_DISABLE ? 6'd0 : vga_o[23:18];
|
||||
assign VGA_G = (VGA_EN | SW[3]) ? 6'bZZZZZZ : (vga_fb | vga_scaler) ? vgas_o[15:10] : VGA_DISABLE ? 6'd0 : vga_o[15:10];
|
||||
assign VGA_B = (VGA_EN | SW[3]) ? 6'bZZZZZZ : (vga_fb | vga_scaler) ? vgas_o[7:2] : VGA_DISABLE ? 6'd0 : vga_o[7:2] ;
|
||||
`endif
|
||||
|
||||
reg video_sync = 0;
|
||||
@@ -1541,14 +1426,14 @@ end
|
||||
|
||||
///////////////////////// Audio output ////////////////////////////////
|
||||
|
||||
assign SDCD_SPDIF = (mcp_en & ~spdif) ? 1'b0 : 1'bZ;
|
||||
assign SDCD_SPDIF =(SW[3] & ~spdif) ? 1'b0 : 1'bZ;
|
||||
|
||||
`ifndef MISTER_DUAL_SDRAM
|
||||
wire analog_l, analog_r;
|
||||
|
||||
assign AUDIO_SPDIF = av_dis ? 1'bZ : (SW[0] | mcp_en) ? HDMI_LRCLK : spdif;
|
||||
assign AUDIO_R = av_dis ? 1'bZ : (SW[0] | mcp_en) ? HDMI_I2S : analog_r;
|
||||
assign AUDIO_L = av_dis ? 1'bZ : (SW[0] | mcp_en) ? HDMI_SCLK : analog_l;
|
||||
assign AUDIO_SPDIF = SW[3] ? 1'bZ : SW[0] ? HDMI_LRCLK : spdif;
|
||||
assign AUDIO_R = SW[3] ? 1'bZ : SW[0] ? HDMI_I2S : analog_r;
|
||||
assign AUDIO_L = SW[3] ? 1'bZ : SW[0] ? HDMI_SCLK : analog_l;
|
||||
`endif
|
||||
|
||||
assign HDMI_MCLK = clk_audio;
|
||||
@@ -1766,8 +1651,6 @@ emu emu
|
||||
.HDMI_WIDTH(direct_video ? 12'd0 : hdmi_width),
|
||||
.HDMI_HEIGHT(direct_video ? 12'd0 : hdmi_height),
|
||||
.HDMI_FREEZE(freeze),
|
||||
.HDMI_BLACKOUT(hdmi_blackout),
|
||||
.HDMI_BOB_DEINT(bob_deint),
|
||||
|
||||
.CLK_VIDEO(clk_vid),
|
||||
.CE_PIXEL(ce_pix),
|
||||
@@ -1840,7 +1723,7 @@ emu emu
|
||||
.SDRAM2_nRAS(SDRAM2_nRAS),
|
||||
.SDRAM2_nCAS(SDRAM2_nCAS),
|
||||
.SDRAM2_CLK(SDRAM2_CLK),
|
||||
.SDRAM2_EN(io_dig),
|
||||
.SDRAM2_EN(SW[3]),
|
||||
`endif
|
||||
|
||||
.BUTTONS(btn),
|
||||
@@ -1850,7 +1733,11 @@ emu emu
|
||||
.SD_MOSI(SD_MOSI),
|
||||
.SD_MISO(SD_MISO),
|
||||
.SD_CS(SD_CS),
|
||||
.SD_CD(SD_CD),
|
||||
`ifdef MISTER_DUAL_SDRAM
|
||||
.SD_CD(mcp_sdcd),
|
||||
`else
|
||||
.SD_CD(mcp_sdcd & (SW[0] ? VGA_HS : (SW[3] | SDCD_SPDIF))),
|
||||
`endif
|
||||
|
||||
.UART_CTS(uart_rts),
|
||||
.UART_RTS(uart_cts),
|
||||
@@ -1892,6 +1779,24 @@ always @(posedge clk) begin
|
||||
end
|
||||
end
|
||||
|
||||
/*
|
||||
always @(posedge clk) begin
|
||||
integer pos = 0, neg = 0, cnt = 0;
|
||||
reg s1,s2;
|
||||
|
||||
s1 <= sync_in;
|
||||
s2 <= s1;
|
||||
|
||||
if(~s2 & s1) neg <= cnt;
|
||||
if(s2 & ~s1) pos <= cnt;
|
||||
|
||||
cnt <= cnt + 1;
|
||||
if(s2 != s1) cnt <= 0;
|
||||
|
||||
pol <= pos > neg;
|
||||
end
|
||||
*/
|
||||
|
||||
endmodule
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
+3
-6
@@ -7,15 +7,13 @@ module vga_out
|
||||
input hsync,
|
||||
input vsync,
|
||||
input csync,
|
||||
input de,
|
||||
|
||||
input [23:0] din,
|
||||
output [23:0] dout,
|
||||
|
||||
output reg hsync_o,
|
||||
output reg vsync_o,
|
||||
output reg csync_o,
|
||||
output reg de_o
|
||||
output reg csync_o
|
||||
);
|
||||
|
||||
wire [7:0] red = din[23:16];
|
||||
@@ -37,8 +35,8 @@ always @(posedge clk) begin
|
||||
reg [18:0] y_1b, pb_1b, pr_1b;
|
||||
reg [18:0] y_2, pb_2, pr_2;
|
||||
reg [23:0] din1, din2;
|
||||
reg hsync2, vsync2, csync2, de2;
|
||||
reg hsync1, vsync1, csync1, de1;
|
||||
reg hsync2, vsync2, csync2;
|
||||
reg hsync1, vsync1, csync1;
|
||||
|
||||
y_1r <= {red, 6'd0} + {red, 3'd0} + {red, 2'd0} + red;
|
||||
pb_1r <= 19'd32768 - ({red, 5'd0} + {red, 3'd0} + {red, 1'd0});
|
||||
@@ -63,7 +61,6 @@ always @(posedge clk) begin
|
||||
hsync_o <= hsync2; hsync2 <= hsync1; hsync1 <= hsync;
|
||||
vsync_o <= vsync2; vsync2 <= vsync1; vsync1 <= vsync;
|
||||
csync_o <= csync2; csync2 <= csync1; csync1 <= csync;
|
||||
de_o <= de2; de2 <= de1; de1 <= de;
|
||||
|
||||
rgb <= din2; din2 <= din1; din1 <= din;
|
||||
end
|
||||
|
||||
+1
-10
@@ -26,10 +26,6 @@ module video_cleaner
|
||||
//optional de
|
||||
input DE_in,
|
||||
|
||||
//optional interlace support
|
||||
input interlace,
|
||||
input f1,
|
||||
|
||||
// video output signals
|
||||
output reg [7:0] VGA_R,
|
||||
output reg [7:0] VGA_G,
|
||||
@@ -60,21 +56,16 @@ always @(posedge clk_vid) begin
|
||||
HBlank_out <= hbl;
|
||||
|
||||
VGA_HS <= hs;
|
||||
if(~VGA_HS & hs) VGA_VS <= vs;
|
||||
|
||||
VGA_R <= R;
|
||||
VGA_G <= G;
|
||||
VGA_B <= B;
|
||||
DE_out <= DE_in;
|
||||
|
||||
if (interlace & f1) begin
|
||||
VGA_VS <= vs;
|
||||
VBlank_out <= vbl;
|
||||
end else begin
|
||||
if(~VGA_HS & hs) VGA_VS <= vs;
|
||||
if(HBlank_out & ~hbl) VBlank_out <= vbl;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
||||
|
||||
+10
-21
@@ -170,8 +170,10 @@ reg [11:0] mul_arg1, mul_arg2;
|
||||
wire [23:0] mul_res;
|
||||
sys_umul #(12,12) mul(CLK_VIDEO,mul_start,mul_run, mul_arg1,mul_arg2,mul_res);
|
||||
|
||||
wire [11:0] wideres = mul_res[11:0] + hsize;
|
||||
|
||||
always @(posedge CLK_VIDEO) begin
|
||||
reg [11:0] oheight,htarget,wres,hinteger,wideres;
|
||||
reg [11:0] oheight,htarget,wres;
|
||||
reg [12:0] arxf,aryf;
|
||||
reg [3:0] cnt;
|
||||
reg narrow;
|
||||
@@ -262,8 +264,7 @@ always @(posedge CLK_VIDEO) begin
|
||||
// [3] 1080 / 512 * 512 * 4 / 3 / 512 * 512 -> 1024
|
||||
|
||||
7: if(mul_res <= HDMI_WIDTH) begin
|
||||
hinteger = mul_res[11:0];
|
||||
cnt <= 12;
|
||||
cnt <= 10;
|
||||
end
|
||||
|
||||
8: begin
|
||||
@@ -285,20 +286,8 @@ always @(posedge CLK_VIDEO) begin
|
||||
// [3] 1920 / 512 * 512 -> 1536
|
||||
|
||||
10: begin
|
||||
hinteger <= mul_res[11:0];
|
||||
mul_arg1 <= vsize;
|
||||
mul_arg2 <= div_res[11:0] ? div_res[11:0] : 12'd1;
|
||||
mul_start <= 1;
|
||||
end
|
||||
|
||||
11: begin
|
||||
oheight <= mul_res[11:0];
|
||||
end
|
||||
|
||||
12: begin
|
||||
wideres <= hinteger + hsize;
|
||||
narrow <= ((htarget - hinteger) <= (wideres - htarget)) || (wideres > HDMI_WIDTH);
|
||||
wres <= hinteger == htarget ? hinteger : wideres;
|
||||
narrow <= ((htarget - mul_res[11:0]) <= (wideres - htarget)) || (wideres > HDMI_WIDTH);
|
||||
wres <= mul_res[11:0] == htarget ? mul_res[11:0] : wideres;
|
||||
end
|
||||
// [1] 1066 - 720 = 346 <= 1440 - 1066 = 374 || 1440 > 1920 -> true
|
||||
// [2] 1280 - 1280 = 0 <= 1920 - 1280 = 640 || 1920 > 1920 -> true
|
||||
@@ -310,11 +299,11 @@ always @(posedge CLK_VIDEO) begin
|
||||
// to target width, meaning it is not optimal for source aspect ratio.
|
||||
// otherwise it is set to narrow width that is optimal.
|
||||
|
||||
13: begin
|
||||
11: begin
|
||||
case(SCALE)
|
||||
2: arxf <= {1'b1, hinteger};
|
||||
3: arxf <= {1'b1, (wres > HDMI_WIDTH) ? hinteger : wres};
|
||||
4: arxf <= {1'b1, narrow ? hinteger : wres};
|
||||
2: arxf <= {1'b1, mul_res[11:0]};
|
||||
3: arxf <= {1'b1, (wres > HDMI_WIDTH) ? mul_res[11:0] : wres};
|
||||
4: arxf <= {1'b1, narrow ? mul_res[11:0] : wres};
|
||||
default: arxf <= {1'b1, div_num[11:0]};
|
||||
endcase
|
||||
aryf <= {1'b1, oheight};
|
||||
|
||||
+6
-9
@@ -36,15 +36,13 @@ module yc_out
|
||||
input hsync,
|
||||
input vsync,
|
||||
input csync,
|
||||
input de,
|
||||
|
||||
input [23:0] din,
|
||||
output [23:0] dout,
|
||||
|
||||
output reg hsync_o,
|
||||
output reg vsync_o,
|
||||
output reg csync_o,
|
||||
output reg de_o
|
||||
output reg csync_o
|
||||
);
|
||||
|
||||
wire [7:0] red = din[23:16];
|
||||
@@ -63,7 +61,6 @@ typedef struct {
|
||||
logic hsync;
|
||||
logic vsync;
|
||||
logic csync;
|
||||
logic de;
|
||||
} phase_t;
|
||||
|
||||
localparam MAX_PHASES = 7'd8;
|
||||
@@ -214,11 +211,11 @@ always_ff @(posedge clk) begin
|
||||
end
|
||||
|
||||
// Adjust sync timing correctly
|
||||
phase[1].hsync <= hsync; phase[1].vsync <= vsync; phase[1].csync <= csync; phase[1].de <= de;
|
||||
phase[2].hsync <= phase[1].hsync; phase[2].vsync <= phase[1].vsync; phase[2].csync <= phase[1].csync; phase[2].de <= phase[1].de;
|
||||
phase[3].hsync <= phase[2].hsync; phase[3].vsync <= phase[2].vsync; phase[3].csync <= phase[2].csync; phase[3].de <= phase[2].de;
|
||||
phase[4].hsync <= phase[3].hsync; phase[4].vsync <= phase[3].vsync; phase[4].csync <= phase[3].csync; phase[4].de <= phase[3].de;
|
||||
hsync_o <= phase[4].hsync; vsync_o <= phase[4].vsync; csync_o <= phase[4].csync; de_o <= phase[4].de;
|
||||
phase[1].hsync <= hsync; phase[1].vsync <= vsync; phase[1].csync <= csync;
|
||||
phase[2].hsync <= phase[1].hsync; phase[2].vsync <= phase[1].vsync; phase[2].csync <= phase[1].csync;
|
||||
phase[3].hsync <= phase[2].hsync; phase[3].vsync <= phase[2].vsync; phase[3].csync <= phase[2].csync;
|
||||
phase[4].hsync <= phase[3].hsync; phase[4].vsync <= phase[3].vsync; phase[4].csync <= phase[3].csync;
|
||||
hsync_o <= phase[4].hsync; vsync_o <= phase[4].vsync; csync_o <= phase[4].csync;
|
||||
|
||||
phase[1].y <= phase[0].y; phase[2].y <= phase[1].y; phase[3].y <= phase[2].y; phase[4].y <= phase[3].y; phase[5].y <= phase[4].y;
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
*.vcd
|
||||
/dw_boot*
|
||||
/fujinet_boot*/
|
||||
fujinet_boot/
|
||||
imgui.ini
|
||||
obj_dir/
|
||||
roms/**/*.rom
|
||||
screenshot_*.png
|
||||
test-out*/
|
||||
test-out/
|
||||
tests/hello.dsk
|
||||
trace*.txt
|
||||
@@ -1,157 +0,0 @@
|
||||
#============================================================================
|
||||
# CoCo3 Verilator simulation
|
||||
#
|
||||
# Same layout as the FM-7 and Apple-IIgs sims: sim.v stands in for CoCo3.sv,
|
||||
# sim/ is the shared ImGui/SDL framework, and one binary runs either windowed
|
||||
# or with --headless.
|
||||
#
|
||||
# make build ./obj_dir/Vemu
|
||||
# make run build and launch the windowed sim
|
||||
# make headless build and boot to BASIC headless, screenshot at the end
|
||||
# make test build and run the headless smoke test (run_tests.sh)
|
||||
# make lint elaborate the design only
|
||||
# make mem regenerate rtl/*.mem from the VHDL/MIF sources
|
||||
# make clean
|
||||
#
|
||||
# No ghdl step. The build uses the Verilog cycle-accurate 6809 (mc6809glb.v,
|
||||
# selected by CoCo3_CYC_ACC_6809 in rtl/config.sv), and the VHDL entities it
|
||||
# does instantiate -- ROMs, RAMs, the font -- are converted by hand in rtl/:
|
||||
#
|
||||
# rtl/rom/coco_rom_32K.vhd, coco_rom_8K.vhd, coco_rom_cart.vhd,
|
||||
# coco_rom_16.vhd, coco3_char_rom.vhd -> rtl/coco_rom.v
|
||||
# rtl/sram/coco_ram.vhd, coco_vid_ram_buf.vhd -> rtl/coco_sram.v
|
||||
#
|
||||
# Quartus-only pieces are replaced as well: rtl/VDAC.v (altsyncram) by
|
||||
# rtl/VDAC.v here, rtl/sdram/sdram2.sv by rtl/sdram2.sv here (same controller,
|
||||
# chip model instead of pins), and the PLL by clocks driven from sim_main.
|
||||
#============================================================================
|
||||
|
||||
V = verilator
|
||||
RTL = ../rtl
|
||||
TOP = --top-module emu
|
||||
|
||||
# Verilator 5 demands --no-timing for the cosmetic `#` delays; 4.x rejects the
|
||||
# flag. Same probe as the FM-7 Makefile.
|
||||
VERILATOR_MAJOR := $(shell verilator --version 2>/dev/null | sed -n 's/^Verilator \([0-9][0-9]*\).*/\1/p')
|
||||
NO_TIMING := $(if $(filter 4,$(VERILATOR_MAJOR)),,--no-timing)
|
||||
|
||||
# -Wno-PROCASSWIRE: coco3fpga.sv and fdc.sv declare a number of registers as
|
||||
# `wire` and assign them in always blocks (Build_Info, VMA, PIX_CLK_D, the $FF40
|
||||
# latch, ...). Quartus accepts that and so does Verilator once the check is
|
||||
# waived; the RTL is left as it is.
|
||||
V_DEFINE = +define+SIMULATION=1 -Wno-PROCASSWIRE \
|
||||
--timescale-override 1ps/1ps -Wno-TIMESCALEMOD -Wno-fatal \
|
||||
$(NO_TIMING) --converge-limit 6000 \
|
||||
-I$(RTL)
|
||||
|
||||
# VCD tracing: `make clean && make TRACE=1`, then run with --vcd <file> and a
|
||||
# --trace-from/--trace-until window (a 114 MHz design dumps ~1 GB a frame).
|
||||
ifeq ($(TRACE),1)
|
||||
V_DEFINE += --trace
|
||||
CXX_DEFINE += -DVM_TRACE_VCD=1
|
||||
else
|
||||
CXX_DEFINE += -DVM_TRACE_VCD=0
|
||||
endif
|
||||
|
||||
UNAME_S := $(shell uname -s)
|
||||
|
||||
ifeq ($(UNAME_S), Darwin)
|
||||
LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs`
|
||||
LIBS += -L/usr/local/lib -L/opt/local/lib -L/opt/homebrew/lib
|
||||
CXXFLAGS += `sdl2-config --cflags`
|
||||
CXXFLAGS += `sdl2-config --cflags | sed 's|include/SDL2|include/|'`
|
||||
CXXFLAGS += -I/usr/local/include -I/opt/local/include -I/opt/homebrew/include
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME_S), Linux)
|
||||
LIBS += -lGL -ldl `sdl2-config --libs`
|
||||
CXXFLAGS += `sdl2-config --cflags`
|
||||
endif
|
||||
|
||||
ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
|
||||
LIBS += -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2`
|
||||
CXXFLAGS += `pkg-config --cflags sdl2`
|
||||
endif
|
||||
|
||||
CC_OPT = -O2
|
||||
V_OPT = -O3 --x-assign fast --x-initial fast --noassert
|
||||
CXXFLAGS += $(CC_OPT) $(CXX_DEFINE) -I../sim/imgui -I../sim -I.. -g
|
||||
LDFLAGS = $(LIBS)
|
||||
EXE = ./obj_dir/Vemu
|
||||
|
||||
V_SRC = \
|
||||
sim.vlt \
|
||||
sim.v \
|
||||
rtl/sdram2.sv \
|
||||
rtl/coco_rom.v \
|
||||
rtl/coco_sram.v \
|
||||
rtl/VDAC.v \
|
||||
rtl/ovo.v \
|
||||
../sys/hps_io.sv \
|
||||
$(RTL)/coco3fpga.sv \
|
||||
$(RTL)/EE_Cold_Bt.v \
|
||||
$(RTL)/cassette.v \
|
||||
$(RTL)/square_gen.v \
|
||||
$(RTL)/AMW.v \
|
||||
$(RTL)/rtc.sv \
|
||||
$(RTL)/fdc.sv \
|
||||
$(RTL)/wd1793.sv \
|
||||
$(RTL)/sdc.sv \
|
||||
$(RTL)/sdc_top.sv \
|
||||
$(RTL)/Auto_Run.sv \
|
||||
$(RTL)/ps2_mouse.v \
|
||||
$(RTL)/coco_mem_fetch.sv \
|
||||
$(RTL)/Cassette_Write.sv \
|
||||
$(RTL)/cocokey.v \
|
||||
$(RTL)/PS2_Key/ps2_keyboard.v \
|
||||
$(RTL)/UART_6551/uart_6551.v \
|
||||
$(RTL)/UART_6551/6551tx.v \
|
||||
$(RTL)/UART_6551/6551rx.v \
|
||||
$(RTL)/mc6809glb/mc6809glb.v \
|
||||
$(RTL)/Mister_Video.v
|
||||
|
||||
C_SRC = \
|
||||
sim_main.cpp dis6809.cpp serial.cpp \
|
||||
sim/sim_bus.cpp sim/sim_clock.cpp sim/sim_console.cpp sim/sim_video.cpp \
|
||||
sim/sim_blkdevice.cpp sim/sim_input.cpp sim/sim_audio.cpp \
|
||||
sim/imgui/imgui_impl_sdl.cpp sim/imgui/imgui_impl_opengl2.cpp \
|
||||
sim/imgui/imgui_draw.cpp sim/imgui/imgui_widgets.cpp sim/imgui/imgui_tables.cpp \
|
||||
sim/imgui/imgui.cpp sim/imgui/ImGuiFileDialog.cpp \
|
||||
sim/imgui/implot.cpp sim/imgui/implot_items.cpp
|
||||
|
||||
VOUT = obj_dir/Vemu.cpp
|
||||
|
||||
all: $(EXE)
|
||||
|
||||
$(VOUT): $(V_SRC) Makefile
|
||||
$V -cc $(V_OPT) -LDFLAGS "$(LDFLAGS)" -exe --Mdir ./obj_dir \
|
||||
$(V_DEFINE) $(TOP) -CFLAGS "$(CXXFLAGS)" $(V_SRC) $(C_SRC)
|
||||
|
||||
$(EXE): $(VOUT) $(C_SRC) sim/*.h dis6809.h serial.h
|
||||
(cd obj_dir; $(MAKE) -f Vemu.mk OBJCACHE= OPT_FAST="-O2" OPT_SLOW="-O0" OPT_GLOBAL="-O2")
|
||||
|
||||
lint:
|
||||
$V --lint-only $(V_DEFINE) -Wno-WIDTH $(TOP) $(V_SRC)
|
||||
|
||||
mem:
|
||||
python3 gen_mem.py
|
||||
|
||||
run: all
|
||||
$(EXE)
|
||||
|
||||
headless: all
|
||||
$(EXE) --headless --stop-at-frame 150 --screenshot 150
|
||||
|
||||
test: all
|
||||
./run_tests.sh
|
||||
|
||||
clean:
|
||||
rm -rf obj_dir
|
||||
|
||||
.PHONY: all lint mem run headless test clean
|
||||
|
||||
# Disassembler self-check. Standalone -- no Verilator, no core.
|
||||
distest: dis6809_test.cpp dis6809.cpp dis6809.h
|
||||
mkdir -p obj_dir && c++ -O1 -o obj_dir/distest dis6809_test.cpp dis6809.cpp -I. && ./obj_dir/distest
|
||||
|
||||
.PHONY: distest
|
||||
@@ -1,288 +0,0 @@
|
||||
# CoCo3 Verilator simulation
|
||||
|
||||
Runs the core on the host, windowed (ImGui + SDL2) or headless, so you can boot
|
||||
it, type at it, mount disks, screenshot it and trace the 6809, without a
|
||||
DE10-Nano or a Quartus build.
|
||||
|
||||
It uses the same framework as the FM-7 and Apple-IIgs sims: `sim.v` stands in
|
||||
for `CoCo3.sv`, `sim/` is the shared ImGui/SDL harness (`sim_bus`, `sim_video`,
|
||||
`sim_input`, `sim_blkdevice`, ...), and one binary does both modes.
|
||||
|
||||
## Build and run
|
||||
|
||||
```sh
|
||||
cd verilator
|
||||
make # -> ./obj_dir/Vemu
|
||||
make run # windowed
|
||||
make headless # boot headless to frame 150, screenshot
|
||||
make test # headless smoke tests (run_tests.sh)
|
||||
make lint # elaborate only
|
||||
```
|
||||
|
||||
Needs Verilator 5 (built and tested with 5.044), SDL2, and Python 3 for the
|
||||
generators (`brew install verilator sdl2`). **Run the binary from this
|
||||
directory**: the ROM defaults and the `$readmemh` images under `rtl/` are
|
||||
relative paths.
|
||||
|
||||
### ROMs
|
||||
|
||||
The core loads its ROMs over ioctl at start-up, the way Main_MiSTer does, so
|
||||
the sim needs the same two files the MiSTer SD card has in `games/CoCo3/`:
|
||||
|
||||
| file | contents | ioctl index |
|
||||
|---|---|---|
|
||||
| `roms/boot0.rom` | CoCo 3 ROM (32K, `coco3.rom`) | 0 |
|
||||
| `roms/boot1.rom` | Disk BASIC 1.1 (8K, `disk11.rom`) | 64 |
|
||||
|
||||
They are not in git (`roms/*.rom` is ignored). Copy them from your MiSTer, or
|
||||
from ToolShed's `cocoroms/` build. `--rom` / `--disk-rom` point elsewhere.
|
||||
|
||||
## Headless
|
||||
|
||||
```sh
|
||||
# Boot and print the text screen
|
||||
./obj_dir/Vemu --headless --stop-at-frame 150 --ascii-end
|
||||
|
||||
# Type at BASIC; {RETURN} or \n for Enter, {BREAK}, {CLEAR}, {UP}...
|
||||
./obj_dir/Vemu --headless --stop-at-frame 260 --type '140:PRINT 2+2\n' --ascii-end
|
||||
|
||||
# Floppy in drive 0 (selects MPI slot 4), load and run a program
|
||||
./obj_dir/Vemu --headless --disk tests/hello.dsk --stop-at-frame 420 \
|
||||
--type '140:RUN"HELLO\n' --screenshot 420
|
||||
|
||||
# Disassembly trace of frames 10-11
|
||||
./obj_dir/Vemu --headless --stop-at-frame 11 --trace-cpu trace.txt --trace-from 10
|
||||
```
|
||||
|
||||
`--help` lists everything: cartridge (`--cart`), cassette (`--cas`), CoCoSDC
|
||||
(`--sdc`), memory size, turbo speed, artifact mode, `--frame-log` (per-frame
|
||||
framebuffer hash + instruction count), `--trace-bus`, `--vcd`.
|
||||
|
||||
BASIC's banner appears around frame 130. Most of that is the core itself:
|
||||
`coco3fpga.sv` holds `RESET_N` for 143 ms and `CPU_RESET` for 286 ms after
|
||||
power-on, and the first frame only appears once the video timing leaves reset.
|
||||
Type from frame 140 on.
|
||||
|
||||
`--ascii` prints the 32×16 VDG screen at `$0400` as the CPU last wrote it (from
|
||||
a shadow of the CPU bus). That is what the tests judge. It does not follow
|
||||
`WIDTH 40/80` or graphics modes; use a screenshot for those.
|
||||
|
||||
Typed keys are held 2 frames with a 2-frame gap, plus 30 frames after each
|
||||
RETURN (`--key-hold`, `--key-gap`, `--return-gap`). The CoCo has no type-ahead:
|
||||
while BASIC runs a line it does not scan the keyboard, so keys pressed then are
|
||||
lost, on the real machine as well as here.
|
||||
|
||||
### Tests
|
||||
|
||||
`./run_tests.sh [name...]` runs these in parallel (about 8 minutes in all):
|
||||
|
||||
| test | does | judged on |
|
||||
|---|---|---|
|
||||
| `boot` | power on, wait for the banner | text screen: `DISK EXTENDED COLOR BASIC 2.1`, `OK` |
|
||||
| `keyboard` | `PRINT 2+2` | text screen: ` 4` |
|
||||
| `disk` | `RUN"HELLO` from `tests/hello.dsk` | text screen: `HELLO FROM DISK`, ` 42` |
|
||||
| `width80` | `WIDTH 80`, then print | screenshot (GIME 80-column text) |
|
||||
| `hscreen` | `HSCREEN 2`, `HCIRCLE`, `HLINE ... B` | screenshot (GIME 320x192 graphics) |
|
||||
|
||||
Every test's final screenshot is compared byte for byte with `test-ref/`. The
|
||||
sim is deterministic, so a changed image means the RTL or harness changed what
|
||||
is drawn. After an intended change, `BLESS=1 ./run_tests.sh` records new
|
||||
references. Output goes to `test-out/`.
|
||||
|
||||
### Speed
|
||||
|
||||
About **1.2 simulated frames per second** (boot to BASIC ~125 s on an
|
||||
Apple-silicon Mac), or ~1.6 fps with `--fast-clocks` (~77 s).
|
||||
|
||||
Where the time goes, and the two speed-ups made:
|
||||
|
||||
- The CoCo clocks are 114.5 MHz (SDRAM controller, the `data_ready` latch,
|
||||
the video line fetcher), 57.3 MHz `clk_sys` (everything else: 48 negedge
|
||||
and 10 posedge blocks), 14.3 MHz pixel clock, and CLK_50M for the RTC/UART.
|
||||
CLK_28 is unused.
|
||||
- `status` (the OSD word) used to be a top-level input. It feeds the video
|
||||
pixel mux, so Verilator re-evaluated that mux on every eval, about 20% of the
|
||||
run time. `sim.v` now registers it, as `hps_io` does on the FPGA.
|
||||
- `--fast-clocks` steps per half-period of `clk_sys` and runs the 114 MHz
|
||||
domain at 57 MHz, halving the evals. At normal CPU speeds an SDRAM access
|
||||
still finishes well inside a CPU cycle. All five tests give byte-identical
|
||||
screenshots and identical instruction counts either way
|
||||
(`SIMARGS=--fast-clocks ./run_tests.sh`). High turbo speeds (6 `clk_sys`
|
||||
per CPU cycle at 9.54 MHz) and video fetch bandwidth are where it could
|
||||
differ; use the default when timing is the question.
|
||||
|
||||
## Serial (RS-232 Pak / FujiNet)
|
||||
|
||||
The core's only UART is the RS-232 Pak, a `glb6551` at `$FF68-$FF6B`; on
|
||||
MiSTer its pins are the `UART_*` signals the FujiNet daemon reaches as
|
||||
`/dev/ttyS1`. The sim works on those pins, not on the registers:
|
||||
|
||||
- **TXD is decoded** at whatever rate the 6551 is programmed for, and every
|
||||
byte is printed: `SERIAL TX <frame> <hex> |ascii|`.
|
||||
- **RXD is driven** from a pty (`--serial-pty`, name printed at start) or from
|
||||
`--serial-send FRAME:HEX...`, at the far end's rate: `--serial-baud N`, or by
|
||||
default the 6551's transmit rate.
|
||||
- `--trace-acia` logs every CPU access to `$FF68-$FF6B`, and whether it
|
||||
actually reached the chip. The exit summary counts bytes, accesses and
|
||||
undecoded accesses, and warns on a receive-clock mismatch.
|
||||
- The windowed build has a Serial window with the same information.
|
||||
- `tests/dwserver.py PTY DISK...` is a minimal DriveWire 3 server (stdlib only)
|
||||
to stand in for FujiNet: `READEX`, `WRITE`, `TIME`, `DWINIT`, ...
|
||||
|
||||
`tests/dw_boot.sh CART DISK STOP [sim args]` wires the two together:
|
||||
|
||||
```sh
|
||||
tests/dw_boot.sh ../../FujiNet_MiSTer/roms/HDBDW3S3.CCC tests/hello.dsk 350 \
|
||||
--type '140:RUN"HELLO\n'
|
||||
```
|
||||
|
||||
That boots HDB-DOS over DriveWire (reads LSN 0 and the directory), then
|
||||
`RUN"HELLO` loads and runs the program from the served image, about 5 minutes.
|
||||
|
||||
The sim runs ~50x slower than real time, so the far end sees roughly 400 baud
|
||||
of real throughput whatever rate is programmed. A real FujiNet may time out
|
||||
where `dwserver.py` does not.
|
||||
|
||||
### FujiNet on this core: what was wrong, and the fix
|
||||
|
||||
Tested with FujiNet_MiSTer's carts and the real FujiNet daemon (FujiNet-PC
|
||||
built for `COCO`, run with FujiNet_MiSTer's `fnconfig.ini` pointed at the sim's
|
||||
pty; `tests/fujinet_boot.sh`).
|
||||
|
||||
1. **The 6551 was unreachable with a cart in slot 3.** `coco3fpga.sv` decoded
|
||||
`$FF68-$FF6B` only when the Multi-Pak I/O select was slot 1
|
||||
(`MPI_SCS == 0`), and the OSD offers only slots 2-4. HDB-DOS programmed the
|
||||
chip and polled status forever. It read `$AA` from an empty bus, stopped at
|
||||
`HDB-DOS 1.5 SY6551 COCO 3`, and transmitted nothing. On a real CoCo the
|
||||
SCS line covers only `$FF40-$FF5F`, and the RS-232 Pak decodes `$FF68` from
|
||||
the address bus, so it works in any slot. **Fix:** `RS232_EN` no longer
|
||||
looks at `MPI_SCS`. (Upstream's 20260927 release moved the decode to slots
|
||||
2 and 4, `MPI_SCS[0] == 1`; HDB-DOS carts can only boot from slot 3, so
|
||||
that still missed every access.)
|
||||
2. **The 19,200 cart received at 115,200.** `HDBDW3L3_19200.CCC` writes
|
||||
control `$0F`. Bit 4 = 0 selects the "external" receive clock, which
|
||||
`uart_6551.v` tied to the 1.8475 MHz enable, i.e. 115,200 baud. The cart
|
||||
transmitted at 19,200 and received garbage: FujiNet logged `Checksum error:
|
||||
expected 65280, got 57344`. **Fix:** the receiver is clocked from the baud
|
||||
generator (`RX_CLK = TX_CLK`). That is unchanged for control `$1x` and for
|
||||
baud select 0.
|
||||
|
||||
3. **Slot 3 hung FujiNet's CONFIG loader.** Once a cart finished downloading
|
||||
after boot, slot 3 toggled the CART interrupt every CPU cycle, forever. That
|
||||
is right for a program pak (CART tied to Q autostarts it), but a disk-style
|
||||
ROM such as HDB-DOS never drives CART. FujiNet's `CFGLOAD.BIN` re-enables
|
||||
that interrupt and then hung in an endless FIRQ, after reading 17 sectors.
|
||||
A reset cleared it, which is why "load cart, then Reset" worked. The OSD's
|
||||
"Cart Interrupt Disabled" option was not connected to anything. **Fix:** a
|
||||
cart that starts with `DK` gets a cold boot instead, the way BASIC starts
|
||||
it at power-on, and the OSD option (Debug menu, `status[19]` ->
|
||||
`SWITCH[9]`) now suppresses the autostart interrupt.
|
||||
Program paks behave as before. The sim reproduces both cases with
|
||||
`--cart-frame N`, which loads the cart after boot the way the OSD and MGL
|
||||
do.
|
||||
|
||||
With these fixes, the L3 cart at 19,200 (the MiSTer configuration) boots from the
|
||||
real FujiNet daemon with no checksum errors, and gets to FujiNet's CONFIG
|
||||
splash. The S3 cart (115,200) reaches the CONFIG host-slots screen.
|
||||
|
||||
On the FPGA the rest of the path already works. `sys_top.v` wires the core's
|
||||
`UART_*` pins straight to the HPS UART (`/dev/ttyS1`), whatever the OSD UART
|
||||
mode. The 6551 only transmits while CTS is low, and CTS is the HPS UART's RTS.
|
||||
FujiNet-PC turns off `CRTSCTS` and leaves RTS as Linux sets it on open
|
||||
(asserted), so that holds while `start_fujinet.sh` has the port open.
|
||||
|
||||
**Sim-only caveat:** FujiNet times out reads after 500 ms of wall-clock time,
|
||||
and the sim runs ~50x slower than real time. The CoCo cannot return a sector's
|
||||
checksum in time, and FujiNet logs `got 65535`. These tests used a FujiNet
|
||||
build with `.readTimeout(120000)` in `lib/bus/drivewire/drivewire.cpp`. On
|
||||
hardware the stock value is fine.
|
||||
|
||||
## Windowed
|
||||
|
||||
`make run`. Windows: the video, a CPU/GIME inspector (registers, `$FF90`, a
|
||||
live disassembly from the bus shadow), Control (run/pause/step, reset, cold
|
||||
boot, screenshot, the OSD options, cart/cassette/floppy/SDC file dialogs) and a
|
||||
console. Keys go to the CoCo from the host keyboard through the same PS/2 path
|
||||
as on hardware.
|
||||
|
||||
## What is simulated, and what is replaced
|
||||
|
||||
`sim.v` wires the core the way `CoCo3.sv` does, including the OSD `status` word
|
||||
decode, the joystick centring and the cassette RAM. The replacements:
|
||||
|
||||
| on MiSTer | here | why |
|
||||
|---|---|---|
|
||||
| PLL (114.545/57.27/28.64/14.32 MHz) | clocks from `sim_main.cpp` | all phase 0, exact /2 /4 /8, so they are derived from one counter and all rise in the same eval |
|
||||
| `rtl/sdram/sdram2.sv` | `rtl/sdram2.sv` | same controller logic, plus a CAS-3, burst-2 SDR chip model in place of the `SDRAM_*` pins |
|
||||
| `hps_io` keyboard | `sys/hps_io.sv`'s own `ps2_device` | `ps2_key` events are fed into the real PS/2 serializer at `PS2DIV(2400)`, so `cocokey.v` sees the same serial stream |
|
||||
| `rtl/VDAC.v` (altsyncram) | `rtl/VDAC.v` | registered dual-port RAM, preloaded from `VDAC.mif` |
|
||||
| VHDL ROM/RAM entities | `rtl/coco_rom.v`, `rtl/coco_sram.v` | Verilog conversions, see below |
|
||||
|
||||
### VHDL to Verilog
|
||||
|
||||
The build uses the Verilog cycle-accurate 6809 (`rtl/mc6809glb/mc6809glb.v`),
|
||||
because `rtl/config.sv` defines `CoCo3_CYC_ACC_6809`. The VHDL CPU
|
||||
(`rtl/CPU09/cpu09*.vhd`) is not instantiated, so nothing needs ghdl. The VHDL
|
||||
the core does use was converted by hand, one module per entity with the same
|
||||
names and ports:
|
||||
|
||||
| VHDL | Verilog |
|
||||
|---|---|
|
||||
| `rtl/rom/coco_rom_32K.vhd`, `coco_rom_8K.vhd`, `coco_rom_cart.vhd` | `rtl/coco_rom.v` (`COCO_ROM_32K`, `COCO_ROM_8K`, `COCO_ROM_CART`) |
|
||||
| `rtl/rom/coco_rom_16.vhd` | `rtl/coco_rom.v` (`COCO_ROM_16`) |
|
||||
| `rtl/rom/coco3_char_rom.vhd` | `rtl/coco_rom.v` (`coco3_Char_ROM`) + `rtl/coco3_char_rom.mem` |
|
||||
| `rtl/sram/coco_ram.vhd`, `coco_vid_ram_buf.vhd` | `rtl/coco_sram.v` (`COCO_SRAM`, `COCO_VID_RAM_BUF`) |
|
||||
| `rtl/OVO.vhd` (debug / "NO ROM" overlay) | `rtl/ovo.v` (`ovo`) |
|
||||
|
||||
`make mem` (`gen_mem.py`) regenerates `rtl/coco3_char_rom.mem` from the font
|
||||
table in the VHDL and `rtl/vdac.mem` from `rtl/VDAC.mif`.
|
||||
|
||||
## Traps found while bringing it up
|
||||
|
||||
**Verilator re-runs block-local initialisers.** A variable declared with an
|
||||
initialiser inside an `always` block, like `reg [4:0] state = STATE_STARTUP;` in
|
||||
`sdram2.sv`, is re-initialised every time the block runs under Verilator 5.044.
|
||||
It is not a one-time static. The SDRAM controller was pinned in
|
||||
`STATE_STARTUP`, and the CPU stalled on its first RAM access. The sim copy
|
||||
hoists those registers to module scope. Look for this in any other core
|
||||
(`make lint` flags them as `IMPLICITSTATIC`).
|
||||
|
||||
**Quartus powers async-set registers up at 1.** A register with an asynchronous
|
||||
set is built with NOT-gate push-back, so it starts at 1 on the FPGA and at 0
|
||||
here. `mc6809x`'s `NMILatched` (active low) is one of them. At 0 the CPU took a
|
||||
phantom NMI on its first instruction. `sim.v` sets it to 1 in an `initial`
|
||||
block, which models the FPGA's power-up state.
|
||||
|
||||
**`// verilator ...` in a comment is a pragma.** A comment line that *starts*
|
||||
with the word "verilator" is parsed as a directive and fails the build with
|
||||
`BADVLTPRAGMA`.
|
||||
|
||||
**`rtl/wd1793.sv`:** `spt_addr` and `buff_wr` were declared inside `generate`
|
||||
blocks but assigned outside them. Quartus accepts that. Verilator rejects
|
||||
`spt_addr`, and silently makes `buff_wr` a separate implicit net, so the
|
||||
sector-buffer write strobe would never reach the RAM. Both are now declared at
|
||||
module scope. FM-7 made the same fix to its copy of the file. There is no
|
||||
behavioural change on the FPGA.
|
||||
|
||||
The core also declares some registers as `wire` and assigns them in `always`
|
||||
blocks (`Build_Info`, `VMA`, `PIX_CLK_D`, the `$FF40` latch in `fdc.sv`).
|
||||
Quartus accepts it. The Makefile passes `-Wno-PROCASSWIRE` rather than editing
|
||||
the RTL.
|
||||
|
||||
## Files
|
||||
|
||||
```
|
||||
Makefile build, lint, test
|
||||
sim.v emu top: CoCo3.sv without sys/, plus debug taps
|
||||
sim_main.cpp clocks, options, headless loop, ImGui windows
|
||||
serial.{cpp,h} 6551 line model: TXD decoder, RXD driver, pty bridge
|
||||
sim.vlt Verilator config (forceable net for --acia-any-slot)
|
||||
dis6809.{cpp,h} 6809 disassembler (shared with FM-7)
|
||||
run_tests.sh smoke tests, judged on text screen + screenshot
|
||||
gen_mem.py VHDL/MIF -> rtl/*.mem
|
||||
rtl/ Verilog conversions and sim replacements
|
||||
sim/ shared ImGui/SDL framework
|
||||
tests/ make_test_disk.py -> hello.dsk (Disk BASIC image),
|
||||
dwserver.py (minimal DriveWire 3 server)
|
||||
test-ref/ blessed screenshots for run_tests.sh
|
||||
```
|
||||
@@ -1,233 +0,0 @@
|
||||
//============================================================================
|
||||
// Motorola 6809 disassembler
|
||||
//
|
||||
// Table-driven, covering pages 1 ($xx), 2 ($10 xx) and 3 ($11 xx), all six
|
||||
// addressing modes and the full indexed postbyte set. No 6309 extensions --
|
||||
// rtl/mc6809i.v is a 6809, and silently decoding 6309 opcodes would hide the
|
||||
// fact that the CPU has run off into data.
|
||||
//============================================================================
|
||||
|
||||
#include "dis6809.h"
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
namespace {
|
||||
|
||||
enum Mode {
|
||||
INH, // inherent
|
||||
IMM8,
|
||||
IMM16,
|
||||
DIR,
|
||||
EXT,
|
||||
IDX,
|
||||
REL8,
|
||||
REL16,
|
||||
RLIST_S, // PSHS/PULS postbyte
|
||||
RLIST_U, // PSHU/PULU postbyte
|
||||
REGPAIR, // TFR/EXG postbyte
|
||||
ILL
|
||||
};
|
||||
|
||||
struct Op { const char* name; Mode mode; };
|
||||
|
||||
// ---- page 1 ---------------------------------------------------------------
|
||||
const Op page1[256] = {
|
||||
/*00*/ {"NEG",DIR},{"?",ILL},{"?",ILL},{"COM",DIR},{"LSR",DIR},{"?",ILL},{"ROR",DIR},{"ASR",DIR},
|
||||
/*08*/ {"LSL",DIR},{"ROL",DIR},{"DEC",DIR},{"?",ILL},{"INC",DIR},{"TST",DIR},{"JMP",DIR},{"CLR",DIR},
|
||||
/*10*/ {"?",ILL},{"?",ILL},{"NOP",INH},{"SYNC",INH},{"?",ILL},{"?",ILL},{"LBRA",REL16},{"LBSR",REL16},
|
||||
/*18*/ {"?",ILL},{"DAA",INH},{"ORCC",IMM8},{"?",ILL},{"ANDCC",IMM8},{"SEX",INH},{"EXG",REGPAIR},{"TFR",REGPAIR},
|
||||
/*20*/ {"BRA",REL8},{"BRN",REL8},{"BHI",REL8},{"BLS",REL8},{"BCC",REL8},{"BCS",REL8},{"BNE",REL8},{"BEQ",REL8},
|
||||
/*28*/ {"BVC",REL8},{"BVS",REL8},{"BPL",REL8},{"BMI",REL8},{"BGE",REL8},{"BLT",REL8},{"BGT",REL8},{"BLE",REL8},
|
||||
/*30*/ {"LEAX",IDX},{"LEAY",IDX},{"LEAS",IDX},{"LEAU",IDX},{"PSHS",RLIST_S},{"PULS",RLIST_S},{"PSHU",RLIST_U},{"PULU",RLIST_U},
|
||||
/*38*/ {"?",ILL},{"RTS",INH},{"ABX",INH},{"RTI",INH},{"CWAI",IMM8},{"MUL",INH},{"RESET",INH},{"SWI",INH},
|
||||
/*40*/ {"NEGA",INH},{"?",ILL},{"?",ILL},{"COMA",INH},{"LSRA",INH},{"?",ILL},{"RORA",INH},{"ASRA",INH},
|
||||
/*48*/ {"LSLA",INH},{"ROLA",INH},{"DECA",INH},{"?",ILL},{"INCA",INH},{"TSTA",INH},{"?",ILL},{"CLRA",INH},
|
||||
/*50*/ {"NEGB",INH},{"?",ILL},{"?",ILL},{"COMB",INH},{"LSRB",INH},{"?",ILL},{"RORB",INH},{"ASRB",INH},
|
||||
/*58*/ {"LSLB",INH},{"ROLB",INH},{"DECB",INH},{"?",ILL},{"INCB",INH},{"TSTB",INH},{"?",ILL},{"CLRB",INH},
|
||||
/*60*/ {"NEG",IDX},{"?",ILL},{"?",ILL},{"COM",IDX},{"LSR",IDX},{"?",ILL},{"ROR",IDX},{"ASR",IDX},
|
||||
/*68*/ {"LSL",IDX},{"ROL",IDX},{"DEC",IDX},{"?",ILL},{"INC",IDX},{"TST",IDX},{"JMP",IDX},{"CLR",IDX},
|
||||
/*70*/ {"NEG",EXT},{"?",ILL},{"?",ILL},{"COM",EXT},{"LSR",EXT},{"?",ILL},{"ROR",EXT},{"ASR",EXT},
|
||||
/*78*/ {"LSL",EXT},{"ROL",EXT},{"DEC",EXT},{"?",ILL},{"INC",EXT},{"TST",EXT},{"JMP",EXT},{"CLR",EXT},
|
||||
/*80*/ {"SUBA",IMM8},{"CMPA",IMM8},{"SBCA",IMM8},{"SUBD",IMM16},{"ANDA",IMM8},{"BITA",IMM8},{"LDA",IMM8},{"?",ILL},
|
||||
/*88*/ {"EORA",IMM8},{"ADCA",IMM8},{"ORA",IMM8},{"ADDA",IMM8},{"CMPX",IMM16},{"BSR",REL8},{"LDX",IMM16},{"?",ILL},
|
||||
/*90*/ {"SUBA",DIR},{"CMPA",DIR},{"SBCA",DIR},{"SUBD",DIR},{"ANDA",DIR},{"BITA",DIR},{"LDA",DIR},{"STA",DIR},
|
||||
/*98*/ {"EORA",DIR},{"ADCA",DIR},{"ORA",DIR},{"ADDA",DIR},{"CMPX",DIR},{"JSR",DIR},{"LDX",DIR},{"STX",DIR},
|
||||
/*A0*/ {"SUBA",IDX},{"CMPA",IDX},{"SBCA",IDX},{"SUBD",IDX},{"ANDA",IDX},{"BITA",IDX},{"LDA",IDX},{"STA",IDX},
|
||||
/*A8*/ {"EORA",IDX},{"ADCA",IDX},{"ORA",IDX},{"ADDA",IDX},{"CMPX",IDX},{"JSR",IDX},{"LDX",IDX},{"STX",IDX},
|
||||
/*B0*/ {"SUBA",EXT},{"CMPA",EXT},{"SBCA",EXT},{"SUBD",EXT},{"ANDA",EXT},{"BITA",EXT},{"LDA",EXT},{"STA",EXT},
|
||||
/*B8*/ {"EORA",EXT},{"ADCA",EXT},{"ORA",EXT},{"ADDA",EXT},{"CMPX",EXT},{"JSR",EXT},{"LDX",EXT},{"STX",EXT},
|
||||
/*C0*/ {"SUBB",IMM8},{"CMPB",IMM8},{"SBCB",IMM8},{"ADDD",IMM16},{"ANDB",IMM8},{"BITB",IMM8},{"LDB",IMM8},{"?",ILL},
|
||||
/*C8*/ {"EORB",IMM8},{"ADCB",IMM8},{"ORB",IMM8},{"ADDB",IMM8},{"LDD",IMM16},{"?",ILL},{"LDU",IMM16},{"?",ILL},
|
||||
/*D0*/ {"SUBB",DIR},{"CMPB",DIR},{"SBCB",DIR},{"ADDD",DIR},{"ANDB",DIR},{"BITB",DIR},{"LDB",DIR},{"STB",DIR},
|
||||
/*D8*/ {"EORB",DIR},{"ADCB",DIR},{"ORB",DIR},{"ADDB",DIR},{"LDD",DIR},{"STD",DIR},{"LDU",DIR},{"STU",DIR},
|
||||
/*E0*/ {"SUBB",IDX},{"CMPB",IDX},{"SBCB",IDX},{"ADDD",IDX},{"ANDB",IDX},{"BITB",IDX},{"LDB",IDX},{"STB",IDX},
|
||||
/*E8*/ {"EORB",IDX},{"ADCB",IDX},{"ORB",IDX},{"ADDB",IDX},{"LDD",IDX},{"STD",IDX},{"LDU",IDX},{"STU",IDX},
|
||||
/*F0*/ {"SUBB",EXT},{"CMPB",EXT},{"SBCB",EXT},{"ADDD",EXT},{"ANDB",EXT},{"BITB",EXT},{"LDB",EXT},{"STB",EXT},
|
||||
/*F8*/ {"EORB",EXT},{"ADCB",EXT},{"ORB",EXT},{"ADDB",EXT},{"LDD",EXT},{"STD",EXT},{"LDU",EXT},{"STU",EXT},
|
||||
};
|
||||
|
||||
// ---- page 2 ($10 prefix) --------------------------------------------------
|
||||
Op page2_lookup(uint8_t op) {
|
||||
switch (op) {
|
||||
case 0x21: return {"LBRN",REL16}; case 0x22: return {"LBHI",REL16};
|
||||
case 0x23: return {"LBLS",REL16}; case 0x24: return {"LBCC",REL16};
|
||||
case 0x25: return {"LBCS",REL16}; case 0x26: return {"LBNE",REL16};
|
||||
case 0x27: return {"LBEQ",REL16}; case 0x28: return {"LBVC",REL16};
|
||||
case 0x29: return {"LBVS",REL16}; case 0x2a: return {"LBPL",REL16};
|
||||
case 0x2b: return {"LBMI",REL16}; case 0x2c: return {"LBGE",REL16};
|
||||
case 0x2d: return {"LBLT",REL16}; case 0x2e: return {"LBGT",REL16};
|
||||
case 0x2f: return {"LBLE",REL16};
|
||||
case 0x3f: return {"SWI2",INH};
|
||||
case 0x83: return {"CMPD",IMM16}; case 0x8c: return {"CMPY",IMM16};
|
||||
case 0x8e: return {"LDY",IMM16};
|
||||
case 0x93: return {"CMPD",DIR}; case 0x9c: return {"CMPY",DIR};
|
||||
case 0x9e: return {"LDY",DIR}; case 0x9f: return {"STY",DIR};
|
||||
case 0xa3: return {"CMPD",IDX}; case 0xac: return {"CMPY",IDX};
|
||||
case 0xae: return {"LDY",IDX}; case 0xaf: return {"STY",IDX};
|
||||
case 0xb3: return {"CMPD",EXT}; case 0xbc: return {"CMPY",EXT};
|
||||
case 0xbe: return {"LDY",EXT}; case 0xbf: return {"STY",EXT};
|
||||
case 0xce: return {"LDS",IMM16};
|
||||
case 0xde: return {"LDS",DIR}; case 0xdf: return {"STS",DIR};
|
||||
case 0xee: return {"LDS",IDX}; case 0xef: return {"STS",IDX};
|
||||
case 0xfe: return {"LDS",EXT}; case 0xff: return {"STS",EXT};
|
||||
default: return {"?",ILL};
|
||||
}
|
||||
}
|
||||
|
||||
// ---- page 3 ($11 prefix) --------------------------------------------------
|
||||
Op page3_lookup(uint8_t op) {
|
||||
switch (op) {
|
||||
case 0x3f: return {"SWI3",INH};
|
||||
case 0x83: return {"CMPU",IMM16}; case 0x8c: return {"CMPS",IMM16};
|
||||
case 0x93: return {"CMPU",DIR}; case 0x9c: return {"CMPS",DIR};
|
||||
case 0xa3: return {"CMPU",IDX}; case 0xac: return {"CMPS",IDX};
|
||||
case 0xb3: return {"CMPU",EXT}; case 0xbc: return {"CMPS",EXT};
|
||||
default: return {"?",ILL};
|
||||
}
|
||||
}
|
||||
|
||||
const char* const IDX_REG[4] = { "X", "Y", "U", "S" };
|
||||
|
||||
// TFR/EXG register field. 6809 leaves 6,7 and 12..15 undefined.
|
||||
const char* const TFR_REG[16] = {
|
||||
"D","X","Y","U","S","PC","?6","?7","A","B","CC","DP","?c","?d","?e","?f"
|
||||
};
|
||||
|
||||
void reg_list(uint8_t pb, bool is_u, char* out, size_t n) {
|
||||
static const char* names_s[8] = {"CC","A","B","DP","X","Y","U","PC"};
|
||||
static const char* names_u[8] = {"CC","A","B","DP","X","Y","S","PC"};
|
||||
const char* const* names = is_u ? names_u : names_s;
|
||||
out[0] = 0;
|
||||
size_t len = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (!(pb & (1 << i))) continue;
|
||||
int w = snprintf(out + len, n - len, "%s%s", len ? "," : "", names[i]);
|
||||
if (w < 0 || (size_t)w >= n - len) break;
|
||||
len += w;
|
||||
}
|
||||
if (!len) snprintf(out, n, "#$%02x", pb);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void cc6809_string(uint8_t cc, char out[9]) {
|
||||
static const char* bits = "EFHINZVC"; // bit 7 .. bit 0
|
||||
for (int i = 0; i < 8; i++) {
|
||||
char c = bits[i];
|
||||
out[i] = (cc & (0x80 >> i)) ? c : (char)(c + 32);
|
||||
}
|
||||
out[8] = 0;
|
||||
}
|
||||
|
||||
int dis6809(uint16_t pc, int (*rd)(uint16_t), char* out, size_t outlen) {
|
||||
// Local fetch helpers. `bad` sticks once any byte of the instruction is
|
||||
// unknown, so the caller sees "??" rather than a plausible-looking lie.
|
||||
int len = 0;
|
||||
bool bad = false;
|
||||
auto fetch = [&](void) -> int {
|
||||
int v = rd((uint16_t)(pc + len));
|
||||
len++;
|
||||
if (v < 0) { bad = true; return 0; }
|
||||
return v;
|
||||
};
|
||||
|
||||
int op = fetch();
|
||||
Op o;
|
||||
if (bad) { snprintf(out, outlen, "??"); return 1; }
|
||||
|
||||
if (op == 0x10) { int o2 = fetch(); o = bad ? Op{"?",ILL} : page2_lookup((uint8_t)o2); }
|
||||
else if (op == 0x11) { int o2 = fetch(); o = bad ? Op{"?",ILL} : page3_lookup((uint8_t)o2); }
|
||||
else o = page1[op];
|
||||
|
||||
if (o.mode == ILL) {
|
||||
snprintf(out, outlen, "FCB $%02x", op);
|
||||
return 1;
|
||||
}
|
||||
|
||||
char arg[64] = "";
|
||||
|
||||
switch (o.mode) {
|
||||
case INH:
|
||||
break;
|
||||
case IMM8: { int v = fetch(); snprintf(arg, sizeof(arg), "#$%02x", v); break; }
|
||||
case IMM16: { int h = fetch(), l = fetch(); snprintf(arg, sizeof(arg), "#$%02x%02x", h, l); break; }
|
||||
case DIR: { int v = fetch(); snprintf(arg, sizeof(arg), "<$%02x", v); break; }
|
||||
case EXT: { int h = fetch(), l = fetch(); snprintf(arg, sizeof(arg), "$%02x%02x", h, l); break; }
|
||||
case REL8: { int v = fetch();
|
||||
uint16_t dst = (uint16_t)(pc + len + (int8_t)v);
|
||||
snprintf(arg, sizeof(arg), "$%04x", dst); break; }
|
||||
case REL16: { int h = fetch(), l = fetch();
|
||||
uint16_t dst = (uint16_t)(pc + len + (int16_t)((h << 8) | l));
|
||||
snprintf(arg, sizeof(arg), "$%04x", dst); break; }
|
||||
case RLIST_S: { int pb = fetch(); reg_list((uint8_t)pb, false, arg, sizeof(arg)); break; }
|
||||
case RLIST_U: { int pb = fetch(); reg_list((uint8_t)pb, true, arg, sizeof(arg)); break; }
|
||||
case REGPAIR: { int pb = fetch();
|
||||
snprintf(arg, sizeof(arg), "%s,%s", TFR_REG[(pb >> 4) & 15], TFR_REG[pb & 15]);
|
||||
break; }
|
||||
case IDX: {
|
||||
int pb = fetch();
|
||||
const char* r = IDX_REG[(pb >> 5) & 3];
|
||||
if (!(pb & 0x80)) {
|
||||
// 5-bit signed offset, no indirect form
|
||||
int off = pb & 0x1f;
|
||||
if (off & 0x10) off -= 0x20;
|
||||
snprintf(arg, sizeof(arg), "%d,%s", off, r);
|
||||
break;
|
||||
}
|
||||
bool ind = (pb & 0x10) != 0;
|
||||
char body[48];
|
||||
switch (pb & 0x0f) {
|
||||
case 0x0: snprintf(body, sizeof(body), ",%s+", r); break;
|
||||
case 0x1: snprintf(body, sizeof(body), ",%s++", r); break;
|
||||
case 0x2: snprintf(body, sizeof(body), ",-%s", r); break;
|
||||
case 0x3: snprintf(body, sizeof(body), ",--%s", r); break;
|
||||
case 0x4: snprintf(body, sizeof(body), ",%s", r); break;
|
||||
case 0x5: snprintf(body, sizeof(body), "B,%s", r); break;
|
||||
case 0x6: snprintf(body, sizeof(body), "A,%s", r); break;
|
||||
case 0x8: { int v = fetch(); snprintf(body, sizeof(body), "$%02x,%s", v, r); break; }
|
||||
case 0x9: { int h = fetch(), l = fetch();
|
||||
snprintf(body, sizeof(body), "$%02x%02x,%s", h, l, r); break; }
|
||||
case 0xb: snprintf(body, sizeof(body), "D,%s", r); break;
|
||||
case 0xc: { int v = fetch();
|
||||
// PCR offsets are relative to the byte after the instruction,
|
||||
// which is only known once the whole thing is decoded -- so
|
||||
// print the raw offset and let the target be inferred.
|
||||
snprintf(body, sizeof(body), "$%02x,PCR", v); break; }
|
||||
case 0xd: { int h = fetch(), l = fetch();
|
||||
snprintf(body, sizeof(body), "$%02x%02x,PCR", h, l); break; }
|
||||
case 0xf: { int h = fetch(), l = fetch();
|
||||
snprintf(body, sizeof(body), "$%02x%02x", h, l); break; }
|
||||
default: snprintf(body, sizeof(body), "?pb$%02x,%s", pb, r); break;
|
||||
}
|
||||
if (ind) snprintf(arg, sizeof(arg), "[%s]", body);
|
||||
else snprintf(arg, sizeof(arg), "%s", body);
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (bad) snprintf(out, outlen, "%-5s ??", o.name);
|
||||
else if (arg[0]) snprintf(out, outlen, "%-5s %s", o.name, arg);
|
||||
else snprintf(out, outlen, "%s", o.name);
|
||||
return len ? len : 1;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
// Motorola 6809 disassembler.
|
||||
//
|
||||
// `read_byte` returns 0..255, or -1 for an address whose contents are not
|
||||
// known. The sim feeds it a shadow of every byte the CPU has actually put on
|
||||
// the bus, so unknown means "the CPU never fetched or wrote this" -- which is
|
||||
// itself informative, and prints as "??".
|
||||
//
|
||||
// Returns the instruction length in bytes (1..5), and writes the mnemonic and
|
||||
// operand to `out`. On an unknown opcode it emits "FCB $xx" and returns 1, so a
|
||||
// caller walking a byte stream always makes progress.
|
||||
int dis6809(uint16_t pc, int (*read_byte)(uint16_t), char* out, size_t outlen);
|
||||
|
||||
// Human-readable CC, e.g. "EFHINZVC" with cleared flags lower-cased.
|
||||
void cc6809_string(uint8_t cc, char out[9]);
|
||||
@@ -1,63 +0,0 @@
|
||||
//============================================================================
|
||||
// dis6809 self-check. `make distest`
|
||||
//
|
||||
// Covers every addressing mode, both prefix pages, the register-list and
|
||||
// register-pair postbytes, and an undefined opcode. Cheap insurance: a
|
||||
// disassembler that is subtly wrong is worse than none, because it produces
|
||||
// confident output you will act on.
|
||||
//============================================================================
|
||||
|
||||
#include "dis6809.h"
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
static unsigned char M[0x10000];
|
||||
static int rd(uint16_t a){ return M[a]; }
|
||||
struct T { const char* bytes; const char* want; };
|
||||
static int put(uint16_t a, const char* hex){ int n=0; while(*hex){ unsigned v; sscanf(hex,"%2x",&v); M[a+n++]=v; hex+=2; if(*hex==' ')hex++; } return n; }
|
||||
int main(){
|
||||
T t[] = {
|
||||
{"20 09", "BRA $100b"},
|
||||
{"16 01 23", "LBRA $1126"},
|
||||
{"86 fd", "LDA #$fd"},
|
||||
{"10 ce fc 7f", "LDS #$fc7f"},
|
||||
{"1f 8b", "TFR A,DP"},
|
||||
{"1e 12", "EXG X,Y"},
|
||||
{"34 76", "PSHS A,B,X,Y,U"},
|
||||
{"35 ff", "PULS CC,A,B,DP,X,Y,U,PC"},
|
||||
{"36 40", "PSHU S"},
|
||||
{"d6 04", "LDB <$04"},
|
||||
{"be fb fe", "LDX $fbfe"},
|
||||
{"6e 84", "JMP ,X"},
|
||||
{"a6 80", "LDA ,X+"},
|
||||
{"a6 81", "LDA ,X++"},
|
||||
{"a6 82", "LDA ,-X"},
|
||||
{"a6 83", "LDA ,--X"},
|
||||
{"a6 91", "LDA [,X++]"},
|
||||
{"a6 a5", "LDA B,Y"},
|
||||
{"a6 c6", "LDA A,U"},
|
||||
{"a6 88 7f", "LDA $7f,X"},
|
||||
{"a6 89 12 34", "LDA $1234,X"},
|
||||
{"a6 9f 20 00", "LDA [$2000]"},
|
||||
{"a6 8c 10", "LDA $10,PCR"},
|
||||
{"a6 1f", "LDA -1,X"},
|
||||
{"a6 05", "LDA 5,X"},
|
||||
{"e7 41", "STB 1,U"},
|
||||
{"10 8e 12 34", "LDY #$1234"},
|
||||
{"11 83 00 01", "CMPU #$0001"},
|
||||
{"11 3f", "SWI3"},
|
||||
{"39", "RTS"},
|
||||
{"3d", "MUL"},
|
||||
{"87", "FCB $87"},
|
||||
};
|
||||
int fail=0;
|
||||
for (auto& e : t) {
|
||||
memset(M,0,sizeof(M));
|
||||
int n = put(0x1000, e.bytes);
|
||||
char out[80];
|
||||
int len = dis6809(0x1000, rd, out, sizeof(out));
|
||||
bool ok = !strcmp(out, e.want) && (len==n || (!strcmp(e.want,"FCB $87")));
|
||||
if(!ok){ printf("FAIL %-16s got \"%s\" (len %d, expected %d) want \"%s\"\n", e.bytes,out,len,n,e.want); fail++; }
|
||||
}
|
||||
printf(fail? "%d FAILURES\n" : "all %d cases pass\n", fail?fail:(int)(sizeof(t)/sizeof(t[0])));
|
||||
return fail!=0;
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Regenerate the $readmemh images the Verilog conversions load.
|
||||
|
||||
rtl/rom/coco3_char_rom.vhd -> verilator/rtl/coco3_char_rom.mem (4096 x 8)
|
||||
rtl/VDAC.mif -> verilator/rtl/vdac.mem ( 256 x 16)
|
||||
|
||||
Run from the verilator/ directory after either source changes.
|
||||
"""
|
||||
import re, sys
|
||||
|
||||
def char_rom():
|
||||
src = open('../rtl/rom/coco3_char_rom.vhd').read()
|
||||
body = src[src.index('signal RAM'):src.index(');', src.index('signal RAM'))]
|
||||
vals = re.findall(r'x"([0-9A-Fa-f]{2})"', body)
|
||||
if len(vals) != 4096:
|
||||
sys.exit(f'coco3_char_rom.vhd: expected 4096 bytes, found {len(vals)}')
|
||||
with open('rtl/coco3_char_rom.mem', 'w') as f:
|
||||
for i in range(0, 4096, 16):
|
||||
f.write(' '.join(v.upper() for v in vals[i:i+16]) + '\n')
|
||||
|
||||
def vdac():
|
||||
mem = [0] * 256
|
||||
txt = open('../rtl/VDAC.mif').read()
|
||||
txt = txt[txt.index('CONTENT BEGIN') + len('CONTENT BEGIN'):txt.index('END;')]
|
||||
for line in txt.splitlines():
|
||||
line = line.split('--')[0].strip().rstrip(';')
|
||||
if ':' not in line:
|
||||
continue
|
||||
addr, data = (s.strip() for s in line.split(':', 1))
|
||||
words = data.split()
|
||||
if addr.startswith('['): # [lo..hi] : value
|
||||
lo, hi = (int(x, 16) for x in addr[1:-1].split('..'))
|
||||
for a in range(lo, hi + 1):
|
||||
mem[a] = int(words[0], 16)
|
||||
else:
|
||||
base = int(addr, 16)
|
||||
for i, w in enumerate(words):
|
||||
mem[base + i] = int(w, 16)
|
||||
with open('rtl/vdac.mem', 'w') as f:
|
||||
for i in range(0, 256, 8):
|
||||
f.write(' '.join(f'{v:04X}' for v in mem[i:i+8]) + '\n')
|
||||
|
||||
char_rom()
|
||||
vdac()
|
||||
@@ -1,27 +0,0 @@
|
||||
//============================================================================
|
||||
// Simulation stand-in for rtl/VDAC.v (an altsyncram megafunction).
|
||||
//
|
||||
// Same ports and the configuration the megafunction declares: DUAL_PORT,
|
||||
// 256 x 16, write on wrclock, address AND output registered on rdclock
|
||||
// (address_reg_b = outdata_reg_b = CLOCK1), so q lags rdaddress by two
|
||||
// rdclock edges. Preloaded from rtl/VDAC.mif via verilator/rtl/vdac.mem.
|
||||
//============================================================================
|
||||
module VDAC
|
||||
(
|
||||
input [15:0] data,
|
||||
input [7:0] rdaddress,
|
||||
input rdclock,
|
||||
input [7:0] wraddress,
|
||||
input wrclock,
|
||||
input wren,
|
||||
output reg [15:0] q
|
||||
);
|
||||
reg [15:0] mem [0:255];
|
||||
reg [7:0] rd_a;
|
||||
initial $readmemh("rtl/vdac.mem", mem);
|
||||
always @(posedge wrclock) if (wren) mem[wraddress] <= data;
|
||||
always @(posedge rdclock) begin
|
||||
rd_a <= rdaddress;
|
||||
q <= mem[rd_a];
|
||||
end
|
||||
endmodule
|
||||
@@ -1,256 +0,0 @@
|
||||
1C 22 20 20 20 22 1C 08 00 00 00 00 00 00 00 00
|
||||
22 00 22 22 22 26 1A 00 00 00 00 00 00 00 00 00
|
||||
04 08 1C 22 3E 20 1C 00 00 00 00 00 00 00 00 00
|
||||
08 14 1C 02 1E 22 1E 00 00 00 00 00 00 00 00 00
|
||||
14 00 1C 02 1E 22 1E 00 00 00 00 00 00 00 00 00
|
||||
10 08 1C 02 1E 22 1E 00 00 00 00 00 00 00 00 00
|
||||
08 00 1C 02 1E 22 1E 00 00 00 00 00 00 00 00 00
|
||||
00 00 1C 22 20 22 1C 08 00 00 00 00 00 00 00 00
|
||||
08 14 1C 22 3E 20 1C 00 00 00 00 00 00 00 00 00
|
||||
14 00 1C 22 3E 20 1C 00 00 00 00 00 00 00 00 00
|
||||
10 08 1C 22 3E 20 1C 00 00 00 00 00 00 00 00 00
|
||||
14 00 18 08 08 08 1C 00 00 00 00 00 00 00 00 00
|
||||
08 14 00 18 08 08 1C 00 00 00 00 00 00 00 00 00
|
||||
00 0C 12 1C 12 12 1C 20 00 00 00 00 00 00 00 00
|
||||
22 08 14 22 3E 22 22 00 00 00 00 00 00 00 00 00
|
||||
08 08 14 22 3E 22 22 00 00 00 00 00 00 00 00 00
|
||||
04 08 1C 22 22 22 1C 00 00 00 00 00 00 00 00 00
|
||||
00 00 34 0A 1E 28 1E 00 00 00 00 00 00 00 00 00
|
||||
1E 28 28 3C 28 28 2C 00 00 00 00 00 00 00 00 00
|
||||
08 14 1C 22 22 22 1C 00 00 00 00 00 00 00 00 00
|
||||
14 00 1C 22 22 22 1C 00 00 00 00 00 00 00 00 00
|
||||
00 00 1C 26 2E 32 1C 00 00 00 00 00 00 00 00 00
|
||||
08 14 00 22 22 26 1A 00 00 00 00 00 00 00 00 00
|
||||
10 08 22 22 22 26 1A 00 00 00 00 00 00 00 00 00
|
||||
1C 26 2A 2A 2A 32 1C 00 00 00 00 00 00 00 00 00
|
||||
22 1C 22 22 22 22 1C 00 00 00 00 00 00 00 00 00
|
||||
14 22 22 22 22 22 1C 00 00 00 00 00 00 00 00 00
|
||||
1C 20 1C 22 1C 02 1C 00 00 00 00 00 00 00 00 00
|
||||
04 0A 08 1C 08 0A 3C 00 00 00 00 00 00 00 00 00
|
||||
08 08 3E 08 08 00 3E 00 00 00 00 00 00 00 00 00
|
||||
04 0A 04 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
04 0A 08 1C 08 08 28 10 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
08 08 08 08 08 00 08 00 00 00 00 00 00 00 00 00
|
||||
14 14 14 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
14 14 3E 14 3E 14 14 00 00 00 00 00 00 00 00 00
|
||||
08 1E 28 1C 0A 3C 08 00 00 00 00 00 00 00 00 00
|
||||
32 32 04 08 10 26 26 00 00 00 00 00 00 00 00 00
|
||||
10 28 28 10 2A 24 1A 00 00 00 00 00 00 00 00 00
|
||||
08 08 10 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
08 10 20 20 20 10 08 00 00 00 00 00 00 00 00 00
|
||||
08 04 02 02 02 04 08 00 00 00 00 00 00 00 00 00
|
||||
00 08 2A 1C 1C 2A 08 00 00 00 00 00 00 00 00 00
|
||||
00 08 08 3E 08 08 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 08 08 10 00 00 00 00 00 00 00 00
|
||||
00 00 00 3E 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 08 00 00 00 00 00 00 00 00 00
|
||||
00 02 04 08 10 20 00 00 00 00 00 00 00 00 00 00
|
||||
1C 22 26 2A 32 22 1C 00 00 00 00 00 00 00 00 00
|
||||
08 18 08 08 08 08 1C 00 00 00 00 00 00 00 00 00
|
||||
1C 22 02 1C 20 20 3E 00 00 00 00 00 00 00 00 00
|
||||
1C 22 02 04 02 22 1C 00 00 00 00 00 00 00 00 00
|
||||
04 0C 14 24 3E 04 04 00 00 00 00 00 00 00 00 00
|
||||
3E 20 3C 02 02 02 3C 00 00 00 00 00 00 00 00 00
|
||||
1C 20 20 3C 22 22 1C 00 00 00 00 00 00 00 00 00
|
||||
3E 02 04 08 10 20 20 00 00 00 00 00 00 00 00 00
|
||||
1C 22 22 1C 22 22 1C 00 00 00 00 00 00 00 00 00
|
||||
1C 22 22 1E 02 02 1C 00 00 00 00 00 00 00 00 00
|
||||
00 00 08 00 00 08 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 08 00 00 08 08 10 00 00 00 00 00 00 00 00
|
||||
04 08 10 20 10 08 04 00 00 00 00 00 00 00 00 00
|
||||
00 00 3E 00 3E 00 00 00 00 00 00 00 00 00 00 00
|
||||
10 08 04 02 04 08 10 00 00 00 00 00 00 00 00 00
|
||||
1C 22 02 04 08 00 08 00 00 00 00 00 00 00 00 00
|
||||
1C 22 02 1A 2A 2A 1C 00 00 00 00 00 00 00 00 00
|
||||
08 14 22 22 3E 22 22 00 00 00 00 00 00 00 00 00
|
||||
3C 12 12 1C 12 12 3C 00 00 00 00 00 00 00 00 00
|
||||
1C 22 20 20 20 22 1C 00 00 00 00 00 00 00 00 00
|
||||
3C 12 12 12 12 12 3C 00 00 00 00 00 00 00 00 00
|
||||
3E 20 20 3C 20 20 3E 00 00 00 00 00 00 00 00 00
|
||||
3E 20 20 3C 20 20 20 00 00 00 00 00 00 00 00 00
|
||||
1E 20 20 26 22 22 1C 00 00 00 00 00 00 00 00 00
|
||||
22 22 22 3E 22 22 22 00 00 00 00 00 00 00 00 00
|
||||
1C 08 08 08 08 08 1C 00 00 00 00 00 00 00 00 00
|
||||
02 02 02 02 22 22 1C 00 00 00 00 00 00 00 00 00
|
||||
22 24 28 30 28 24 22 00 00 00 00 00 00 00 00 00
|
||||
20 20 20 20 20 20 3E 00 00 00 00 00 00 00 00 00
|
||||
22 36 2A 2A 22 22 22 00 00 00 00 00 00 00 00 00
|
||||
22 32 2A 26 22 22 22 00 00 00 00 00 00 00 00 00
|
||||
1C 22 22 22 22 22 1C 00 00 00 00 00 00 00 00 00
|
||||
3C 22 22 3C 20 20 20 00 00 00 00 00 00 00 00 00
|
||||
1C 22 22 22 2A 24 1A 00 00 00 00 00 00 00 00 00
|
||||
3C 22 22 3C 28 24 22 00 00 00 00 00 00 00 00 00
|
||||
1C 22 10 08 04 22 1C 00 00 00 00 00 00 00 00 00
|
||||
3E 08 08 08 08 08 08 00 00 00 00 00 00 00 00 00
|
||||
22 22 22 22 22 22 1C 00 00 00 00 00 00 00 00 00
|
||||
22 22 22 14 14 08 08 00 00 00 00 00 00 00 00 00
|
||||
22 22 22 2A 2A 36 22 00 00 00 00 00 00 00 00 00
|
||||
22 22 14 08 14 22 22 00 00 00 00 00 00 00 00 00
|
||||
22 22 14 08 08 08 08 00 00 00 00 00 00 00 00 00
|
||||
3E 02 04 08 10 20 3E 00 00 00 00 00 00 00 00 00
|
||||
38 20 20 20 20 20 38 00 00 00 00 00 00 00 00 00
|
||||
20 20 10 08 04 02 02 00 00 00 00 00 00 00 00 00
|
||||
0E 02 02 02 02 02 0E 00 00 00 00 00 00 00 00 00
|
||||
08 1C 2A 08 08 08 08 00 00 00 00 00 00 00 00 00
|
||||
00 08 10 3E 10 08 00 00 00 00 00 00 00 00 00 00
|
||||
08 14 22 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 1C 02 1E 22 1E 00 00 00 00 00 00 00 00 00
|
||||
20 20 2C 32 22 32 2C 00 00 00 00 00 00 00 00 00
|
||||
00 00 1C 22 20 22 1C 00 00 00 00 00 00 00 00 00
|
||||
02 02 1A 26 22 26 1A 00 00 00 00 00 00 00 00 00
|
||||
00 00 1C 22 3E 20 1C 00 00 00 00 00 00 00 00 00
|
||||
04 0A 08 1C 08 08 08 00 00 00 00 00 00 00 00 00
|
||||
00 00 1A 26 26 1A 02 1C 00 00 00 00 00 00 00 00
|
||||
20 20 2C 32 22 22 22 00 00 00 00 00 00 00 00 00
|
||||
00 08 00 18 08 08 1C 00 00 00 00 00 00 00 00 00
|
||||
00 02 00 02 02 02 22 1C 00 00 00 00 00 00 00 00
|
||||
20 20 24 28 30 28 24 00 00 00 00 00 00 00 00 00
|
||||
18 08 08 08 08 08 1C 00 00 00 00 00 00 00 00 00
|
||||
00 00 14 2A 2A 2A 2A 00 00 00 00 00 00 00 00 00
|
||||
00 00 2C 32 22 22 22 00 00 00 00 00 00 00 00 00
|
||||
00 00 1C 22 22 22 1C 00 00 00 00 00 00 00 00 00
|
||||
00 00 2C 32 32 2C 20 20 00 00 00 00 00 00 00 00
|
||||
00 00 1A 26 26 1A 02 02 00 00 00 00 00 00 00 00
|
||||
00 00 2C 32 20 20 20 00 00 00 00 00 00 00 00 00
|
||||
00 00 1E 20 1C 02 3C 00 00 00 00 00 00 00 00 00
|
||||
10 10 38 10 10 12 0C 00 00 00 00 00 00 00 00 00
|
||||
00 00 22 22 22 26 1A 00 00 00 00 00 00 00 00 00
|
||||
00 00 22 22 22 14 08 00 00 00 00 00 00 00 00 00
|
||||
00 00 22 2A 2A 14 14 00 00 00 00 00 00 00 00 00
|
||||
00 00 22 14 08 14 22 00 00 00 00 00 00 00 00 00
|
||||
00 00 22 22 22 1E 02 1C 00 00 00 00 00 00 00 00
|
||||
00 00 3E 04 08 10 3E 00 00 00 00 00 00 00 00 00
|
||||
08 10 10 20 10 10 08 00 00 00 00 00 00 00 00 00
|
||||
08 08 08 00 08 08 08 00 00 00 00 00 00 00 00 00
|
||||
08 04 04 02 04 04 08 00 00 00 00 00 00 00 00 00
|
||||
10 2A 04 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 3E 00 00 00 00 00 00 00 00 00
|
||||
00 00 1C 22 20 20 20 22 1C 08 00 00 00 00 00 00
|
||||
00 00 22 00 22 22 22 26 1A 00 00 00 00 00 00 00
|
||||
00 00 04 08 1C 22 3E 20 1C 00 00 00 00 00 00 00
|
||||
00 00 08 14 1C 02 1E 22 1E 00 00 00 00 00 00 00
|
||||
00 00 14 00 1C 02 1E 22 1E 00 00 00 00 00 00 00
|
||||
00 00 10 08 1C 02 1E 22 1E 00 00 00 00 00 00 00
|
||||
00 00 08 00 1C 02 1E 22 1E 00 00 00 00 00 00 00
|
||||
00 00 00 00 1C 22 20 22 1C 08 00 00 00 00 00 00
|
||||
00 00 08 14 1C 22 3E 20 1C 00 00 00 00 00 00 00
|
||||
00 00 14 00 1C 22 3E 20 1C 00 00 00 00 00 00 00
|
||||
00 00 10 08 1C 22 3E 20 1C 00 00 00 00 00 00 00
|
||||
00 00 14 00 18 08 08 08 1C 00 00 00 00 00 00 00
|
||||
00 00 08 14 00 18 08 08 1C 00 00 00 00 00 00 00
|
||||
00 00 00 0C 12 1C 12 12 1C 20 00 00 00 00 00 00
|
||||
00 00 22 08 14 22 3E 22 22 00 00 00 00 00 00 00
|
||||
00 00 08 08 14 22 3E 22 22 00 00 00 00 00 00 00
|
||||
00 00 04 08 1C 22 22 22 1C 00 00 00 00 00 00 00
|
||||
00 00 00 00 34 0A 1E 28 1E 00 00 00 00 00 00 00
|
||||
00 00 1E 28 28 3C 28 28 2C 00 00 00 00 00 00 00
|
||||
00 00 08 14 1C 22 22 22 1C 00 00 00 00 00 00 00
|
||||
00 00 14 00 1C 22 22 22 1C 00 00 00 00 00 00 00
|
||||
00 00 00 00 1C 26 2E 32 1C 00 00 00 00 00 00 00
|
||||
00 00 08 14 00 22 22 26 1A 00 00 00 00 00 00 00
|
||||
00 00 10 08 22 22 22 26 1A 00 00 00 00 00 00 00
|
||||
00 00 1C 26 2A 2A 2A 32 1C 00 00 00 00 00 00 00
|
||||
00 00 22 1C 22 22 22 22 1C 00 00 00 00 00 00 00
|
||||
00 00 14 22 22 22 22 22 1C 00 00 00 00 00 00 00
|
||||
00 00 1C 20 1C 22 1C 02 1C 00 00 00 00 00 00 00
|
||||
00 00 04 0A 08 1C 08 0A 3C 00 00 00 00 00 00 00
|
||||
00 00 08 08 3E 08 08 00 3E 00 00 00 00 00 00 00
|
||||
00 00 04 0A 04 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 04 0A 08 1C 08 08 28 10 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 08 08 08 08 08 00 08 00 00 00 00 00 00 00
|
||||
00 00 14 14 14 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 14 14 3E 14 3E 14 14 00 00 00 00 00 00 00
|
||||
00 00 08 1E 28 1C 0A 3C 08 00 00 00 00 00 00 00
|
||||
00 00 32 32 04 08 10 26 26 00 00 00 00 00 00 00
|
||||
00 00 10 28 28 10 2A 24 1A 00 00 00 00 00 00 00
|
||||
00 00 08 08 10 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 08 10 20 20 20 10 08 00 00 00 00 00 00 00
|
||||
00 00 08 04 02 02 02 04 08 00 00 00 00 00 00 00
|
||||
00 00 00 08 2A 1C 1C 2A 08 00 00 00 00 00 00 00
|
||||
00 00 00 08 08 3E 08 08 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 08 08 10 00 00 00 00 00 00
|
||||
00 00 00 00 00 3E 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00
|
||||
00 00 00 02 04 08 10 20 00 00 00 00 00 00 00 00
|
||||
00 00 1C 22 26 2A 32 22 1C 00 00 00 00 00 00 00
|
||||
00 00 08 18 08 08 08 08 1C 00 00 00 00 00 00 00
|
||||
00 00 1C 22 02 1C 20 20 3E 00 00 00 00 00 00 00
|
||||
00 00 1C 22 02 04 02 22 1C 00 00 00 00 00 00 00
|
||||
00 00 04 0C 14 24 3E 04 04 00 00 00 00 00 00 00
|
||||
00 00 3E 20 3C 02 02 02 3C 00 00 00 00 00 00 00
|
||||
00 00 1C 20 20 3C 22 22 1C 00 00 00 00 00 00 00
|
||||
00 00 3E 02 04 08 10 20 20 00 00 00 00 00 00 00
|
||||
00 00 1C 22 22 1C 22 22 1C 00 00 00 00 00 00 00
|
||||
00 00 1C 22 22 1E 02 02 1C 00 00 00 00 00 00 00
|
||||
00 00 00 00 08 00 00 08 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 08 00 00 08 08 10 00 00 00 00 00 00
|
||||
00 00 04 08 10 20 10 08 04 00 00 00 00 00 00 00
|
||||
00 00 00 00 3E 00 3E 00 00 00 00 00 00 00 00 00
|
||||
00 00 10 08 04 02 04 08 10 00 00 00 00 00 00 00
|
||||
00 00 1C 22 02 04 08 00 08 00 00 00 00 00 00 00
|
||||
00 00 1C 22 02 1A 2A 2A 1C 00 00 00 00 00 00 00
|
||||
00 00 08 14 22 22 3E 22 22 00 00 00 00 00 00 00
|
||||
00 00 3C 12 12 1C 12 12 3C 00 00 00 00 00 00 00
|
||||
00 00 1C 22 20 20 20 22 1C 00 00 00 00 00 00 00
|
||||
00 00 3C 12 12 12 12 12 3C 00 00 00 00 00 00 00
|
||||
00 00 3E 20 20 3C 20 20 3E 00 00 00 00 00 00 00
|
||||
00 00 3E 20 20 3C 20 20 20 00 00 00 00 00 00 00
|
||||
00 00 1E 20 20 26 22 22 1C 00 00 00 00 00 00 00
|
||||
00 00 22 22 22 3E 22 22 22 00 00 00 00 00 00 00
|
||||
00 00 1C 08 08 08 08 08 1C 00 00 00 00 00 00 00
|
||||
00 00 02 02 02 02 22 22 1C 00 00 00 00 00 00 00
|
||||
00 00 22 24 28 30 28 24 22 00 00 00 00 00 00 00
|
||||
00 00 20 20 20 20 20 20 3E 00 00 00 00 00 00 00
|
||||
00 00 22 36 2A 2A 22 22 22 00 00 00 00 00 00 00
|
||||
00 00 22 32 2A 26 22 22 22 00 00 00 00 00 00 00
|
||||
00 00 1C 22 22 22 22 22 1C 00 00 00 00 00 00 00
|
||||
00 00 3C 22 22 3C 20 20 20 00 00 00 00 00 00 00
|
||||
00 00 1C 22 22 22 2A 24 1A 00 00 00 00 00 00 00
|
||||
00 00 3C 22 22 3C 28 24 22 00 00 00 00 00 00 00
|
||||
00 00 1C 22 10 08 04 22 1C 00 00 00 00 00 00 00
|
||||
00 00 3E 08 08 08 08 08 08 00 00 00 00 00 00 00
|
||||
00 00 22 22 22 22 22 22 1C 00 00 00 00 00 00 00
|
||||
00 00 22 22 22 14 14 08 08 00 00 00 00 00 00 00
|
||||
00 00 22 22 22 2A 2A 36 22 00 00 00 00 00 00 00
|
||||
00 00 22 22 14 08 14 22 22 00 00 00 00 00 00 00
|
||||
00 00 22 22 14 08 08 08 08 00 00 00 00 00 00 00
|
||||
00 00 3E 02 04 08 10 20 3E 00 00 00 00 00 00 00
|
||||
00 00 38 20 20 20 20 20 38 00 00 00 00 00 00 00
|
||||
00 00 20 20 10 08 04 02 02 00 00 00 00 00 00 00
|
||||
00 00 0E 02 02 02 02 02 0E 00 00 00 00 00 00 00
|
||||
00 00 08 1C 2A 08 08 08 08 00 00 00 00 00 00 00
|
||||
00 00 00 08 10 3E 10 08 00 00 00 00 00 00 00 00
|
||||
00 00 08 14 22 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 1C 02 1E 22 1E 00 00 00 00 00 00 00
|
||||
00 00 20 20 2C 32 22 32 2C 00 00 00 00 00 00 00
|
||||
00 00 00 00 1C 22 20 22 1C 00 00 00 00 00 00 00
|
||||
00 00 02 02 1A 26 22 26 1A 00 00 00 00 00 00 00
|
||||
00 00 00 00 1C 22 3E 20 1C 00 00 00 00 00 00 00
|
||||
00 00 04 0A 08 1C 08 08 08 00 00 00 00 00 00 00
|
||||
00 00 00 00 1A 26 26 1A 02 1C 00 00 00 00 00 00
|
||||
00 00 20 20 2C 32 22 22 22 00 00 00 00 00 00 00
|
||||
00 00 00 08 00 18 08 08 1C 00 00 00 00 00 00 00
|
||||
00 00 00 02 00 02 02 02 22 1C 00 00 00 00 00 00
|
||||
00 00 20 20 24 28 30 28 24 00 00 00 00 00 00 00
|
||||
00 00 18 08 08 08 08 08 1C 00 00 00 00 00 00 00
|
||||
00 00 00 00 14 2A 2A 2A 2A 00 00 00 00 00 00 00
|
||||
00 00 00 00 2C 32 22 22 22 00 00 00 00 00 00 00
|
||||
00 00 00 00 1C 22 22 22 1C 00 00 00 00 00 00 00
|
||||
00 00 00 00 2C 32 32 2C 20 20 00 00 00 00 00 00
|
||||
00 00 00 00 1A 26 26 1A 02 02 00 00 00 00 00 00
|
||||
00 00 00 00 2C 32 20 20 20 00 00 00 00 00 00 00
|
||||
00 00 00 00 1E 20 1C 02 3C 00 00 00 00 00 00 00
|
||||
00 00 10 10 38 10 10 12 0C 00 00 00 00 00 00 00
|
||||
00 00 00 00 22 22 22 26 1A 00 00 00 00 00 00 00
|
||||
00 00 00 00 22 22 22 14 08 00 00 00 00 00 00 00
|
||||
00 00 00 00 22 2A 2A 14 14 00 00 00 00 00 00 00
|
||||
00 00 00 00 22 14 08 14 22 00 00 00 00 00 00 00
|
||||
00 00 00 00 22 22 22 1E 02 1C 00 00 00 00 00 00
|
||||
00 00 00 00 3E 04 08 10 3E 00 00 00 00 00 00 00
|
||||
00 00 08 10 10 20 10 10 08 00 00 00 00 00 00 00
|
||||
00 00 08 08 08 00 08 08 08 00 00 00 00 00 00 00
|
||||
00 00 08 04 04 02 04 04 08 00 00 00 00 00 00 00
|
||||
00 00 10 2A 04 00 00 00 00 00 00 00 00 00 00 00
|
||||
00 00 00 00 00 00 00 00 3E 00 00 00 00 00 00 00
|
||||
@@ -1,102 +0,0 @@
|
||||
//============================================================================
|
||||
// Verilog conversions of the CoCo3 ROM entities in rtl/rom/*.vhd.
|
||||
//
|
||||
// Line-for-line translations: same entity names, same ports, same clocking.
|
||||
// The three loadable ROMs are single-clock RAMs filled over ioctl; while a
|
||||
// write is in progress the read register holds its previous value, exactly as
|
||||
// the VHDL `if WRITE = '1' ... else DATA <= ...` does.
|
||||
//============================================================================
|
||||
|
||||
// rtl/rom/coco_rom_32K.vhd -- CoCo3 system ROM (boot0.rom, ioctl index 0)
|
||||
module COCO_ROM_32K
|
||||
(
|
||||
input [14:0] ADDR,
|
||||
output reg [7:0] DATA,
|
||||
input CLK,
|
||||
input [14:0] WR_ADDR,
|
||||
input [7:0] WR_DATA,
|
||||
input WRITE
|
||||
);
|
||||
reg [7:0] ROM [0:32767];
|
||||
always @(posedge CLK) begin
|
||||
if (WRITE) ROM[WR_ADDR] <= WR_DATA;
|
||||
else DATA <= ROM[ADDR];
|
||||
end
|
||||
endmodule
|
||||
|
||||
// rtl/rom/coco_rom_8K.vhd -- Disk BASIC ROM (boot1.rom, ioctl index 64)
|
||||
module COCO_ROM_8K
|
||||
(
|
||||
input [12:0] ADDR,
|
||||
output reg [7:0] DATA,
|
||||
input CLK,
|
||||
input [12:0] WR_ADDR,
|
||||
input [7:0] WR_DATA,
|
||||
input WRITE
|
||||
);
|
||||
reg [7:0] ROM [0:8191];
|
||||
always @(posedge CLK) begin
|
||||
if (WRITE) ROM[WR_ADDR] <= WR_DATA;
|
||||
else DATA <= ROM[ADDR];
|
||||
end
|
||||
endmodule
|
||||
|
||||
// rtl/rom/coco_rom_cart.vhd -- Program Pak, up to 128K (ioctl index 1)
|
||||
module COCO_ROM_CART
|
||||
(
|
||||
input [16:0] ADDR,
|
||||
output reg [7:0] DATA,
|
||||
input CLK,
|
||||
input [16:0] WR_ADDR,
|
||||
input [7:0] WR_DATA,
|
||||
input WRITE
|
||||
);
|
||||
reg [7:0] ROM [0:131071];
|
||||
always @(posedge CLK) begin
|
||||
if (WRITE) ROM[WR_ADDR] <= WR_DATA;
|
||||
else DATA <= ROM[ADDR];
|
||||
end
|
||||
endmodule
|
||||
|
||||
// rtl/rom/coco_rom_16.vhd -- the AMW (automatic memory write) script: three
|
||||
// {valid, a24..a0, data} records followed by a terminator. Asynchronous.
|
||||
module COCO_ROM_16
|
||||
(
|
||||
input [3:0] ADDR,
|
||||
output reg [7:0] DATA
|
||||
);
|
||||
always @(*) begin
|
||||
case (ADDR)
|
||||
// Clear $71 [Warm Start Flag]
|
||||
4'd0: DATA = 8'h80; 4'd1: DATA = 8'h07; 4'd2: DATA = 8'h00;
|
||||
4'd3: DATA = 8'h71; 4'd4: DATA = 8'h00;
|
||||
// Set $C000 <- $55 [Clear D in DK identifier in rom]
|
||||
4'd5: DATA = 8'h80; 4'd6: DATA = 8'h07; 4'd7: DATA = 8'hC0;
|
||||
4'd8: DATA = 8'h00; 4'd9: DATA = 8'h55;
|
||||
// Clear $72 [Warm Start Jump]
|
||||
4'd10: DATA = 8'h80; 4'd11: DATA = 8'h07; 4'd12: DATA = 8'h00;
|
||||
4'd13: DATA = 8'h72; 4'd14: DATA = 8'h00;
|
||||
// terminator
|
||||
default: DATA = 8'h00;
|
||||
endcase
|
||||
end
|
||||
endmodule
|
||||
|
||||
// rtl/rom/coco3_char_rom.vhd -- 4K font RAM, preloaded with the CoCo3 font
|
||||
// (verilator/rtl/coco3_char_rom.mem, extracted from the VHDL by gen_mem.py).
|
||||
// Separate write and registered-read clocks, as in the VHDL.
|
||||
module coco3_Char_ROM
|
||||
(
|
||||
input RD_CLK,
|
||||
input [11:0] ADDR_R,
|
||||
output reg [7:0] DATA_R,
|
||||
input WR_CLK,
|
||||
input WE,
|
||||
input [11:0] ADDR_W,
|
||||
input [7:0] DATA_W
|
||||
);
|
||||
reg [7:0] RAM [0:4095];
|
||||
initial $readmemh("rtl/coco3_char_rom.mem", RAM);
|
||||
always @(posedge WR_CLK) if (WE) RAM[ADDR_W] <= DATA_W;
|
||||
always @(posedge RD_CLK) DATA_R <= RAM[ADDR_R];
|
||||
endmodule
|
||||
@@ -1,33 +0,0 @@
|
||||
//============================================================================
|
||||
// Verilog conversions of rtl/sram/*.vhd: synchronous write, asynchronous
|
||||
// read, matching the VHDL (`DATA_O <= SRAM(ADDR)` outside the process).
|
||||
//============================================================================
|
||||
|
||||
// rtl/sram/coco_ram.vhd -- 64K cassette buffer (R_W low = write)
|
||||
module COCO_SRAM
|
||||
(
|
||||
input CLK,
|
||||
input [15:0] ADDR,
|
||||
input R_W,
|
||||
input [7:0] DATA_I,
|
||||
output [7:0] DATA_O
|
||||
);
|
||||
reg [7:0] SRAM [0:65535];
|
||||
always @(posedge CLK) if (!R_W) SRAM[ADDR] <= DATA_I;
|
||||
assign DATA_O = SRAM[ADDR];
|
||||
endmodule
|
||||
|
||||
// rtl/sram/coco_vid_ram_buf.vhd -- 512 x 16 video line buffer
|
||||
module COCO_VID_RAM_BUF
|
||||
(
|
||||
input CLK,
|
||||
input [8:0] ADDR_I,
|
||||
input [8:0] ADDR_O,
|
||||
input WE,
|
||||
input [15:0] DATA_I,
|
||||
output [15:0] DATA_O
|
||||
);
|
||||
reg [15:0] SRAM [0:511];
|
||||
always @(posedge CLK) if (WE) SRAM[ADDR_I] <= DATA_I;
|
||||
assign DATA_O = SRAM[ADDR_O];
|
||||
endmodule
|
||||
@@ -1,111 +0,0 @@
|
||||
// Verilog translation of rtl/OVO.vhd (the debug / "NO ROM" text overlay) for the
|
||||
// simulation, since the simulator cannot read VHDL. Same ports, generics and timing: two
|
||||
// cycles of video delay, probes latched at Hcount = Vcount = 0, 8x8 font.
|
||||
//
|
||||
// VHDL bit order: vin0/vin1 are (0 TO COLS*5-1), so character 0 is the
|
||||
// leftmost 5 bits of in0/in1, i.e. the first entry of the concatenation in
|
||||
// coco3fpga.sv; a font row's bit 0 is the leftmost pixel.
|
||||
|
||||
module ovo #(
|
||||
parameter COLS = 32,
|
||||
parameter LINES = 2,
|
||||
parameter RGB = 24'hFFFFFF,
|
||||
parameter H_OFFSET = 4,
|
||||
parameter V_OFFSET = 45
|
||||
) (
|
||||
input [7:0] i_r,
|
||||
input [7:0] i_g,
|
||||
input [7:0] i_b,
|
||||
input i_clk,
|
||||
|
||||
input [10:0] i_Hcount,
|
||||
input [9:0] i_VCount,
|
||||
|
||||
output reg [7:0] o_r,
|
||||
output reg [7:0] o_g,
|
||||
output reg [7:0] o_b,
|
||||
|
||||
input ena,
|
||||
|
||||
input [COLS*5-1:0] in0,
|
||||
input [COLS*5-1:0] in1
|
||||
);
|
||||
|
||||
localparam N = COLS*5;
|
||||
|
||||
reg [7:0] chars [0:255];
|
||||
initial begin
|
||||
{chars[ 0],chars[ 1],chars[ 2],chars[ 3],chars[ 4],chars[ 5],chars[ 6],chars[ 7]} = 64'h3E63737B6F673E00; // 0
|
||||
{chars[ 8],chars[ 9],chars[ 10],chars[ 11],chars[ 12],chars[ 13],chars[ 14],chars[ 15]} = 64'h0C0E0C0C0C0C3F00; // 1
|
||||
{chars[ 16],chars[ 17],chars[ 18],chars[ 19],chars[ 20],chars[ 21],chars[ 22],chars[ 23]} = 64'h1E33301C06333F00; // 2
|
||||
{chars[ 24],chars[ 25],chars[ 26],chars[ 27],chars[ 28],chars[ 29],chars[ 30],chars[ 31]} = 64'h1E33301C30331E00; // 3
|
||||
{chars[ 32],chars[ 33],chars[ 34],chars[ 35],chars[ 36],chars[ 37],chars[ 38],chars[ 39]} = 64'h383C36337F307800; // 4
|
||||
{chars[ 40],chars[ 41],chars[ 42],chars[ 43],chars[ 44],chars[ 45],chars[ 46],chars[ 47]} = 64'h3F031F3030331E00; // 5
|
||||
{chars[ 48],chars[ 49],chars[ 50],chars[ 51],chars[ 52],chars[ 53],chars[ 54],chars[ 55]} = 64'h1C06031F33331E00; // 6
|
||||
{chars[ 56],chars[ 57],chars[ 58],chars[ 59],chars[ 60],chars[ 61],chars[ 62],chars[ 63]} = 64'h3F3330180C0C0C00; // 7
|
||||
{chars[ 64],chars[ 65],chars[ 66],chars[ 67],chars[ 68],chars[ 69],chars[ 70],chars[ 71]} = 64'h1E33331E33331E00; // 8
|
||||
{chars[ 72],chars[ 73],chars[ 74],chars[ 75],chars[ 76],chars[ 77],chars[ 78],chars[ 79]} = 64'h1E33333E30180E00; // 9
|
||||
{chars[ 80],chars[ 81],chars[ 82],chars[ 83],chars[ 84],chars[ 85],chars[ 86],chars[ 87]} = 64'h0C1E33333F333300; // A
|
||||
{chars[ 88],chars[ 89],chars[ 90],chars[ 91],chars[ 92],chars[ 93],chars[ 94],chars[ 95]} = 64'h3F66663E66663F00; // B
|
||||
{chars[ 96],chars[ 97],chars[ 98],chars[ 99],chars[100],chars[101],chars[102],chars[103]} = 64'h3C66030303663C00; // C
|
||||
{chars[104],chars[105],chars[106],chars[107],chars[108],chars[109],chars[110],chars[111]} = 64'h1F36666666361F00; // D
|
||||
{chars[112],chars[113],chars[114],chars[115],chars[116],chars[117],chars[118],chars[119]} = 64'h7F46161E16467F00; // E
|
||||
{chars[120],chars[121],chars[122],chars[123],chars[124],chars[125],chars[126],chars[127]} = 64'h7F46161E16060F00; // F
|
||||
{chars[128],chars[129],chars[130],chars[131],chars[132],chars[133],chars[134],chars[135]} = 64'h0000000000000000; // ' ' 10
|
||||
{chars[136],chars[137],chars[138],chars[139],chars[140],chars[141],chars[142],chars[143]} = 64'h00003F00003F0000; // = 11
|
||||
{chars[144],chars[145],chars[146],chars[147],chars[148],chars[149],chars[150],chars[151]} = 64'h000C0C3F0C0C0000; // + 12
|
||||
{chars[152],chars[153],chars[154],chars[155],chars[156],chars[157],chars[158],chars[159]} = 64'h0000003F00000000; // - 13
|
||||
{chars[160],chars[161],chars[162],chars[163],chars[164],chars[165],chars[166],chars[167]} = 64'h180C0603060C1800; // < 14
|
||||
{chars[168],chars[169],chars[170],chars[171],chars[172],chars[173],chars[174],chars[175]} = 64'h060C1830180C0600; // > 15
|
||||
{chars[176],chars[177],chars[178],chars[179],chars[180],chars[181],chars[182],chars[183]} = 64'h081C366341000000; // ^ 16
|
||||
{chars[184],chars[185],chars[186],chars[187],chars[188],chars[189],chars[190],chars[191]} = 64'h081C366341000000; // v 17
|
||||
{chars[192],chars[193],chars[194],chars[195],chars[196],chars[197],chars[198],chars[199]} = 64'h180C0606060C1800; // ( 18
|
||||
{chars[200],chars[201],chars[202],chars[203],chars[204],chars[205],chars[206],chars[207]} = 64'h060C1818180C0600; // ) 19
|
||||
{chars[208],chars[209],chars[210],chars[211],chars[212],chars[213],chars[214],chars[215]} = 64'h000C0C00000C0C00; // : 1A
|
||||
{chars[216],chars[217],chars[218],chars[219],chars[220],chars[221],chars[222],chars[223]} = 64'h4143454951614100; // N 1B
|
||||
{chars[224],chars[225],chars[226],chars[227],chars[228],chars[229],chars[230],chars[231]} = 64'h3E41414141413E00; // O 1C
|
||||
{chars[232],chars[233],chars[234],chars[235],chars[236],chars[237],chars[238],chars[239]} = 64'h3F41413F11214100; // R 1D
|
||||
{chars[240],chars[241],chars[242],chars[243],chars[244],chars[245],chars[246],chars[247]} = 64'h4163554941414100; // M 1E
|
||||
{chars[248],chars[249],chars[250],chars[251],chars[252],chars[253],chars[254],chars[255]} = 64'h36367F367F363600; // # 1F
|
||||
end
|
||||
|
||||
reg [N-1:0] in0s, in1s, vin0, vin1;
|
||||
reg [7:0] t_r, t_g, t_b;
|
||||
reg [11:0] hcpt, hcpt2, vcpt;
|
||||
reg [7:0] col;
|
||||
|
||||
wire [N-1:0] vin_v = vcpt[3] ? vin1 : vin0; // (vcpt/8) mod 2
|
||||
wire [11:0] cidx = hcpt >> 3;
|
||||
wire [4:0] char_v = (hcpt < COLS*8 && vcpt < LINES*8) ? vin_v[N-1-cidx*5 -: 5] : 5'b10000;
|
||||
|
||||
always @(posedge i_clk) begin
|
||||
in0s <= in0;
|
||||
in1s <= in1;
|
||||
|
||||
t_r <= i_r;
|
||||
t_g <= i_g;
|
||||
t_b <= i_b;
|
||||
|
||||
if (i_Hcount == 0 && i_VCount == 0) begin
|
||||
vin0 <= in0s;
|
||||
vin1 <= in1s;
|
||||
end
|
||||
|
||||
hcpt <= (i_Hcount < H_OFFSET) ? COLS*8 : {1'b0, i_Hcount} - H_OFFSET;
|
||||
vcpt <= (i_VCount < V_OFFSET) ? 12'd512 : {2'b0, i_VCount} - V_OFFSET;
|
||||
hcpt2 <= hcpt;
|
||||
|
||||
col <= chars[{char_v, vcpt[2:0]}];
|
||||
|
||||
if (ena && col[hcpt2[2:0]]) begin
|
||||
o_r <= RGB[23:16];
|
||||
o_g <= RGB[15:8];
|
||||
o_b <= RGB[7:0];
|
||||
end else begin
|
||||
o_r <= t_r;
|
||||
o_g <= t_g;
|
||||
o_b <= t_b;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
@@ -1,327 +0,0 @@
|
||||
//============================================================================
|
||||
// Simulation replacement for rtl/sdram/sdram2.sv (module sdram_32r8w).
|
||||
//
|
||||
// The controller below is rtl/sdram/sdram2.sv copied verbatim -- the same
|
||||
// state machine, refresh schedule, CAS/burst delays and ack/ready timing the
|
||||
// core is written against. Only the pins changed:
|
||||
//
|
||||
// - SDRAM_DQ is not a tristate. The controller's drive is SDRAM_DQ (a reg
|
||||
// that it sets to 16'bZ when idle, harmless here) and what it samples is
|
||||
// chip_dq, driven by the chip model at the bottom of this file.
|
||||
// - The block-local registers of the main always block are declared at
|
||||
// module scope instead; see the note there.
|
||||
// - The altddio_out that forwards the (inverted) clock to the chip is gone;
|
||||
// the chip model samples the controller's registered command one clk
|
||||
// later, which is where the inverted SDRAM_CLK edge lands.
|
||||
//
|
||||
// Chip model: one 32 MB x16 SDR SDRAM, CAS latency 3, sequential burst 2,
|
||||
// single-word writes, DQM byte masks on A[12:11] -- the mode sdram2.sv
|
||||
// programs. A READ registered at clk edge k (command <= CMD_READ) makes word 0
|
||||
// land in dq_reg at edge k+4 and word 1 at k+5, which is exactly when the
|
||||
// controller's data_*_ready_delay taps say the data is there.
|
||||
//============================================================================
|
||||
module sdram_32r8w
|
||||
(
|
||||
input init, // reset to initialize RAM
|
||||
input clk, // clock ~100MHz
|
||||
|
||||
// CPU R/W port
|
||||
input [24:0] sdram_cpu_addr, // 25 bit address for 8bit mode.
|
||||
output [15:0] sdram_dout, // data output to cpu [for both ports]
|
||||
input [7:0] sdram_cpu_din, // data input from cpu
|
||||
input sdram_cpu_req, // request
|
||||
input sdram_cpu_rnw, // 1 - read, 0 - write
|
||||
output reg sdram_cpu_ack, // 1 = ack
|
||||
output reg sdram_cpu_ready, // dout is valid. Ready to accept new read/write.
|
||||
|
||||
// Video R port
|
||||
input [24:0] sdram_vid_addr, // 25 bit A0=0.
|
||||
input sdram_vid_req, // request
|
||||
output reg sdram_vid_ack, // 1 = ack
|
||||
output reg sdram_vid_ready, // dout is valid. Ready to accept new read/write.
|
||||
|
||||
output reg sdram_busy // doing something...
|
||||
);
|
||||
|
||||
reg [15:0] SDRAM_DQ;
|
||||
reg [12:0] SDRAM_A;
|
||||
reg [1:0] SDRAM_BA;
|
||||
reg [15:0] chip_dq;
|
||||
|
||||
|
||||
assign sdram_dout = dq_reg;
|
||||
|
||||
// Burst length = 4
|
||||
localparam BURST_LENGTH = 2;
|
||||
localparam BURST_CODE = (BURST_LENGTH == 8) ? 3'b011 : (BURST_LENGTH == 4) ? 3'b010 : (BURST_LENGTH == 2) ? 3'b001 : 3'b000; // 000=1, 001=2, 010=4, 011=8
|
||||
localparam ACCESS_TYPE = 1'b0; // 0=sequential, 1=interleaved
|
||||
localparam CAS_LATENCY = 3'd3; // 2 for < 100MHz, 3 for >100MHz
|
||||
localparam OP_MODE = 2'b00; // only 00 (standard operation) allowed
|
||||
localparam NO_WRITE_BURST = 1'b1; // 0= write burst enabled, 1=only single access write
|
||||
localparam MODE = {3'b000, NO_WRITE_BURST, OP_MODE, CAS_LATENCY, ACCESS_TYPE, BURST_CODE};
|
||||
|
||||
localparam sdram_startup_cycles= 14'd12100;// 100us, plus a little more, @ 100MHz
|
||||
localparam startup_refresh_max = 14'b11111111111111;
|
||||
//localparam cycles_per_refresh = 14'd780; // (64000*100)/8192-1 Calc'd as (64ms @ 100MHz)/8192 rose
|
||||
localparam cycles_per_refresh = 14'd890; // (64000*100)/8192-1 Calc'd as (64ms @ 114.560MHz)/8192 rose (act 895)
|
||||
|
||||
// SDRAM commands
|
||||
wire [2:0] CMD_NOP = 3'b111;
|
||||
wire [2:0] CMD_ACTIVE = 3'b011;
|
||||
wire [2:0] CMD_READ = 3'b101;
|
||||
wire [2:0] CMD_WRITE = 3'b100;
|
||||
wire [2:0] CMD_PRECHARGE = 3'b010;
|
||||
wire [2:0] CMD_AUTO_REFRESH = 3'b001;
|
||||
wire [2:0] CMD_LOAD_MODE = 3'b000;
|
||||
|
||||
reg [13:0] refresh_count = startup_refresh_max - sdram_startup_cycles;
|
||||
reg [2:0] command;
|
||||
|
||||
localparam STATE_STARTUP = 0;
|
||||
localparam STATE_WAIT = 1;
|
||||
localparam STATE_WAIT1 = 2;
|
||||
localparam STATE_RW1 = 3;
|
||||
localparam STATE_IDLE = 4;
|
||||
localparam STATE_DLY1 = 5;
|
||||
localparam STATE_DLY2 = 6;
|
||||
localparam STATE_IDLE_7 = 17;
|
||||
localparam STATE_IDLE_6 = 16;
|
||||
localparam STATE_IDLE_5 = 15;
|
||||
localparam STATE_IDLE_4 = 14;
|
||||
localparam STATE_IDLE_3 = 13;
|
||||
localparam STATE_IDLE_2 = 12;
|
||||
localparam STATE_IDLE_1 = 11;
|
||||
|
||||
reg [15:0] dq_reg;
|
||||
|
||||
// In the original these are declared inside the always block below, with
|
||||
// `state` initialised there. Verilator (5.044) re-applies a block-local
|
||||
// initialiser every time the block runs, so `state` was forced back to
|
||||
// STATE_STARTUP on every clock and no request was ever served. At module scope
|
||||
// the initialiser runs once, as Quartus treats it.
|
||||
reg [CAS_LATENCY+BURST_LENGTH:0] data_cpu_ready_delay;
|
||||
reg [CAS_LATENCY+BURST_LENGTH:0] data_vid_ready_delay;
|
||||
|
||||
reg saved_wr;
|
||||
reg saved_vid;
|
||||
reg [12:0] cas_addr;
|
||||
reg [31:0] saved_data;
|
||||
reg [4:0] state = STATE_STARTUP;
|
||||
|
||||
always @(posedge clk) begin
|
||||
|
||||
refresh_count <= refresh_count + 1'b1;
|
||||
|
||||
data_vid_ready_delay[CAS_LATENCY+BURST_LENGTH] <= 0;
|
||||
|
||||
data_cpu_ready_delay[CAS_LATENCY+BURST_LENGTH] <= 0;
|
||||
|
||||
data_cpu_ready_delay <= data_cpu_ready_delay>>1;
|
||||
data_vid_ready_delay <= data_vid_ready_delay>>1;
|
||||
|
||||
dq_reg <= chip_dq;
|
||||
|
||||
// if(data_ready_delay[1]) sdram_ldout[15:00] <= dq_reg;
|
||||
// if(data_ready_delay[0]) sdram_ldout[31:16] <= dq_reg;
|
||||
|
||||
sdram_cpu_ready <= 1'b0;
|
||||
sdram_vid_ready <= 1'b0;
|
||||
|
||||
if (data_cpu_ready_delay[2]) sdram_cpu_ready <= 1'b1; // Data valid for the first 16 bits
|
||||
if (data_cpu_ready_delay[1]) sdram_busy <= 1'b0;
|
||||
|
||||
if (data_vid_ready_delay[2]) sdram_vid_ready <= 1'b1; // Data valid for the first 16 bits
|
||||
if (data_vid_ready_delay[1]) sdram_vid_ready <= 1'b1; // Data valid for the second 16 bits
|
||||
|
||||
if (data_vid_ready_delay[0]) sdram_busy <= 1'b0;
|
||||
|
||||
|
||||
SDRAM_DQ <= 16'h0000; // was 16'bZ: the bus is not tristated here
|
||||
|
||||
command <= CMD_NOP;
|
||||
|
||||
if (!sdram_cpu_req)
|
||||
sdram_cpu_ack <= 1'b0;
|
||||
|
||||
if (!sdram_vid_req)
|
||||
sdram_vid_ack <= 1'b0;
|
||||
|
||||
case (state)
|
||||
STATE_STARTUP: begin
|
||||
SDRAM_A <= 0;
|
||||
SDRAM_BA <= 0;
|
||||
sdram_cpu_ready <= 0; //not ready
|
||||
sdram_vid_ready <= 0; //not ready
|
||||
sdram_busy <= 1'b1;
|
||||
|
||||
// All the commands during the startup are NOPS, except these
|
||||
if (refresh_count == startup_refresh_max-31) begin
|
||||
// ensure all rows are closed
|
||||
command <= CMD_PRECHARGE;
|
||||
SDRAM_A[10] <= 1; // all banks
|
||||
SDRAM_BA <= 2'b00;
|
||||
end
|
||||
if (refresh_count == startup_refresh_max-23) begin
|
||||
// these refreshes need to be at least tREF (66ns) apart
|
||||
command <= CMD_AUTO_REFRESH;
|
||||
end
|
||||
if (refresh_count == startup_refresh_max-15) begin
|
||||
command <= CMD_AUTO_REFRESH;
|
||||
end
|
||||
if (refresh_count == startup_refresh_max-7) begin
|
||||
// Now load the mode register
|
||||
command <= CMD_LOAD_MODE;
|
||||
SDRAM_A <= MODE;
|
||||
end
|
||||
|
||||
if (!refresh_count) begin
|
||||
state <= STATE_IDLE;
|
||||
sdram_busy <= 1'b0;
|
||||
refresh_count <= 0;
|
||||
end
|
||||
end
|
||||
|
||||
STATE_IDLE_7: state <= STATE_IDLE_6;
|
||||
STATE_IDLE_6: state <= STATE_IDLE_5;
|
||||
STATE_IDLE_5: state <= STATE_IDLE_4;
|
||||
STATE_IDLE_4: state <= STATE_IDLE_3;
|
||||
STATE_IDLE_3: state <= STATE_IDLE_2;
|
||||
STATE_IDLE_2: state <= STATE_IDLE_1;
|
||||
STATE_IDLE_1: begin
|
||||
state <= STATE_IDLE;
|
||||
sdram_busy <= 1'b0;
|
||||
// mask possible refresh to reduce colliding.
|
||||
if(refresh_count > cycles_per_refresh) begin
|
||||
state <= STATE_IDLE_7;
|
||||
command <= CMD_AUTO_REFRESH;
|
||||
refresh_count <= 0;
|
||||
sdram_busy <= 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
STATE_IDLE: begin
|
||||
saved_vid <= 1'b0;
|
||||
if(refresh_count > (cycles_per_refresh<<1))
|
||||
begin
|
||||
state <= STATE_IDLE_1;
|
||||
sdram_busy <= 1'b1;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if(sdram_cpu_req & !sdram_cpu_ack) // request has to go away after ready=0
|
||||
begin
|
||||
// fix byte writes [no new command until data is actually written]
|
||||
if (~sdram_cpu_rnw)
|
||||
{cas_addr[12:9],SDRAM_BA,SDRAM_A,cas_addr[8:0]} <= {~sdram_cpu_addr[0], sdram_cpu_addr[0], 2'b10, sdram_cpu_addr[24:1]}; // Bytes by A0 for writes
|
||||
else
|
||||
{cas_addr[12:9],SDRAM_BA,SDRAM_A,cas_addr[8:0]} <= {2'b00, 2'b10, sdram_cpu_addr[24:1]}; // No bytes for reads...
|
||||
|
||||
saved_data <= {sdram_cpu_din, sdram_cpu_din};
|
||||
saved_wr <= ~sdram_cpu_rnw;
|
||||
command <= CMD_ACTIVE;
|
||||
state <= STATE_WAIT;
|
||||
sdram_busy <= 1'b1;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if (sdram_vid_req)
|
||||
begin
|
||||
{cas_addr[12:9],SDRAM_BA,SDRAM_A,cas_addr[8:0]} <= {2'b00, 2'b10, sdram_vid_addr[24:1]}; // No bytes for reads...
|
||||
command <= CMD_ACTIVE;
|
||||
saved_vid <= 1'b1;
|
||||
saved_wr <= 1'b0;
|
||||
sdram_busy <= 1'b1;
|
||||
state <= STATE_WAIT;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
STATE_WAIT: state <= STATE_WAIT1;
|
||||
STATE_WAIT1: begin
|
||||
if (saved_wr)
|
||||
begin
|
||||
if ((data_vid_ready_delay[5:1] == 5'b00000) && (data_cpu_ready_delay[5:1] == 5'b00000))
|
||||
state <= STATE_RW1; // added for clk > 100Mhz
|
||||
end
|
||||
else
|
||||
state <= STATE_RW1; // added for clk > 100Mhz
|
||||
end
|
||||
|
||||
STATE_RW1: begin
|
||||
SDRAM_A <= cas_addr;
|
||||
if (saved_vid)
|
||||
sdram_vid_ack <= 1'b1;
|
||||
else
|
||||
sdram_cpu_ack <= 1'b1;
|
||||
|
||||
if(saved_wr) begin
|
||||
command <= CMD_WRITE;
|
||||
SDRAM_DQ <= saved_data[15:0];
|
||||
// state <= STATE_IDLE;
|
||||
state <= STATE_DLY1;
|
||||
sdram_cpu_ready <= 1'b1; // write done
|
||||
sdram_busy <= 1'b0;
|
||||
end
|
||||
else begin
|
||||
command <= CMD_READ;
|
||||
state <= STATE_IDLE;
|
||||
if (saved_vid)
|
||||
begin
|
||||
data_vid_ready_delay[CAS_LATENCY+BURST_LENGTH] <= 1;
|
||||
state <= STATE_DLY1;
|
||||
end
|
||||
else
|
||||
data_cpu_ready_delay[CAS_LATENCY+BURST_LENGTH] <= 1;
|
||||
state <= STATE_DLY1;
|
||||
end
|
||||
end
|
||||
STATE_DLY1:
|
||||
state <= STATE_DLY2;
|
||||
STATE_DLY2:
|
||||
state <= STATE_IDLE;
|
||||
endcase
|
||||
|
||||
if (init) begin
|
||||
sdram_cpu_ack <= 1'b0;
|
||||
sdram_vid_ack <= 1'b0;
|
||||
state <= STATE_STARTUP;
|
||||
refresh_count <= startup_refresh_max - sdram_startup_cycles;
|
||||
end
|
||||
end
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// SDR SDRAM chip model
|
||||
//----------------------------------------------------------------------------
|
||||
reg [15:0] chip_mem [0:(1<<24)-1];
|
||||
reg [12:0] chip_row [0:3];
|
||||
|
||||
reg rd_p1, rd_p2, rd_w1;
|
||||
reg [23:0] rd_a1, rd_a2, rd_aw;
|
||||
|
||||
wire [23:0] cmd_addr = {SDRAM_BA, chip_row[SDRAM_BA], SDRAM_A[8:0]};
|
||||
|
||||
always @(posedge clk) begin
|
||||
case (command)
|
||||
3'b011: chip_row[SDRAM_BA] <= SDRAM_A; // ACTIVE
|
||||
3'b100: begin // WRITE
|
||||
if (!SDRAM_A[11]) chip_mem[cmd_addr][7:0] <= SDRAM_DQ[7:0];
|
||||
if (!SDRAM_A[12]) chip_mem[cmd_addr][15:8] <= SDRAM_DQ[15:8];
|
||||
end
|
||||
default: ;
|
||||
endcase
|
||||
|
||||
// READ: two pipeline stages, then word 0 and word 1 on consecutive edges.
|
||||
rd_p1 <= (command == 3'b101);
|
||||
rd_a1 <= cmd_addr;
|
||||
rd_p2 <= rd_p1;
|
||||
rd_a2 <= rd_a1;
|
||||
rd_w1 <= rd_p2;
|
||||
rd_aw <= {rd_a2[23:1], ~rd_a2[0]}; // burst 2, sequential
|
||||
|
||||
if (rd_p2) chip_dq <= chip_mem[rd_a2];
|
||||
else if (rd_w1) chip_dq <= chip_mem[rd_aw];
|
||||
else chip_dq <= 16'h0000;
|
||||
end
|
||||
|
||||
endmodule
|
||||
@@ -1,32 +0,0 @@
|
||||
0000 0010 0020 0030 0040 0050 0060 0070
|
||||
0080 0090 00A0 00B0 00C0 00D0 00E0 00F0
|
||||
0100 0110 0120 0130 0140 0150 0160 0170
|
||||
0180 0190 01A0 01B0 01C0 01D0 01E0 01F0
|
||||
0200 0210 0220 0230 0240 0250 0260 0270
|
||||
0280 0290 02A0 02B0 02C0 02D0 02E0 02F0
|
||||
0300 0310 0320 0330 0340 0350 0360 0370
|
||||
0380 0390 03A0 03B0 03C0 03D0 03E0 03F0
|
||||
0400 0410 0420 0430 0440 0450 0460 0470
|
||||
0480 0490 04A0 04B0 04C0 04D0 04E0 04F0
|
||||
0500 0510 0520 0530 0540 0550 0560 0570
|
||||
0580 0590 05A0 05B0 05C0 05D0 05E0 05F0
|
||||
0600 0610 0620 0630 0640 0650 0660 0670
|
||||
0680 0690 06A0 06B0 06C0 06D0 06E0 06F0
|
||||
0700 0710 0720 0730 0740 0750 0760 0770
|
||||
0780 0790 07A0 07B0 07C0 07D0 07E0 07F0
|
||||
0800 0810 0820 0830 0840 0850 0860 0870
|
||||
0880 0890 08A0 08B0 08C0 08D0 08E0 08F0
|
||||
0900 0910 0920 0930 0940 0950 0960 0970
|
||||
0980 0990 09A0 09B0 09C0 09D0 09E0 09F0
|
||||
0A00 0A10 0A20 0A30 0A40 0A50 0A60 0A70
|
||||
0A80 0A90 0AA0 0AB0 0AC0 0AD0 0AE0 0AF0
|
||||
0B00 0B10 0B20 0B30 0B40 0B50 0B60 0B70
|
||||
0B80 0B90 0BA0 0BB0 0BC0 0BD0 0BE0 0BF0
|
||||
0C00 0C10 0C20 0C30 0C40 0C50 0C60 0C70
|
||||
0C80 0C90 0CA0 0CB0 0CC0 0CD0 0CE0 0CF0
|
||||
0D00 0D10 0D20 0D30 0D40 0D50 0D60 0D70
|
||||
0D80 0D90 0DA0 0DB0 0DC0 0DD0 0DE0 0DF0
|
||||
0E00 0E10 0E20 0E30 0E40 0E50 0E60 0E70
|
||||
0E80 0E90 0EA0 0EB0 0EC0 0ED0 0EE0 0EF0
|
||||
0F00 0F10 0F20 0F30 0F40 0F50 0F60 0F70
|
||||
0F80 0F90 0FA0 0FB0 0FC0 0FD0 0FE0 0FF0
|
||||
@@ -1,112 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Headless smoke tests for the CoCo3 sim. Each test boots the machine, types at
|
||||
# BASIC on a frame schedule, and is judged two ways:
|
||||
#
|
||||
# * the TEXT SCREEN ($0400, as the CPU wrote it) must contain every expected
|
||||
# string -- this is what says the machine did the right thing;
|
||||
# * the final SCREENSHOT is compared byte for byte with $REF/<name>.png --
|
||||
# this is what catches a video change nobody meant to make.
|
||||
#
|
||||
# The sim is deterministic, so a screenshot only moves when the RTL (or the
|
||||
# harness) moves it. When a change is intentional, bless the new references:
|
||||
#
|
||||
# BLESS=1 ./run_tests.sh
|
||||
#
|
||||
# A test with no reference is reported "new" and does not fail the run.
|
||||
# Tests run in parallel; each is a few minutes (the sim runs at ~1.2 frames/s,
|
||||
# and the core's own power-on reset plus the BASIC banner take ~130 frames).
|
||||
#
|
||||
# ./run_tests.sh all tests
|
||||
# ./run_tests.sh boot disk just those
|
||||
#
|
||||
# Needs roms/boot0.rom (CoCo3 ROM) and roms/boot1.rom (Disk BASIC 1.1); see
|
||||
# README.md.
|
||||
|
||||
set -u
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
EXE=./obj_dir/Vemu
|
||||
OUT=${OUT:-test-out}
|
||||
SIMARGS=${SIMARGS:-} # extra sim options for every test, e.g. --fast-clocks
|
||||
REF=${REF:-test-ref}
|
||||
mkdir -p "$OUT" "$REF"
|
||||
|
||||
if [ ! -x "$EXE" ]; then echo "build first: make"; exit 2; fi
|
||||
for r in roms/boot0.rom roms/boot1.rom; do
|
||||
[ -f "$r" ] || { echo "missing $r -- see README.md"; exit 2; }
|
||||
done
|
||||
[ -f tests/hello.dsk ] || python3 tests/make_test_disk.py >/dev/null
|
||||
|
||||
# name | stop frame | extra args | expected strings (;-separated)
|
||||
TESTS=(
|
||||
"boot|150||DISK EXTENDED COLOR BASIC 2.1;OK"
|
||||
"keyboard|260|--type '140:PRINT 2+2\\n'|PRINT 2+2; 4"
|
||||
"disk|420|--disk tests/hello.dsk --type '140:RUN\"HELLO\\n'|HELLO FROM DISK; 42"
|
||||
# GIME modes. --ascii only reads the 32-column VDG screen, so these two are
|
||||
# judged on the screenshot alone.
|
||||
"width80|330|--type '140:WIDTH 80\\nPRINT \"80 COLUMNS\"\\n'|"
|
||||
"hscreen|560|--type '140:HSCREEN2:HCIRCLE(160,96),60,4:HLINE(0,0)-(319,191),PSET,B:FORI=1TO9E9:NEXT\\n'|"
|
||||
)
|
||||
|
||||
want=("$@")
|
||||
selected() {
|
||||
[ ${#want[@]} -eq 0 ] && return 0
|
||||
for w in "${want[@]}"; do [ "$w" = "$1" ] && return 0; done
|
||||
return 1
|
||||
}
|
||||
|
||||
pids=()
|
||||
names=()
|
||||
for t in "${TESTS[@]}"; do
|
||||
IFS='|' read -r name stop extra expect <<<"$t"
|
||||
selected "$name" || continue
|
||||
# shellcheck disable=SC2086
|
||||
eval "set -- $extra"
|
||||
# shellcheck disable=SC2086
|
||||
( "$EXE" --headless --stop-at-frame "$stop" $SIMARGS "$@" \
|
||||
--screenshot "$stop" --screenshot-prefix "$OUT/$name" --ascii-end \
|
||||
> "$OUT/$name.log" 2>&1 ) &
|
||||
pids+=($!)
|
||||
names+=("$name")
|
||||
done
|
||||
|
||||
for p in "${pids[@]}"; do wait "$p"; done
|
||||
|
||||
fail=0
|
||||
printf "%-10s %-6s %-9s %s\n" TEST SCREEN IMAGE NOTES
|
||||
for t in "${TESTS[@]}"; do
|
||||
IFS='|' read -r name stop extra expect <<<"$t"
|
||||
selected "$name" || continue
|
||||
log="$OUT/$name.log"
|
||||
shot=$(printf "%s/%s_frame_%04d.png" "$OUT" "$name" "$stop")
|
||||
notes=""
|
||||
|
||||
screen=ok
|
||||
if [ -n "$expect" ]; then # bash 3.2: an empty array is "unbound" under set -u
|
||||
IFS=';' read -r -a strings <<<"$expect"
|
||||
for s in "${strings[@]}"; do
|
||||
if ! grep -qF -- "|$s" "$log"; then screen=FAIL; notes="$notes missing \"$s\";"; fi
|
||||
done
|
||||
else
|
||||
screen=-
|
||||
fi
|
||||
|
||||
image=ok
|
||||
if [ ! -f "$shot" ]; then
|
||||
image=FAIL; notes="$notes no screenshot;"
|
||||
elif [ -n "${BLESS:-}" ]; then
|
||||
cp "$shot" "$REF/$name.png"; image=blessed
|
||||
elif [ ! -f "$REF/$name.png" ]; then
|
||||
image=new
|
||||
elif ! cmp -s "$shot" "$REF/$name.png"; then
|
||||
image=CHANGED; notes="$notes differs from $REF/$name.png;"
|
||||
fi
|
||||
|
||||
[ "$screen" = FAIL ] && fail=1
|
||||
[ "$image" = FAIL ] || [ "$image" = CHANGED ] && fail=1
|
||||
notes="$notes $(grep -o 'Finished at frame.*' "$log" | sed 's/, active.*//')"
|
||||
printf "%-10s %-6s %-9s %s\n" "$name" "$screen" "$image" "$notes"
|
||||
done
|
||||
|
||||
exit $fail
|
||||
@@ -1,172 +0,0 @@
|
||||
#include "serial.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cerrno>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static const double CLK_SYS_HZ = 57272727.0;
|
||||
static const int XTAL_DIV = 31; // coco3fpga.sv CLK_6551_EN
|
||||
static const size_t HIST_MAX = 4096;
|
||||
|
||||
// uart_6551.v: TX_CLK_DIV wraps after this many enables for CTL[3:0]; the
|
||||
// baud clock toggles on each wrap and pulses on every second one.
|
||||
static const int wrap_enables[16] = {
|
||||
0, 1152, 768, 524, 428, 384, 192, 96, 48, 32, 24, 16, 12, 8, 6, 3
|
||||
};
|
||||
|
||||
long SerialPort::bit_clks(uint8_t ctl) {
|
||||
int sel = ctl & 0x0F;
|
||||
// CTL[3:0] == 0: "16x external clock", which in this core is the
|
||||
// 1.8475 MHz enable itself -- 115,469 baud.
|
||||
long enables_per_16x = sel ? 2L * wrap_enables[sel] : 1L;
|
||||
return XTAL_DIV * enables_per_16x * 16;
|
||||
}
|
||||
|
||||
long SerialPort::rx_bit_clks(uint8_t ctl) {
|
||||
// uart_6551.v: RX_CLK = TX_CLK, i.e. the receiver always runs off the baud
|
||||
// generator. (It used to take the "external" 1.8475 MHz clock when CTL bit 4
|
||||
// was 0, which made CTL=$0F transmit at 19,200 but receive at 115,200.)
|
||||
return bit_clks(ctl);
|
||||
}
|
||||
|
||||
double SerialPort::baud(long clks) { return CLK_SYS_HZ / (double)clks; }
|
||||
|
||||
bool SerialPort::open_pty() {
|
||||
pty_fd = posix_openpt(O_RDWR | O_NOCTTY);
|
||||
if (pty_fd < 0 || grantpt(pty_fd) < 0 || unlockpt(pty_fd) < 0) {
|
||||
perror("serial: posix_openpt");
|
||||
return false;
|
||||
}
|
||||
const char* name = ptsname(pty_fd);
|
||||
if (!name) { perror("serial: ptsname"); return false; }
|
||||
pty_name = name;
|
||||
// Hold the slave open ourselves: otherwise reads on the master return EIO
|
||||
// until something connects, and again whenever the far end reconnects.
|
||||
pty_slave_fd = open(name, O_RDWR | O_NOCTTY);
|
||||
if (pty_slave_fd >= 0) {
|
||||
struct termios t;
|
||||
if (tcgetattr(pty_slave_fd, &t) == 0) {
|
||||
cfmakeraw(&t);
|
||||
tcsetattr(pty_slave_fd, TCSANOW, &t);
|
||||
}
|
||||
}
|
||||
fcntl(pty_fd, F_SETFL, fcntl(pty_fd, F_GETFL) | O_NONBLOCK);
|
||||
printf("Serial: RS-232 Pak on pty %s\n", name);
|
||||
fflush(stdout);
|
||||
return true;
|
||||
}
|
||||
|
||||
void SerialPort::queue_rx(const uint8_t* p, size_t n) {
|
||||
rx_queue.insert(rx_queue.end(), p, p + n);
|
||||
}
|
||||
|
||||
void SerialPort::poll_pty() {
|
||||
if (pty_fd < 0) return;
|
||||
uint8_t buf[256];
|
||||
ssize_t n = read(pty_fd, buf, sizeof(buf));
|
||||
if (n > 0) queue_rx(buf, (size_t)n);
|
||||
}
|
||||
|
||||
void SerialPort::got_tx_byte(uint8_t b, bool framing_ok, int frame) {
|
||||
tx_count++;
|
||||
if (!framing_ok) tx_framing_errors++;
|
||||
tx_hist.push_back(b);
|
||||
if (tx_hist.size() > HIST_MAX) tx_hist.erase(tx_hist.begin());
|
||||
tx_line.push_back(b);
|
||||
if (log_file)
|
||||
fprintf(log_file, "%6d TX %02X%s\n", frame, b, framing_ok ? "" : " framing error");
|
||||
if (pty_fd >= 0) {
|
||||
ssize_t w = write(pty_fd, &b, 1);
|
||||
(void)w;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t SerialPort::clock(uint8_t txd, uint8_t ctl_now, uint8_t cmd_now, int frame) {
|
||||
ctl = ctl_now;
|
||||
cmd = cmd_now;
|
||||
|
||||
// ---- TX: decode what the 6551 puts on the pin ---------------------
|
||||
const long bclk = bit_clks(ctl);
|
||||
switch (tx_phase) {
|
||||
case 0:
|
||||
if (tx_last && !txd) { tx_phase = 1; tx_timer = bclk / 2; }
|
||||
break;
|
||||
case 1: // middle of the start bit
|
||||
if (--tx_timer <= 0) {
|
||||
if (txd) tx_phase = 0; // glitch, not a start bit
|
||||
else { tx_phase = 2; tx_timer = bclk; tx_bitn = 0; tx_shift = 0; }
|
||||
}
|
||||
break;
|
||||
case 2: // data bits, LSB first
|
||||
if (--tx_timer <= 0) {
|
||||
tx_shift |= (uint16_t)(txd & 1) << tx_bitn;
|
||||
tx_timer = bclk;
|
||||
if (++tx_bitn == data_bits(ctl)) tx_phase = (cmd & 0x20) ? 3 : 4;
|
||||
}
|
||||
break;
|
||||
case 3: // parity (not checked)
|
||||
if (--tx_timer <= 0) { tx_phase = 4; tx_timer = bclk; }
|
||||
break;
|
||||
case 4: // stop bit
|
||||
if (--tx_timer <= 0) {
|
||||
got_tx_byte((uint8_t)tx_shift, txd != 0, frame);
|
||||
tx_phase = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
tx_last = txd;
|
||||
|
||||
// ---- RX: drive the pin, 8N1 at the far end's rate -------------------
|
||||
if (++poll_timer >= 4096) { poll_timer = 0; poll_pty(); }
|
||||
if (rx_timer > 0) rx_timer--;
|
||||
if (rx_timer == 0) {
|
||||
if (rx_bits_left == 0 && !rx_queue.empty()) {
|
||||
uint8_t b = rx_queue.front();
|
||||
rx_queue.pop_front();
|
||||
rx_count++;
|
||||
rx_hist.push_back(b);
|
||||
if (rx_hist.size() > HIST_MAX) rx_hist.erase(rx_hist.begin());
|
||||
rx_line.push_back(b);
|
||||
if (log_file) fprintf(log_file, "%6d RX %02X\n", frame, b);
|
||||
rx_frame = (uint16_t)(1u << 9) | ((uint16_t)b << 1); // start 0, data, stop 1
|
||||
rx_bits_left = 10;
|
||||
}
|
||||
if (rx_bits_left > 0) {
|
||||
// Each bit, the stop bit included, is held for a full bit time.
|
||||
rx_level = rx_frame & 1;
|
||||
rx_frame >>= 1;
|
||||
rx_bits_left--;
|
||||
rx_timer = line_clks();
|
||||
} else {
|
||||
rx_level = 1;
|
||||
}
|
||||
}
|
||||
return rx_level;
|
||||
}
|
||||
|
||||
void SerialPort::print_line(const char* dir, std::vector<uint8_t>& v, int frame) {
|
||||
if (v.empty()) return;
|
||||
if (print_bytes) {
|
||||
for (size_t i = 0; i < v.size(); i += 16) {
|
||||
char hex[16 * 3 + 1] = {0}, asc[17] = {0};
|
||||
size_t n = std::min<size_t>(16, v.size() - i);
|
||||
for (size_t j = 0; j < n; j++) {
|
||||
uint8_t c = v[i + j];
|
||||
snprintf(hex + j * 3, 4, "%02X ", c);
|
||||
asc[j] = (c >= 0x20 && c < 0x7f) ? (char)c : '.';
|
||||
}
|
||||
printf("SERIAL %s %6d %-48s |%s|\n", dir, frame, hex, asc);
|
||||
}
|
||||
fflush(stdout);
|
||||
}
|
||||
v.clear();
|
||||
}
|
||||
|
||||
void SerialPort::end_frame(int frame) {
|
||||
print_line("TX", tx_line, frame);
|
||||
print_line("RX", rx_line, frame);
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
#pragma once
|
||||
//============================================================================
|
||||
// RS-232 Pak (glb6551) line model for the CoCo3 sim.
|
||||
//
|
||||
// Works on the pins, not on the registers: TXD is decoded as the far end of
|
||||
// the cable would see it, and RXD is driven bit by bit. So a byte is only
|
||||
// logged as transmitted if the 6551 really shifted it out, at the baud rate
|
||||
// it was really programmed for.
|
||||
//
|
||||
// Clocked once per clk_sys (57.272727 MHz). Bit timing follows
|
||||
// rtl/UART_6551/uart_6551.v: a 1.8475 MHz enable (clk_sys / 31) feeds the
|
||||
// divider; the 6551 samples at 16x the bit rate.
|
||||
//
|
||||
// Optional pty bridge: the slave side (/dev/ttysNNN) can be opened by a
|
||||
// DriveWire server or FujiNet-PC, or by socat to reach a TCP one. Note the sim
|
||||
// runs ~50x slower than real time, so the far end sees ~400 baud of real
|
||||
// throughput whatever the programmed rate is.
|
||||
//============================================================================
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct SerialPort {
|
||||
// --- configuration -------------------------------------------------
|
||||
bool print_bytes = true; // SERIAL TX/RX lines on stdout
|
||||
FILE* log_file = nullptr; // --serial-log: one line per byte
|
||||
// Rate the far end sends at, in clk_sys cycles per bit. 0 = the rate the
|
||||
// 6551 transmits at, i.e. a peer configured to match. RXD is driven at this
|
||||
// rate whatever the 6551's RECEIVER is clocked at, so a receiver-clock
|
||||
// mismatch shows up as garbage, as it would on the cable.
|
||||
long line_bit_clks = 0;
|
||||
long line_clks() const { return line_bit_clks ? line_bit_clks : bit_clks(ctl); }
|
||||
|
||||
// --- state visible to the UI ----------------------------------------
|
||||
std::string pty_name;
|
||||
long tx_count = 0, rx_count = 0;
|
||||
long tx_framing_errors = 0;
|
||||
std::vector<uint8_t> tx_hist, rx_hist; // capped, for the Serial window
|
||||
uint8_t ctl = 0, cmd = 0; // last seen 6551 registers
|
||||
|
||||
// Bits per word and clk_sys cycles per bit for a control/command value.
|
||||
static int data_bits(uint8_t ctl) { return 8 - ((ctl >> 5) & 3); }
|
||||
static long bit_clks(uint8_t ctl); // transmitter / internal generator
|
||||
static long rx_bit_clks(uint8_t ctl); // receiver (CTL bit 4 picks the source)
|
||||
static double baud(long clks);
|
||||
|
||||
bool open_pty();
|
||||
void queue_rx(const uint8_t* p, size_t n);
|
||||
|
||||
// One clk_sys cycle. Returns the level to drive on RXD.
|
||||
uint8_t clock(uint8_t txd, uint8_t ctl, uint8_t cmd, int frame);
|
||||
|
||||
// Flush the per-frame byte lines.
|
||||
void end_frame(int frame);
|
||||
|
||||
private:
|
||||
// TX decoder
|
||||
int tx_phase = 0; // 0 idle, 1 start, 2 data, 3 parity, 4 stop
|
||||
long tx_timer = 0;
|
||||
int tx_bitn = 0;
|
||||
uint16_t tx_shift = 0;
|
||||
uint8_t tx_last = 1;
|
||||
// RX driver
|
||||
std::deque<uint8_t> rx_queue;
|
||||
uint16_t rx_frame = 0; // bits to send, LSB first
|
||||
int rx_bits_left = 0;
|
||||
long rx_timer = 0;
|
||||
uint8_t rx_level = 1;
|
||||
// pty
|
||||
int pty_fd = -1, pty_slave_fd = -1;
|
||||
long poll_timer = 0;
|
||||
// per-frame print buffers
|
||||
std::vector<uint8_t> tx_line, rx_line;
|
||||
|
||||
void got_tx_byte(uint8_t b, bool framing_ok, int frame);
|
||||
void poll_pty();
|
||||
void print_line(const char* dir, std::vector<uint8_t>& v, int frame);
|
||||
};
|
||||
-571
@@ -1,571 +0,0 @@
|
||||
//============================================================================
|
||||
// CoCo3 Verilator simulation wrapper
|
||||
//
|
||||
// Stands in for CoCo3.sv (the MiSTer top level) without the sys/ framework:
|
||||
// no hps_io, no PLL, no video_mixer. sim_main.cpp drives the clocks and the
|
||||
// ioctl/block-device/keyboard ports; everything between those and the core
|
||||
// is wired the way CoCo3.sv wires it, with the OSD `status` word decoded
|
||||
// here by the same expressions.
|
||||
//
|
||||
// Deliberate differences from CoCo3.sv:
|
||||
// - CLK_114/57/28/14 come straight from sim_main instead of the PLL. The PLL
|
||||
// makes them 114.545454 / 57.272727 / 28.636363 / 14.318181 MHz, all
|
||||
// phase 0, i.e. exact /2 /4 /8 divisions of one clock, which is what
|
||||
// sim_main produces -- all four change in the same eval, so there is no
|
||||
// derived-clock race between domains. CLK_50M (rtc.sv, the UART) is
|
||||
// approximated by sim_main with a phase accumulator.
|
||||
// - rtl/sdram/sdram2.sv is replaced by verilator/rtl/sdram2.sv: the same
|
||||
// controller with an SDR chip model hung off it instead of SDRAM_* pins.
|
||||
// - hps_io's keyboard path is reproduced from its parts: ps2_key events are
|
||||
// turned into scan-code bytes and pushed into MiSTer's own ps2_device
|
||||
// (sys/hps_io.sv) clocked exactly as hps_io clocks it with PS2DIV(2400),
|
||||
// so cocokey.v sees the same PS/2 serial stream as on hardware.
|
||||
// - The VHDL entities are replaced by their Verilog conversions in this
|
||||
// directory: rtl/coco_rom.v, rtl/coco_sram.v. VDAC.v's altsyncram becomes an
|
||||
// equivalent registered dual-port RAM.
|
||||
//============================================================================
|
||||
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
module emu
|
||||
(
|
||||
input CLK_114,
|
||||
input CLK_57, // clk_sys
|
||||
input CLK_28,
|
||||
input CLK_14,
|
||||
input CLK_50M,
|
||||
input RESET,
|
||||
|
||||
// The OSD status word, bit-for-bit as hps_io would present it.
|
||||
input [63:0] status,
|
||||
input [1:0] buttons,
|
||||
|
||||
// [7:0] scancode, [8] extended, [9] pressed, [10] toggles per event
|
||||
input [10:0] ps2_key,
|
||||
input [24:0] ps2_mouse,
|
||||
|
||||
input [31:0] joy1,
|
||||
input [31:0] joy2,
|
||||
input [15:0] joya1,
|
||||
input [15:0] joya2,
|
||||
|
||||
input [64:0] RTC,
|
||||
|
||||
// HPS ioctl download
|
||||
input ioctl_download,
|
||||
input ioctl_wr,
|
||||
input [24:0] ioctl_addr,
|
||||
input [7:0] ioctl_dout,
|
||||
input [7:0] ioctl_index,
|
||||
output ioctl_wait,
|
||||
|
||||
// MiSTer block device (VDNUM 7): 0-1 SDC, 2-5 floppy, 6 cassette write.
|
||||
// Widths match SimBlockDevice's member types.
|
||||
input [15:0] img_mounted,
|
||||
input img_readonly,
|
||||
input [63:0] img_size,
|
||||
output [31:0] sd_lba [7],
|
||||
output [15:0] sd_rd,
|
||||
output [15:0] sd_wr,
|
||||
input [15:0] sd_ack,
|
||||
input [8:0] sd_buff_addr,
|
||||
input [7:0] sd_buff_dout,
|
||||
output [7:0] sd_buff_din [7],
|
||||
input sd_buff_wr,
|
||||
|
||||
output [7:0] VGA_R,
|
||||
output [7:0] VGA_G,
|
||||
output [7:0] VGA_B,
|
||||
output VGA_HS,
|
||||
output VGA_VS,
|
||||
output VGA_HB,
|
||||
output VGA_VB,
|
||||
output CE_PIXEL, // coco3fpga PIX_CLK: a clk_sys enable; sample RGB/syncs on a clk_sys rising edge when high
|
||||
|
||||
output [15:0] AUDIO_L,
|
||||
output [15:0] AUDIO_R,
|
||||
|
||||
// RS-232 Pak (glb6551 at $FF68-$FF6B). On MiSTer these are the UART_* pins
|
||||
// of the sys framework (the FujiNet daemon's /dev/ttyS1); here sim_main
|
||||
// decodes TXD and drives RXD. Idle is 1.
|
||||
output uart_txd,
|
||||
input uart_rxd,
|
||||
output uart_rts,
|
||||
output uart_dtr,
|
||||
|
||||
// ---- debug taps ----------------------------------------------------
|
||||
// Hierarchical reads into the core; nothing here drives it.
|
||||
output [15:0] dbg_pc,
|
||||
output [7:0] dbg_a, dbg_b, dbg_cc, dbg_dp,
|
||||
output [15:0] dbg_x, dbg_y, dbg_u, dbg_s,
|
||||
output dbg_lic, // last instruction cycle
|
||||
output [15:0] dbg_addr,
|
||||
output [7:0] dbg_din, // data into the CPU
|
||||
output [7:0] dbg_dout, // data out of the CPU
|
||||
output dbg_rw, // 1 = read
|
||||
output dbg_ena, // cpu_cycle_ena: the CPU advances on this
|
||||
output dbg_irqn,
|
||||
output dbg_firqn,
|
||||
output dbg_reset, // CPU_RESET
|
||||
output [7:0] dbg_gime_init0, // $FF90
|
||||
output [2:0] dbg_speed, // assigned_turbo_speed
|
||||
|
||||
// ACIA / Multi-Pak state, for the serial trace
|
||||
output dbg_rs232_en, // $FF68-$FF6B decoded to the 6551 this cycle
|
||||
output [1:0] dbg_mpi_scs, // $FF7F SCS (I/O slot, 0 = slot 1)
|
||||
output [1:0] dbg_mpi_cts, // $FF7F CTS (ROM slot)
|
||||
output [7:0] dbg_acia_ctl, // 6551 control register (baud in [3:0])
|
||||
output [7:0] dbg_acia_cmd // 6551 command register
|
||||
);
|
||||
|
||||
// The OSD word as the core sees it. hps_io hands `status` over as a register;
|
||||
// registering it here too keeps it off the top-level input path. Verilator
|
||||
// re-evaluates everything combinational on a top-level input at EVERY eval,
|
||||
// and status feeds the video pixel mux (artifact/colour-set options), so as a
|
||||
// raw input it cost ~20% of the run time.
|
||||
reg [63:0] status_q = 64'd0;
|
||||
always @(posedge CLK_14) status_q <= status;
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// status decode -- copied from CoCo3.sv
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
wire clk_sys = CLK_57;
|
||||
|
||||
wire [2:0] turbo_speed = status_q[34:32];
|
||||
wire [2:0] assigned_turbo_speed;
|
||||
wire [1:0] art = status_q[38:37];
|
||||
wire [1:0] Auto_Mode = status_q[41:40];
|
||||
|
||||
wire AMW_ACK;
|
||||
|
||||
wire [1:0] mpi = status_q[13:12] + 1'b1;
|
||||
wire CASS_REW_RECORD = status_q[14];
|
||||
wire rs_swap = status_q[16];
|
||||
wire cartint = status_q[19];
|
||||
wire sg4v6 = status_q[21];
|
||||
|
||||
wire PHASE = status_q[18];
|
||||
|
||||
wire coldboot = status_q[22];
|
||||
|
||||
wire F_Turbo = status_q[24];
|
||||
wire [2:0] Mem_Size = status_q[27:25];
|
||||
wire SWAP_M_J = status_q[28];
|
||||
wire display_debug = status_q[29];
|
||||
wire UART_INPUT = status_q[30];
|
||||
|
||||
wire digitalJoy = status_q[23];
|
||||
wire easter_egg = status_q[10];
|
||||
|
||||
reg [2:0] mpi_d = 2'b00;
|
||||
reg first_mpi_chg = 1'b0;
|
||||
reg mpi_reset = 1'b0;
|
||||
|
||||
always @(negedge CLK_14) begin
|
||||
mpi_d <= mpi;
|
||||
mpi_reset <= 1'b0;
|
||||
if (~(mpi == mpi_d))
|
||||
if (~first_mpi_chg)
|
||||
first_mpi_chg <= 1'b1;
|
||||
else
|
||||
mpi_reset <= 1'b1;
|
||||
end
|
||||
|
||||
reg [2:0] Mem_Size_d = 3'b000;
|
||||
reg first_mem_chg = 1'b0;
|
||||
reg mem_reset = 1'b0;
|
||||
|
||||
always @(negedge CLK_14) begin
|
||||
Mem_Size_d <= Mem_Size;
|
||||
mem_reset <= 1'b0;
|
||||
if (~(Mem_Size == Mem_Size_d))
|
||||
if (~first_mem_chg)
|
||||
first_mem_chg <= 1'b1;
|
||||
else
|
||||
mem_reset <= 1'b1;
|
||||
end
|
||||
|
||||
// Set bit 9 to swap serial ports...
|
||||
wire [9:0] switch = { cartint,UART_INPUT,art,sg4v6,rs_swap,CASS_REW_RECORD,mpi,1'b0};
|
||||
|
||||
wire reset = RESET | status_q[0] | buttons[1];
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Joysticks -- copied from CoCo3.sv
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
wire [9:0] center_joystick_y1 = 8'd128 + joya1[15:8];
|
||||
wire [9:0] center_joystick_x1 = 8'd128 + joya1[7:0];
|
||||
wire [9:0] center_joystick_y2 = 8'd128 + joya2[15:8];
|
||||
wire [9:0] center_joystick_x2 = 8'd128 + joya2[7:0];
|
||||
|
||||
wire [31:0] coco_joy1 = status_q[6] ? joy2 : joy1;
|
||||
wire [31:0] coco_joy2 = status_q[6] ? joy1 : joy2;
|
||||
|
||||
wire [15:0] coco_ajoy1 = status_q[6] ? {center_joystick_x2[7:0],center_joystick_y2[7:0]} : {center_joystick_x1[7:0],center_joystick_y1[7:0]};
|
||||
wire [15:0] coco_ajoy2 = status_q[6] ? {center_joystick_x1[7:0],center_joystick_y1[7:0]} : {center_joystick_x2[7:0],center_joystick_y2[7:0]};
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Keyboard: ps2_key -> PS/2 serial, the way hps_io produces it
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
reg clk_ps2 = 1'b0;
|
||||
reg [11:0] ps2_div = 12'd0;
|
||||
always @(posedge clk_sys) begin
|
||||
ps2_div <= ps2_div + 1'd1;
|
||||
if (ps2_div == 12'd2400) begin // hps_io PS2DIV
|
||||
clk_ps2 <= ~clk_ps2;
|
||||
ps2_div <= 12'd0;
|
||||
end
|
||||
end
|
||||
|
||||
// One ps2_key event becomes [E0] [F0] code. Main_MiSTer hands hps_io the same
|
||||
// bytes one at a time; here they go into ps2_device's FIFO on consecutive
|
||||
// clk_sys cycles.
|
||||
reg old_ps2_stb = 1'b0;
|
||||
reg [1:0] kbd_seq = 2'd0;
|
||||
reg kbd_ext, kbd_rel;
|
||||
reg [7:0] kbd_code;
|
||||
reg [7:0] kbd_data;
|
||||
reg kbd_we = 1'b0;
|
||||
|
||||
always @(posedge clk_sys) begin
|
||||
kbd_we <= 1'b0;
|
||||
old_ps2_stb <= ps2_key[10];
|
||||
if (kbd_seq == 2'd0 && old_ps2_stb != ps2_key[10]) begin
|
||||
kbd_ext <= ps2_key[8];
|
||||
kbd_rel <= ~ps2_key[9];
|
||||
kbd_code <= ps2_key[7:0];
|
||||
kbd_seq <= 2'd1;
|
||||
end
|
||||
else if (kbd_seq == 2'd1) begin
|
||||
kbd_seq <= 2'd2;
|
||||
if (kbd_ext) begin kbd_data <= 8'hE0; kbd_we <= 1'b1; end
|
||||
end
|
||||
else if (kbd_seq == 2'd2) begin
|
||||
kbd_seq <= 2'd3;
|
||||
if (kbd_rel) begin kbd_data <= 8'hF0; kbd_we <= 1'b1; end
|
||||
end
|
||||
else if (kbd_seq == 2'd3) begin
|
||||
kbd_seq <= 2'd0;
|
||||
kbd_data <= kbd_code;
|
||||
kbd_we <= 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
wire ps2_kbd_clk;
|
||||
wire ps2_kbd_data;
|
||||
|
||||
ps2_device keyboard
|
||||
(
|
||||
.clk_sys(clk_sys),
|
||||
.wdata(kbd_data),
|
||||
.we(kbd_we),
|
||||
.ps2_clk(clk_ps2),
|
||||
.ps2_clk_out(ps2_kbd_clk),
|
||||
.ps2_dat_out(ps2_kbd_data),
|
||||
.tx_empty(),
|
||||
.ps2_clk_in(1'b1), // PS2WE=0: host never talks back
|
||||
.ps2_dat_in(1'b1),
|
||||
.rdata(),
|
||||
.rd(1'b0)
|
||||
);
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Core
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
wire Programmed_RESET_N;
|
||||
wire Programmed_EE;
|
||||
|
||||
EE_Cold_Bt COCO3_EE_Cold_Bt (
|
||||
.CLK(CLK_14),
|
||||
.RESET(1'b0),
|
||||
.Display_EE(easter_egg),
|
||||
.Cold_Boot(AMW_ACK),
|
||||
.RESET_to_COCO_N(Programmed_RESET_N),
|
||||
.EE_to_COCO(Programmed_EE)
|
||||
);
|
||||
|
||||
wire [15:0] audio_left;
|
||||
wire [15:0] audio_right;
|
||||
assign AUDIO_L = { audio_left[15:14], audio_left[13] ^ (status_q[17] ? casdout : 1'b0), audio_left[12:0]};
|
||||
assign AUDIO_R = audio_right;
|
||||
|
||||
wire [7:0] r, g, b;
|
||||
wire hblank, vblank, hs, vs, pix_clk;
|
||||
wire [6:0] probe_o;
|
||||
|
||||
wire [71:0] Config_Data = {"SIMULATE", 8'h00};
|
||||
|
||||
wire [24:0] sdram_cpu_addr;
|
||||
wire [15:0] sdram_dout;
|
||||
wire [7:0] sdram_cpu_din;
|
||||
wire sdram_cpu_req, sdram_cpu_rnw;
|
||||
wire sdram_cpu_ack, sdram_vid_ack;
|
||||
wire sdram_cpu_ready;
|
||||
wire [24:0] sdram_vid_addr;
|
||||
wire sdram_vid_req;
|
||||
wire sdram_vid_ready;
|
||||
wire sdram_busy;
|
||||
|
||||
wire [6:0] sd_rd_c, sd_wr_c;
|
||||
wire [5:0] sd_blk_cnt [7];
|
||||
assign sd_rd = {9'd0, sd_rd_c};
|
||||
assign sd_wr = {9'd0, sd_wr_c};
|
||||
|
||||
wire clk_Q_out;
|
||||
wire casdout;
|
||||
wire cas_relay;
|
||||
|
||||
wire UART_TXD, UART_RTS, UART_DTR;
|
||||
|
||||
coco3fpga coco3 (
|
||||
.CLK_50M(CLK_50M),
|
||||
.CLK_114(CLK_114),
|
||||
.CLK_57(CLK_57),
|
||||
.CLK_28(CLK_28),
|
||||
.CLK_14(CLK_14),
|
||||
|
||||
.COCO_RESET_N((~reset & Programmed_RESET_N)),
|
||||
|
||||
.RED_O(r),
|
||||
.GREEN_O(g),
|
||||
.BLUE_O(b),
|
||||
|
||||
.EE_N(Programmed_EE),
|
||||
.PHASE(PHASE),
|
||||
|
||||
.H_SYNC(hs),
|
||||
.V_SYNC(vs),
|
||||
.HBLANK(hblank),
|
||||
.VBLANK(vblank),
|
||||
.PIX_CLK(pix_clk),
|
||||
|
||||
.ps2_clk(ps2_kbd_clk),
|
||||
.ps2_data(ps2_kbd_data),
|
||||
.ps2_mouse(ps2_mouse),
|
||||
|
||||
.joy_use_dpad(digitalJoy),
|
||||
.joy1(coco_joy1[15:0]),
|
||||
.joy2(coco_joy2[15:0]),
|
||||
.joya1(coco_ajoy1),
|
||||
.joya2(coco_ajoy2),
|
||||
.SWAP_M_J(SWAP_M_J),
|
||||
|
||||
// R1, L2, R2, L1
|
||||
.P_SWITCH(~{coco_joy2[4],coco_joy1[5],coco_joy2[5],coco_joy1[4]}),
|
||||
.SWITCH(switch),
|
||||
.SOUND_LEFT(audio_left),
|
||||
.SOUND_RIGHT(audio_right),
|
||||
|
||||
.ioctl_addr(ioctl_addr),
|
||||
.ioctl_data(ioctl_dout),
|
||||
.ioctl_download(ioctl_download),
|
||||
.ioctl_index({8'd0, ioctl_index}),
|
||||
.ioctl_wr(ioctl_wr),
|
||||
|
||||
.sdram_sz(16'h8001), // SDRAM present, 32 MB
|
||||
|
||||
.img_mounted(img_mounted[6:0]),
|
||||
.img_readonly(img_readonly),
|
||||
.img_size(img_size),
|
||||
|
||||
.sd_lba(sd_lba),
|
||||
.sd_blk_cnt(sd_blk_cnt),
|
||||
.sd_rd(sd_rd_c),
|
||||
.sd_wr(sd_wr_c),
|
||||
.sd_ack(sd_ack[6:0]),
|
||||
|
||||
.sd_buff_addr(sd_buff_addr),
|
||||
.sd_buff_dout(sd_buff_dout),
|
||||
.sd_buff_din(sd_buff_din),
|
||||
.sd_buff_wr(sd_buff_wr),
|
||||
|
||||
.GPIO(),
|
||||
|
||||
.PROBE_O(probe_o),
|
||||
.PROBE_I(7'h7F), // SNAC (USER_IN) pins idle high
|
||||
.clk_Q_out(clk_Q_out),
|
||||
.casdout(casdout),
|
||||
.cas_relay(cas_relay),
|
||||
|
||||
.sdram_cpu_addr(sdram_cpu_addr),
|
||||
.sdram_dout(sdram_dout),
|
||||
.sdram_cpu_din(sdram_cpu_din),
|
||||
.sdram_cpu_req(sdram_cpu_req),
|
||||
.sdram_cpu_rnw(sdram_cpu_rnw),
|
||||
.sdram_cpu_ack(sdram_cpu_ack),
|
||||
.sdram_cpu_ready(sdram_cpu_ready),
|
||||
|
||||
.sdram_vid_addr(sdram_vid_addr),
|
||||
.sdram_vid_req(sdram_vid_req),
|
||||
.sdram_vid_ack(sdram_vid_ack),
|
||||
.sdram_vid_ready(sdram_vid_ready),
|
||||
|
||||
.sdram_busy(sdram_busy),
|
||||
|
||||
.turbo_speed(turbo_speed),
|
||||
.assigned_turbo_speed(assigned_turbo_speed),
|
||||
|
||||
.RTC(RTC),
|
||||
|
||||
.AMW_Trigger(coldboot | mpi_reset | mem_reset),
|
||||
.AMW_ACK(AMW_ACK),
|
||||
|
||||
.F_Turbo(F_Turbo),
|
||||
.Mem_Size(Mem_Size),
|
||||
.AUTO_MODE(Auto_Mode),
|
||||
.Config_Data(Config_Data),
|
||||
.Display_Debug(display_debug),
|
||||
|
||||
.UART_TXD(UART_TXD),
|
||||
.UART_RXD(uart_rxd),
|
||||
.UART_RTS(UART_RTS),
|
||||
.UART_CTS(1'b0), // active low: always clear to send
|
||||
.UART_DTR(UART_DTR),
|
||||
.UART_DSR(1'b0)
|
||||
);
|
||||
|
||||
sdram_32r8w coco3_sdram
|
||||
(
|
||||
.init(reset),
|
||||
.clk(CLK_114),
|
||||
.sdram_cpu_addr(sdram_cpu_addr),
|
||||
.sdram_dout(sdram_dout),
|
||||
.sdram_cpu_din(sdram_cpu_din),
|
||||
.sdram_cpu_req(sdram_cpu_req),
|
||||
.sdram_cpu_rnw(sdram_cpu_rnw),
|
||||
.sdram_cpu_ack(sdram_cpu_ack),
|
||||
.sdram_cpu_ready(sdram_cpu_ready),
|
||||
.sdram_vid_addr(sdram_vid_addr),
|
||||
.sdram_vid_req(sdram_vid_req),
|
||||
.sdram_vid_ack(sdram_vid_ack),
|
||||
.sdram_vid_ready(sdram_vid_ready),
|
||||
.sdram_busy(sdram_busy)
|
||||
);
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Cassette -- copied from CoCo3.sv
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
wire load_tape = ioctl_index == 2;
|
||||
|
||||
wire [15:0] ram_addr;
|
||||
wire [7:0] ram_data_o;
|
||||
reg ram_wr;
|
||||
reg [15:0] ram_ad_buf;
|
||||
|
||||
always @(posedge clk_sys) begin
|
||||
ram_wr <= ~(ioctl_wr & load_tape);
|
||||
if (ioctl_download)
|
||||
ram_ad_buf <= ioctl_addr[15:0];
|
||||
else
|
||||
ram_ad_buf <= ram_addr;
|
||||
end
|
||||
|
||||
COCO_SRAM CC3_CAS1(
|
||||
.CLK(clk_sys),
|
||||
.ADDR(ram_ad_buf),
|
||||
.R_W(ram_wr),
|
||||
.DATA_I(ioctl_dout),
|
||||
.DATA_O(ram_data_o)
|
||||
);
|
||||
|
||||
cassette cassette(
|
||||
.clk(clk_sys),
|
||||
.Q(clk_Q_out),
|
||||
.rewind(status_q[15]|~ram_wr),
|
||||
.en(cas_relay),
|
||||
.sdram_addr(ram_addr),
|
||||
.sdram_data(ram_data_o),
|
||||
.data(casdout)
|
||||
);
|
||||
|
||||
assign ioctl_wait = 1'b0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Video out
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
assign VGA_R = r;
|
||||
assign VGA_G = g;
|
||||
assign VGA_B = b;
|
||||
assign VGA_HS = hs;
|
||||
assign VGA_VS = vs;
|
||||
assign VGA_HB = hblank;
|
||||
assign VGA_VB = vblank;
|
||||
assign CE_PIXEL = pix_clk;
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Debug taps
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
assign dbg_pc = coco3.GLBCPU09.pc;
|
||||
assign dbg_a = coco3.GLBCPU09.a;
|
||||
assign dbg_b = coco3.GLBCPU09.b;
|
||||
assign dbg_x = coco3.GLBCPU09.x;
|
||||
assign dbg_y = coco3.GLBCPU09.y;
|
||||
assign dbg_u = coco3.GLBCPU09.u;
|
||||
assign dbg_s = coco3.GLBCPU09.s;
|
||||
assign dbg_cc = coco3.GLBCPU09.cc;
|
||||
assign dbg_dp = coco3.GLBCPU09.dp;
|
||||
assign dbg_lic = coco3.GLBCPU09.LIC;
|
||||
assign dbg_addr = coco3.ADDRESS;
|
||||
assign dbg_din = coco3.DATA_IN;
|
||||
assign dbg_dout = coco3.DATA_OUT;
|
||||
assign dbg_rw = coco3.RW_N;
|
||||
assign dbg_ena = coco3.cpu_cycle_ena;
|
||||
assign dbg_irqn = coco3.CPU_IRQ_N;
|
||||
assign dbg_firqn = coco3.CPU_FIRQ_N;
|
||||
assign dbg_reset = coco3.CPU_RESET;
|
||||
assign dbg_gime_init0 = {coco3.COCO1, coco3.MMU_EN, coco3.GIME_IRQ, coco3.GIME_FIRQ,
|
||||
coco3.VEC_PAG_RAM, coco3.ST_SCS, coco3.ROM};
|
||||
assign dbg_speed = assigned_turbo_speed;
|
||||
|
||||
assign uart_txd = UART_TXD;
|
||||
assign uart_rts = UART_RTS;
|
||||
assign uart_dtr = UART_DTR;
|
||||
assign dbg_rs232_en = coco3.RS232_EN;
|
||||
assign dbg_mpi_scs = coco3.MPI_SCS;
|
||||
assign dbg_mpi_cts = coco3.MPI_CTS;
|
||||
assign dbg_acia_ctl = coco3.RS232.CTL_REG;
|
||||
assign dbg_acia_cmd = coco3.RS232.CMD_REG;
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// FPGA power-up state
|
||||
//
|
||||
// Every register starts at 0 in this sim. Quartus does the same, EXCEPT for a
|
||||
// register with an asynchronous set: it implements the set with NOT-gate
|
||||
// push-back, so the register powers up at 1. Where that matters it is
|
||||
// reproduced here.
|
||||
//
|
||||
// mc6809x NMILatched: active low (0 = NMI pending), in an
|
||||
// `always @(negedge NMISample2 or posedge wNMIClear)` block whose async branch
|
||||
// sets it. At 0 the CPU takes a phantom NMI on its first instruction -- the
|
||||
// ORCC at the reset entry -- and vectors through $FFFC into uninitialised RAM.
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
initial coco3.GLBCPU09.NMILatched = 1'b1;
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// +acia_any_slot (--acia-any-slot)
|
||||
//
|
||||
// coco3fpga.sv used to decode the RS-232 Pak at $FF68-$FF6B only when the
|
||||
// Multi-Pak I/O select was slot 1 (MPI_SCS == 0), which the OSD cannot select,
|
||||
// so a cart in slot 3 driving the 6551 -- HDB-DOS SY6551 for FujiNet -- talked
|
||||
// to an empty bus. The RTL now decodes it in any slot, which makes this a no-op;
|
||||
// it is kept for testing RTL from before that fix.
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
// The right-hand side of a procedural force is taken once, when the
|
||||
// force executes (Verilator 5.044), so it is re-issued whenever the decode it follows
|
||||
// changes. The net must also be `forceable` (sim.vlt) or the force is lost.
|
||||
wire acia_any_slot_en = (coco3.ADDRESS[15:2] == 14'b11111111011010);
|
||||
reg acia_any_slot = 1'b0;
|
||||
initial acia_any_slot = $test$plusargs("acia_any_slot");
|
||||
always @(acia_any_slot_en or acia_any_slot)
|
||||
if (acia_any_slot) force coco3.RS232_EN = acia_any_slot_en;
|
||||
|
||||
endmodule
|
||||
@@ -1,4 +0,0 @@
|
||||
`verilator_config
|
||||
// Nets sim.v overrides with `force` for --acia-any-slot. Without this Verilator
|
||||
// folds RS232_EN into its users and the force has no effect.
|
||||
forceable -module "coco3fpga" -var "RS232_EN"
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,70 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// uncomment and modify defines under for customize ImGuiFileDialog
|
||||
|
||||
//#define MAX_FILE_DIALOG_NAME_BUFFER 1024
|
||||
//#define MAX_PATH_BUFFER_SIZE 1024
|
||||
|
||||
//#define USE_EXPLORATION_BY_KEYS
|
||||
// this mapping by default is for GLFW but you can use another
|
||||
//#include <GLFW/glfw3.h>
|
||||
// Up key for explore to the top
|
||||
//#define IGFD_KEY_UP GLFW_KEY_UP
|
||||
// Down key for explore to the bottom
|
||||
//#define IGFD_KEY_DOWN GLFW_KEY_DOWN
|
||||
// Enter key for open directory
|
||||
//#define IGFD_KEY_ENTER GLFW_KEY_ENTER
|
||||
// BackSpace for comming back to the last directory
|
||||
//#define IGFD_KEY_BACKSPACE GLFW_KEY_BACKSPACE
|
||||
|
||||
// widget
|
||||
// filter combobox width
|
||||
//#define FILTER_COMBO_WIDTH 120.0f
|
||||
// button widget use for compose path
|
||||
//#define IMGUI_PATH_BUTTON ImGui::Button
|
||||
// standard button
|
||||
//#define IMGUI_BUTTON ImGui::Button
|
||||
|
||||
// locales string
|
||||
//#define createDirButtonString "+"
|
||||
//#define okButtonString " OK"
|
||||
//#define cancelButtonString " Cancel"
|
||||
//#define resetButtonString "R"
|
||||
//#define drivesButtonString "Drives"
|
||||
//#define searchString "Search"
|
||||
//#define dirEntryString "[DIR] "
|
||||
//#define linkEntryString "[LINK] "
|
||||
//#define fileEntryString "[FILE] "
|
||||
//#define fileNameString "File Name : "
|
||||
//#define dirNameString "Directory Path :"
|
||||
//#define buttonResetSearchString "Reset search"
|
||||
//#define buttonDriveString "Drives"
|
||||
//#define buttonResetPathString "Reset to current directory"
|
||||
//#define buttonCreateDirString "Create Directory"
|
||||
//#define OverWriteDialogTitleString "The file Already Exist !"
|
||||
//#define OverWriteDialogMessageString "Would you like to OverWrite it ?"
|
||||
//#define OverWriteDialogConfirmButtonString "Confirm"
|
||||
//#define OverWriteDialogCancelButtonString "Cancel"
|
||||
|
||||
// DateTimeFormat
|
||||
// see strftime functionin <ctime> for customize
|
||||
// "%Y/%m/%d %H:%M" give 2021:01:22 11:47
|
||||
// "%Y/%m/%d %i:%M%p" give 2021:01:22 11:45PM
|
||||
//#define DateTimeFormat "%Y/%m/%d %i:%M%p"
|
||||
|
||||
// theses icons will appear in table headers
|
||||
//#define USE_CUSTOM_SORTING_ICON
|
||||
//#define tableHeaderAscendingIcon "A|"
|
||||
//#define tableHeaderDescendingIcon "D|"
|
||||
//#define tableHeaderFileNameString " File name"
|
||||
//#define tableHeaderFileTypeString " Type"
|
||||
//#define tableHeaderFileSizeString " Size"
|
||||
//#define tableHeaderFileDateTimeString " Date"
|
||||
|
||||
//#define USE_BOOKMARK
|
||||
//#define bookmarkPaneWith 150.0f
|
||||
//#define IMGUI_TOGGLE_BUTTON ToggleButton
|
||||
//#define bookmarksButtonString "Bookmark"
|
||||
//#define bookmarksButtonHelpString "Bookmark"
|
||||
//#define addBookmarkButtonString "+"
|
||||
//#define removeBookmarkButtonString "-"
|
||||
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2022 Omar Cornut
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,78 +0,0 @@
|
||||
#
|
||||
# Cross Platform Makefile
|
||||
# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X
|
||||
#
|
||||
# You will need SDL2 (http://www.libsdl.org):
|
||||
# Linux:
|
||||
# apt-get install libsdl2-dev
|
||||
# Mac OS X:
|
||||
# brew install sdl2
|
||||
# MSYS2:
|
||||
# pacman -S mingw-w64-i686-SDL
|
||||
#
|
||||
|
||||
#CXX = g++
|
||||
#CXX = clang++
|
||||
|
||||
EXE = example_sdl_opengl2
|
||||
SOURCES = main.cpp
|
||||
SOURCES += ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp
|
||||
SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp
|
||||
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
|
||||
UNAME_S := $(shell uname -s)
|
||||
|
||||
CXXFLAGS = -I../ -I../../
|
||||
CXXFLAGS += -g -Wall -Wformat
|
||||
LIBS =
|
||||
|
||||
##---------------------------------------------------------------------
|
||||
## BUILD FLAGS PER PLATFORM
|
||||
##---------------------------------------------------------------------
|
||||
|
||||
ifeq ($(UNAME_S), Linux) #LINUX
|
||||
ECHO_MESSAGE = "Linux"
|
||||
LIBS += -lGL -ldl `sdl2-config --libs`
|
||||
|
||||
CXXFLAGS += `sdl2-config --cflags`
|
||||
CFLAGS = $(CXXFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME_S), Darwin) #APPLE
|
||||
ECHO_MESSAGE = "Mac OS X"
|
||||
LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs`
|
||||
LIBS += -L/usr/local/lib -L/opt/local/lib
|
||||
|
||||
CXXFLAGS += `sdl2-config --cflags`
|
||||
CXXFLAGS += -I/usr/local/include -I/opt/local/include
|
||||
CFLAGS = $(CXXFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
|
||||
ECHO_MESSAGE = "MinGW"
|
||||
LIBS += -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2`
|
||||
|
||||
CXXFLAGS += `pkg-config --cflags sdl2`
|
||||
CFLAGS = $(CXXFLAGS)
|
||||
endif
|
||||
|
||||
##---------------------------------------------------------------------
|
||||
## BUILD RULES
|
||||
##---------------------------------------------------------------------
|
||||
|
||||
%.o:%.cpp
|
||||
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
%.o:../%.cpp
|
||||
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
%.o:../../%.cpp
|
||||
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
all: $(EXE)
|
||||
@echo Build complete for $(ECHO_MESSAGE)
|
||||
|
||||
$(EXE): $(OBJS)
|
||||
$(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS)
|
||||
|
||||
clean:
|
||||
rm -f $(EXE) $(OBJS)
|
||||
@@ -1,129 +0,0 @@
|
||||
2018-05-08 Toni Rönkkö
|
||||
|
||||
* Version 1.23.2: fixes bad scandir prototype.
|
||||
|
||||
2017-08-27 Toni Rönkkö
|
||||
|
||||
* Version 1.23: support readdir_r and scandir functions.
|
||||
|
||||
2017-07-18 Toni Rönkkö
|
||||
|
||||
* Created release branches v1.22 and v1.21 to Git. Published version
|
||||
1.22 at softagalleria.net.
|
||||
|
||||
2016-09-11 Toni Rönkkö
|
||||
|
||||
* Version 1.22: added support for CMake. Thanks to Paul Fultz II.
|
||||
|
||||
2014-09-25 Toni Rönkkö
|
||||
|
||||
* Version 1.21: compiles correctly under Open Watcom. Thanks to
|
||||
Virgil Banowetz for a patch!
|
||||
|
||||
2014-04-07 Toni Rönkkö
|
||||
|
||||
* Version 1.20.1: the zip file from the previous version did not open
|
||||
correctly with Microsoft's compressed folders. Thanks to Alexandre
|
||||
for info!
|
||||
|
||||
2014-03-17 Toni Ronkko
|
||||
|
||||
* Version 1.20: dirent.h compiles correctly in 64-bit architecture.
|
||||
Thanks to Aaron Simmons!
|
||||
|
||||
2014-03-03 Toni Ronkko
|
||||
|
||||
* Version 1.13.2: define DT_LNK for compatibility with Unix
|
||||
programs. Thanks to Joel Bruick for suggestion!
|
||||
|
||||
2013-01-27 Toni Ronkko
|
||||
|
||||
* Version 1.13.1: patch from Edward Berner fixes set_errno() on
|
||||
Windows NT 4.0.
|
||||
|
||||
* Revised wcstombs() and mbstowcs() wrappers to make sure that they do
|
||||
not write past their target string.
|
||||
|
||||
* PATH_MAX from windows.h includes zero terminator so there is no
|
||||
need to add one extra byte to variables and structures.
|
||||
|
||||
2012-12-12 Toni Ronkko
|
||||
|
||||
* Version 1.13: use the traditional 8+3 file naming scheme if a file
|
||||
name cannot be represented in the default ANSI code page. Now
|
||||
compiles again with MSVC 6.0. Thanks to Konstantin Khomoutov for
|
||||
testing.
|
||||
|
||||
2012-10-01 Toni Ronkko
|
||||
|
||||
* Version 1.12.1: renamed wide-character DIR structure _wDIR to
|
||||
_WDIR (with capital W) in order to maintain compatibility with MingW.
|
||||
|
||||
2012-09-30 Toni Ronkko
|
||||
|
||||
* Version 1.12: define PATH_MAX and NAME_MAX. Added wide-character
|
||||
variants _wDIR, _wdirent, _wopendir(), _wreaddir(), _wclosedir() and
|
||||
_wrewinddir(). Thanks to Edgar Buerkle and Jan Nijtmans for ideas
|
||||
and code.
|
||||
|
||||
* Now avoiding windows.h. This allows dirent.h to be integrated
|
||||
more easily into programs using winsock. Thanks to Fernando
|
||||
Azaldegui.
|
||||
|
||||
2011-03-15 Toni Ronkko
|
||||
|
||||
* Version 1.11: defined FILE_ATTRIBUTE_DEVICE for MSVC 6.0.
|
||||
|
||||
2010-08-11 Toni Ronkko
|
||||
|
||||
* Version 1.10: added d_type and d_namlen fields to dirent structure.
|
||||
The former is especially useful for determining whether directory
|
||||
entry represents a file or a directory. For more information, see
|
||||
http://www.delorie.com/gnu/docs/glibc/libc_270.html
|
||||
|
||||
* Improved conformance to the standards. For example, errno is now
|
||||
set properly on failure and assert() is never used. Thanks to Peter
|
||||
Brockam for suggestions.
|
||||
|
||||
* Fixed a bug in rewinddir(): when using relative directory names,
|
||||
change of working directory no longer causes rewinddir() to fail.
|
||||
|
||||
2009-12-15 John Cunningham
|
||||
|
||||
* Version 1.9: added rewinddir member function
|
||||
|
||||
2008-01-18 Toni Ronkko
|
||||
|
||||
* Version 1.8: Using FindFirstFileA and WIN32_FIND_DATAA to avoid
|
||||
converting string between multi-byte and unicode representations.
|
||||
This makes the code simpler and also allows the code to be compiled
|
||||
under MingW. Thanks to Azriel Fasten for the suggestion.
|
||||
|
||||
2007-03-04 Toni Ronkko
|
||||
|
||||
* Bug fix: due to the strncpy_s() function this file only compiled in
|
||||
Visual Studio 2005. Using the new string functions only when the
|
||||
compiler version allows.
|
||||
|
||||
2006-11-02 Toni Ronkko
|
||||
|
||||
* Major update: removed support for Watcom C, MS-DOS and Turbo C to
|
||||
simplify the file, updated the code to compile cleanly on Visual
|
||||
Studio 2005 with both unicode and multi-byte character strings,
|
||||
removed rewinddir() as it had a bug.
|
||||
|
||||
2006-08-20 Toni Ronkko
|
||||
|
||||
* Removed all remarks about MSVC 1.0, which is antiqued now.
|
||||
Simplified comments by removing SGML tags.
|
||||
|
||||
2002-05-14 Toni Ronkko
|
||||
|
||||
* Embedded the function definitions directly to the header so that no
|
||||
source modules need to be included in the Visual Studio project.
|
||||
Removed all the dependencies to other projects so that this header
|
||||
file can be used independently.
|
||||
|
||||
1998-05-28 Toni Ronkko
|
||||
|
||||
* First version.
|
||||
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 1998-2019 Toni Ronkko
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,96 +0,0 @@
|
||||
# Dirent
|
||||
Dirent is a C/C++ programming interface that allows programmers to retrieve
|
||||
information about files and directories under Linux/UNIX. This project
|
||||
provides Linux compatible Dirent interface for Microsoft Windows.
|
||||
|
||||
|
||||
# Installation
|
||||
|
||||
Download the latest Dirent installation package from
|
||||
[GitHub](https://github.com/tronkko/dirent/releases) and
|
||||
unpack the installation file with 7-zip, for example. The installation
|
||||
package contains dirent.h file as well as a few example programs and
|
||||
tests.
|
||||
|
||||
|
||||
## Install Dirent for All Programs
|
||||
|
||||
To make dirent.h available for all C/C++ programs, simply copy the
|
||||
``include/dirent.h`` file to the system include directory. System include
|
||||
directory contains header files such as assert.h and windows.h. In Visual
|
||||
Studio 2008, for example, the system include may be found at
|
||||
``C:\Program Files\Microsoft Visual Studio 9.0\VC\include``.
|
||||
|
||||
Everything you need is included in the single dirent.h file, and you can
|
||||
start using Dirent immediately -- there is no need to add files to your
|
||||
Visual Studio project.
|
||||
|
||||
|
||||
## Embed Dirent into Your Own Project
|
||||
|
||||
If you wish to distribute dirent.h alongside with your own source code, then
|
||||
copy ``include/dirent.h`` file to a new sub-directory within your project and
|
||||
add that directory to include path on Windows while omitting the directory
|
||||
under Linux/UNIX. This allows your project to be compiled against native
|
||||
dirent.h on Linux/UNIX while substituting the functionality on Microsoft
|
||||
Windows.
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
The installation package contains four example programs:
|
||||
|
||||
Program | Purpose
|
||||
-------- | -----------------------------------------------------------------
|
||||
ls | List files in a directory, e.g. ls "c:\Program Files"
|
||||
find | Find files in subdirectories, e.g. find "c:\Program Files\CMake"
|
||||
updatedb | Build database of files in a drive, e.g. updatedb c:\
|
||||
locate | Locate a file from database, e.g. locate notepad.exe
|
||||
|
||||
To build the example programs, first install [CMake](https://cmake.org/).
|
||||
Then, with CMake installed, open command prompt and create a temporary
|
||||
directory ``c:\temp\dirent`` for the build files as
|
||||
|
||||
```
|
||||
c:\
|
||||
mkdir temp
|
||||
mkdir temp\dirent
|
||||
cd temp\dirent
|
||||
```
|
||||
|
||||
Generate build files as
|
||||
|
||||
```
|
||||
cmake d:\dirent
|
||||
```
|
||||
|
||||
where ``d:\dirent`` is the root directory of the Dirent package (containing
|
||||
this README.md and LICENSE file).
|
||||
|
||||
Once CMake is finished, open Visual Studio, load the generated dirent.sln file
|
||||
from the build directory and build the solution. Once the build completes, run
|
||||
the example programs from the command prompt as
|
||||
|
||||
```
|
||||
cd Debug
|
||||
ls .
|
||||
find .
|
||||
updatedb c:\
|
||||
locate cmd.exe
|
||||
```
|
||||
|
||||
|
||||
# Copying
|
||||
|
||||
Dirent may be freely distributed under the MIT license. See the
|
||||
[LICENSE](LICENSE) file for details.
|
||||
|
||||
|
||||
# Alternatives to Dirent
|
||||
|
||||
I ported Dirent to Microsoft Windows in 1998 when only a few alternatives
|
||||
were available. However, the situation has changed since then and nowadays
|
||||
both [Cygwin](http://www.cygwin.com) and [MingW](http://www.mingw.org)
|
||||
allow you to compile a great number of UNIX programs in Microsoft Windows.
|
||||
They both provide a full dirent API as well as many other UNIX APIs. MingW
|
||||
can even be used for commercial applications!
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,124 +0,0 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// COMPILE-TIME OPTIONS FOR DEAR IMGUI
|
||||
// Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure.
|
||||
// You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions.
|
||||
//-----------------------------------------------------------------------------
|
||||
// A) You may edit imconfig.h (and not overwrite it when updating Dear ImGui, or maintain a patch/rebased branch with your modifications to it)
|
||||
// B) or '#define IMGUI_USER_CONFIG "my_imgui_config.h"' in your project and then add directives in your own file without touching this template.
|
||||
//-----------------------------------------------------------------------------
|
||||
// You need to make sure that configuration settings are defined consistently _everywhere_ Dear ImGui is used, which include the imgui*.cpp
|
||||
// files but also _any_ of your code that uses Dear ImGui. This is because some compile-time options have an affect on data structures.
|
||||
// Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts.
|
||||
// Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
//---- Define assertion handler. Defaults to calling assert().
|
||||
// If your macro uses multiple statements, make sure is enclosed in a 'do { .. } while (0)' block so it can be used as a single statement.
|
||||
//#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
|
||||
//#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts
|
||||
|
||||
//---- Define attributes of all API symbols declarations, e.g. for DLL under Windows
|
||||
// Using Dear ImGui via a shared library is not recommended, because of function call overhead and because we don't guarantee backward nor forward ABI compatibility.
|
||||
// DLL users: heaps and globals are not shared across DLL boundaries! You will need to call SetCurrentContext() + SetAllocatorFunctions()
|
||||
// for each static/DLL boundary you are calling from. Read "Context and Memory Allocators" section of imgui.cpp for more details.
|
||||
//#define IMGUI_API __declspec( dllexport )
|
||||
//#define IMGUI_API __declspec( dllimport )
|
||||
|
||||
//---- Don't define obsolete functions/enums/behaviors. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names.
|
||||
//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
//#define IMGUI_DISABLE_OBSOLETE_KEYIO // 1.87: disable legacy io.KeyMap[]+io.KeysDown[] in favor io.AddKeyEvent(). This will be folded into IMGUI_DISABLE_OBSOLETE_FUNCTIONS in a few versions.
|
||||
|
||||
//---- Disable all of Dear ImGui or don't implement standard windows.
|
||||
// It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp.
|
||||
//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty.
|
||||
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended.
|
||||
//#define IMGUI_DISABLE_METRICS_WINDOW // Disable metrics/debugger and other debug tools: ShowMetricsWindow() and ShowStackToolWindow() will be empty.
|
||||
|
||||
//---- Don't implement some functions to reduce linkage requirements.
|
||||
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a)
|
||||
//#define IMGUI_ENABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with Visual Studio] Implement default IME handler (require imm32.lib/.a, auto-link for Visual Studio, -limm32 on command-line for MinGW)
|
||||
//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] [Default with non-Visual Studio compilers] Don't implement default IME handler (won't require imm32.lib/.a)
|
||||
//#define IMGUI_DISABLE_WIN32_FUNCTIONS // [Win32] Won't use and link with any Win32 function (clipboard, ime).
|
||||
//#define IMGUI_ENABLE_OSX_DEFAULT_CLIPBOARD_FUNCTIONS // [OSX] Implement default OSX clipboard handler (need to link with '-framework ApplicationServices', this is why this is not the default).
|
||||
//#define IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself (e.g. if you don't want to link with vsnprintf)
|
||||
//#define IMGUI_DISABLE_DEFAULT_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 so you can implement them yourself.
|
||||
//#define IMGUI_DISABLE_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle at all (replace them with dummies)
|
||||
//#define IMGUI_DISABLE_DEFAULT_FILE_FUNCTIONS // Don't implement ImFileOpen/ImFileClose/ImFileRead/ImFileWrite and ImFileHandle so you can implement them yourself if you don't want to link with fopen/fclose/fread/fwrite. This will also disable the LogToTTY() function.
|
||||
//#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions().
|
||||
//#define IMGUI_DISABLE_SSE // Disable use of SSE intrinsics even if available
|
||||
|
||||
//---- Include imgui_user.h at the end of imgui.h as a convenience
|
||||
//#define IMGUI_INCLUDE_IMGUI_USER_H
|
||||
|
||||
//---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another)
|
||||
//#define IMGUI_USE_BGRA_PACKED_COLOR
|
||||
|
||||
//---- Use 32-bit for ImWchar (default is 16-bit) to support unicode planes 1-16. (e.g. point beyond 0xFFFF like emoticons, dingbats, symbols, shapes, ancient languages, etc...)
|
||||
//#define IMGUI_USE_WCHAR32
|
||||
|
||||
//---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version
|
||||
// By default the embedded implementations are declared static and not available outside of Dear ImGui sources files.
|
||||
//#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h"
|
||||
//#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h"
|
||||
//#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
|
||||
//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
|
||||
|
||||
//---- Use stb_printf's faster implementation of vsnprintf instead of the one from libc (unless IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS is defined)
|
||||
// Requires 'stb_sprintf.h' to be available in the include path. Compatibility checks of arguments and formats done by clang and GCC will be disabled in order to support the extra formats provided by STB sprintf.
|
||||
// #define IMGUI_USE_STB_SPRINTF
|
||||
|
||||
//---- Use FreeType to build and rasterize the font atlas (instead of stb_truetype which is embedded by default in Dear ImGui)
|
||||
// Requires FreeType headers to be available in the include path. Requires program to be compiled with 'misc/freetype/imgui_freetype.cpp' (in this repository) + the FreeType library (not provided).
|
||||
// On Windows you may use vcpkg with 'vcpkg install freetype --triplet=x64-windows' + 'vcpkg integrate install'.
|
||||
//#define IMGUI_ENABLE_FREETYPE
|
||||
|
||||
//---- Use stb_truetype to build and rasterize the font atlas (default)
|
||||
// The only purpose of this define is if you want force compilation of the stb_truetype backend ALONG with the FreeType backend.
|
||||
//#define IMGUI_ENABLE_STB_TRUETYPE
|
||||
|
||||
//---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4.
|
||||
// This will be inlined as part of ImVec2 and ImVec4 class declarations.
|
||||
/*
|
||||
#define IM_VEC2_CLASS_EXTRA \
|
||||
ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \
|
||||
operator MyVec2() const { return MyVec2(x,y); }
|
||||
|
||||
#define IM_VEC4_CLASS_EXTRA \
|
||||
ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \
|
||||
operator MyVec4() const { return MyVec4(x,y,z,w); }
|
||||
*/
|
||||
|
||||
//---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices.
|
||||
// Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices).
|
||||
// Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer.
|
||||
// Read about ImGuiBackendFlags_RendererHasVtxOffset for details.
|
||||
//#define ImDrawIdx unsigned int
|
||||
|
||||
//---- Override ImDrawCallback signature (will need to modify renderer backends accordingly)
|
||||
//struct ImDrawList;
|
||||
//struct ImDrawCmd;
|
||||
//typedef void (*MyImDrawCallback)(const ImDrawList* draw_list, const ImDrawCmd* cmd, void* my_renderer_user_data);
|
||||
//#define ImDrawCallback MyImDrawCallback
|
||||
|
||||
//---- Debug Tools: Macro to break in Debugger
|
||||
// (use 'Metrics->Tools->Item Picker' to pick widgets with the mouse and break into them for easy debugging.)
|
||||
//#define IM_DEBUG_BREAK IM_ASSERT(0)
|
||||
//#define IM_DEBUG_BREAK __debugbreak()
|
||||
|
||||
//---- Debug Tools: Have the Item Picker break in the ItemAdd() function instead of ItemHoverable(),
|
||||
// (which comes earlier in the code, will catch a few extra items, allow picking items other than Hovered one.)
|
||||
// This adds a small runtime cost which is why it is not enabled by default.
|
||||
//#define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX
|
||||
|
||||
//---- Debug Tools: Enable slower asserts
|
||||
//#define IMGUI_DEBUG_PARANOID
|
||||
|
||||
//---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files.
|
||||
/*
|
||||
namespace ImGui
|
||||
{
|
||||
void MyFunction(const char* name, const MyMatrix44& v);
|
||||
}
|
||||
*/
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,594 +0,0 @@
|
||||
// dear imgui: Renderer Backend for DirectX11
|
||||
// This needs to be used along with a Platform Backend (e.g. Win32)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID!
|
||||
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
|
||||
|
||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
||||
// 2021-05-19: DirectX11: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement)
|
||||
// 2021-02-18: DirectX11: Change blending equation to preserve alpha in output buffer.
|
||||
// 2019-08-01: DirectX11: Fixed code querying the Geometry Shader state (would generally error with Debug layer enabled).
|
||||
// 2019-07-21: DirectX11: Backup, clear and restore Geometry Shader is any is bound when calling ImGui_ImplDX10_RenderDrawData. Clearing Hull/Domain/Compute shaders without backup/restore.
|
||||
// 2019-05-29: DirectX11: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
||||
// 2019-04-30: DirectX11: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
||||
// 2018-12-03: Misc: Added #pragma comment statement to automatically link with d3dcompiler.lib when using D3DCompile().
|
||||
// 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.
|
||||
// 2018-08-01: DirectX11: Querying for IDXGIFactory instead of IDXGIFactory1 to increase compatibility.
|
||||
// 2018-07-13: DirectX11: Fixed unreleased resources in Init and Shutdown functions.
|
||||
// 2018-06-08: Misc: Extracted imgui_impl_dx11.cpp/.h away from the old combined DX11+Win32 example.
|
||||
// 2018-06-08: DirectX11: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
|
||||
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplDX11_RenderDrawData() in the .h file so you can call it yourself.
|
||||
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
|
||||
// 2016-05-07: DirectX11: Disabling depth-write.
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_dx11.h"
|
||||
|
||||
// DirectX
|
||||
#include <stdio.h>
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "d3dcompiler") // Automatically link with d3dcompiler.lib as we are using D3DCompile() below.
|
||||
#endif
|
||||
|
||||
// DirectX11 data
|
||||
struct ImGui_ImplDX11_Data
|
||||
{
|
||||
ID3D11Device* pd3dDevice;
|
||||
ID3D11DeviceContext* pd3dDeviceContext;
|
||||
IDXGIFactory* pFactory;
|
||||
ID3D11Buffer* pVB;
|
||||
ID3D11Buffer* pIB;
|
||||
ID3D11VertexShader* pVertexShader;
|
||||
ID3D11InputLayout* pInputLayout;
|
||||
ID3D11Buffer* pVertexConstantBuffer;
|
||||
ID3D11PixelShader* pPixelShader;
|
||||
ID3D11SamplerState* pFontSampler;
|
||||
ID3D11ShaderResourceView* pFontTextureView;
|
||||
ID3D11RasterizerState* pRasterizerState;
|
||||
ID3D11BlendState* pBlendState;
|
||||
ID3D11DepthStencilState* pDepthStencilState;
|
||||
int VertexBufferSize;
|
||||
int IndexBufferSize;
|
||||
|
||||
ImGui_ImplDX11_Data() { memset(this, 0, sizeof(*this)); VertexBufferSize = 5000; IndexBufferSize = 10000; }
|
||||
};
|
||||
|
||||
struct VERTEX_CONSTANT_BUFFER
|
||||
{
|
||||
float mvp[4][4];
|
||||
};
|
||||
|
||||
// Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts
|
||||
// It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts.
|
||||
static ImGui_ImplDX11_Data* ImGui_ImplDX11_GetBackendData()
|
||||
{
|
||||
return ImGui::GetCurrentContext() ? (ImGui_ImplDX11_Data*)ImGui::GetIO().BackendRendererUserData : NULL;
|
||||
}
|
||||
|
||||
// Functions
|
||||
static void ImGui_ImplDX11_SetupRenderState(ImDrawData* draw_data, ID3D11DeviceContext* ctx)
|
||||
{
|
||||
ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData();
|
||||
|
||||
// Setup viewport
|
||||
D3D11_VIEWPORT vp;
|
||||
memset(&vp, 0, sizeof(D3D11_VIEWPORT));
|
||||
vp.Width = draw_data->DisplaySize.x;
|
||||
vp.Height = draw_data->DisplaySize.y;
|
||||
vp.MinDepth = 0.0f;
|
||||
vp.MaxDepth = 1.0f;
|
||||
vp.TopLeftX = vp.TopLeftY = 0;
|
||||
ctx->RSSetViewports(1, &vp);
|
||||
|
||||
// Setup shader and vertex buffers
|
||||
unsigned int stride = sizeof(ImDrawVert);
|
||||
unsigned int offset = 0;
|
||||
ctx->IASetInputLayout(bd->pInputLayout);
|
||||
ctx->IASetVertexBuffers(0, 1, &bd->pVB, &stride, &offset);
|
||||
ctx->IASetIndexBuffer(bd->pIB, sizeof(ImDrawIdx) == 2 ? DXGI_FORMAT_R16_UINT : DXGI_FORMAT_R32_UINT, 0);
|
||||
ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||
ctx->VSSetShader(bd->pVertexShader, NULL, 0);
|
||||
ctx->VSSetConstantBuffers(0, 1, &bd->pVertexConstantBuffer);
|
||||
ctx->PSSetShader(bd->pPixelShader, NULL, 0);
|
||||
ctx->PSSetSamplers(0, 1, &bd->pFontSampler);
|
||||
ctx->GSSetShader(NULL, NULL, 0);
|
||||
ctx->HSSetShader(NULL, NULL, 0); // In theory we should backup and restore this as well.. very infrequently used..
|
||||
ctx->DSSetShader(NULL, NULL, 0); // In theory we should backup and restore this as well.. very infrequently used..
|
||||
ctx->CSSetShader(NULL, NULL, 0); // In theory we should backup and restore this as well.. very infrequently used..
|
||||
|
||||
// Setup blend state
|
||||
const float blend_factor[4] = { 0.f, 0.f, 0.f, 0.f };
|
||||
ctx->OMSetBlendState(bd->pBlendState, blend_factor, 0xffffffff);
|
||||
ctx->OMSetDepthStencilState(bd->pDepthStencilState, 0);
|
||||
ctx->RSSetState(bd->pRasterizerState);
|
||||
}
|
||||
|
||||
// Render function
|
||||
void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data)
|
||||
{
|
||||
// Avoid rendering when minimized
|
||||
if (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f)
|
||||
return;
|
||||
|
||||
ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData();
|
||||
ID3D11DeviceContext* ctx = bd->pd3dDeviceContext;
|
||||
|
||||
// Create and grow vertex/index buffers if needed
|
||||
if (!bd->pVB || bd->VertexBufferSize < draw_data->TotalVtxCount)
|
||||
{
|
||||
if (bd->pVB) { bd->pVB->Release(); bd->pVB = NULL; }
|
||||
bd->VertexBufferSize = draw_data->TotalVtxCount + 5000;
|
||||
D3D11_BUFFER_DESC desc;
|
||||
memset(&desc, 0, sizeof(D3D11_BUFFER_DESC));
|
||||
desc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
desc.ByteWidth = bd->VertexBufferSize * sizeof(ImDrawVert);
|
||||
desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
desc.MiscFlags = 0;
|
||||
if (bd->pd3dDevice->CreateBuffer(&desc, NULL, &bd->pVB) < 0)
|
||||
return;
|
||||
}
|
||||
if (!bd->pIB || bd->IndexBufferSize < draw_data->TotalIdxCount)
|
||||
{
|
||||
if (bd->pIB) { bd->pIB->Release(); bd->pIB = NULL; }
|
||||
bd->IndexBufferSize = draw_data->TotalIdxCount + 10000;
|
||||
D3D11_BUFFER_DESC desc;
|
||||
memset(&desc, 0, sizeof(D3D11_BUFFER_DESC));
|
||||
desc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
desc.ByteWidth = bd->IndexBufferSize * sizeof(ImDrawIdx);
|
||||
desc.BindFlags = D3D11_BIND_INDEX_BUFFER;
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
if (bd->pd3dDevice->CreateBuffer(&desc, NULL, &bd->pIB) < 0)
|
||||
return;
|
||||
}
|
||||
|
||||
// Upload vertex/index data into a single contiguous GPU buffer
|
||||
D3D11_MAPPED_SUBRESOURCE vtx_resource, idx_resource;
|
||||
if (ctx->Map(bd->pVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &vtx_resource) != S_OK)
|
||||
return;
|
||||
if (ctx->Map(bd->pIB, 0, D3D11_MAP_WRITE_DISCARD, 0, &idx_resource) != S_OK)
|
||||
return;
|
||||
ImDrawVert* vtx_dst = (ImDrawVert*)vtx_resource.pData;
|
||||
ImDrawIdx* idx_dst = (ImDrawIdx*)idx_resource.pData;
|
||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||
{
|
||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||
memcpy(vtx_dst, cmd_list->VtxBuffer.Data, cmd_list->VtxBuffer.Size * sizeof(ImDrawVert));
|
||||
memcpy(idx_dst, cmd_list->IdxBuffer.Data, cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx));
|
||||
vtx_dst += cmd_list->VtxBuffer.Size;
|
||||
idx_dst += cmd_list->IdxBuffer.Size;
|
||||
}
|
||||
ctx->Unmap(bd->pVB, 0);
|
||||
ctx->Unmap(bd->pIB, 0);
|
||||
|
||||
// Setup orthographic projection matrix into our constant buffer
|
||||
// Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps.
|
||||
{
|
||||
D3D11_MAPPED_SUBRESOURCE mapped_resource;
|
||||
if (ctx->Map(bd->pVertexConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped_resource) != S_OK)
|
||||
return;
|
||||
VERTEX_CONSTANT_BUFFER* constant_buffer = (VERTEX_CONSTANT_BUFFER*)mapped_resource.pData;
|
||||
float L = draw_data->DisplayPos.x;
|
||||
float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x;
|
||||
float T = draw_data->DisplayPos.y;
|
||||
float B = draw_data->DisplayPos.y + draw_data->DisplaySize.y;
|
||||
float mvp[4][4] =
|
||||
{
|
||||
{ 2.0f/(R-L), 0.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 2.0f/(T-B), 0.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 0.5f, 0.0f },
|
||||
{ (R+L)/(L-R), (T+B)/(B-T), 0.5f, 1.0f },
|
||||
};
|
||||
memcpy(&constant_buffer->mvp, mvp, sizeof(mvp));
|
||||
ctx->Unmap(bd->pVertexConstantBuffer, 0);
|
||||
}
|
||||
|
||||
// Backup DX state that will be modified to restore it afterwards (unfortunately this is very ugly looking and verbose. Close your eyes!)
|
||||
struct BACKUP_DX11_STATE
|
||||
{
|
||||
UINT ScissorRectsCount, ViewportsCount;
|
||||
D3D11_RECT ScissorRects[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];
|
||||
D3D11_VIEWPORT Viewports[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];
|
||||
ID3D11RasterizerState* RS;
|
||||
ID3D11BlendState* BlendState;
|
||||
FLOAT BlendFactor[4];
|
||||
UINT SampleMask;
|
||||
UINT StencilRef;
|
||||
ID3D11DepthStencilState* DepthStencilState;
|
||||
ID3D11ShaderResourceView* PSShaderResource;
|
||||
ID3D11SamplerState* PSSampler;
|
||||
ID3D11PixelShader* PS;
|
||||
ID3D11VertexShader* VS;
|
||||
ID3D11GeometryShader* GS;
|
||||
UINT PSInstancesCount, VSInstancesCount, GSInstancesCount;
|
||||
ID3D11ClassInstance *PSInstances[256], *VSInstances[256], *GSInstances[256]; // 256 is max according to PSSetShader documentation
|
||||
D3D11_PRIMITIVE_TOPOLOGY PrimitiveTopology;
|
||||
ID3D11Buffer* IndexBuffer, *VertexBuffer, *VSConstantBuffer;
|
||||
UINT IndexBufferOffset, VertexBufferStride, VertexBufferOffset;
|
||||
DXGI_FORMAT IndexBufferFormat;
|
||||
ID3D11InputLayout* InputLayout;
|
||||
};
|
||||
BACKUP_DX11_STATE old = {};
|
||||
old.ScissorRectsCount = old.ViewportsCount = D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
|
||||
ctx->RSGetScissorRects(&old.ScissorRectsCount, old.ScissorRects);
|
||||
ctx->RSGetViewports(&old.ViewportsCount, old.Viewports);
|
||||
ctx->RSGetState(&old.RS);
|
||||
ctx->OMGetBlendState(&old.BlendState, old.BlendFactor, &old.SampleMask);
|
||||
ctx->OMGetDepthStencilState(&old.DepthStencilState, &old.StencilRef);
|
||||
ctx->PSGetShaderResources(0, 1, &old.PSShaderResource);
|
||||
ctx->PSGetSamplers(0, 1, &old.PSSampler);
|
||||
old.PSInstancesCount = old.VSInstancesCount = old.GSInstancesCount = 256;
|
||||
ctx->PSGetShader(&old.PS, old.PSInstances, &old.PSInstancesCount);
|
||||
ctx->VSGetShader(&old.VS, old.VSInstances, &old.VSInstancesCount);
|
||||
ctx->VSGetConstantBuffers(0, 1, &old.VSConstantBuffer);
|
||||
ctx->GSGetShader(&old.GS, old.GSInstances, &old.GSInstancesCount);
|
||||
|
||||
ctx->IAGetPrimitiveTopology(&old.PrimitiveTopology);
|
||||
ctx->IAGetIndexBuffer(&old.IndexBuffer, &old.IndexBufferFormat, &old.IndexBufferOffset);
|
||||
ctx->IAGetVertexBuffers(0, 1, &old.VertexBuffer, &old.VertexBufferStride, &old.VertexBufferOffset);
|
||||
ctx->IAGetInputLayout(&old.InputLayout);
|
||||
|
||||
// Setup desired DX state
|
||||
ImGui_ImplDX11_SetupRenderState(draw_data, ctx);
|
||||
|
||||
// Render command lists
|
||||
// (Because we merged all buffers into a single one, we maintain our own offset into them)
|
||||
int global_idx_offset = 0;
|
||||
int global_vtx_offset = 0;
|
||||
ImVec2 clip_off = draw_data->DisplayPos;
|
||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||
{
|
||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||
{
|
||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||
if (pcmd->UserCallback != NULL)
|
||||
{
|
||||
// User callback, registered via ImDrawList::AddCallback()
|
||||
// (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
|
||||
if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
|
||||
ImGui_ImplDX11_SetupRenderState(draw_data, ctx);
|
||||
else
|
||||
pcmd->UserCallback(cmd_list, pcmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Project scissor/clipping rectangles into framebuffer space
|
||||
ImVec2 clip_min(pcmd->ClipRect.x - clip_off.x, pcmd->ClipRect.y - clip_off.y);
|
||||
ImVec2 clip_max(pcmd->ClipRect.z - clip_off.x, pcmd->ClipRect.w - clip_off.y);
|
||||
if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
|
||||
continue;
|
||||
|
||||
// Apply scissor/clipping rectangle
|
||||
const D3D11_RECT r = { (LONG)clip_min.x, (LONG)clip_min.y, (LONG)clip_max.x, (LONG)clip_max.y };
|
||||
ctx->RSSetScissorRects(1, &r);
|
||||
|
||||
// Bind texture, Draw
|
||||
ID3D11ShaderResourceView* texture_srv = (ID3D11ShaderResourceView*)pcmd->GetTexID();
|
||||
ctx->PSSetShaderResources(0, 1, &texture_srv);
|
||||
ctx->DrawIndexed(pcmd->ElemCount, pcmd->IdxOffset + global_idx_offset, pcmd->VtxOffset + global_vtx_offset);
|
||||
}
|
||||
}
|
||||
global_idx_offset += cmd_list->IdxBuffer.Size;
|
||||
global_vtx_offset += cmd_list->VtxBuffer.Size;
|
||||
}
|
||||
|
||||
// Restore modified DX state
|
||||
ctx->RSSetScissorRects(old.ScissorRectsCount, old.ScissorRects);
|
||||
ctx->RSSetViewports(old.ViewportsCount, old.Viewports);
|
||||
ctx->RSSetState(old.RS); if (old.RS) old.RS->Release();
|
||||
ctx->OMSetBlendState(old.BlendState, old.BlendFactor, old.SampleMask); if (old.BlendState) old.BlendState->Release();
|
||||
ctx->OMSetDepthStencilState(old.DepthStencilState, old.StencilRef); if (old.DepthStencilState) old.DepthStencilState->Release();
|
||||
ctx->PSSetShaderResources(0, 1, &old.PSShaderResource); if (old.PSShaderResource) old.PSShaderResource->Release();
|
||||
ctx->PSSetSamplers(0, 1, &old.PSSampler); if (old.PSSampler) old.PSSampler->Release();
|
||||
ctx->PSSetShader(old.PS, old.PSInstances, old.PSInstancesCount); if (old.PS) old.PS->Release();
|
||||
for (UINT i = 0; i < old.PSInstancesCount; i++) if (old.PSInstances[i]) old.PSInstances[i]->Release();
|
||||
ctx->VSSetShader(old.VS, old.VSInstances, old.VSInstancesCount); if (old.VS) old.VS->Release();
|
||||
ctx->VSSetConstantBuffers(0, 1, &old.VSConstantBuffer); if (old.VSConstantBuffer) old.VSConstantBuffer->Release();
|
||||
ctx->GSSetShader(old.GS, old.GSInstances, old.GSInstancesCount); if (old.GS) old.GS->Release();
|
||||
for (UINT i = 0; i < old.VSInstancesCount; i++) if (old.VSInstances[i]) old.VSInstances[i]->Release();
|
||||
ctx->IASetPrimitiveTopology(old.PrimitiveTopology);
|
||||
ctx->IASetIndexBuffer(old.IndexBuffer, old.IndexBufferFormat, old.IndexBufferOffset); if (old.IndexBuffer) old.IndexBuffer->Release();
|
||||
ctx->IASetVertexBuffers(0, 1, &old.VertexBuffer, &old.VertexBufferStride, &old.VertexBufferOffset); if (old.VertexBuffer) old.VertexBuffer->Release();
|
||||
ctx->IASetInputLayout(old.InputLayout); if (old.InputLayout) old.InputLayout->Release();
|
||||
}
|
||||
|
||||
static void ImGui_ImplDX11_CreateFontsTexture()
|
||||
{
|
||||
// Build texture atlas
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData();
|
||||
unsigned char* pixels;
|
||||
int width, height;
|
||||
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
|
||||
|
||||
// Upload texture to graphics system
|
||||
{
|
||||
D3D11_TEXTURE2D_DESC desc;
|
||||
ZeroMemory(&desc, sizeof(desc));
|
||||
desc.Width = width;
|
||||
desc.Height = height;
|
||||
desc.MipLevels = 1;
|
||||
desc.ArraySize = 1;
|
||||
desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
desc.SampleDesc.Count = 1;
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
desc.CPUAccessFlags = 0;
|
||||
|
||||
ID3D11Texture2D* pTexture = NULL;
|
||||
D3D11_SUBRESOURCE_DATA subResource;
|
||||
subResource.pSysMem = pixels;
|
||||
subResource.SysMemPitch = desc.Width * 4;
|
||||
subResource.SysMemSlicePitch = 0;
|
||||
bd->pd3dDevice->CreateTexture2D(&desc, &subResource, &pTexture);
|
||||
IM_ASSERT(pTexture != NULL);
|
||||
|
||||
// Create texture view
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
|
||||
ZeroMemory(&srvDesc, sizeof(srvDesc));
|
||||
srvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
|
||||
srvDesc.Texture2D.MipLevels = desc.MipLevels;
|
||||
srvDesc.Texture2D.MostDetailedMip = 0;
|
||||
bd->pd3dDevice->CreateShaderResourceView(pTexture, &srvDesc, &bd->pFontTextureView);
|
||||
pTexture->Release();
|
||||
}
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->SetTexID((ImTextureID)bd->pFontTextureView);
|
||||
|
||||
// Create texture sampler
|
||||
{
|
||||
D3D11_SAMPLER_DESC desc;
|
||||
ZeroMemory(&desc, sizeof(desc));
|
||||
desc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
||||
desc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||
desc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||
desc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||
desc.MipLODBias = 0.f;
|
||||
desc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
|
||||
desc.MinLOD = 0.f;
|
||||
desc.MaxLOD = 0.f;
|
||||
bd->pd3dDevice->CreateSamplerState(&desc, &bd->pFontSampler);
|
||||
}
|
||||
}
|
||||
|
||||
bool ImGui_ImplDX11_CreateDeviceObjects()
|
||||
{
|
||||
ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData();
|
||||
if (!bd->pd3dDevice)
|
||||
return false;
|
||||
if (bd->pFontSampler)
|
||||
ImGui_ImplDX11_InvalidateDeviceObjects();
|
||||
|
||||
// By using D3DCompile() from <d3dcompiler.h> / d3dcompiler.lib, we introduce a dependency to a given version of d3dcompiler_XX.dll (see D3DCOMPILER_DLL_A)
|
||||
// If you would like to use this DX11 sample code but remove this dependency you can:
|
||||
// 1) compile once, save the compiled shader blobs into a file or source code and pass them to CreateVertexShader()/CreatePixelShader() [preferred solution]
|
||||
// 2) use code to detect any version of the DLL and grab a pointer to D3DCompile from the DLL.
|
||||
// See https://github.com/ocornut/imgui/pull/638 for sources and details.
|
||||
|
||||
// Create the vertex shader
|
||||
{
|
||||
static const char* vertexShader =
|
||||
"cbuffer vertexBuffer : register(b0) \
|
||||
{\
|
||||
float4x4 ProjectionMatrix; \
|
||||
};\
|
||||
struct VS_INPUT\
|
||||
{\
|
||||
float2 pos : POSITION;\
|
||||
float4 col : COLOR0;\
|
||||
float2 uv : TEXCOORD0;\
|
||||
};\
|
||||
\
|
||||
struct PS_INPUT\
|
||||
{\
|
||||
float4 pos : SV_POSITION;\
|
||||
float4 col : COLOR0;\
|
||||
float2 uv : TEXCOORD0;\
|
||||
};\
|
||||
\
|
||||
PS_INPUT main(VS_INPUT input)\
|
||||
{\
|
||||
PS_INPUT output;\
|
||||
output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f));\
|
||||
output.col = input.col;\
|
||||
output.uv = input.uv;\
|
||||
return output;\
|
||||
}";
|
||||
|
||||
ID3DBlob* vertexShaderBlob;
|
||||
if (FAILED(D3DCompile(vertexShader, strlen(vertexShader), NULL, NULL, NULL, "main", "vs_4_0", 0, 0, &vertexShaderBlob, NULL)))
|
||||
return false; // NB: Pass ID3DBlob* pErrorBlob to D3DCompile() to get error showing in (const char*)pErrorBlob->GetBufferPointer(). Make sure to Release() the blob!
|
||||
if (bd->pd3dDevice->CreateVertexShader(vertexShaderBlob->GetBufferPointer(), vertexShaderBlob->GetBufferSize(), NULL, &bd->pVertexShader) != S_OK)
|
||||
{
|
||||
vertexShaderBlob->Release();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create the input layout
|
||||
D3D11_INPUT_ELEMENT_DESC local_layout[] =
|
||||
{
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (UINT)IM_OFFSETOF(ImDrawVert, pos), D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (UINT)IM_OFFSETOF(ImDrawVert, uv), D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
{ "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, (UINT)IM_OFFSETOF(ImDrawVert, col), D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
};
|
||||
if (bd->pd3dDevice->CreateInputLayout(local_layout, 3, vertexShaderBlob->GetBufferPointer(), vertexShaderBlob->GetBufferSize(), &bd->pInputLayout) != S_OK)
|
||||
{
|
||||
vertexShaderBlob->Release();
|
||||
return false;
|
||||
}
|
||||
vertexShaderBlob->Release();
|
||||
|
||||
// Create the constant buffer
|
||||
{
|
||||
D3D11_BUFFER_DESC desc;
|
||||
desc.ByteWidth = sizeof(VERTEX_CONSTANT_BUFFER);
|
||||
desc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
desc.MiscFlags = 0;
|
||||
bd->pd3dDevice->CreateBuffer(&desc, NULL, &bd->pVertexConstantBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
// Create the pixel shader
|
||||
{
|
||||
static const char* pixelShader =
|
||||
"struct PS_INPUT\
|
||||
{\
|
||||
float4 pos : SV_POSITION;\
|
||||
float4 col : COLOR0;\
|
||||
float2 uv : TEXCOORD0;\
|
||||
};\
|
||||
sampler sampler0;\
|
||||
Texture2D texture0;\
|
||||
\
|
||||
float4 main(PS_INPUT input) : SV_Target\
|
||||
{\
|
||||
float4 out_col = input.col * texture0.Sample(sampler0, input.uv); \
|
||||
return out_col; \
|
||||
}";
|
||||
|
||||
ID3DBlob* pixelShaderBlob;
|
||||
if (FAILED(D3DCompile(pixelShader, strlen(pixelShader), NULL, NULL, NULL, "main", "ps_4_0", 0, 0, &pixelShaderBlob, NULL)))
|
||||
return false; // NB: Pass ID3DBlob* pErrorBlob to D3DCompile() to get error showing in (const char*)pErrorBlob->GetBufferPointer(). Make sure to Release() the blob!
|
||||
if (bd->pd3dDevice->CreatePixelShader(pixelShaderBlob->GetBufferPointer(), pixelShaderBlob->GetBufferSize(), NULL, &bd->pPixelShader) != S_OK)
|
||||
{
|
||||
pixelShaderBlob->Release();
|
||||
return false;
|
||||
}
|
||||
pixelShaderBlob->Release();
|
||||
}
|
||||
|
||||
// Create the blending setup
|
||||
{
|
||||
D3D11_BLEND_DESC desc;
|
||||
ZeroMemory(&desc, sizeof(desc));
|
||||
desc.AlphaToCoverageEnable = false;
|
||||
desc.RenderTarget[0].BlendEnable = true;
|
||||
desc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
|
||||
desc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
|
||||
desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
|
||||
desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
|
||||
desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
|
||||
desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
|
||||
desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
|
||||
bd->pd3dDevice->CreateBlendState(&desc, &bd->pBlendState);
|
||||
}
|
||||
|
||||
// Create the rasterizer state
|
||||
{
|
||||
D3D11_RASTERIZER_DESC desc;
|
||||
ZeroMemory(&desc, sizeof(desc));
|
||||
desc.FillMode = D3D11_FILL_SOLID;
|
||||
desc.CullMode = D3D11_CULL_NONE;
|
||||
desc.ScissorEnable = true;
|
||||
desc.DepthClipEnable = true;
|
||||
bd->pd3dDevice->CreateRasterizerState(&desc, &bd->pRasterizerState);
|
||||
}
|
||||
|
||||
// Create depth-stencil State
|
||||
{
|
||||
D3D11_DEPTH_STENCIL_DESC desc;
|
||||
ZeroMemory(&desc, sizeof(desc));
|
||||
desc.DepthEnable = false;
|
||||
desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
|
||||
desc.DepthFunc = D3D11_COMPARISON_ALWAYS;
|
||||
desc.StencilEnable = false;
|
||||
desc.FrontFace.StencilFailOp = desc.FrontFace.StencilDepthFailOp = desc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
|
||||
desc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
|
||||
desc.BackFace = desc.FrontFace;
|
||||
bd->pd3dDevice->CreateDepthStencilState(&desc, &bd->pDepthStencilState);
|
||||
}
|
||||
|
||||
ImGui_ImplDX11_CreateFontsTexture();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGui_ImplDX11_InvalidateDeviceObjects()
|
||||
{
|
||||
ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData();
|
||||
if (!bd->pd3dDevice)
|
||||
return;
|
||||
|
||||
if (bd->pFontSampler) { bd->pFontSampler->Release(); bd->pFontSampler = NULL; }
|
||||
if (bd->pFontTextureView) { bd->pFontTextureView->Release(); bd->pFontTextureView = NULL; ImGui::GetIO().Fonts->SetTexID(NULL); } // We copied data->pFontTextureView to io.Fonts->TexID so let's clear that as well.
|
||||
if (bd->pIB) { bd->pIB->Release(); bd->pIB = NULL; }
|
||||
if (bd->pVB) { bd->pVB->Release(); bd->pVB = NULL; }
|
||||
if (bd->pBlendState) { bd->pBlendState->Release(); bd->pBlendState = NULL; }
|
||||
if (bd->pDepthStencilState) { bd->pDepthStencilState->Release(); bd->pDepthStencilState = NULL; }
|
||||
if (bd->pRasterizerState) { bd->pRasterizerState->Release(); bd->pRasterizerState = NULL; }
|
||||
if (bd->pPixelShader) { bd->pPixelShader->Release(); bd->pPixelShader = NULL; }
|
||||
if (bd->pVertexConstantBuffer) { bd->pVertexConstantBuffer->Release(); bd->pVertexConstantBuffer = NULL; }
|
||||
if (bd->pInputLayout) { bd->pInputLayout->Release(); bd->pInputLayout = NULL; }
|
||||
if (bd->pVertexShader) { bd->pVertexShader->Release(); bd->pVertexShader = NULL; }
|
||||
}
|
||||
|
||||
bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
IM_ASSERT(io.BackendRendererUserData == NULL && "Already initialized a renderer backend!");
|
||||
|
||||
// Setup backend capabilities flags
|
||||
ImGui_ImplDX11_Data* bd = IM_NEW(ImGui_ImplDX11_Data)();
|
||||
io.BackendRendererUserData = (void*)bd;
|
||||
io.BackendRendererName = "imgui_impl_dx11";
|
||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
|
||||
|
||||
// Get factory from device
|
||||
IDXGIDevice* pDXGIDevice = NULL;
|
||||
IDXGIAdapter* pDXGIAdapter = NULL;
|
||||
IDXGIFactory* pFactory = NULL;
|
||||
|
||||
if (device->QueryInterface(IID_PPV_ARGS(&pDXGIDevice)) == S_OK)
|
||||
if (pDXGIDevice->GetParent(IID_PPV_ARGS(&pDXGIAdapter)) == S_OK)
|
||||
if (pDXGIAdapter->GetParent(IID_PPV_ARGS(&pFactory)) == S_OK)
|
||||
{
|
||||
bd->pd3dDevice = device;
|
||||
bd->pd3dDeviceContext = device_context;
|
||||
bd->pFactory = pFactory;
|
||||
}
|
||||
if (pDXGIDevice) pDXGIDevice->Release();
|
||||
if (pDXGIAdapter) pDXGIAdapter->Release();
|
||||
bd->pd3dDevice->AddRef();
|
||||
bd->pd3dDeviceContext->AddRef();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGui_ImplDX11_Shutdown()
|
||||
{
|
||||
ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData();
|
||||
IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?");
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
ImGui_ImplDX11_InvalidateDeviceObjects();
|
||||
if (bd->pFactory) { bd->pFactory->Release(); }
|
||||
if (bd->pd3dDevice) { bd->pd3dDevice->Release(); }
|
||||
if (bd->pd3dDeviceContext) { bd->pd3dDeviceContext->Release(); }
|
||||
io.BackendRendererName = NULL;
|
||||
io.BackendRendererUserData = NULL;
|
||||
IM_DELETE(bd);
|
||||
}
|
||||
|
||||
void ImGui_ImplDX11_NewFrame()
|
||||
{
|
||||
ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData();
|
||||
IM_ASSERT(bd != NULL && "Did you call ImGui_ImplDX11_Init()?");
|
||||
|
||||
if (!bd->pFontSampler)
|
||||
ImGui_ImplDX11_CreateDeviceObjects();
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
// dear imgui: Renderer Backend for DirectX11
|
||||
// This needs to be used along with a Platform Backend (e.g. Win32)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID!
|
||||
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
|
||||
|
||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
struct ID3D11Device;
|
||||
struct ID3D11DeviceContext;
|
||||
|
||||
IMGUI_IMPL_API bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context);
|
||||
IMGUI_IMPL_API void ImGui_ImplDX11_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_ImplDX11_NewFrame();
|
||||
IMGUI_IMPL_API void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data);
|
||||
|
||||
// Use if you want to reset your rendering device without losing Dear ImGui state.
|
||||
IMGUI_IMPL_API void ImGui_ImplDX11_InvalidateDeviceObjects();
|
||||
IMGUI_IMPL_API bool ImGui_ImplDX11_CreateDeviceObjects();
|
||||
@@ -1,258 +0,0 @@
|
||||
// dear imgui: Renderer Backend for OpenGL2 (legacy OpenGL, fixed pipeline)
|
||||
// This needs to be used along with a Platform Backend (e.g. GLFW, SDL, Win32, custom..)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID!
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||
|
||||
// **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
||||
// **Prefer using the code in imgui_impl_opengl3.cpp**
|
||||
// This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read.
|
||||
// If your code is using GL3+ context or any semi modern OpenGL calls, using this is likely to make everything more
|
||||
// complicated, will require your code to reset every single OpenGL attributes to their initial state, and might
|
||||
// confuse your GPU driver.
|
||||
// The GL2 code is unable to reset attributes or even call e.g. "glUseProgram(0)" because they don't exist in that API.
|
||||
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2021-01-03: OpenGL: Backup, setup and restore GL_SHADE_MODEL state, disable GL_STENCIL_TEST and disable GL_NORMAL_ARRAY client state to increase compatibility with legacy OpenGL applications.
|
||||
// 2020-01-23: OpenGL: Backup, setup and restore GL_TEXTURE_ENV to increase compatibility with legacy OpenGL applications.
|
||||
// 2019-04-30: OpenGL: Added support for special ImDrawCallback_ResetRenderState callback to reset render state.
|
||||
// 2019-02-11: OpenGL: Projecting clipping rectangles correctly using draw_data->FramebufferScale to allow multi-viewports for retina display.
|
||||
// 2018-11-30: Misc: Setting up io.BackendRendererName so it can be displayed in the About Window.
|
||||
// 2018-08-03: OpenGL: Disabling/restoring GL_LIGHTING and GL_COLOR_MATERIAL to increase compatibility with legacy OpenGL applications.
|
||||
// 2018-06-08: Misc: Extracted imgui_impl_opengl2.cpp/.h away from the old combined GLFW/SDL+OpenGL2 examples.
|
||||
// 2018-06-08: OpenGL: Use draw_data->DisplayPos and draw_data->DisplaySize to setup projection matrix and clipping rectangle.
|
||||
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_ImplOpenGL2_RenderDrawData() in the .h file so you can call it yourself.
|
||||
// 2017-09-01: OpenGL: Save and restore current polygon mode.
|
||||
// 2016-09-10: OpenGL: Uploading font texture as RGBA32 to increase compatibility with users shaders (not ideal).
|
||||
// 2016-09-05: OpenGL: Fixed save and restore of current scissor rectangle.
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_opengl2.h"
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
|
||||
#include <stddef.h> // intptr_t
|
||||
#else
|
||||
#include <stdint.h> // intptr_t
|
||||
#endif
|
||||
|
||||
// Include OpenGL header (without an OpenGL loader) requires a bit of fiddling
|
||||
#if defined(_WIN32) && !defined(APIENTRY)
|
||||
#define APIENTRY __stdcall // It is customary to use APIENTRY for OpenGL function pointer declarations on all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
|
||||
#endif
|
||||
#if defined(_WIN32) && !defined(WINGDIAPI)
|
||||
#define WINGDIAPI __declspec(dllimport) // Some Windows OpenGL headers need this
|
||||
#endif
|
||||
#if defined(__APPLE__)
|
||||
#define GL_SILENCE_DEPRECATION
|
||||
#include <OpenGL/gl.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
|
||||
// OpenGL Data
|
||||
static GLuint g_FontTexture = 0;
|
||||
|
||||
// Functions
|
||||
bool ImGui_ImplOpenGL2_Init()
|
||||
{
|
||||
// Setup backend capabilities flags
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.BackendRendererName = "imgui_impl_opengl2";
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGui_ImplOpenGL2_Shutdown()
|
||||
{
|
||||
ImGui_ImplOpenGL2_DestroyDeviceObjects();
|
||||
}
|
||||
|
||||
void ImGui_ImplOpenGL2_NewFrame()
|
||||
{
|
||||
if (!g_FontTexture)
|
||||
ImGui_ImplOpenGL2_CreateDeviceObjects();
|
||||
}
|
||||
|
||||
static void ImGui_ImplOpenGL2_SetupRenderState(ImDrawData* draw_data, int fb_width, int fb_height)
|
||||
{
|
||||
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, vertex/texcoord/color pointers, polygon fill.
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
//glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); // In order to composite our output buffer we need to preserve alpha
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_COLOR_MATERIAL);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
glShadeModel(GL_SMOOTH);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
// If you are using this code with non-legacy OpenGL header/contexts (which you should not, prefer using imgui_impl_opengl3.cpp!!),
|
||||
// you may need to backup/reset/restore other state, e.g. for current shader using the commented lines below.
|
||||
// (DO NOT MODIFY THIS FILE! Add the code in your calling function)
|
||||
// GLint last_program;
|
||||
// glGetIntegerv(GL_CURRENT_PROGRAM, &last_program);
|
||||
// glUseProgram(0);
|
||||
// ImGui_ImplOpenGL2_RenderDrawData(...);
|
||||
// glUseProgram(last_program)
|
||||
// There are potentially many more states you could need to clear/setup that we can't access from default headers.
|
||||
// e.g. glBindBuffer(GL_ARRAY_BUFFER, 0), glDisable(GL_TEXTURE_CUBE_MAP).
|
||||
|
||||
// Setup viewport, orthographic projection matrix
|
||||
// Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps.
|
||||
glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho(draw_data->DisplayPos.x, draw_data->DisplayPos.x + draw_data->DisplaySize.x, draw_data->DisplayPos.y + draw_data->DisplaySize.y, draw_data->DisplayPos.y, -1.0f, +1.0f);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
// OpenGL2 Render function.
|
||||
// Note that this implementation is little overcomplicated because we are saving/setting up/restoring every OpenGL state explicitly.
|
||||
// This is in order to be able to run within an OpenGL engine that doesn't do so.
|
||||
void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data)
|
||||
{
|
||||
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
|
||||
int fb_width = (int)(draw_data->DisplaySize.x * draw_data->FramebufferScale.x);
|
||||
int fb_height = (int)(draw_data->DisplaySize.y * draw_data->FramebufferScale.y);
|
||||
if (fb_width == 0 || fb_height == 0)
|
||||
return;
|
||||
|
||||
// Backup GL state
|
||||
GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
||||
GLint last_polygon_mode[2]; glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode);
|
||||
GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
|
||||
GLint last_scissor_box[4]; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box);
|
||||
GLint last_shade_model; glGetIntegerv(GL_SHADE_MODEL, &last_shade_model);
|
||||
GLint last_tex_env_mode; glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &last_tex_env_mode);
|
||||
glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_TRANSFORM_BIT);
|
||||
|
||||
// Setup desired GL state
|
||||
ImGui_ImplOpenGL2_SetupRenderState(draw_data, fb_width, fb_height);
|
||||
|
||||
// Will project scissor/clipping rectangles into framebuffer space
|
||||
ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports
|
||||
ImVec2 clip_scale = draw_data->FramebufferScale; // (1,1) unless using retina display which are often (2,2)
|
||||
|
||||
// Render command lists
|
||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||
{
|
||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||
const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;
|
||||
const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
|
||||
glVertexPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, pos)));
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, uv)));
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, col)));
|
||||
|
||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||
{
|
||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||
if (pcmd->UserCallback)
|
||||
{
|
||||
// User callback, registered via ImDrawList::AddCallback()
|
||||
// (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
|
||||
if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
|
||||
ImGui_ImplOpenGL2_SetupRenderState(draw_data, fb_width, fb_height);
|
||||
else
|
||||
pcmd->UserCallback(cmd_list, pcmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Project scissor/clipping rectangles into framebuffer space
|
||||
ImVec4 clip_rect;
|
||||
clip_rect.x = (pcmd->ClipRect.x - clip_off.x) * clip_scale.x;
|
||||
clip_rect.y = (pcmd->ClipRect.y - clip_off.y) * clip_scale.y;
|
||||
clip_rect.z = (pcmd->ClipRect.z - clip_off.x) * clip_scale.x;
|
||||
clip_rect.w = (pcmd->ClipRect.w - clip_off.y) * clip_scale.y;
|
||||
|
||||
if (clip_rect.x < fb_width && clip_rect.y < fb_height && clip_rect.z >= 0.0f && clip_rect.w >= 0.0f)
|
||||
{
|
||||
// Apply scissor/clipping rectangle
|
||||
glScissor((int)clip_rect.x, (int)(fb_height - clip_rect.w), (int)(clip_rect.z - clip_rect.x), (int)(clip_rect.w - clip_rect.y));
|
||||
|
||||
// Bind texture, Draw
|
||||
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId);
|
||||
glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer);
|
||||
}
|
||||
}
|
||||
idx_buffer += pcmd->ElemCount;
|
||||
}
|
||||
}
|
||||
|
||||
// Restore modified GL state
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glBindTexture(GL_TEXTURE_2D, (GLuint)last_texture);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
glPopAttrib();
|
||||
glPolygonMode(GL_FRONT, (GLenum)last_polygon_mode[0]); glPolygonMode(GL_BACK, (GLenum)last_polygon_mode[1]);
|
||||
glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
|
||||
glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]);
|
||||
glShadeModel(last_shade_model);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, last_tex_env_mode);
|
||||
}
|
||||
|
||||
bool ImGui_ImplOpenGL2_CreateFontsTexture()
|
||||
{
|
||||
// Build texture atlas
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
unsigned char* pixels;
|
||||
int width, height;
|
||||
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bit (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.
|
||||
|
||||
// Upload texture to graphics system
|
||||
GLint last_texture;
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
||||
glGenTextures(1, &g_FontTexture);
|
||||
glBindTexture(GL_TEXTURE_2D, g_FontTexture);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->SetTexID((ImTextureID)(intptr_t)g_FontTexture);
|
||||
|
||||
// Restore state
|
||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGui_ImplOpenGL2_DestroyFontsTexture()
|
||||
{
|
||||
if (g_FontTexture)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
glDeleteTextures(1, &g_FontTexture);
|
||||
io.Fonts->SetTexID(0);
|
||||
g_FontTexture = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool ImGui_ImplOpenGL2_CreateDeviceObjects()
|
||||
{
|
||||
return ImGui_ImplOpenGL2_CreateFontsTexture();
|
||||
}
|
||||
|
||||
void ImGui_ImplOpenGL2_DestroyDeviceObjects()
|
||||
{
|
||||
ImGui_ImplOpenGL2_DestroyFontsTexture();
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
// dear imgui: Renderer Backend for OpenGL2 (legacy OpenGL, fixed pipeline)
|
||||
// This needs to be used along with a Platform Backend (e.g. GLFW, SDL, Win32, custom..)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID!
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||
|
||||
// **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)**
|
||||
// **Prefer using the code in imgui_impl_opengl3.cpp**
|
||||
// This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read.
|
||||
// If your code is using GL3+ context or any semi modern OpenGL calls, using this is likely to make everything more
|
||||
// complicated, will require your code to reset every single OpenGL attributes to their initial state, and might
|
||||
// confuse your GPU driver.
|
||||
// The GL2 code is unable to reset attributes or even call e.g. "glUseProgram(0)" because they don't exist in that API.
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
IMGUI_IMPL_API bool ImGui_ImplOpenGL2_Init();
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL2_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL2_NewFrame();
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data);
|
||||
|
||||
// Called by Init/NewFrame/Shutdown
|
||||
IMGUI_IMPL_API bool ImGui_ImplOpenGL2_CreateFontsTexture();
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL2_DestroyFontsTexture();
|
||||
IMGUI_IMPL_API bool ImGui_ImplOpenGL2_CreateDeviceObjects();
|
||||
IMGUI_IMPL_API void ImGui_ImplOpenGL2_DestroyDeviceObjects();
|
||||
@@ -1,377 +0,0 @@
|
||||
// dear imgui: Platform Backend for SDL2
|
||||
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
|
||||
// (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
|
||||
// (Requires: SDL 2.0. Prefer SDL 2.0.4+ for full feature support.)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
||||
// [X] Platform: Clipboard support.
|
||||
// [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE).
|
||||
// [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
||||
// Missing features:
|
||||
// [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME.
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2021-03-22: Rework global mouse pos availability check listing supported platforms explicitly, effectively fixing mouse access on Raspberry Pi. (#2837, #3950)
|
||||
// 2020-05-25: Misc: Report a zero display-size when window is minimized, to be consistent with other backends.
|
||||
// 2020-02-20: Inputs: Fixed mapping for ImGuiKey_KeyPadEnter (using SDL_SCANCODE_KP_ENTER instead of SDL_SCANCODE_RETURN2).
|
||||
// 2019-12-17: Inputs: On Wayland, use SDL_GetMouseState (because there is no global mouse state).
|
||||
// 2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor.
|
||||
// 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter.
|
||||
// 2019-04-23: Inputs: Added support for SDL_GameController (if ImGuiConfigFlags_NavEnableGamepad is set by user application).
|
||||
// 2019-03-12: Misc: Preserve DisplayFramebufferScale when main window is minimized.
|
||||
// 2018-12-21: Inputs: Workaround for Android/iOS which don't seem to handle focus related calls.
|
||||
// 2018-11-30: Misc: Setting up io.BackendPlatformName so it can be displayed in the About Window.
|
||||
// 2018-11-14: Changed the signature of ImGui_ImplSDL2_ProcessEvent() to take a 'const SDL_Event*'.
|
||||
// 2018-08-01: Inputs: Workaround for Emscripten which doesn't seem to handle focus related calls.
|
||||
// 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.
|
||||
// 2018-06-08: Misc: Extracted imgui_impl_sdl.cpp/.h away from the old combined SDL2+OpenGL/Vulkan examples.
|
||||
// 2018-06-08: Misc: ImGui_ImplSDL2_InitForOpenGL() now takes a SDL_GLContext parameter.
|
||||
// 2018-05-09: Misc: Fixed clipboard paste memory leak (we didn't call SDL_FreeMemory on the data returned by SDL_GetClipboardText).
|
||||
// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors flag + honor ImGuiConfigFlags_NoMouseCursorChange flag.
|
||||
// 2018-02-16: Inputs: Added support for mouse cursors, honoring ImGui::GetMouseCursor() value.
|
||||
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
|
||||
// 2018-02-06: Inputs: Added mapping for ImGuiKey_Space.
|
||||
// 2018-02-05: Misc: Using SDL_GetPerformanceCounter() instead of SDL_GetTicks() to be able to handle very high framerate (1000+ FPS).
|
||||
// 2018-02-05: Inputs: Keyboard mapping is using scancodes everywhere instead of a confusing mixture of keycodes and scancodes.
|
||||
// 2018-01-20: Inputs: Added Horizontal Mouse Wheel support.
|
||||
// 2018-01-19: Inputs: When available (SDL 2.0.4+) using SDL_CaptureMouse() to retrieve coordinates outside of client area when dragging. Otherwise (SDL 2.0.3 and before) testing for SDL_WINDOW_INPUT_FOCUS instead of SDL_WINDOW_MOUSE_FOCUS.
|
||||
// 2018-01-18: Inputs: Added mapping for ImGuiKey_Insert.
|
||||
// 2017-08-25: Inputs: MousePos set to -FLT_MAX,-FLT_MAX when mouse is unavailable/missing (instead of -1,-1).
|
||||
// 2016-10-15: Misc: Added a void* user_data parameter to Clipboard function handlers.
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_sdl.h"
|
||||
|
||||
// SDL
|
||||
#include <SDL.h>
|
||||
#include <SDL_syswm.h>
|
||||
#if defined(__APPLE__)
|
||||
#include "TargetConditionals.h"
|
||||
#endif
|
||||
|
||||
#define SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE SDL_VERSION_ATLEAST(2,0,4)
|
||||
#define SDL_HAS_VULKAN SDL_VERSION_ATLEAST(2,0,6)
|
||||
|
||||
// Data
|
||||
static SDL_Window* g_Window = NULL;
|
||||
static Uint64 g_Time = 0;
|
||||
static bool g_MousePressed[3] = { false, false, false };
|
||||
static SDL_Cursor* g_MouseCursors[ImGuiMouseCursor_COUNT] = {};
|
||||
static char* g_ClipboardTextData = NULL;
|
||||
static bool g_MouseCanUseGlobalState = true;
|
||||
|
||||
static const char* ImGui_ImplSDL2_GetClipboardText(void*)
|
||||
{
|
||||
if (g_ClipboardTextData)
|
||||
SDL_free(g_ClipboardTextData);
|
||||
g_ClipboardTextData = SDL_GetClipboardText();
|
||||
return g_ClipboardTextData;
|
||||
}
|
||||
|
||||
static void ImGui_ImplSDL2_SetClipboardText(void*, const char* text)
|
||||
{
|
||||
SDL_SetClipboardText(text);
|
||||
}
|
||||
|
||||
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
|
||||
// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.
|
||||
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
|
||||
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
||||
// If you have multiple SDL events and some of them are not meant to be used by dear imgui, you may need to filter events based on their windowID field.
|
||||
bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
switch (event->type)
|
||||
{
|
||||
case SDL_MOUSEWHEEL:
|
||||
{
|
||||
if (event->wheel.x > 0) io.MouseWheelH += 1;
|
||||
if (event->wheel.x < 0) io.MouseWheelH -= 1;
|
||||
if (event->wheel.y > 0) io.MouseWheel += 1;
|
||||
if (event->wheel.y < 0) io.MouseWheel -= 1;
|
||||
return true;
|
||||
}
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
{
|
||||
if (event->button.button == SDL_BUTTON_LEFT) g_MousePressed[0] = true;
|
||||
if (event->button.button == SDL_BUTTON_RIGHT) g_MousePressed[1] = true;
|
||||
if (event->button.button == SDL_BUTTON_MIDDLE) g_MousePressed[2] = true;
|
||||
return true;
|
||||
}
|
||||
case SDL_TEXTINPUT:
|
||||
{
|
||||
io.AddInputCharactersUTF8(event->text.text);
|
||||
return true;
|
||||
}
|
||||
case SDL_KEYDOWN:
|
||||
case SDL_KEYUP:
|
||||
{
|
||||
int key = event->key.keysym.scancode;
|
||||
IM_ASSERT(key >= 0 && key < IM_ARRAYSIZE(io.KeysDown));
|
||||
io.KeysDown[key] = (event->type == SDL_KEYDOWN);
|
||||
io.KeyShift = ((SDL_GetModState() & KMOD_SHIFT) != 0);
|
||||
io.KeyCtrl = ((SDL_GetModState() & KMOD_CTRL) != 0);
|
||||
io.KeyAlt = ((SDL_GetModState() & KMOD_ALT) != 0);
|
||||
#ifdef _WIN32
|
||||
io.KeySuper = false;
|
||||
#else
|
||||
io.KeySuper = ((SDL_GetModState() & KMOD_GUI) != 0);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool ImGui_ImplSDL2_Init(SDL_Window* window)
|
||||
{
|
||||
g_Window = window;
|
||||
|
||||
// Setup backend capabilities flags
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
|
||||
io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
|
||||
io.BackendPlatformName = "imgui_impl_sdl";
|
||||
|
||||
// Keyboard mapping. Dear ImGui will use those indices to peek into the io.KeysDown[] array.
|
||||
io.KeyMap[ImGuiKey_Tab] = SDL_SCANCODE_TAB;
|
||||
io.KeyMap[ImGuiKey_LeftArrow] = SDL_SCANCODE_LEFT;
|
||||
io.KeyMap[ImGuiKey_RightArrow] = SDL_SCANCODE_RIGHT;
|
||||
io.KeyMap[ImGuiKey_UpArrow] = SDL_SCANCODE_UP;
|
||||
io.KeyMap[ImGuiKey_DownArrow] = SDL_SCANCODE_DOWN;
|
||||
io.KeyMap[ImGuiKey_PageUp] = SDL_SCANCODE_PAGEUP;
|
||||
io.KeyMap[ImGuiKey_PageDown] = SDL_SCANCODE_PAGEDOWN;
|
||||
io.KeyMap[ImGuiKey_Home] = SDL_SCANCODE_HOME;
|
||||
io.KeyMap[ImGuiKey_End] = SDL_SCANCODE_END;
|
||||
io.KeyMap[ImGuiKey_Insert] = SDL_SCANCODE_INSERT;
|
||||
io.KeyMap[ImGuiKey_Delete] = SDL_SCANCODE_DELETE;
|
||||
io.KeyMap[ImGuiKey_Backspace] = SDL_SCANCODE_BACKSPACE;
|
||||
io.KeyMap[ImGuiKey_Space] = SDL_SCANCODE_SPACE;
|
||||
io.KeyMap[ImGuiKey_Enter] = SDL_SCANCODE_RETURN;
|
||||
io.KeyMap[ImGuiKey_Escape] = SDL_SCANCODE_ESCAPE;
|
||||
io.KeyMap[ImGuiKey_KeyPadEnter] = SDL_SCANCODE_KP_ENTER;
|
||||
io.KeyMap[ImGuiKey_A] = SDL_SCANCODE_A;
|
||||
io.KeyMap[ImGuiKey_C] = SDL_SCANCODE_C;
|
||||
io.KeyMap[ImGuiKey_V] = SDL_SCANCODE_V;
|
||||
io.KeyMap[ImGuiKey_X] = SDL_SCANCODE_X;
|
||||
io.KeyMap[ImGuiKey_Y] = SDL_SCANCODE_Y;
|
||||
io.KeyMap[ImGuiKey_Z] = SDL_SCANCODE_Z;
|
||||
|
||||
io.SetClipboardTextFn = ImGui_ImplSDL2_SetClipboardText;
|
||||
io.GetClipboardTextFn = ImGui_ImplSDL2_GetClipboardText;
|
||||
io.ClipboardUserData = NULL;
|
||||
|
||||
// Load mouse cursors
|
||||
g_MouseCursors[ImGuiMouseCursor_Arrow] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
|
||||
g_MouseCursors[ImGuiMouseCursor_TextInput] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_IBEAM);
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeAll] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEALL);
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeNS] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENS);
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeEW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEWE);
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeNESW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENESW);
|
||||
g_MouseCursors[ImGuiMouseCursor_ResizeNWSE] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENWSE);
|
||||
g_MouseCursors[ImGuiMouseCursor_Hand] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND);
|
||||
g_MouseCursors[ImGuiMouseCursor_NotAllowed] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NO);
|
||||
|
||||
// Check and store if we are on a SDL backend that supports global mouse position
|
||||
// ("wayland" and "rpi" don't support it, but we chose to use a white-list instead of a black-list)
|
||||
const char* sdl_backend = SDL_GetCurrentVideoDriver();
|
||||
const char* global_mouse_whitelist[] = { "windows", "cocoa", "x11", "DIVE", "VMAN" };
|
||||
g_MouseCanUseGlobalState = false;
|
||||
for (int n = 0; n < IM_ARRAYSIZE(global_mouse_whitelist); n++)
|
||||
if (strncmp(sdl_backend, global_mouse_whitelist[n], strlen(global_mouse_whitelist[n])) == 0)
|
||||
g_MouseCanUseGlobalState = true;
|
||||
|
||||
#ifdef _WIN32
|
||||
SDL_SysWMinfo wmInfo;
|
||||
SDL_VERSION(&wmInfo.version);
|
||||
SDL_GetWindowWMInfo(window, &wmInfo);
|
||||
io.ImeWindowHandle = wmInfo.info.win.window;
|
||||
#else
|
||||
(void)window;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ImGui_ImplSDL2_InitForOpenGL(SDL_Window* window, void* sdl_gl_context)
|
||||
{
|
||||
(void)sdl_gl_context; // Viewport branch will need this.
|
||||
return ImGui_ImplSDL2_Init(window);
|
||||
}
|
||||
|
||||
bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window)
|
||||
{
|
||||
#if !SDL_HAS_VULKAN
|
||||
IM_ASSERT(0 && "Unsupported");
|
||||
#endif
|
||||
return ImGui_ImplSDL2_Init(window);
|
||||
}
|
||||
|
||||
bool ImGui_ImplSDL2_InitForD3D(SDL_Window* window)
|
||||
{
|
||||
#if !defined(_WIN32)
|
||||
IM_ASSERT(0 && "Unsupported");
|
||||
#endif
|
||||
return ImGui_ImplSDL2_Init(window);
|
||||
}
|
||||
|
||||
bool ImGui_ImplSDL2_InitForMetal(SDL_Window* window)
|
||||
{
|
||||
return ImGui_ImplSDL2_Init(window);
|
||||
}
|
||||
|
||||
void ImGui_ImplSDL2_Shutdown()
|
||||
{
|
||||
g_Window = NULL;
|
||||
|
||||
// Destroy last known clipboard data
|
||||
if (g_ClipboardTextData)
|
||||
SDL_free(g_ClipboardTextData);
|
||||
g_ClipboardTextData = NULL;
|
||||
|
||||
// Destroy SDL mouse cursors
|
||||
for (ImGuiMouseCursor cursor_n = 0; cursor_n < ImGuiMouseCursor_COUNT; cursor_n++)
|
||||
SDL_FreeCursor(g_MouseCursors[cursor_n]);
|
||||
memset(g_MouseCursors, 0, sizeof(g_MouseCursors));
|
||||
}
|
||||
|
||||
static void ImGui_ImplSDL2_UpdateMousePosAndButtons()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
// Set OS mouse position if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user)
|
||||
if (io.WantSetMousePos)
|
||||
SDL_WarpMouseInWindow(g_Window, (int)io.MousePos.x, (int)io.MousePos.y);
|
||||
else
|
||||
io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
|
||||
|
||||
int mx, my;
|
||||
Uint32 mouse_buttons = SDL_GetMouseState(&mx, &my);
|
||||
io.MouseDown[0] = g_MousePressed[0] || (mouse_buttons & SDL_BUTTON(SDL_BUTTON_LEFT)) != 0; // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
|
||||
io.MouseDown[1] = g_MousePressed[1] || (mouse_buttons & SDL_BUTTON(SDL_BUTTON_RIGHT)) != 0;
|
||||
io.MouseDown[2] = g_MousePressed[2] || (mouse_buttons & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0;
|
||||
g_MousePressed[0] = g_MousePressed[1] = g_MousePressed[2] = false;
|
||||
|
||||
#if SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE && !defined(__EMSCRIPTEN__) && !defined(__ANDROID__) && !(defined(__APPLE__) && TARGET_OS_IOS)
|
||||
SDL_Window* focused_window = SDL_GetKeyboardFocus();
|
||||
if (g_Window == focused_window)
|
||||
{
|
||||
if (g_MouseCanUseGlobalState)
|
||||
{
|
||||
// SDL_GetMouseState() gives mouse position seemingly based on the last window entered/focused(?)
|
||||
// The creation of a new windows at runtime and SDL_CaptureMouse both seems to severely mess up with that, so we retrieve that position globally.
|
||||
// Won't use this workaround on SDL backends that have no global mouse position, like Wayland or RPI
|
||||
int wx, wy;
|
||||
SDL_GetWindowPosition(focused_window, &wx, &wy);
|
||||
SDL_GetGlobalMouseState(&mx, &my);
|
||||
mx -= wx;
|
||||
my -= wy;
|
||||
}
|
||||
io.MousePos = ImVec2((float)mx, (float)my);
|
||||
}
|
||||
|
||||
// SDL_CaptureMouse() let the OS know e.g. that our imgui drag outside the SDL window boundaries shouldn't e.g. trigger the OS window resize cursor.
|
||||
// The function is only supported from SDL 2.0.4 (released Jan 2016)
|
||||
bool any_mouse_button_down = ImGui::IsAnyMouseDown();
|
||||
SDL_CaptureMouse(any_mouse_button_down ? SDL_TRUE : SDL_FALSE);
|
||||
#else
|
||||
if (SDL_GetWindowFlags(g_Window) & SDL_WINDOW_INPUT_FOCUS)
|
||||
io.MousePos = ImVec2((float)mx, (float)my);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ImGui_ImplSDL2_UpdateMouseCursor()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange)
|
||||
return;
|
||||
|
||||
ImGuiMouseCursor imgui_cursor = ImGui::GetMouseCursor();
|
||||
if (io.MouseDrawCursor || imgui_cursor == ImGuiMouseCursor_None)
|
||||
{
|
||||
// Hide OS mouse cursor if imgui is drawing it or if it wants no cursor
|
||||
SDL_ShowCursor(SDL_FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Show OS mouse cursor
|
||||
SDL_SetCursor(g_MouseCursors[imgui_cursor] ? g_MouseCursors[imgui_cursor] : g_MouseCursors[ImGuiMouseCursor_Arrow]);
|
||||
SDL_ShowCursor(SDL_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static void ImGui_ImplSDL2_UpdateGamepads()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
memset(io.NavInputs, 0, sizeof(io.NavInputs));
|
||||
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0)
|
||||
return;
|
||||
|
||||
// Get gamepad
|
||||
SDL_GameController* game_controller = SDL_GameControllerOpen(0);
|
||||
if (!game_controller)
|
||||
{
|
||||
io.BackendFlags &= ~ImGuiBackendFlags_HasGamepad;
|
||||
return;
|
||||
}
|
||||
|
||||
// Update gamepad inputs
|
||||
#define MAP_BUTTON(NAV_NO, BUTTON_NO) { io.NavInputs[NAV_NO] = (SDL_GameControllerGetButton(game_controller, BUTTON_NO) != 0) ? 1.0f : 0.0f; }
|
||||
#define MAP_ANALOG(NAV_NO, AXIS_NO, V0, V1) { float vn = (float)(SDL_GameControllerGetAxis(game_controller, AXIS_NO) - V0) / (float)(V1 - V0); if (vn > 1.0f) vn = 1.0f; if (vn > 0.0f && io.NavInputs[NAV_NO] < vn) io.NavInputs[NAV_NO] = vn; }
|
||||
const int thumb_dead_zone = 8000; // SDL_gamecontroller.h suggests using this value.
|
||||
MAP_BUTTON(ImGuiNavInput_Activate, SDL_CONTROLLER_BUTTON_A); // Cross / A
|
||||
MAP_BUTTON(ImGuiNavInput_Cancel, SDL_CONTROLLER_BUTTON_B); // Circle / B
|
||||
MAP_BUTTON(ImGuiNavInput_Menu, SDL_CONTROLLER_BUTTON_X); // Square / X
|
||||
MAP_BUTTON(ImGuiNavInput_Input, SDL_CONTROLLER_BUTTON_Y); // Triangle / Y
|
||||
MAP_BUTTON(ImGuiNavInput_DpadLeft, SDL_CONTROLLER_BUTTON_DPAD_LEFT); // D-Pad Left
|
||||
MAP_BUTTON(ImGuiNavInput_DpadRight, SDL_CONTROLLER_BUTTON_DPAD_RIGHT); // D-Pad Right
|
||||
MAP_BUTTON(ImGuiNavInput_DpadUp, SDL_CONTROLLER_BUTTON_DPAD_UP); // D-Pad Up
|
||||
MAP_BUTTON(ImGuiNavInput_DpadDown, SDL_CONTROLLER_BUTTON_DPAD_DOWN); // D-Pad Down
|
||||
MAP_BUTTON(ImGuiNavInput_FocusPrev, SDL_CONTROLLER_BUTTON_LEFTSHOULDER); // L1 / LB
|
||||
MAP_BUTTON(ImGuiNavInput_FocusNext, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER); // R1 / RB
|
||||
MAP_BUTTON(ImGuiNavInput_TweakSlow, SDL_CONTROLLER_BUTTON_LEFTSHOULDER); // L1 / LB
|
||||
MAP_BUTTON(ImGuiNavInput_TweakFast, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER); // R1 / RB
|
||||
MAP_ANALOG(ImGuiNavInput_LStickLeft, SDL_CONTROLLER_AXIS_LEFTX, -thumb_dead_zone, -32768);
|
||||
MAP_ANALOG(ImGuiNavInput_LStickRight, SDL_CONTROLLER_AXIS_LEFTX, +thumb_dead_zone, +32767);
|
||||
MAP_ANALOG(ImGuiNavInput_LStickUp, SDL_CONTROLLER_AXIS_LEFTY, -thumb_dead_zone, -32767);
|
||||
MAP_ANALOG(ImGuiNavInput_LStickDown, SDL_CONTROLLER_AXIS_LEFTY, +thumb_dead_zone, +32767);
|
||||
|
||||
io.BackendFlags |= ImGuiBackendFlags_HasGamepad;
|
||||
#undef MAP_BUTTON
|
||||
#undef MAP_ANALOG
|
||||
}
|
||||
|
||||
void ImGui_ImplSDL2_NewFrame(SDL_Window* window)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
IM_ASSERT(io.Fonts->IsBuilt() && "Font atlas not built! It is generally built by the renderer backend. Missing call to renderer _NewFrame() function? e.g. ImGui_ImplOpenGL3_NewFrame().");
|
||||
|
||||
// Setup display size (every frame to accommodate for window resizing)
|
||||
int w, h;
|
||||
int display_w, display_h;
|
||||
SDL_GetWindowSize(window, &w, &h);
|
||||
if (SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED)
|
||||
w = h = 0;
|
||||
SDL_GL_GetDrawableSize(window, &display_w, &display_h);
|
||||
io.DisplaySize = ImVec2((float)w, (float)h);
|
||||
if (w > 0 && h > 0)
|
||||
io.DisplayFramebufferScale = ImVec2((float)display_w / w, (float)display_h / h);
|
||||
|
||||
// Setup time step (we don't use SDL_GetTicks() because it is using millisecond resolution)
|
||||
static Uint64 frequency = SDL_GetPerformanceFrequency();
|
||||
Uint64 current_time = SDL_GetPerformanceCounter();
|
||||
io.DeltaTime = g_Time > 0 ? (float)((double)(current_time - g_Time) / frequency) : (float)(1.0f / 60.0f);
|
||||
g_Time = current_time;
|
||||
|
||||
ImGui_ImplSDL2_UpdateMousePosAndButtons();
|
||||
ImGui_ImplSDL2_UpdateMouseCursor();
|
||||
|
||||
// Update game controllers (if enabled and available)
|
||||
ImGui_ImplSDL2_UpdateGamepads();
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
// dear imgui: Platform Backend for SDL2
|
||||
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
|
||||
// (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
||||
// [X] Platform: Clipboard support.
|
||||
// [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE).
|
||||
// [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
||||
// Missing features:
|
||||
// [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME.
|
||||
|
||||
// You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
struct SDL_Window;
|
||||
typedef union SDL_Event SDL_Event;
|
||||
|
||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForOpenGL(SDL_Window* window, void* sdl_gl_context);
|
||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window);
|
||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForD3D(SDL_Window* window);
|
||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForMetal(SDL_Window* window);
|
||||
IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame(SDL_Window* window);
|
||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event);
|
||||
@@ -1,790 +0,0 @@
|
||||
// dear imgui: Platform Backend for Windows (standard windows API for 32 and 64 bits applications)
|
||||
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Platform: Clipboard support (for Win32 this is actually part of core dear imgui)
|
||||
// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy VK_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set]
|
||||
// [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
||||
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
||||
|
||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_win32.h"
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <windowsx.h> // GET_X_LPARAM(), GET_Y_LPARAM()
|
||||
#include <tchar.h>
|
||||
#include <dwmapi.h>
|
||||
|
||||
// Configuration flags to add in your imconfig.h file:
|
||||
//#define IMGUI_IMPL_WIN32_DISABLE_GAMEPAD // Disable gamepad support. This was meaningful before <1.81 but we now load XInput dynamically so the option is now less relevant.
|
||||
|
||||
// Using XInput for gamepad (will load DLL dynamically)
|
||||
#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
|
||||
#include <xinput.h>
|
||||
typedef DWORD (WINAPI *PFN_XInputGetCapabilities)(DWORD, DWORD, XINPUT_CAPABILITIES*);
|
||||
typedef DWORD (WINAPI *PFN_XInputGetState)(DWORD, XINPUT_STATE*);
|
||||
#endif
|
||||
|
||||
// CHANGELOG
|
||||
// (minor and older changes stripped away, please see git history for details)
|
||||
// 2022-01-26: Inputs: replaced short-lived io.AddKeyModsEvent() (added two weeks ago)with io.AddKeyEvent() using ImGuiKey_ModXXX flags. Sorry for the confusion.
|
||||
// 2021-01-20: Inputs: calling new io.AddKeyAnalogEvent() for gamepad support, instead of writing directly to io.NavInputs[].
|
||||
// 2022-01-17: Inputs: calling new io.AddMousePosEvent(), io.AddMouseButtonEvent(), io.AddMouseWheelEvent() API (1.87+).
|
||||
// 2022-01-17: Inputs: always update key mods next and before a key event (not in NewFrame) to fix input queue with very low framerates.
|
||||
// 2022-01-12: Inputs: Update mouse inputs using WM_MOUSEMOVE/WM_MOUSELEAVE + fallback to provide it when focused but not hovered/captured. More standard and will allow us to pass it to future input queue API.
|
||||
// 2022-01-12: Inputs: Maintain our own copy of MouseButtonsDown mask instead of using ImGui::IsAnyMouseDown() which will be obsoleted.
|
||||
// 2022-01-10: Inputs: calling new io.AddKeyEvent(), io.AddKeyModsEvent() + io.SetKeyEventNativeData() API (1.87+). Support for full ImGuiKey range.
|
||||
// 2021-12-16: Inputs: Fill VK_LCONTROL/VK_RCONTROL/VK_LSHIFT/VK_RSHIFT/VK_LMENU/VK_RMENU for completeness.
|
||||
// 2021-08-17: Calling io.AddFocusEvent() on WM_SETFOCUS/WM_KILLFOCUS messages.
|
||||
// 2021-08-02: Inputs: Fixed keyboard modifiers being reported when host window doesn't have focus.
|
||||
// 2021-07-29: Inputs: MousePos is correctly reported when the host platform window is hovered but not focused (using TrackMouseEvent() to receive WM_MOUSELEAVE events).
|
||||
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
||||
// 2021-06-08: Fixed ImGui_ImplWin32_EnableDpiAwareness() and ImGui_ImplWin32_GetDpiScaleForMonitor() to handle Windows 8.1/10 features without a manifest (per-monitor DPI, and properly calls SetProcessDpiAwareness() on 8.1).
|
||||
// 2021-03-23: Inputs: Clearing keyboard down array when losing focus (WM_KILLFOCUS).
|
||||
// 2021-02-18: Added ImGui_ImplWin32_EnableAlphaCompositing(). Non Visual Studio users will need to link with dwmapi.lib (MinGW/gcc: use -ldwmapi).
|
||||
// 2021-02-17: Fixed ImGui_ImplWin32_EnableDpiAwareness() attempting to get SetProcessDpiAwareness from shcore.dll on Windows 8 whereas it is only supported on Windows 8.1.
|
||||
// 2021-01-25: Inputs: Dynamically loading XInput DLL.
|
||||
// 2020-12-04: Misc: Fixed setting of io.DisplaySize to invalid/uninitialized data when after hwnd has been closed.
|
||||
// 2020-03-03: Inputs: Calling AddInputCharacterUTF16() to support surrogate pairs leading to codepoint >= 0x10000 (for more complete CJK inputs)
|
||||
// 2020-02-17: Added ImGui_ImplWin32_EnableDpiAwareness(), ImGui_ImplWin32_GetDpiScaleForHwnd(), ImGui_ImplWin32_GetDpiScaleForMonitor() helper functions.
|
||||
// 2020-01-14: Inputs: Added support for #define IMGUI_IMPL_WIN32_DISABLE_GAMEPAD/IMGUI_IMPL_WIN32_DISABLE_LINKING_XINPUT.
|
||||
// 2019-12-05: Inputs: Added support for ImGuiMouseCursor_NotAllowed mouse cursor.
|
||||
// 2019-05-11: Inputs: Don't filter value from WM_CHAR before calling AddInputCharacter().
|
||||
// 2019-01-17: Misc: Using GetForegroundWindow()+IsChild() instead of GetActiveWindow() to be compatible with windows created in a different thread or parent.
|
||||
// 2019-01-17: Inputs: Added support for mouse buttons 4 and 5 via WM_XBUTTON* messages.
|
||||
// 2019-01-15: Inputs: Added support for XInput gamepads (if ImGuiConfigFlags_NavEnableGamepad is set by user application).
|
||||
// 2018-11-30: Misc: Setting up io.BackendPlatformName so it can be displayed in the About Window.
|
||||
// 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor.
|
||||
// 2018-06-10: Inputs: Fixed handling of mouse wheel messages to support fine position messages (typically sent by track-pads).
|
||||
// 2018-06-08: Misc: Extracted imgui_impl_win32.cpp/.h away from the old combined DX9/DX10/DX11/DX12 examples.
|
||||
// 2018-03-20: Misc: Setup io.BackendFlags ImGuiBackendFlags_HasMouseCursors and ImGuiBackendFlags_HasSetMousePos flags + honor ImGuiConfigFlags_NoMouseCursorChange flag.
|
||||
// 2018-02-20: Inputs: Added support for mouse cursors (ImGui::GetMouseCursor() value and WM_SETCURSOR message handling).
|
||||
// 2018-02-06: Inputs: Added mapping for ImGuiKey_Space.
|
||||
// 2018-02-06: Inputs: Honoring the io.WantSetMousePos by repositioning the mouse (when using navigation and ImGuiConfigFlags_NavMoveMouse is set).
|
||||
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
|
||||
// 2018-01-20: Inputs: Added Horizontal Mouse Wheel support.
|
||||
// 2018-01-08: Inputs: Added mapping for ImGuiKey_Insert.
|
||||
// 2018-01-05: Inputs: Added WM_LBUTTONDBLCLK double-click handlers for window classes with the CS_DBLCLKS flag.
|
||||
// 2017-10-23: Inputs: Added WM_SYSKEYDOWN / WM_SYSKEYUP handlers so e.g. the VK_MENU key can be read.
|
||||
// 2017-10-23: Inputs: Using Win32 ::SetCapture/::GetCapture() to retrieve mouse positions outside the client area when dragging.
|
||||
// 2016-11-12: Inputs: Only call Win32 ::SetCursor(NULL) when io.MouseDrawCursor is set.
|
||||
|
||||
struct ImGui_ImplWin32_Data
|
||||
{
|
||||
HWND hWnd;
|
||||
HWND MouseHwnd;
|
||||
bool MouseTracked;
|
||||
int MouseButtonsDown;
|
||||
INT64 Time;
|
||||
INT64 TicksPerSecond;
|
||||
ImGuiMouseCursor LastMouseCursor;
|
||||
bool HasGamepad;
|
||||
bool WantUpdateHasGamepad;
|
||||
|
||||
#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
|
||||
HMODULE XInputDLL;
|
||||
PFN_XInputGetCapabilities XInputGetCapabilities;
|
||||
PFN_XInputGetState XInputGetState;
|
||||
#endif
|
||||
|
||||
ImGui_ImplWin32_Data() { memset(this, 0, sizeof(*this)); }
|
||||
};
|
||||
|
||||
// Backend data stored in io.BackendPlatformUserData to allow support for multiple Dear ImGui contexts
|
||||
// It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts.
|
||||
// FIXME: multi-context support is not well tested and probably dysfunctional in this backend.
|
||||
// FIXME: some shared resources (mouse cursor shape, gamepad) are mishandled when using multi-context.
|
||||
static ImGui_ImplWin32_Data* ImGui_ImplWin32_GetBackendData()
|
||||
{
|
||||
return ImGui::GetCurrentContext() ? (ImGui_ImplWin32_Data*)ImGui::GetIO().BackendPlatformUserData : NULL;
|
||||
}
|
||||
|
||||
// Functions
|
||||
bool ImGui_ImplWin32_Init(void* hwnd)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
IM_ASSERT(io.BackendPlatformUserData == NULL && "Already initialized a platform backend!");
|
||||
|
||||
INT64 perf_frequency, perf_counter;
|
||||
if (!::QueryPerformanceFrequency((LARGE_INTEGER*)&perf_frequency))
|
||||
return false;
|
||||
if (!::QueryPerformanceCounter((LARGE_INTEGER*)&perf_counter))
|
||||
return false;
|
||||
|
||||
// Setup backend capabilities flags
|
||||
ImGui_ImplWin32_Data* bd = IM_NEW(ImGui_ImplWin32_Data)();
|
||||
io.BackendPlatformUserData = (void*)bd;
|
||||
io.BackendPlatformName = "imgui_impl_win32";
|
||||
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
|
||||
io.BackendFlags |= ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used)
|
||||
|
||||
bd->hWnd = (HWND)hwnd;
|
||||
bd->WantUpdateHasGamepad = true;
|
||||
bd->TicksPerSecond = perf_frequency;
|
||||
bd->Time = perf_counter;
|
||||
bd->LastMouseCursor = ImGuiMouseCursor_COUNT;
|
||||
|
||||
// Set platform dependent data in viewport
|
||||
ImGui::GetMainViewport()->PlatformHandleRaw = (void*)hwnd;
|
||||
|
||||
// Dynamically load XInput library
|
||||
#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
|
||||
const char* xinput_dll_names[] =
|
||||
{
|
||||
"xinput1_4.dll", // Windows 8+
|
||||
"xinput1_3.dll", // DirectX SDK
|
||||
"xinput9_1_0.dll", // Windows Vista, Windows 7
|
||||
"xinput1_2.dll", // DirectX SDK
|
||||
"xinput1_1.dll" // DirectX SDK
|
||||
};
|
||||
for (int n = 0; n < IM_ARRAYSIZE(xinput_dll_names); n++)
|
||||
if (HMODULE dll = ::LoadLibraryA(xinput_dll_names[n]))
|
||||
{
|
||||
bd->XInputDLL = dll;
|
||||
bd->XInputGetCapabilities = (PFN_XInputGetCapabilities)::GetProcAddress(dll, "XInputGetCapabilities");
|
||||
bd->XInputGetState = (PFN_XInputGetState)::GetProcAddress(dll, "XInputGetState");
|
||||
break;
|
||||
}
|
||||
#endif // IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ImGui_ImplWin32_Shutdown()
|
||||
{
|
||||
ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();
|
||||
IM_ASSERT(bd != NULL && "No platform backend to shutdown, or already shutdown?");
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
// Unload XInput library
|
||||
#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
|
||||
if (bd->XInputDLL)
|
||||
::FreeLibrary(bd->XInputDLL);
|
||||
#endif // IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
|
||||
|
||||
io.BackendPlatformName = NULL;
|
||||
io.BackendPlatformUserData = NULL;
|
||||
IM_DELETE(bd);
|
||||
}
|
||||
|
||||
static bool ImGui_ImplWin32_UpdateMouseCursor()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_NoMouseCursorChange)
|
||||
return false;
|
||||
|
||||
ImGuiMouseCursor imgui_cursor = ImGui::GetMouseCursor();
|
||||
if (imgui_cursor == ImGuiMouseCursor_None || io.MouseDrawCursor)
|
||||
{
|
||||
// Hide OS mouse cursor if imgui is drawing it or if it wants no cursor
|
||||
::SetCursor(NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Show OS mouse cursor
|
||||
LPTSTR win32_cursor = IDC_ARROW;
|
||||
switch (imgui_cursor)
|
||||
{
|
||||
case ImGuiMouseCursor_Arrow: win32_cursor = IDC_ARROW; break;
|
||||
case ImGuiMouseCursor_TextInput: win32_cursor = IDC_IBEAM; break;
|
||||
case ImGuiMouseCursor_ResizeAll: win32_cursor = IDC_SIZEALL; break;
|
||||
case ImGuiMouseCursor_ResizeEW: win32_cursor = IDC_SIZEWE; break;
|
||||
case ImGuiMouseCursor_ResizeNS: win32_cursor = IDC_SIZENS; break;
|
||||
case ImGuiMouseCursor_ResizeNESW: win32_cursor = IDC_SIZENESW; break;
|
||||
case ImGuiMouseCursor_ResizeNWSE: win32_cursor = IDC_SIZENWSE; break;
|
||||
case ImGuiMouseCursor_Hand: win32_cursor = IDC_HAND; break;
|
||||
case ImGuiMouseCursor_NotAllowed: win32_cursor = IDC_NO; break;
|
||||
}
|
||||
::SetCursor(::LoadCursor(NULL, win32_cursor));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool IsVkDown(int vk)
|
||||
{
|
||||
return (::GetKeyState(vk) & 0x8000) != 0;
|
||||
}
|
||||
|
||||
static void ImGui_ImplWin32_AddKeyEvent(ImGuiKey key, bool down, int native_keycode, int native_scancode = -1)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.AddKeyEvent(key, down);
|
||||
io.SetKeyEventNativeData(key, native_keycode, native_scancode); // To support legacy indexing (<1.87 user code)
|
||||
IM_UNUSED(native_scancode);
|
||||
}
|
||||
|
||||
static void ImGui_ImplWin32_ProcessKeyEventsWorkarounds()
|
||||
{
|
||||
// Left & right Shift keys: when both are pressed together, Windows tend to not generate the WM_KEYUP event for the first released one.
|
||||
if (ImGui::IsKeyDown(ImGuiKey_LeftShift) && !IsVkDown(VK_LSHIFT))
|
||||
ImGui_ImplWin32_AddKeyEvent(ImGuiKey_LeftShift, false, VK_LSHIFT);
|
||||
if (ImGui::IsKeyDown(ImGuiKey_RightShift) && !IsVkDown(VK_RSHIFT))
|
||||
ImGui_ImplWin32_AddKeyEvent(ImGuiKey_RightShift, false, VK_RSHIFT);
|
||||
|
||||
// Sometimes WM_KEYUP for Win key is not passed down to the app (e.g. for Win+V on some setups, according to GLFW).
|
||||
if (ImGui::IsKeyDown(ImGuiKey_LeftSuper) && !IsVkDown(VK_LWIN))
|
||||
ImGui_ImplWin32_AddKeyEvent(ImGuiKey_LeftSuper, false, VK_LWIN);
|
||||
if (ImGui::IsKeyDown(ImGuiKey_RightSuper) && !IsVkDown(VK_RWIN))
|
||||
ImGui_ImplWin32_AddKeyEvent(ImGuiKey_RightSuper, false, VK_RWIN);
|
||||
}
|
||||
|
||||
static void ImGui_ImplWin32_UpdateKeyModifiers()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.AddKeyEvent(ImGuiKey_ModCtrl, IsVkDown(VK_CONTROL));
|
||||
io.AddKeyEvent(ImGuiKey_ModShift, IsVkDown(VK_SHIFT));
|
||||
io.AddKeyEvent(ImGuiKey_ModAlt, IsVkDown(VK_MENU));
|
||||
io.AddKeyEvent(ImGuiKey_ModSuper, IsVkDown(VK_APPS));
|
||||
}
|
||||
|
||||
static void ImGui_ImplWin32_UpdateMouseData()
|
||||
{
|
||||
ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
IM_ASSERT(bd->hWnd != 0);
|
||||
|
||||
const bool is_app_focused = (::GetForegroundWindow() == bd->hWnd);
|
||||
if (is_app_focused)
|
||||
{
|
||||
// (Optional) Set OS mouse position from Dear ImGui if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user)
|
||||
if (io.WantSetMousePos)
|
||||
{
|
||||
POINT pos = { (int)io.MousePos.x, (int)io.MousePos.y };
|
||||
if (::ClientToScreen(bd->hWnd, &pos))
|
||||
::SetCursorPos(pos.x, pos.y);
|
||||
}
|
||||
|
||||
// (Optional) Fallback to provide mouse position when focused (WM_MOUSEMOVE already provides this when hovered or captured)
|
||||
if (!io.WantSetMousePos && !bd->MouseTracked)
|
||||
{
|
||||
POINT pos;
|
||||
if (::GetCursorPos(&pos) && ::ScreenToClient(bd->hWnd, &pos))
|
||||
io.AddMousePosEvent((float)pos.x, (float)pos.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Gamepad navigation mapping
|
||||
static void ImGui_ImplWin32_UpdateGamepads()
|
||||
{
|
||||
#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();
|
||||
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0)
|
||||
return;
|
||||
|
||||
// Calling XInputGetState() every frame on disconnected gamepads is unfortunately too slow.
|
||||
// Instead we refresh gamepad availability by calling XInputGetCapabilities() _only_ after receiving WM_DEVICECHANGE.
|
||||
if (bd->WantUpdateHasGamepad)
|
||||
{
|
||||
XINPUT_CAPABILITIES caps = {};
|
||||
bd->HasGamepad = bd->XInputGetCapabilities ? (bd->XInputGetCapabilities(0, XINPUT_FLAG_GAMEPAD, &caps) == ERROR_SUCCESS) : false;
|
||||
bd->WantUpdateHasGamepad = false;
|
||||
}
|
||||
|
||||
io.BackendFlags &= ~ImGuiBackendFlags_HasGamepad;
|
||||
XINPUT_STATE xinput_state;
|
||||
XINPUT_GAMEPAD& gamepad = xinput_state.Gamepad;
|
||||
if (!bd->HasGamepad || bd->XInputGetState == NULL || bd->XInputGetState(0, &xinput_state) != ERROR_SUCCESS)
|
||||
return;
|
||||
io.BackendFlags |= ImGuiBackendFlags_HasGamepad;
|
||||
|
||||
#define IM_SATURATE(V) (V < 0.0f ? 0.0f : V > 1.0f ? 1.0f : V)
|
||||
#define MAP_BUTTON(KEY_NO, BUTTON_ENUM) { io.AddKeyEvent(KEY_NO, (gamepad.wButtons & BUTTON_ENUM) != 0); }
|
||||
#define MAP_ANALOG(KEY_NO, VALUE, V0, V1) { float vn = (float)(VALUE - V0) / (float)(V1 - V0); io.AddKeyAnalogEvent(KEY_NO, vn > 0.10f, IM_SATURATE(vn)); }
|
||||
MAP_BUTTON(ImGuiKey_GamepadStart, XINPUT_GAMEPAD_START);
|
||||
MAP_BUTTON(ImGuiKey_GamepadBack, XINPUT_GAMEPAD_BACK);
|
||||
MAP_BUTTON(ImGuiKey_GamepadFaceDown, XINPUT_GAMEPAD_A);
|
||||
MAP_BUTTON(ImGuiKey_GamepadFaceRight, XINPUT_GAMEPAD_B);
|
||||
MAP_BUTTON(ImGuiKey_GamepadFaceLeft, XINPUT_GAMEPAD_X);
|
||||
MAP_BUTTON(ImGuiKey_GamepadFaceUp, XINPUT_GAMEPAD_Y);
|
||||
MAP_BUTTON(ImGuiKey_GamepadDpadLeft, XINPUT_GAMEPAD_DPAD_LEFT);
|
||||
MAP_BUTTON(ImGuiKey_GamepadDpadRight, XINPUT_GAMEPAD_DPAD_RIGHT);
|
||||
MAP_BUTTON(ImGuiKey_GamepadDpadUp, XINPUT_GAMEPAD_DPAD_UP);
|
||||
MAP_BUTTON(ImGuiKey_GamepadDpadDown, XINPUT_GAMEPAD_DPAD_DOWN);
|
||||
MAP_BUTTON(ImGuiKey_GamepadL1, XINPUT_GAMEPAD_LEFT_SHOULDER);
|
||||
MAP_BUTTON(ImGuiKey_GamepadR1, XINPUT_GAMEPAD_RIGHT_SHOULDER);
|
||||
MAP_ANALOG(ImGuiKey_GamepadL2, gamepad.bLeftTrigger, XINPUT_GAMEPAD_TRIGGER_THRESHOLD, 255);
|
||||
MAP_ANALOG(ImGuiKey_GamepadR2, gamepad.bRightTrigger, XINPUT_GAMEPAD_TRIGGER_THRESHOLD, 255);
|
||||
MAP_BUTTON(ImGuiKey_GamepadL3, XINPUT_GAMEPAD_LEFT_THUMB);
|
||||
MAP_BUTTON(ImGuiKey_GamepadR3, XINPUT_GAMEPAD_RIGHT_THUMB);
|
||||
MAP_ANALOG(ImGuiKey_GamepadLStickLeft, gamepad.sThumbLX, -XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE, -32768);
|
||||
MAP_ANALOG(ImGuiKey_GamepadLStickRight, gamepad.sThumbLX, +XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE, +32767);
|
||||
MAP_ANALOG(ImGuiKey_GamepadLStickUp, gamepad.sThumbLY, +XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE, +32767);
|
||||
MAP_ANALOG(ImGuiKey_GamepadLStickDown, gamepad.sThumbLY, -XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE, -32768);
|
||||
MAP_ANALOG(ImGuiKey_GamepadRStickLeft, gamepad.sThumbRX, -XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE, -32768);
|
||||
MAP_ANALOG(ImGuiKey_GamepadRStickRight, gamepad.sThumbRX, +XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE, +32767);
|
||||
MAP_ANALOG(ImGuiKey_GamepadRStickUp, gamepad.sThumbRY, +XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE, +32767);
|
||||
MAP_ANALOG(ImGuiKey_GamepadRStickDown, gamepad.sThumbRY, -XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE, -32768);
|
||||
#undef MAP_BUTTON
|
||||
#undef MAP_ANALOG
|
||||
#endif // #ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
|
||||
}
|
||||
|
||||
void ImGui_ImplWin32_NewFrame()
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();
|
||||
IM_ASSERT(bd != NULL && "Did you call ImGui_ImplWin32_Init()?");
|
||||
|
||||
// Setup display size (every frame to accommodate for window resizing)
|
||||
RECT rect = { 0, 0, 0, 0 };
|
||||
::GetClientRect(bd->hWnd, &rect);
|
||||
io.DisplaySize = ImVec2((float)(rect.right - rect.left), (float)(rect.bottom - rect.top));
|
||||
|
||||
// Setup time step
|
||||
INT64 current_time = 0;
|
||||
::QueryPerformanceCounter((LARGE_INTEGER*)¤t_time);
|
||||
io.DeltaTime = (float)(current_time - bd->Time) / bd->TicksPerSecond;
|
||||
bd->Time = current_time;
|
||||
|
||||
// Update OS mouse position
|
||||
ImGui_ImplWin32_UpdateMouseData();
|
||||
|
||||
// Process workarounds for known Windows key handling issues
|
||||
ImGui_ImplWin32_ProcessKeyEventsWorkarounds();
|
||||
|
||||
// Update OS mouse cursor with the cursor requested by imgui
|
||||
ImGuiMouseCursor mouse_cursor = io.MouseDrawCursor ? ImGuiMouseCursor_None : ImGui::GetMouseCursor();
|
||||
if (bd->LastMouseCursor != mouse_cursor)
|
||||
{
|
||||
bd->LastMouseCursor = mouse_cursor;
|
||||
ImGui_ImplWin32_UpdateMouseCursor();
|
||||
}
|
||||
|
||||
// Update game controllers (if enabled and available)
|
||||
ImGui_ImplWin32_UpdateGamepads();
|
||||
}
|
||||
|
||||
// There is no distinct VK_xxx for keypad enter, instead it is VK_RETURN + KF_EXTENDED, we assign it an arbitrary value to make code more readable (VK_ codes go up to 255)
|
||||
#define IM_VK_KEYPAD_ENTER (VK_RETURN + 256)
|
||||
|
||||
// Map VK_xxx to ImGuiKey_xxx.
|
||||
static ImGuiKey ImGui_ImplWin32_VirtualKeyToImGuiKey(WPARAM wParam)
|
||||
{
|
||||
switch (wParam)
|
||||
{
|
||||
case VK_TAB: return ImGuiKey_Tab;
|
||||
case VK_LEFT: return ImGuiKey_LeftArrow;
|
||||
case VK_RIGHT: return ImGuiKey_RightArrow;
|
||||
case VK_UP: return ImGuiKey_UpArrow;
|
||||
case VK_DOWN: return ImGuiKey_DownArrow;
|
||||
case VK_PRIOR: return ImGuiKey_PageUp;
|
||||
case VK_NEXT: return ImGuiKey_PageDown;
|
||||
case VK_HOME: return ImGuiKey_Home;
|
||||
case VK_END: return ImGuiKey_End;
|
||||
case VK_INSERT: return ImGuiKey_Insert;
|
||||
case VK_DELETE: return ImGuiKey_Delete;
|
||||
case VK_BACK: return ImGuiKey_Backspace;
|
||||
case VK_SPACE: return ImGuiKey_Space;
|
||||
case VK_RETURN: return ImGuiKey_Enter;
|
||||
case VK_ESCAPE: return ImGuiKey_Escape;
|
||||
case VK_OEM_7: return ImGuiKey_Apostrophe;
|
||||
case VK_OEM_COMMA: return ImGuiKey_Comma;
|
||||
case VK_OEM_MINUS: return ImGuiKey_Minus;
|
||||
case VK_OEM_PERIOD: return ImGuiKey_Period;
|
||||
case VK_OEM_2: return ImGuiKey_Slash;
|
||||
case VK_OEM_1: return ImGuiKey_Semicolon;
|
||||
case VK_OEM_PLUS: return ImGuiKey_Equal;
|
||||
case VK_OEM_4: return ImGuiKey_LeftBracket;
|
||||
case VK_OEM_5: return ImGuiKey_Backslash;
|
||||
case VK_OEM_6: return ImGuiKey_RightBracket;
|
||||
case VK_OEM_3: return ImGuiKey_GraveAccent;
|
||||
case VK_CAPITAL: return ImGuiKey_CapsLock;
|
||||
case VK_SCROLL: return ImGuiKey_ScrollLock;
|
||||
case VK_NUMLOCK: return ImGuiKey_NumLock;
|
||||
case VK_SNAPSHOT: return ImGuiKey_PrintScreen;
|
||||
case VK_PAUSE: return ImGuiKey_Pause;
|
||||
case VK_NUMPAD0: return ImGuiKey_Keypad0;
|
||||
case VK_NUMPAD1: return ImGuiKey_Keypad1;
|
||||
case VK_NUMPAD2: return ImGuiKey_Keypad2;
|
||||
case VK_NUMPAD3: return ImGuiKey_Keypad3;
|
||||
case VK_NUMPAD4: return ImGuiKey_Keypad4;
|
||||
case VK_NUMPAD5: return ImGuiKey_Keypad5;
|
||||
case VK_NUMPAD6: return ImGuiKey_Keypad6;
|
||||
case VK_NUMPAD7: return ImGuiKey_Keypad7;
|
||||
case VK_NUMPAD8: return ImGuiKey_Keypad8;
|
||||
case VK_NUMPAD9: return ImGuiKey_Keypad9;
|
||||
case VK_DECIMAL: return ImGuiKey_KeypadDecimal;
|
||||
case VK_DIVIDE: return ImGuiKey_KeypadDivide;
|
||||
case VK_MULTIPLY: return ImGuiKey_KeypadMultiply;
|
||||
case VK_SUBTRACT: return ImGuiKey_KeypadSubtract;
|
||||
case VK_ADD: return ImGuiKey_KeypadAdd;
|
||||
case IM_VK_KEYPAD_ENTER: return ImGuiKey_KeypadEnter;
|
||||
case VK_LSHIFT: return ImGuiKey_LeftShift;
|
||||
case VK_LCONTROL: return ImGuiKey_LeftCtrl;
|
||||
case VK_LMENU: return ImGuiKey_LeftAlt;
|
||||
case VK_LWIN: return ImGuiKey_LeftSuper;
|
||||
case VK_RSHIFT: return ImGuiKey_RightShift;
|
||||
case VK_RCONTROL: return ImGuiKey_RightCtrl;
|
||||
case VK_RMENU: return ImGuiKey_RightAlt;
|
||||
case VK_RWIN: return ImGuiKey_RightSuper;
|
||||
case VK_APPS: return ImGuiKey_Menu;
|
||||
case '0': return ImGuiKey_0;
|
||||
case '1': return ImGuiKey_1;
|
||||
case '2': return ImGuiKey_2;
|
||||
case '3': return ImGuiKey_3;
|
||||
case '4': return ImGuiKey_4;
|
||||
case '5': return ImGuiKey_5;
|
||||
case '6': return ImGuiKey_6;
|
||||
case '7': return ImGuiKey_7;
|
||||
case '8': return ImGuiKey_8;
|
||||
case '9': return ImGuiKey_9;
|
||||
case 'A': return ImGuiKey_A;
|
||||
case 'B': return ImGuiKey_B;
|
||||
case 'C': return ImGuiKey_C;
|
||||
case 'D': return ImGuiKey_D;
|
||||
case 'E': return ImGuiKey_E;
|
||||
case 'F': return ImGuiKey_F;
|
||||
case 'G': return ImGuiKey_G;
|
||||
case 'H': return ImGuiKey_H;
|
||||
case 'I': return ImGuiKey_I;
|
||||
case 'J': return ImGuiKey_J;
|
||||
case 'K': return ImGuiKey_K;
|
||||
case 'L': return ImGuiKey_L;
|
||||
case 'M': return ImGuiKey_M;
|
||||
case 'N': return ImGuiKey_N;
|
||||
case 'O': return ImGuiKey_O;
|
||||
case 'P': return ImGuiKey_P;
|
||||
case 'Q': return ImGuiKey_Q;
|
||||
case 'R': return ImGuiKey_R;
|
||||
case 'S': return ImGuiKey_S;
|
||||
case 'T': return ImGuiKey_T;
|
||||
case 'U': return ImGuiKey_U;
|
||||
case 'V': return ImGuiKey_V;
|
||||
case 'W': return ImGuiKey_W;
|
||||
case 'X': return ImGuiKey_X;
|
||||
case 'Y': return ImGuiKey_Y;
|
||||
case 'Z': return ImGuiKey_Z;
|
||||
case VK_F1: return ImGuiKey_F1;
|
||||
case VK_F2: return ImGuiKey_F2;
|
||||
case VK_F3: return ImGuiKey_F3;
|
||||
case VK_F4: return ImGuiKey_F4;
|
||||
case VK_F5: return ImGuiKey_F5;
|
||||
case VK_F6: return ImGuiKey_F6;
|
||||
case VK_F7: return ImGuiKey_F7;
|
||||
case VK_F8: return ImGuiKey_F8;
|
||||
case VK_F9: return ImGuiKey_F9;
|
||||
case VK_F10: return ImGuiKey_F10;
|
||||
case VK_F11: return ImGuiKey_F11;
|
||||
case VK_F12: return ImGuiKey_F12;
|
||||
default: return ImGuiKey_None;
|
||||
}
|
||||
}
|
||||
|
||||
// Allow compilation with old Windows SDK. MinGW doesn't have default _WIN32_WINNT/WINVER versions.
|
||||
#ifndef WM_MOUSEHWHEEL
|
||||
#define WM_MOUSEHWHEEL 0x020E
|
||||
#endif
|
||||
#ifndef DBT_DEVNODES_CHANGED
|
||||
#define DBT_DEVNODES_CHANGED 0x0007
|
||||
#endif
|
||||
|
||||
// Win32 message handler (process Win32 mouse/keyboard inputs, etc.)
|
||||
// Call from your application's message handler.
|
||||
// When implementing your own backend, you can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if Dear ImGui wants to use your inputs.
|
||||
// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.
|
||||
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
|
||||
// Generally you may always pass all inputs to Dear ImGui, and hide them from your application based on those two flags.
|
||||
// PS: In this Win32 handler, we use the capture API (GetCapture/SetCapture/ReleaseCapture) to be able to read mouse coordinates when dragging mouse outside of our window bounds.
|
||||
// PS: We treat DBLCLK messages as regular mouse down messages, so this code will work on windows classes that have the CS_DBLCLKS flag set. Our own example app code doesn't set this flag.
|
||||
#if 0
|
||||
// Copy this line into your .cpp file to forward declare the function.
|
||||
extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
#endif
|
||||
IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (ImGui::GetCurrentContext() == NULL)
|
||||
return 0;
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case WM_MOUSEMOVE:
|
||||
// We need to call TrackMouseEvent in order to receive WM_MOUSELEAVE events
|
||||
bd->MouseHwnd = hwnd;
|
||||
if (!bd->MouseTracked)
|
||||
{
|
||||
TRACKMOUSEEVENT tme = { sizeof(tme), TME_LEAVE, hwnd, 0 };
|
||||
::TrackMouseEvent(&tme);
|
||||
bd->MouseTracked = true;
|
||||
}
|
||||
io.AddMousePosEvent((float)GET_X_LPARAM(lParam), (float)GET_Y_LPARAM(lParam));
|
||||
break;
|
||||
case WM_MOUSELEAVE:
|
||||
if (bd->MouseHwnd == hwnd)
|
||||
bd->MouseHwnd = NULL;
|
||||
bd->MouseTracked = false;
|
||||
io.AddMousePosEvent(-FLT_MAX, -FLT_MAX);
|
||||
break;
|
||||
case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK:
|
||||
case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK:
|
||||
case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK:
|
||||
case WM_XBUTTONDOWN: case WM_XBUTTONDBLCLK:
|
||||
{
|
||||
int button = 0;
|
||||
if (msg == WM_LBUTTONDOWN || msg == WM_LBUTTONDBLCLK) { button = 0; }
|
||||
if (msg == WM_RBUTTONDOWN || msg == WM_RBUTTONDBLCLK) { button = 1; }
|
||||
if (msg == WM_MBUTTONDOWN || msg == WM_MBUTTONDBLCLK) { button = 2; }
|
||||
if (msg == WM_XBUTTONDOWN || msg == WM_XBUTTONDBLCLK) { button = (GET_XBUTTON_WPARAM(wParam) == XBUTTON1) ? 3 : 4; }
|
||||
if (bd->MouseButtonsDown == 0 && ::GetCapture() == NULL)
|
||||
::SetCapture(hwnd);
|
||||
bd->MouseButtonsDown |= 1 << button;
|
||||
io.AddMouseButtonEvent(button, true);
|
||||
return 0;
|
||||
}
|
||||
case WM_LBUTTONUP:
|
||||
case WM_RBUTTONUP:
|
||||
case WM_MBUTTONUP:
|
||||
case WM_XBUTTONUP:
|
||||
{
|
||||
int button = 0;
|
||||
if (msg == WM_LBUTTONUP) { button = 0; }
|
||||
if (msg == WM_RBUTTONUP) { button = 1; }
|
||||
if (msg == WM_MBUTTONUP) { button = 2; }
|
||||
if (msg == WM_XBUTTONUP) { button = (GET_XBUTTON_WPARAM(wParam) == XBUTTON1) ? 3 : 4; }
|
||||
bd->MouseButtonsDown &= ~(1 << button);
|
||||
if (bd->MouseButtonsDown == 0 && ::GetCapture() == hwnd)
|
||||
::ReleaseCapture();
|
||||
io.AddMouseButtonEvent(button, false);
|
||||
return 0;
|
||||
}
|
||||
case WM_MOUSEWHEEL:
|
||||
io.AddMouseWheelEvent(0.0f, (float)GET_WHEEL_DELTA_WPARAM(wParam) / (float)WHEEL_DELTA);
|
||||
return 0;
|
||||
case WM_MOUSEHWHEEL:
|
||||
io.AddMouseWheelEvent((float)GET_WHEEL_DELTA_WPARAM(wParam) / (float)WHEEL_DELTA, 0.0f);
|
||||
return 0;
|
||||
case WM_KEYDOWN:
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYDOWN:
|
||||
case WM_SYSKEYUP:
|
||||
{
|
||||
const bool is_key_down = (msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN);
|
||||
if (wParam < 256)
|
||||
{
|
||||
// Submit modifiers
|
||||
ImGui_ImplWin32_UpdateKeyModifiers();
|
||||
|
||||
// Obtain virtual key code
|
||||
// (keypad enter doesn't have its own... VK_RETURN with KF_EXTENDED flag means keypad enter, see IM_VK_KEYPAD_ENTER definition for details, it is mapped to ImGuiKey_KeyPadEnter.)
|
||||
int vk = (int)wParam;
|
||||
if ((wParam == VK_RETURN) && (HIWORD(lParam) & KF_EXTENDED))
|
||||
vk = IM_VK_KEYPAD_ENTER;
|
||||
|
||||
// Submit key event
|
||||
const ImGuiKey key = ImGui_ImplWin32_VirtualKeyToImGuiKey(vk);
|
||||
const int scancode = (int)LOBYTE(HIWORD(lParam));
|
||||
if (key != ImGuiKey_None)
|
||||
ImGui_ImplWin32_AddKeyEvent(key, is_key_down, vk, scancode);
|
||||
|
||||
// Submit individual left/right modifier events
|
||||
if (vk == VK_SHIFT)
|
||||
{
|
||||
// Important: Shift keys tend to get stuck when pressed together, missing key-up events are corrected in ImGui_ImplWin32_ProcessKeyEventsWorkarounds()
|
||||
if (IsVkDown(VK_LSHIFT) == is_key_down) { ImGui_ImplWin32_AddKeyEvent(ImGuiKey_LeftShift, is_key_down, VK_LSHIFT, scancode); }
|
||||
if (IsVkDown(VK_RSHIFT) == is_key_down) { ImGui_ImplWin32_AddKeyEvent(ImGuiKey_RightShift, is_key_down, VK_RSHIFT, scancode); }
|
||||
}
|
||||
else if (vk == VK_CONTROL)
|
||||
{
|
||||
if (IsVkDown(VK_LCONTROL) == is_key_down) { ImGui_ImplWin32_AddKeyEvent(ImGuiKey_LeftCtrl, is_key_down, VK_LCONTROL, scancode); }
|
||||
if (IsVkDown(VK_RCONTROL) == is_key_down) { ImGui_ImplWin32_AddKeyEvent(ImGuiKey_RightCtrl, is_key_down, VK_RCONTROL, scancode); }
|
||||
}
|
||||
else if (vk == VK_MENU)
|
||||
{
|
||||
if (IsVkDown(VK_LMENU) == is_key_down) { ImGui_ImplWin32_AddKeyEvent(ImGuiKey_LeftAlt, is_key_down, VK_LMENU, scancode); }
|
||||
if (IsVkDown(VK_RMENU) == is_key_down) { ImGui_ImplWin32_AddKeyEvent(ImGuiKey_RightAlt, is_key_down, VK_RMENU, scancode); }
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
case WM_SETFOCUS:
|
||||
case WM_KILLFOCUS:
|
||||
io.AddFocusEvent(msg == WM_SETFOCUS);
|
||||
return 0;
|
||||
case WM_CHAR:
|
||||
// You can also use ToAscii()+GetKeyboardState() to retrieve characters.
|
||||
if (wParam > 0 && wParam < 0x10000)
|
||||
io.AddInputCharacterUTF16((unsigned short)wParam);
|
||||
return 0;
|
||||
case WM_SETCURSOR:
|
||||
if (LOWORD(lParam) == HTCLIENT && ImGui_ImplWin32_UpdateMouseCursor())
|
||||
return 1;
|
||||
return 0;
|
||||
case WM_DEVICECHANGE:
|
||||
if ((UINT)wParam == DBT_DEVNODES_CHANGED)
|
||||
bd->WantUpdateHasGamepad = true;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// DPI-related helpers (optional)
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// - Use to enable DPI awareness without having to create an application manifest.
|
||||
// - Your own app may already do this via a manifest or explicit calls. This is mostly useful for our examples/ apps.
|
||||
// - In theory we could call simple functions from Windows SDK such as SetProcessDPIAware(), SetProcessDpiAwareness(), etc.
|
||||
// but most of the functions provided by Microsoft require Windows 8.1/10+ SDK at compile time and Windows 8/10+ at runtime,
|
||||
// neither we want to require the user to have. So we dynamically select and load those functions to avoid dependencies.
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
// This is the scheme successfully used by GLFW (from which we borrowed some of the code) and other apps aiming to be highly portable.
|
||||
// ImGui_ImplWin32_EnableDpiAwareness() is just a helper called by main.cpp, we don't call it automatically.
|
||||
// If you are trying to implement your own backend for your own engine, you may ignore that noise.
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
|
||||
// Perform our own check with RtlVerifyVersionInfo() instead of using functions from <VersionHelpers.h> as they
|
||||
// require a manifest to be functional for checks above 8.1. See https://github.com/ocornut/imgui/issues/4200
|
||||
static BOOL _IsWindowsVersionOrGreater(WORD major, WORD minor, WORD)
|
||||
{
|
||||
typedef LONG(WINAPI* PFN_RtlVerifyVersionInfo)(OSVERSIONINFOEXW*, ULONG, ULONGLONG);
|
||||
static PFN_RtlVerifyVersionInfo RtlVerifyVersionInfoFn = NULL;
|
||||
if (RtlVerifyVersionInfoFn == NULL)
|
||||
if (HMODULE ntdllModule = ::GetModuleHandleA("ntdll.dll"))
|
||||
RtlVerifyVersionInfoFn = (PFN_RtlVerifyVersionInfo)GetProcAddress(ntdllModule, "RtlVerifyVersionInfo");
|
||||
if (RtlVerifyVersionInfoFn == NULL)
|
||||
return FALSE;
|
||||
|
||||
RTL_OSVERSIONINFOEXW versionInfo = { };
|
||||
ULONGLONG conditionMask = 0;
|
||||
versionInfo.dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW);
|
||||
versionInfo.dwMajorVersion = major;
|
||||
versionInfo.dwMinorVersion = minor;
|
||||
VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
|
||||
VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
|
||||
return (RtlVerifyVersionInfoFn(&versionInfo, VER_MAJORVERSION | VER_MINORVERSION, conditionMask) == 0) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
#define _IsWindowsVistaOrGreater() _IsWindowsVersionOrGreater(HIBYTE(0x0600), LOBYTE(0x0600), 0) // _WIN32_WINNT_VISTA
|
||||
#define _IsWindows8OrGreater() _IsWindowsVersionOrGreater(HIBYTE(0x0602), LOBYTE(0x0602), 0) // _WIN32_WINNT_WIN8
|
||||
#define _IsWindows8Point1OrGreater() _IsWindowsVersionOrGreater(HIBYTE(0x0603), LOBYTE(0x0603), 0) // _WIN32_WINNT_WINBLUE
|
||||
#define _IsWindows10OrGreater() _IsWindowsVersionOrGreater(HIBYTE(0x0A00), LOBYTE(0x0A00), 0) // _WIN32_WINNT_WINTHRESHOLD / _WIN32_WINNT_WIN10
|
||||
|
||||
#ifndef DPI_ENUMS_DECLARED
|
||||
typedef enum { PROCESS_DPI_UNAWARE = 0, PROCESS_SYSTEM_DPI_AWARE = 1, PROCESS_PER_MONITOR_DPI_AWARE = 2 } PROCESS_DPI_AWARENESS;
|
||||
typedef enum { MDT_EFFECTIVE_DPI = 0, MDT_ANGULAR_DPI = 1, MDT_RAW_DPI = 2, MDT_DEFAULT = MDT_EFFECTIVE_DPI } MONITOR_DPI_TYPE;
|
||||
#endif
|
||||
#ifndef _DPI_AWARENESS_CONTEXTS_
|
||||
DECLARE_HANDLE(DPI_AWARENESS_CONTEXT);
|
||||
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE (DPI_AWARENESS_CONTEXT)-3
|
||||
#endif
|
||||
#ifndef DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2
|
||||
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 (DPI_AWARENESS_CONTEXT)-4
|
||||
#endif
|
||||
typedef HRESULT(WINAPI* PFN_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS); // Shcore.lib + dll, Windows 8.1+
|
||||
typedef HRESULT(WINAPI* PFN_GetDpiForMonitor)(HMONITOR, MONITOR_DPI_TYPE, UINT*, UINT*); // Shcore.lib + dll, Windows 8.1+
|
||||
typedef DPI_AWARENESS_CONTEXT(WINAPI* PFN_SetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT); // User32.lib + dll, Windows 10 v1607+ (Creators Update)
|
||||
|
||||
// Helper function to enable DPI awareness without setting up a manifest
|
||||
void ImGui_ImplWin32_EnableDpiAwareness()
|
||||
{
|
||||
if (_IsWindows10OrGreater())
|
||||
{
|
||||
static HINSTANCE user32_dll = ::LoadLibraryA("user32.dll"); // Reference counted per-process
|
||||
if (PFN_SetThreadDpiAwarenessContext SetThreadDpiAwarenessContextFn = (PFN_SetThreadDpiAwarenessContext)::GetProcAddress(user32_dll, "SetThreadDpiAwarenessContext"))
|
||||
{
|
||||
SetThreadDpiAwarenessContextFn(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (_IsWindows8Point1OrGreater())
|
||||
{
|
||||
static HINSTANCE shcore_dll = ::LoadLibraryA("shcore.dll"); // Reference counted per-process
|
||||
if (PFN_SetProcessDpiAwareness SetProcessDpiAwarenessFn = (PFN_SetProcessDpiAwareness)::GetProcAddress(shcore_dll, "SetProcessDpiAwareness"))
|
||||
{
|
||||
SetProcessDpiAwarenessFn(PROCESS_PER_MONITOR_DPI_AWARE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#if _WIN32_WINNT >= 0x0600
|
||||
::SetProcessDPIAware();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(NOGDI)
|
||||
#pragma comment(lib, "gdi32") // Link with gdi32.lib for GetDeviceCaps(). MinGW will require linking with '-lgdi32'
|
||||
#endif
|
||||
|
||||
float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor)
|
||||
{
|
||||
UINT xdpi = 96, ydpi = 96;
|
||||
if (_IsWindows8Point1OrGreater())
|
||||
{
|
||||
static HINSTANCE shcore_dll = ::LoadLibraryA("shcore.dll"); // Reference counted per-process
|
||||
static PFN_GetDpiForMonitor GetDpiForMonitorFn = NULL;
|
||||
if (GetDpiForMonitorFn == NULL && shcore_dll != NULL)
|
||||
GetDpiForMonitorFn = (PFN_GetDpiForMonitor)::GetProcAddress(shcore_dll, "GetDpiForMonitor");
|
||||
if (GetDpiForMonitorFn != NULL)
|
||||
{
|
||||
GetDpiForMonitorFn((HMONITOR)monitor, MDT_EFFECTIVE_DPI, &xdpi, &ydpi);
|
||||
IM_ASSERT(xdpi == ydpi); // Please contact me if you hit this assert!
|
||||
return xdpi / 96.0f;
|
||||
}
|
||||
}
|
||||
#ifndef NOGDI
|
||||
const HDC dc = ::GetDC(NULL);
|
||||
xdpi = ::GetDeviceCaps(dc, LOGPIXELSX);
|
||||
ydpi = ::GetDeviceCaps(dc, LOGPIXELSY);
|
||||
IM_ASSERT(xdpi == ydpi); // Please contact me if you hit this assert!
|
||||
::ReleaseDC(NULL, dc);
|
||||
#endif
|
||||
return xdpi / 96.0f;
|
||||
}
|
||||
|
||||
float ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd)
|
||||
{
|
||||
HMONITOR monitor = ::MonitorFromWindow((HWND)hwnd, MONITOR_DEFAULTTONEAREST);
|
||||
return ImGui_ImplWin32_GetDpiScaleForMonitor(monitor);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
// Transparency related helpers (optional)
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma comment(lib, "dwmapi") // Link with dwmapi.lib. MinGW will require linking with '-ldwmapi'
|
||||
#endif
|
||||
|
||||
// [experimental]
|
||||
// Borrowed from GLFW's function updateFramebufferTransparency() in src/win32_window.c
|
||||
// (the Dwm* functions are Vista era functions but we are borrowing logic from GLFW)
|
||||
void ImGui_ImplWin32_EnableAlphaCompositing(void* hwnd)
|
||||
{
|
||||
if (!_IsWindowsVistaOrGreater())
|
||||
return;
|
||||
|
||||
BOOL composition;
|
||||
if (FAILED(::DwmIsCompositionEnabled(&composition)) || !composition)
|
||||
return;
|
||||
|
||||
BOOL opaque;
|
||||
DWORD color;
|
||||
if (_IsWindows8OrGreater() || (SUCCEEDED(::DwmGetColorizationColor(&color, &opaque)) && !opaque))
|
||||
{
|
||||
HRGN region = ::CreateRectRgn(0, 0, -1, -1);
|
||||
DWM_BLURBEHIND bb = {};
|
||||
bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
|
||||
bb.hRgnBlur = region;
|
||||
bb.fEnable = TRUE;
|
||||
::DwmEnableBlurBehindWindow((HWND)hwnd, &bb);
|
||||
::DeleteObject(region);
|
||||
}
|
||||
else
|
||||
{
|
||||
DWM_BLURBEHIND bb = {};
|
||||
bb.dwFlags = DWM_BB_ENABLE;
|
||||
::DwmEnableBlurBehindWindow((HWND)hwnd, &bb);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
@@ -1,42 +0,0 @@
|
||||
// dear imgui: Platform Backend for Windows (standard windows API for 32 and 64 bits applications)
|
||||
// This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..)
|
||||
|
||||
// Implemented features:
|
||||
// [X] Platform: Clipboard support (for Win32 this is actually part of core dear imgui)
|
||||
// [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy VK_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set]
|
||||
// [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
||||
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
||||
|
||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||
|
||||
#pragma once
|
||||
#include "imgui.h" // IMGUI_IMPL_API
|
||||
|
||||
IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd);
|
||||
IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown();
|
||||
IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame();
|
||||
|
||||
// Win32 message handler your application need to call.
|
||||
// - Intentionally commented out in a '#if 0' block to avoid dragging dependencies on <windows.h> from this helper.
|
||||
// - You should COPY the line below into your .cpp code to forward declare the function and then you can call it.
|
||||
#if 0
|
||||
extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
#endif
|
||||
|
||||
// DPI-related helpers (optional)
|
||||
// - Use to enable DPI awareness without having to create an application manifest.
|
||||
// - Your own app may already do this via a manifest or explicit calls. This is mostly useful for our examples/ apps.
|
||||
// - In theory we could call simple functions from Windows SDK such as SetProcessDPIAware(), SetProcessDpiAwareness(), etc.
|
||||
// but most of the functions provided by Microsoft require Windows 8.1/10+ SDK at compile time and Windows 8/10+ at runtime,
|
||||
// neither we want to require the user to have. So we dynamically select and load those functions to avoid dependencies.
|
||||
IMGUI_IMPL_API void ImGui_ImplWin32_EnableDpiAwareness();
|
||||
IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd); // HWND hwnd
|
||||
IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor); // HMONITOR monitor
|
||||
|
||||
// Transparency related helpers (optional) [experimental]
|
||||
// - Use to enable alpha compositing transparency with the desktop.
|
||||
// - Use together with e.g. clearing your framebuffer with zero-alpha.
|
||||
IMGUI_IMPL_API void ImGui_ImplWin32_EnableAlphaCompositing(void* hwnd); // HWND hwnd
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,751 +0,0 @@
|
||||
// Mini memory editor for Dear ImGui (to embed in your game/tools)
|
||||
// Get latest version at http://www.github.com/ocornut/imgui_club
|
||||
//
|
||||
// Right-click anywhere to access the Options menu!
|
||||
// You can adjust the keyboard repeat delay/rate in ImGuiIO.
|
||||
// The code assume a mono-space font for simplicity!
|
||||
// If you don't use the default font, use ImGui::PushFont()/PopFont() to switch to a mono-space font before calling this.
|
||||
//
|
||||
// Usage:
|
||||
// // Create a window and draw memory editor inside it:
|
||||
// static MemoryEditor mem_edit_1;
|
||||
// static char data[0x10000];
|
||||
// size_t data_size = 0x10000;
|
||||
// mem_edit_1.DrawWindow("Memory Editor", data, data_size);
|
||||
//
|
||||
// Usage:
|
||||
// // If you already have a window, use DrawContents() instead:
|
||||
// static MemoryEditor mem_edit_2;
|
||||
// ImGui::Begin("MyWindow")
|
||||
// mem_edit_2.DrawContents(this, sizeof(*this), (size_t)this);
|
||||
// ImGui::End();
|
||||
//
|
||||
// Changelog:
|
||||
// - v0.10: initial version
|
||||
// - v0.23 (2017/08/17): added to github. fixed right-arrow triggering a byte write.
|
||||
// - v0.24 (2018/06/02): changed DragInt("Rows" to use a %d data format (which is desirable since imgui 1.61).
|
||||
// - v0.25 (2018/07/11): fixed wording: all occurrences of "Rows" renamed to "Columns".
|
||||
// - v0.26 (2018/08/02): fixed clicking on hex region
|
||||
// - v0.30 (2018/08/02): added data preview for common data types
|
||||
// - v0.31 (2018/10/10): added OptUpperCaseHex option to select lower/upper casing display [@samhocevar]
|
||||
// - v0.32 (2018/10/10): changed signatures to use void* instead of unsigned char*
|
||||
// - v0.33 (2018/10/10): added OptShowOptions option to hide all the interactive option setting.
|
||||
// - v0.34 (2019/05/07): binary preview now applies endianness setting [@nicolasnoble]
|
||||
// - v0.35 (2020/01/29): using ImGuiDataType available since Dear ImGui 1.69.
|
||||
// - v0.36 (2020/05/05): minor tweaks, minor refactor.
|
||||
// - v0.40 (2020/10/04): fix misuse of ImGuiListClipper API, broke with Dear ImGui 1.79. made cursor position appears on left-side of edit box. option popup appears on mouse release. fix MSVC warnings where _CRT_SECURE_NO_WARNINGS wasn't working in recent versions.
|
||||
// - v0.41 (2020/10/05): fix when using with keyboard/gamepad navigation enabled.
|
||||
// - v0.42 (2020/10/14): fix for . character in ASCII view always being greyed out.
|
||||
// - v0.43 (2021/03/12): added OptFooterExtraHeight to allow for custom drawing at the bottom of the editor [@leiradel]
|
||||
// - v0.44 (2021/03/12): use ImGuiInputTextFlags_AlwaysOverwrite in 1.82 + fix hardcoded width.
|
||||
//
|
||||
// Todo/Bugs:
|
||||
// - This is generally old code, it should work but please don't use this as reference!
|
||||
// - Arrows are being sent to the InputText() about to disappear which for LeftArrow makes the text cursor appear at position 1 for one frame.
|
||||
// - Using InputText() is awkward and maybe overkill here, consider implementing something custom.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h> // sprintf, scanf
|
||||
#include <stdint.h> // uint8_t, etc.
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define _PRISizeT "I"
|
||||
#define ImSnprintf _snprintf
|
||||
#else
|
||||
#define _PRISizeT "z"
|
||||
#define ImSnprintf snprintf
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable: 4996) // warning C4996: 'sprintf': This function or variable may be unsafe.
|
||||
#endif
|
||||
|
||||
struct MemoryEditor
|
||||
{
|
||||
enum DataFormat
|
||||
{
|
||||
DataFormat_Bin = 0,
|
||||
DataFormat_Dec = 1,
|
||||
DataFormat_Hex = 2,
|
||||
DataFormat_COUNT
|
||||
};
|
||||
|
||||
// Settings
|
||||
bool Open; // = true // set to false when DrawWindow() was closed. ignore if not using DrawWindow().
|
||||
bool ReadOnly; // = false // disable any editing.
|
||||
int Cols; // = 16 // number of columns to display.
|
||||
bool OptShowOptions; // = true // display options button/context menu. when disabled, options will be locked unless you provide your own UI for them.
|
||||
bool OptShowDataPreview; // = false // display a footer previewing the decimal/binary/hex/float representation of the currently selected bytes.
|
||||
bool OptShowHexII; // = false // display values in HexII representation instead of regular hexadecimal: hide null/zero bytes, ascii values as ".X".
|
||||
bool OptShowAscii; // = true // display ASCII representation on the right side.
|
||||
bool OptGreyOutZeroes; // = true // display null/zero bytes using the TextDisabled color.
|
||||
bool OptUpperCaseHex; // = true // display hexadecimal values as "FF" instead of "ff".
|
||||
int OptMidColsCount; // = 8 // set to 0 to disable extra spacing between every mid-cols.
|
||||
int OptAddrDigitsCount; // = 0 // number of addr digits to display (default calculated based on maximum displayed addr).
|
||||
float OptFooterExtraHeight; // = 0 // space to reserve at the bottom of the widget to add custom widgets
|
||||
ImU32 HighlightColor; // // background color of highlighted bytes.
|
||||
ImU8 (*ReadFn)(const ImU8* data, size_t off); // = 0 // optional handler to read bytes.
|
||||
void (*WriteFn)(ImU8* data, size_t off, ImU8 d); // = 0 // optional handler to write bytes.
|
||||
bool (*HighlightFn)(const ImU8* data, size_t off);//= 0 // optional handler to return Highlight property (to support non-contiguous highlighting).
|
||||
|
||||
// [Internal State]
|
||||
bool ContentsWidthChanged;
|
||||
size_t DataPreviewAddr;
|
||||
size_t DataEditingAddr;
|
||||
bool DataEditingTakeFocus;
|
||||
char DataInputBuf[32];
|
||||
char AddrInputBuf[32];
|
||||
size_t GotoAddr;
|
||||
size_t HighlightMin, HighlightMax;
|
||||
int PreviewEndianess;
|
||||
ImGuiDataType PreviewDataType;
|
||||
|
||||
MemoryEditor()
|
||||
{
|
||||
// Settings
|
||||
Open = true;
|
||||
ReadOnly = false;
|
||||
Cols = 16;
|
||||
OptShowOptions = true;
|
||||
OptShowDataPreview = false;
|
||||
OptShowHexII = false;
|
||||
OptShowAscii = true;
|
||||
OptGreyOutZeroes = true;
|
||||
OptUpperCaseHex = true;
|
||||
OptMidColsCount = 8;
|
||||
OptAddrDigitsCount = 0;
|
||||
OptFooterExtraHeight = 0.0f;
|
||||
HighlightColor = IM_COL32(255, 255, 255, 50);
|
||||
ReadFn = NULL;
|
||||
WriteFn = NULL;
|
||||
HighlightFn = NULL;
|
||||
|
||||
// State/Internals
|
||||
ContentsWidthChanged = false;
|
||||
DataPreviewAddr = DataEditingAddr = (size_t)-1;
|
||||
DataEditingTakeFocus = false;
|
||||
memset(DataInputBuf, 0, sizeof(DataInputBuf));
|
||||
memset(AddrInputBuf, 0, sizeof(AddrInputBuf));
|
||||
GotoAddr = (size_t)-1;
|
||||
HighlightMin = HighlightMax = (size_t)-1;
|
||||
PreviewEndianess = 0;
|
||||
PreviewDataType = ImGuiDataType_S32;
|
||||
}
|
||||
|
||||
void GotoAddrAndHighlight(size_t addr_min, size_t addr_max)
|
||||
{
|
||||
GotoAddr = addr_min;
|
||||
HighlightMin = addr_min;
|
||||
HighlightMax = addr_max;
|
||||
}
|
||||
|
||||
struct Sizes
|
||||
{
|
||||
int AddrDigitsCount;
|
||||
float LineHeight;
|
||||
float GlyphWidth;
|
||||
float HexCellWidth;
|
||||
float SpacingBetweenMidCols;
|
||||
float PosHexStart;
|
||||
float PosHexEnd;
|
||||
float PosAsciiStart;
|
||||
float PosAsciiEnd;
|
||||
float WindowWidth;
|
||||
|
||||
Sizes() { memset(this, 0, sizeof(*this)); }
|
||||
};
|
||||
|
||||
void CalcSizes(Sizes& s, size_t mem_size, size_t base_display_addr)
|
||||
{
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
s.AddrDigitsCount = OptAddrDigitsCount;
|
||||
if (s.AddrDigitsCount == 0)
|
||||
for (size_t n = base_display_addr + mem_size - 1; n > 0; n >>= 4)
|
||||
s.AddrDigitsCount++;
|
||||
s.LineHeight = ImGui::GetTextLineHeight();
|
||||
s.GlyphWidth = ImGui::CalcTextSize("F").x + 1; // We assume the font is mono-space
|
||||
s.HexCellWidth = (float)(int)(s.GlyphWidth * 2.5f); // "FF " we include trailing space in the width to easily catch clicks everywhere
|
||||
s.SpacingBetweenMidCols = (float)(int)(s.HexCellWidth * 0.25f); // Every OptMidColsCount columns we add a bit of extra spacing
|
||||
s.PosHexStart = (s.AddrDigitsCount + 2) * s.GlyphWidth;
|
||||
s.PosHexEnd = s.PosHexStart + (s.HexCellWidth * Cols);
|
||||
s.PosAsciiStart = s.PosAsciiEnd = s.PosHexEnd;
|
||||
if (OptShowAscii)
|
||||
{
|
||||
s.PosAsciiStart = s.PosHexEnd + s.GlyphWidth * 1;
|
||||
if (OptMidColsCount > 0)
|
||||
s.PosAsciiStart += (float)((Cols + OptMidColsCount - 1) / OptMidColsCount) * s.SpacingBetweenMidCols;
|
||||
s.PosAsciiEnd = s.PosAsciiStart + Cols * s.GlyphWidth;
|
||||
}
|
||||
s.WindowWidth = s.PosAsciiEnd + style.ScrollbarSize + style.WindowPadding.x * 2 + s.GlyphWidth;
|
||||
}
|
||||
|
||||
// Standalone Memory Editor window
|
||||
void DrawWindow(const char* title, void* mem_data, size_t mem_size, size_t base_display_addr = 0x0000)
|
||||
{
|
||||
Sizes s;
|
||||
CalcSizes(s, mem_size, base_display_addr);
|
||||
ImGui::SetNextWindowSizeConstraints(ImVec2(0.0f, 0.0f), ImVec2(s.WindowWidth, FLT_MAX));
|
||||
|
||||
Open = true;
|
||||
if (ImGui::Begin(title, &Open, ImGuiWindowFlags_NoScrollbar))
|
||||
{
|
||||
if (ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows) && ImGui::IsMouseReleased(ImGuiMouseButton_Right))
|
||||
ImGui::OpenPopup("context");
|
||||
DrawContents(mem_data, mem_size, base_display_addr);
|
||||
if (ContentsWidthChanged)
|
||||
{
|
||||
CalcSizes(s, mem_size, base_display_addr);
|
||||
ImGui::SetWindowSize(ImVec2(s.WindowWidth, ImGui::GetWindowSize().y));
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
// Memory Editor contents only
|
||||
void DrawContents(void* mem_data_void, size_t mem_size, size_t base_display_addr = 0x0000)
|
||||
{
|
||||
if (Cols < 1)
|
||||
Cols = 1;
|
||||
|
||||
ImU8* mem_data = (ImU8*)mem_data_void;
|
||||
Sizes s;
|
||||
CalcSizes(s, mem_size, base_display_addr);
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
|
||||
// We begin into our scrolling region with the 'ImGuiWindowFlags_NoMove' in order to prevent click from moving the window.
|
||||
// This is used as a facility since our main click detection code doesn't assign an ActiveId so the click would normally be caught as a window-move.
|
||||
const float height_separator = style.ItemSpacing.y;
|
||||
float footer_height = OptFooterExtraHeight;
|
||||
if (OptShowOptions)
|
||||
footer_height += height_separator + ImGui::GetFrameHeightWithSpacing() * 1;
|
||||
if (OptShowDataPreview)
|
||||
footer_height += height_separator + ImGui::GetFrameHeightWithSpacing() * 1 + ImGui::GetTextLineHeightWithSpacing() * 3;
|
||||
ImGui::BeginChild("##scrolling", ImVec2(0, -footer_height), false, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoNav);
|
||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
||||
|
||||
// We are not really using the clipper API correctly here, because we rely on visible_start_addr/visible_end_addr for our scrolling function.
|
||||
const int line_total_count = (int)((mem_size + Cols - 1) / Cols);
|
||||
ImGuiListClipper clipper;
|
||||
clipper.Begin(line_total_count, s.LineHeight);
|
||||
clipper.Step();
|
||||
const size_t visible_start_addr = clipper.DisplayStart * Cols;
|
||||
const size_t visible_end_addr = clipper.DisplayEnd * Cols;
|
||||
|
||||
bool data_next = false;
|
||||
|
||||
if (ReadOnly || DataEditingAddr >= mem_size)
|
||||
DataEditingAddr = (size_t)-1;
|
||||
if (DataPreviewAddr >= mem_size)
|
||||
DataPreviewAddr = (size_t)-1;
|
||||
|
||||
size_t preview_data_type_size = OptShowDataPreview ? DataTypeGetSize(PreviewDataType) : 0;
|
||||
|
||||
size_t data_editing_addr_backup = DataEditingAddr;
|
||||
size_t data_editing_addr_next = (size_t)-1;
|
||||
if (DataEditingAddr != (size_t)-1)
|
||||
{
|
||||
// Move cursor but only apply on next frame so scrolling with be synchronized (because currently we can't change the scrolling while the window is being rendered)
|
||||
if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_UpArrow)) && DataEditingAddr >= (size_t)Cols) { data_editing_addr_next = DataEditingAddr - Cols; DataEditingTakeFocus = true; }
|
||||
else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_DownArrow)) && DataEditingAddr < mem_size - Cols) { data_editing_addr_next = DataEditingAddr + Cols; DataEditingTakeFocus = true; }
|
||||
else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_LeftArrow)) && DataEditingAddr > 0) { data_editing_addr_next = DataEditingAddr - 1; DataEditingTakeFocus = true; }
|
||||
else if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_RightArrow)) && DataEditingAddr < mem_size - 1) { data_editing_addr_next = DataEditingAddr + 1; DataEditingTakeFocus = true; }
|
||||
}
|
||||
if (data_editing_addr_next != (size_t)-1 && (data_editing_addr_next / Cols) != (data_editing_addr_backup / Cols))
|
||||
{
|
||||
// Track cursor movements
|
||||
const int scroll_offset = ((int)(data_editing_addr_next / Cols) - (int)(data_editing_addr_backup / Cols));
|
||||
const bool scroll_desired = (scroll_offset < 0 && data_editing_addr_next < visible_start_addr + Cols * 2) || (scroll_offset > 0 && data_editing_addr_next > visible_end_addr - Cols * 2);
|
||||
if (scroll_desired)
|
||||
ImGui::SetScrollY(ImGui::GetScrollY() + scroll_offset * s.LineHeight);
|
||||
}
|
||||
|
||||
// Draw vertical separator
|
||||
ImVec2 window_pos = ImGui::GetWindowPos();
|
||||
if (OptShowAscii)
|
||||
draw_list->AddLine(ImVec2(window_pos.x + s.PosAsciiStart - s.GlyphWidth, window_pos.y), ImVec2(window_pos.x + s.PosAsciiStart - s.GlyphWidth, window_pos.y + 9999), ImGui::GetColorU32(ImGuiCol_Border));
|
||||
|
||||
const ImU32 color_text = ImGui::GetColorU32(ImGuiCol_Text);
|
||||
const ImU32 color_disabled = OptGreyOutZeroes ? ImGui::GetColorU32(ImGuiCol_TextDisabled) : color_text;
|
||||
|
||||
const char* format_address = OptUpperCaseHex ? "%0*" _PRISizeT "X: " : "%0*" _PRISizeT "x: ";
|
||||
const char* format_data = OptUpperCaseHex ? "%0*" _PRISizeT "X" : "%0*" _PRISizeT "x";
|
||||
const char* format_byte = OptUpperCaseHex ? "%02X" : "%02x";
|
||||
const char* format_byte_space = OptUpperCaseHex ? "%02X " : "%02x ";
|
||||
|
||||
for (int line_i = clipper.DisplayStart; line_i < clipper.DisplayEnd; line_i++) // display only visible lines
|
||||
{
|
||||
size_t addr = (size_t)(line_i * Cols);
|
||||
ImGui::Text(format_address, s.AddrDigitsCount, base_display_addr + addr);
|
||||
|
||||
// Draw Hexadecimal
|
||||
for (int n = 0; n < Cols && addr < mem_size; n++, addr++)
|
||||
{
|
||||
float byte_pos_x = s.PosHexStart + s.HexCellWidth * n;
|
||||
if (OptMidColsCount > 0)
|
||||
byte_pos_x += (float)(n / OptMidColsCount) * s.SpacingBetweenMidCols;
|
||||
ImGui::SameLine(byte_pos_x);
|
||||
|
||||
// Draw highlight
|
||||
bool is_highlight_from_user_range = (addr >= HighlightMin && addr < HighlightMax);
|
||||
bool is_highlight_from_user_func = (HighlightFn && HighlightFn(mem_data, addr));
|
||||
bool is_highlight_from_preview = (addr >= DataPreviewAddr && addr < DataPreviewAddr + preview_data_type_size);
|
||||
if (is_highlight_from_user_range || is_highlight_from_user_func || is_highlight_from_preview)
|
||||
{
|
||||
ImVec2 pos = ImGui::GetCursorScreenPos();
|
||||
float highlight_width = s.GlyphWidth * 2;
|
||||
bool is_next_byte_highlighted = (addr + 1 < mem_size) && ((HighlightMax != (size_t)-1 && addr + 1 < HighlightMax) || (HighlightFn && HighlightFn(mem_data, addr + 1)));
|
||||
if (is_next_byte_highlighted || (n + 1 == Cols))
|
||||
{
|
||||
highlight_width = s.HexCellWidth;
|
||||
if (OptMidColsCount > 0 && n > 0 && (n + 1) < Cols && ((n + 1) % OptMidColsCount) == 0)
|
||||
highlight_width += s.SpacingBetweenMidCols;
|
||||
}
|
||||
draw_list->AddRectFilled(pos, ImVec2(pos.x + highlight_width, pos.y + s.LineHeight), HighlightColor);
|
||||
}
|
||||
|
||||
if (DataEditingAddr == addr)
|
||||
{
|
||||
// Display text input on current byte
|
||||
bool data_write = false;
|
||||
ImGui::PushID((void*)addr);
|
||||
if (DataEditingTakeFocus)
|
||||
{
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
ImGui::CaptureKeyboardFromApp(true);
|
||||
sprintf(AddrInputBuf, format_data, s.AddrDigitsCount, base_display_addr + addr);
|
||||
sprintf(DataInputBuf, format_byte, ReadFn ? ReadFn(mem_data, addr) : mem_data[addr]);
|
||||
}
|
||||
struct UserData
|
||||
{
|
||||
// FIXME: We should have a way to retrieve the text edit cursor position more easily in the API, this is rather tedious. This is such a ugly mess we may be better off not using InputText() at all here.
|
||||
static int Callback(ImGuiInputTextCallbackData* data)
|
||||
{
|
||||
UserData* user_data = (UserData*)data->UserData;
|
||||
if (!data->HasSelection())
|
||||
user_data->CursorPos = data->CursorPos;
|
||||
if (data->SelectionStart == 0 && data->SelectionEnd == data->BufTextLen)
|
||||
{
|
||||
// When not editing a byte, always rewrite its content (this is a bit tricky, since InputText technically "owns" the master copy of the buffer we edit it in there)
|
||||
data->DeleteChars(0, data->BufTextLen);
|
||||
data->InsertChars(0, user_data->CurrentBufOverwrite);
|
||||
data->SelectionStart = 0;
|
||||
data->SelectionEnd = 2;
|
||||
data->CursorPos = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
char CurrentBufOverwrite[3]; // Input
|
||||
int CursorPos; // Output
|
||||
};
|
||||
UserData user_data;
|
||||
user_data.CursorPos = -1;
|
||||
sprintf(user_data.CurrentBufOverwrite, format_byte, ReadFn ? ReadFn(mem_data, addr) : mem_data[addr]);
|
||||
ImGuiInputTextFlags flags = ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll | ImGuiInputTextFlags_NoHorizontalScroll | ImGuiInputTextFlags_CallbackAlways;
|
||||
#if IMGUI_VERSION_NUM >= 18104
|
||||
flags |= ImGuiInputTextFlags_AlwaysOverwrite;
|
||||
#else
|
||||
flags |= ImGuiInputTextFlags_AlwaysInsertMode;
|
||||
#endif
|
||||
ImGui::SetNextItemWidth(s.GlyphWidth * 2);
|
||||
if (ImGui::InputText("##data", DataInputBuf, IM_ARRAYSIZE(DataInputBuf), flags, UserData::Callback, &user_data))
|
||||
data_write = data_next = true;
|
||||
else if (!DataEditingTakeFocus && !ImGui::IsItemActive())
|
||||
DataEditingAddr = data_editing_addr_next = (size_t)-1;
|
||||
DataEditingTakeFocus = false;
|
||||
if (user_data.CursorPos >= 2)
|
||||
data_write = data_next = true;
|
||||
if (data_editing_addr_next != (size_t)-1)
|
||||
data_write = data_next = false;
|
||||
unsigned int data_input_value = 0;
|
||||
if (data_write && sscanf(DataInputBuf, "%X", &data_input_value) == 1)
|
||||
{
|
||||
if (WriteFn)
|
||||
WriteFn(mem_data, addr, (ImU8)data_input_value);
|
||||
else
|
||||
mem_data[addr] = (ImU8)data_input_value;
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
else
|
||||
{
|
||||
// NB: The trailing space is not visible but ensure there's no gap that the mouse cannot click on.
|
||||
ImU8 b = ReadFn ? ReadFn(mem_data, addr) : mem_data[addr];
|
||||
|
||||
if (OptShowHexII)
|
||||
{
|
||||
if ((b >= 32 && b < 128))
|
||||
ImGui::Text(".%c ", b);
|
||||
else if (b == 0xFF && OptGreyOutZeroes)
|
||||
ImGui::TextDisabled("## ");
|
||||
else if (b == 0x00)
|
||||
ImGui::Text(" ");
|
||||
else
|
||||
ImGui::Text(format_byte_space, b);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (b == 0 && OptGreyOutZeroes)
|
||||
ImGui::TextDisabled("00 ");
|
||||
else
|
||||
ImGui::Text(format_byte_space, b);
|
||||
}
|
||||
if (!ReadOnly && ImGui::IsItemHovered() && ImGui::IsMouseClicked(0))
|
||||
{
|
||||
DataEditingTakeFocus = true;
|
||||
data_editing_addr_next = addr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (OptShowAscii)
|
||||
{
|
||||
// Draw ASCII values
|
||||
ImGui::SameLine(s.PosAsciiStart);
|
||||
ImVec2 pos = ImGui::GetCursorScreenPos();
|
||||
addr = line_i * Cols;
|
||||
ImGui::PushID(line_i);
|
||||
if (ImGui::InvisibleButton("ascii", ImVec2(s.PosAsciiEnd - s.PosAsciiStart, s.LineHeight)))
|
||||
{
|
||||
DataEditingAddr = DataPreviewAddr = addr + (size_t)((ImGui::GetIO().MousePos.x - pos.x) / s.GlyphWidth);
|
||||
DataEditingTakeFocus = true;
|
||||
}
|
||||
ImGui::PopID();
|
||||
for (int n = 0; n < Cols && addr < mem_size; n++, addr++)
|
||||
{
|
||||
if (addr == DataEditingAddr)
|
||||
{
|
||||
draw_list->AddRectFilled(pos, ImVec2(pos.x + s.GlyphWidth, pos.y + s.LineHeight), ImGui::GetColorU32(ImGuiCol_FrameBg));
|
||||
draw_list->AddRectFilled(pos, ImVec2(pos.x + s.GlyphWidth, pos.y + s.LineHeight), ImGui::GetColorU32(ImGuiCol_TextSelectedBg));
|
||||
}
|
||||
unsigned char c = ReadFn ? ReadFn(mem_data, addr) : mem_data[addr];
|
||||
char display_c = (c < 32 || c >= 128) ? '.' : c;
|
||||
draw_list->AddText(pos, (display_c == c) ? color_text : color_disabled, &display_c, &display_c + 1);
|
||||
pos.x += s.GlyphWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
IM_ASSERT(clipper.Step() == false);
|
||||
clipper.End();
|
||||
ImGui::PopStyleVar(2);
|
||||
ImGui::EndChild();
|
||||
|
||||
// Notify the main window of our ideal child content size (FIXME: we are missing an API to get the contents size from the child)
|
||||
ImGui::SetCursorPosX(s.WindowWidth);
|
||||
|
||||
if (data_next && DataEditingAddr < mem_size)
|
||||
{
|
||||
DataEditingAddr = DataPreviewAddr = DataEditingAddr + 1;
|
||||
DataEditingTakeFocus = true;
|
||||
}
|
||||
else if (data_editing_addr_next != (size_t)-1)
|
||||
{
|
||||
DataEditingAddr = DataPreviewAddr = data_editing_addr_next;
|
||||
}
|
||||
|
||||
const bool lock_show_data_preview = OptShowDataPreview;
|
||||
if (OptShowOptions)
|
||||
{
|
||||
ImGui::Separator();
|
||||
DrawOptionsLine(s, mem_data, mem_size, base_display_addr);
|
||||
}
|
||||
|
||||
if (lock_show_data_preview)
|
||||
{
|
||||
ImGui::Separator();
|
||||
DrawPreviewLine(s, mem_data, mem_size, base_display_addr);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawOptionsLine(const Sizes& s, void* mem_data, size_t mem_size, size_t base_display_addr)
|
||||
{
|
||||
IM_UNUSED(mem_data);
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
const char* format_range = OptUpperCaseHex ? "Range %0*" _PRISizeT "X..%0*" _PRISizeT "X" : "Range %0*" _PRISizeT "x..%0*" _PRISizeT "x";
|
||||
|
||||
// Options menu
|
||||
if (ImGui::Button("Options"))
|
||||
ImGui::OpenPopup("context");
|
||||
if (ImGui::BeginPopup("context"))
|
||||
{
|
||||
ImGui::SetNextItemWidth(s.GlyphWidth * 7 + style.FramePadding.x * 2.0f);
|
||||
if (ImGui::DragInt("##cols", &Cols, 0.2f, 4, 32, "%d cols")) { ContentsWidthChanged = true; if (Cols < 1) Cols = 1; }
|
||||
ImGui::Checkbox("Show Data Preview", &OptShowDataPreview);
|
||||
ImGui::Checkbox("Show HexII", &OptShowHexII);
|
||||
if (ImGui::Checkbox("Show Ascii", &OptShowAscii)) { ContentsWidthChanged = true; }
|
||||
ImGui::Checkbox("Grey out zeroes", &OptGreyOutZeroes);
|
||||
ImGui::Checkbox("Uppercase Hex", &OptUpperCaseHex);
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::Text(format_range, s.AddrDigitsCount, base_display_addr, s.AddrDigitsCount, base_display_addr + mem_size - 1);
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth((s.AddrDigitsCount + 1) * s.GlyphWidth + style.FramePadding.x * 2.0f);
|
||||
if (ImGui::InputText("##addr", AddrInputBuf, IM_ARRAYSIZE(AddrInputBuf), ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_EnterReturnsTrue))
|
||||
{
|
||||
size_t goto_addr;
|
||||
if (sscanf(AddrInputBuf, "%" _PRISizeT "X", &goto_addr) == 1)
|
||||
{
|
||||
GotoAddr = goto_addr - base_display_addr;
|
||||
HighlightMin = HighlightMax = (size_t)-1;
|
||||
}
|
||||
}
|
||||
|
||||
if (GotoAddr != (size_t)-1)
|
||||
{
|
||||
if (GotoAddr < mem_size)
|
||||
{
|
||||
ImGui::BeginChild("##scrolling");
|
||||
ImGui::SetScrollFromPosY(ImGui::GetCursorStartPos().y + (GotoAddr / Cols) * ImGui::GetTextLineHeight());
|
||||
ImGui::EndChild();
|
||||
DataEditingAddr = DataPreviewAddr = GotoAddr;
|
||||
DataEditingTakeFocus = true;
|
||||
}
|
||||
GotoAddr = (size_t)-1;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawPreviewLine(const Sizes& s, void* mem_data_void, size_t mem_size, size_t base_display_addr)
|
||||
{
|
||||
IM_UNUSED(base_display_addr);
|
||||
ImU8* mem_data = (ImU8*)mem_data_void;
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::Text("Preview as:");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth((s.GlyphWidth * 10.0f) + style.FramePadding.x * 2.0f + style.ItemInnerSpacing.x);
|
||||
if (ImGui::BeginCombo("##combo_type", DataTypeGetDesc(PreviewDataType), ImGuiComboFlags_HeightLargest))
|
||||
{
|
||||
for (int n = 0; n < ImGuiDataType_COUNT; n++)
|
||||
if (ImGui::Selectable(DataTypeGetDesc((ImGuiDataType)n), PreviewDataType == n))
|
||||
PreviewDataType = (ImGuiDataType)n;
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth((s.GlyphWidth * 6.0f) + style.FramePadding.x * 2.0f + style.ItemInnerSpacing.x);
|
||||
ImGui::Combo("##combo_endianess", &PreviewEndianess, "LE\0BE\0\0");
|
||||
|
||||
char buf[128] = "";
|
||||
float x = s.GlyphWidth * 6.0f;
|
||||
bool has_value = DataPreviewAddr != (size_t)-1;
|
||||
if (has_value)
|
||||
DrawPreviewData(DataPreviewAddr, mem_data, mem_size, PreviewDataType, DataFormat_Dec, buf, (size_t)IM_ARRAYSIZE(buf));
|
||||
ImGui::Text("Dec"); ImGui::SameLine(x); ImGui::TextUnformatted(has_value ? buf : "N/A");
|
||||
if (has_value)
|
||||
DrawPreviewData(DataPreviewAddr, mem_data, mem_size, PreviewDataType, DataFormat_Hex, buf, (size_t)IM_ARRAYSIZE(buf));
|
||||
ImGui::Text("Hex"); ImGui::SameLine(x); ImGui::TextUnformatted(has_value ? buf : "N/A");
|
||||
if (has_value)
|
||||
DrawPreviewData(DataPreviewAddr, mem_data, mem_size, PreviewDataType, DataFormat_Bin, buf, (size_t)IM_ARRAYSIZE(buf));
|
||||
buf[IM_ARRAYSIZE(buf) - 1] = 0;
|
||||
ImGui::Text("Bin"); ImGui::SameLine(x); ImGui::TextUnformatted(has_value ? buf : "N/A");
|
||||
}
|
||||
|
||||
// Utilities for Data Preview
|
||||
const char* DataTypeGetDesc(ImGuiDataType data_type) const
|
||||
{
|
||||
const char* descs[] = { "Int8", "Uint8", "Int16", "Uint16", "Int32", "Uint32", "Int64", "Uint64", "Float", "Double" };
|
||||
IM_ASSERT(data_type >= 0 && data_type < ImGuiDataType_COUNT);
|
||||
return descs[data_type];
|
||||
}
|
||||
|
||||
size_t DataTypeGetSize(ImGuiDataType data_type) const
|
||||
{
|
||||
const size_t sizes[] = { 1, 1, 2, 2, 4, 4, 8, 8, sizeof(float), sizeof(double) };
|
||||
IM_ASSERT(data_type >= 0 && data_type < ImGuiDataType_COUNT);
|
||||
return sizes[data_type];
|
||||
}
|
||||
|
||||
const char* DataFormatGetDesc(DataFormat data_format) const
|
||||
{
|
||||
const char* descs[] = { "Bin", "Dec", "Hex" };
|
||||
IM_ASSERT(data_format >= 0 && data_format < DataFormat_COUNT);
|
||||
return descs[data_format];
|
||||
}
|
||||
|
||||
bool IsBigEndian() const
|
||||
{
|
||||
uint16_t x = 1;
|
||||
char c[2];
|
||||
memcpy(c, &x, 2);
|
||||
return c[0] != 0;
|
||||
}
|
||||
|
||||
static void* EndianessCopyBigEndian(void* _dst, void* _src, size_t s, int is_little_endian)
|
||||
{
|
||||
if (is_little_endian)
|
||||
{
|
||||
uint8_t* dst = (uint8_t*)_dst;
|
||||
uint8_t* src = (uint8_t*)_src + s - 1;
|
||||
for (int i = 0, n = (int)s; i < n; ++i)
|
||||
memcpy(dst++, src--, 1);
|
||||
return _dst;
|
||||
}
|
||||
else
|
||||
{
|
||||
return memcpy(_dst, _src, s);
|
||||
}
|
||||
}
|
||||
|
||||
static void* EndianessCopyLittleEndian(void* _dst, void* _src, size_t s, int is_little_endian)
|
||||
{
|
||||
if (is_little_endian)
|
||||
{
|
||||
return memcpy(_dst, _src, s);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t* dst = (uint8_t*)_dst;
|
||||
uint8_t* src = (uint8_t*)_src + s - 1;
|
||||
for (int i = 0, n = (int)s; i < n; ++i)
|
||||
memcpy(dst++, src--, 1);
|
||||
return _dst;
|
||||
}
|
||||
}
|
||||
|
||||
void* EndianessCopy(void* dst, void* src, size_t size) const
|
||||
{
|
||||
static void* (*fp)(void*, void*, size_t, int) = NULL;
|
||||
if (fp == NULL)
|
||||
fp = IsBigEndian() ? EndianessCopyBigEndian : EndianessCopyLittleEndian;
|
||||
return fp(dst, src, size, PreviewEndianess);
|
||||
}
|
||||
|
||||
const char* FormatBinary(const uint8_t* buf, int width) const
|
||||
{
|
||||
IM_ASSERT(width <= 64);
|
||||
size_t out_n = 0;
|
||||
static char out_buf[64 + 8 + 1];
|
||||
int n = width / 8;
|
||||
for (int j = n - 1; j >= 0; --j)
|
||||
{
|
||||
for (int i = 0; i < 8; ++i)
|
||||
out_buf[out_n++] = (buf[j] & (1 << (7 - i))) ? '1' : '0';
|
||||
out_buf[out_n++] = ' ';
|
||||
}
|
||||
IM_ASSERT(out_n < IM_ARRAYSIZE(out_buf));
|
||||
out_buf[out_n] = 0;
|
||||
return out_buf;
|
||||
}
|
||||
|
||||
// [Internal]
|
||||
void DrawPreviewData(size_t addr, const ImU8* mem_data, size_t mem_size, ImGuiDataType data_type, DataFormat data_format, char* out_buf, size_t out_buf_size) const
|
||||
{
|
||||
uint8_t buf[8];
|
||||
size_t elem_size = DataTypeGetSize(data_type);
|
||||
size_t size = addr + elem_size > mem_size ? mem_size - addr : elem_size;
|
||||
if (ReadFn)
|
||||
for (int i = 0, n = (int)size; i < n; ++i)
|
||||
buf[i] = ReadFn(mem_data, addr + i);
|
||||
else
|
||||
memcpy(buf, mem_data + addr, size);
|
||||
|
||||
if (data_format == DataFormat_Bin)
|
||||
{
|
||||
uint8_t binbuf[8];
|
||||
EndianessCopy(binbuf, buf, size);
|
||||
ImSnprintf(out_buf, out_buf_size, "%s", FormatBinary(binbuf, (int)size * 8));
|
||||
return;
|
||||
}
|
||||
|
||||
out_buf[0] = 0;
|
||||
switch (data_type)
|
||||
{
|
||||
case ImGuiDataType_S8:
|
||||
{
|
||||
int8_t int8 = 0;
|
||||
EndianessCopy(&int8, buf, size);
|
||||
if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%hhd", int8); return; }
|
||||
if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%02x", int8 & 0xFF); return; }
|
||||
break;
|
||||
}
|
||||
case ImGuiDataType_U8:
|
||||
{
|
||||
uint8_t uint8 = 0;
|
||||
EndianessCopy(&uint8, buf, size);
|
||||
if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%hhu", uint8); return; }
|
||||
if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%02x", uint8 & 0XFF); return; }
|
||||
break;
|
||||
}
|
||||
case ImGuiDataType_S16:
|
||||
{
|
||||
int16_t int16 = 0;
|
||||
EndianessCopy(&int16, buf, size);
|
||||
if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%hd", int16); return; }
|
||||
if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%04x", int16 & 0xFFFF); return; }
|
||||
break;
|
||||
}
|
||||
case ImGuiDataType_U16:
|
||||
{
|
||||
uint16_t uint16 = 0;
|
||||
EndianessCopy(&uint16, buf, size);
|
||||
if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%hu", uint16); return; }
|
||||
if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%04x", uint16 & 0xFFFF); return; }
|
||||
break;
|
||||
}
|
||||
case ImGuiDataType_S32:
|
||||
{
|
||||
int32_t int32 = 0;
|
||||
EndianessCopy(&int32, buf, size);
|
||||
if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%d", int32); return; }
|
||||
if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%08x", int32); return; }
|
||||
break;
|
||||
}
|
||||
case ImGuiDataType_U32:
|
||||
{
|
||||
uint32_t uint32 = 0;
|
||||
EndianessCopy(&uint32, buf, size);
|
||||
if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%u", uint32); return; }
|
||||
if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%08x", uint32); return; }
|
||||
break;
|
||||
}
|
||||
case ImGuiDataType_S64:
|
||||
{
|
||||
int64_t int64 = 0;
|
||||
EndianessCopy(&int64, buf, size);
|
||||
if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%lld", (long long)int64); return; }
|
||||
if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%016llx", (long long)int64); return; }
|
||||
break;
|
||||
}
|
||||
case ImGuiDataType_U64:
|
||||
{
|
||||
uint64_t uint64 = 0;
|
||||
EndianessCopy(&uint64, buf, size);
|
||||
if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%llu", (long long)uint64); return; }
|
||||
if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "0x%016llx", (long long)uint64); return; }
|
||||
break;
|
||||
}
|
||||
case ImGuiDataType_Float:
|
||||
{
|
||||
float float32 = 0.0f;
|
||||
EndianessCopy(&float32, buf, size);
|
||||
if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%f", float32); return; }
|
||||
if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "%a", float32); return; }
|
||||
break;
|
||||
}
|
||||
case ImGuiDataType_Double:
|
||||
{
|
||||
double float64 = 0.0;
|
||||
EndianessCopy(&float64, buf, size);
|
||||
if (data_format == DataFormat_Dec) { ImSnprintf(out_buf, out_buf_size, "%f", float64); return; }
|
||||
if (data_format == DataFormat_Hex) { ImSnprintf(out_buf, out_buf_size, "%a", float64); return; }
|
||||
break;
|
||||
}
|
||||
case ImGuiDataType_COUNT:
|
||||
break;
|
||||
} // Switch
|
||||
IM_ASSERT(0); // Shouldn't reach
|
||||
}
|
||||
};
|
||||
|
||||
#undef _PRISizeT
|
||||
#undef ImSnprintf
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
@@ -1,263 +0,0 @@
|
||||
#include <imgui_plot.h>
|
||||
#include <imgui.h>
|
||||
#ifndef IMGUI_DEFINE_MATH_OPERATORS
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#endif
|
||||
#include <imgui_internal.h>
|
||||
|
||||
namespace ImGui {
|
||||
// [0..1] -> [0..1]
|
||||
static float rescale(float t, float min, float max, PlotConfig::Scale::Type type) {
|
||||
switch (type) {
|
||||
case PlotConfig::Scale::Linear:
|
||||
return t;
|
||||
case PlotConfig::Scale::Log10:
|
||||
return log10(ImLerp(min, max, t) / min) / log10(max / min);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// [0..1] -> [0..1]
|
||||
static float rescale_inv(float t, float min, float max, PlotConfig::Scale::Type type) {
|
||||
switch (type) {
|
||||
case PlotConfig::Scale::Linear:
|
||||
return t;
|
||||
case PlotConfig::Scale::Log10:
|
||||
return (pow(max/min, t) * min - min) / (max - min);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cursor_to_idx(const ImVec2& pos, const ImRect& bb, const PlotConfig& conf, float x_min, float x_max) {
|
||||
const float t = ImClamp((pos.x - bb.Min.x) / (bb.Max.x - bb.Min.x), 0.0f, 0.9999f);
|
||||
const int v_idx = (int)(rescale_inv(t, x_min, x_max, conf.scale.type) * (conf.values.count - 1));
|
||||
IM_ASSERT(v_idx >= 0 && v_idx < conf.values.count);
|
||||
|
||||
return v_idx;
|
||||
}
|
||||
|
||||
PlotStatus Plot(const char* label, const PlotConfig& conf) {
|
||||
PlotStatus status = PlotStatus::nothing;
|
||||
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return status;
|
||||
|
||||
const float* const* ys_list = conf.values.ys_list;
|
||||
int ys_count = conf.values.ys_count;
|
||||
const ImU32* colors = conf.values.colors;
|
||||
if (conf.values.ys != nullptr) { // draw only a single plot
|
||||
ys_list = &conf.values.ys;
|
||||
ys_count = 1;
|
||||
colors = &conf.values.color;
|
||||
}
|
||||
|
||||
ImGuiContext& g = *GImGui;
|
||||
const ImGuiStyle& style = g.Style;
|
||||
const ImGuiID id = window->GetID(label);
|
||||
|
||||
const ImRect frame_bb(
|
||||
window->DC.CursorPos,
|
||||
window->DC.CursorPos + conf.frame_size);
|
||||
const ImRect inner_bb(
|
||||
frame_bb.Min + style.FramePadding,
|
||||
frame_bb.Max - style.FramePadding);
|
||||
const ImRect total_bb = frame_bb;
|
||||
ItemSize(total_bb, style.FramePadding.y);
|
||||
if (!ItemAdd(total_bb, 0, &frame_bb))
|
||||
return status;
|
||||
const bool hovered = ItemHoverable(frame_bb, id);
|
||||
|
||||
RenderFrame(
|
||||
frame_bb.Min,
|
||||
frame_bb.Max,
|
||||
GetColorU32(ImGuiCol_FrameBg),
|
||||
true,
|
||||
style.FrameRounding);
|
||||
|
||||
if (conf.values.count > 0) {
|
||||
int res_w;
|
||||
if (conf.skip_small_lines)
|
||||
res_w = ImMin((int)conf.frame_size.x, conf.values.count);
|
||||
else
|
||||
res_w = conf.values.count;
|
||||
res_w -= 1;
|
||||
int item_count = conf.values.count - 1;
|
||||
|
||||
float x_min = conf.values.offset;
|
||||
float x_max = conf.values.offset + conf.values.count - 1;
|
||||
if (conf.values.xs) {
|
||||
x_min = conf.values.xs[size_t(x_min)];
|
||||
x_max = conf.values.xs[size_t(x_max)];
|
||||
}
|
||||
|
||||
// Tooltip on hover
|
||||
int v_hovered = -1;
|
||||
if (conf.tooltip.show && hovered && inner_bb.Contains(g.IO.MousePos)) {
|
||||
const int v_idx = cursor_to_idx(g.IO.MousePos, inner_bb, conf, x_min, x_max);
|
||||
const size_t data_idx = conf.values.offset + (v_idx % conf.values.count);
|
||||
const float x0 = conf.values.xs ? conf.values.xs[data_idx] : v_idx;
|
||||
const float y0 = ys_list[0][data_idx]; // TODO: tooltip is only shown for the first y-value!
|
||||
SetTooltip(conf.tooltip.format, x0, y0);
|
||||
v_hovered = v_idx;
|
||||
}
|
||||
|
||||
const float t_step = 1.0f / (float)res_w;
|
||||
const float inv_scale = (conf.scale.min == conf.scale.max) ?
|
||||
0.0f : (1.0f / (conf.scale.max - conf.scale.min));
|
||||
|
||||
if (conf.grid_x.show) {
|
||||
int y0 = inner_bb.Min.y;
|
||||
int y1 = inner_bb.Max.y;
|
||||
switch (conf.scale.type) {
|
||||
case PlotConfig::Scale::Linear: {
|
||||
float cnt = conf.values.count / (conf.grid_x.size / conf.grid_x.subticks);
|
||||
float inc = 1.f / cnt;
|
||||
for (int i = 0; i <= cnt; ++i) {
|
||||
int x0 = ImLerp(inner_bb.Min.x, inner_bb.Max.x, i * inc);
|
||||
window->DrawList->AddLine(
|
||||
ImVec2(x0, y0),
|
||||
ImVec2(x0, y1),
|
||||
IM_COL32(200, 200, 200, (i % conf.grid_x.subticks) ? 128 : 255));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PlotConfig::Scale::Log10: {
|
||||
float start = 1.f;
|
||||
while (start < x_max) {
|
||||
for (int i = 1; i < 10; ++i) {
|
||||
float x = start * i;
|
||||
if (x < x_min) continue;
|
||||
if (x > x_max) break;
|
||||
float t = log10(x / x_min) / log10(x_max / x_min);
|
||||
int x0 = ImLerp(inner_bb.Min.x, inner_bb.Max.x, t);
|
||||
window->DrawList->AddLine(
|
||||
ImVec2(x0, y0),
|
||||
ImVec2(x0, y1),
|
||||
IM_COL32(200, 200, 200, (i > 1) ? 128 : 255));
|
||||
}
|
||||
start *= 10.f;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (conf.grid_y.show) {
|
||||
int x0 = inner_bb.Min.x;
|
||||
int x1 = inner_bb.Max.x;
|
||||
float cnt = (conf.scale.max - conf.scale.min) / (conf.grid_y.size / conf.grid_y.subticks);
|
||||
float inc = 1.f / cnt;
|
||||
for (int i = 0; i <= cnt; ++i) {
|
||||
int y0 = ImLerp(inner_bb.Min.y, inner_bb.Max.y, i * inc);
|
||||
window->DrawList->AddLine(
|
||||
ImVec2(x0, y0),
|
||||
ImVec2(x1, y0),
|
||||
IM_COL32(0, 0, 0, (i % conf.grid_y.subticks) ? 16 : 64));
|
||||
}
|
||||
}
|
||||
|
||||
const ImU32 col_hovered = GetColorU32(ImGuiCol_PlotLinesHovered);
|
||||
ImU32 col_base = GetColorU32(ImGuiCol_PlotLines);
|
||||
|
||||
for (int i = 0; i < ys_count; ++i) {
|
||||
if (colors) {
|
||||
if (colors[i]) col_base = colors[i];
|
||||
else col_base = GetColorU32(ImGuiCol_PlotLines);
|
||||
}
|
||||
float v0 = ys_list[i][conf.values.offset];
|
||||
float t0 = 0.0f;
|
||||
// Point in the normalized space of our target rectangle
|
||||
ImVec2 tp0 = ImVec2(t0, 1.0f - ImSaturate((v0 - conf.scale.min) * inv_scale));
|
||||
|
||||
for (int n = 0; n < res_w; n++)
|
||||
{
|
||||
const float t1 = t0 + t_step;
|
||||
const int v1_idx = (int)(t0 * item_count + 0.5f);
|
||||
IM_ASSERT(v1_idx >= 0 && v1_idx < conf.values.count);
|
||||
const float v1 = ys_list[i][conf.values.offset + (v1_idx + 1) % conf.values.count];
|
||||
const ImVec2 tp1 = ImVec2(
|
||||
rescale(t1, x_min, x_max, conf.scale.type),
|
||||
1.0f - ImSaturate((v1 - conf.scale.min) * inv_scale));
|
||||
|
||||
// NB: Draw calls are merged together by the DrawList system. Still, we should render our batch are lower level to save a bit of CPU.
|
||||
ImVec2 pos0 = ImLerp(inner_bb.Min, inner_bb.Max, tp0);
|
||||
ImVec2 pos1 = ImLerp(inner_bb.Min, inner_bb.Max, tp1);
|
||||
|
||||
if (v1_idx == v_hovered) {
|
||||
window->DrawList->AddCircleFilled(pos0, 3, col_hovered);
|
||||
}
|
||||
|
||||
window->DrawList->AddLine(
|
||||
pos0,
|
||||
pos1,
|
||||
col_base,
|
||||
conf.line_thickness);
|
||||
|
||||
t0 = t1;
|
||||
tp0 = tp1;
|
||||
}
|
||||
}
|
||||
|
||||
if (conf.v_lines.show) {
|
||||
for (size_t i = 0; i < conf.v_lines.count; ++i) {
|
||||
const size_t idx = conf.v_lines.indices[i];
|
||||
const float t1 = rescale(idx * t_step, x_min, x_max, conf.scale.type);
|
||||
ImVec2 pos0 = ImLerp(inner_bb.Min, inner_bb.Max, ImVec2(t1, 0.f));
|
||||
ImVec2 pos1 = ImLerp(inner_bb.Min, inner_bb.Max, ImVec2(t1, 1.f));
|
||||
window->DrawList->AddLine(pos0, pos1, IM_COL32(0xff, 0, 0, 0x88));
|
||||
}
|
||||
}
|
||||
|
||||
if (conf.selection.show) {
|
||||
if (hovered) {
|
||||
if (g.IO.MouseClicked[0]) {
|
||||
SetActiveID(id, window);
|
||||
FocusWindow(window);
|
||||
|
||||
const int v_idx = cursor_to_idx(g.IO.MousePos, inner_bb, conf, x_min, x_max);
|
||||
uint32_t start = conf.values.offset + (v_idx % conf.values.count);
|
||||
uint32_t end = start;
|
||||
if (conf.selection.sanitize_fn)
|
||||
end = conf.selection.sanitize_fn(end - start) + start;
|
||||
if (end < conf.values.offset + conf.values.count) {
|
||||
*conf.selection.start = start;
|
||||
*conf.selection.length = end - start;
|
||||
status = PlotStatus::selection_updated;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (g.ActiveId == id) {
|
||||
if (g.IO.MouseDown[0]) {
|
||||
const int v_idx = cursor_to_idx(g.IO.MousePos, inner_bb, conf, x_min, x_max);
|
||||
const uint32_t start = *conf.selection.start;
|
||||
uint32_t end = conf.values.offset + (v_idx % conf.values.count);
|
||||
if (end > start) {
|
||||
if (conf.selection.sanitize_fn)
|
||||
end = conf.selection.sanitize_fn(end - start) + start;
|
||||
if (end < conf.values.offset + conf.values.count) {
|
||||
*conf.selection.length = end - start;
|
||||
status = PlotStatus::selection_updated;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ClearActiveID();
|
||||
}
|
||||
}
|
||||
float fSelectionStep = 1.0 / item_count;
|
||||
ImVec2 pos0 = ImLerp(inner_bb.Min, inner_bb.Max,
|
||||
ImVec2(fSelectionStep * *conf.selection.start, 0.f));
|
||||
ImVec2 pos1 = ImLerp(inner_bb.Min, inner_bb.Max,
|
||||
ImVec2(fSelectionStep * (*conf.selection.start + *conf.selection.length), 1.f));
|
||||
window->DrawList->AddRectFilled(pos0, pos1, IM_COL32(128, 128, 128, 32));
|
||||
window->DrawList->AddRect(pos0, pos1, IM_COL32(128, 128, 128, 128));
|
||||
}
|
||||
}
|
||||
|
||||
// Text overlay
|
||||
if (conf.overlay_text)
|
||||
RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, conf.overlay_text, NULL, NULL, ImVec2(0.5f,0.0f));
|
||||
|
||||
return status;
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <imgui.h>
|
||||
|
||||
namespace ImGui {
|
||||
// Use this structure to pass the plot data and settings into the Plot function
|
||||
struct PlotConfig {
|
||||
struct Values {
|
||||
// if necessary, you can provide x-axis values
|
||||
const float *xs = nullptr;
|
||||
// array of y values. If null, use ys_list (below)
|
||||
const float *ys = nullptr;
|
||||
// the number of values in each array
|
||||
int count;
|
||||
// at which offset to start plotting.
|
||||
// Warning: count+offset must be <= length of array!
|
||||
int offset = 0;
|
||||
// Plot color. If 0, use ImGuiCol_PlotLines.
|
||||
ImU32 color = 0;
|
||||
|
||||
// in case you need to draw multiple plots at once, use this instead of ys
|
||||
const float **ys_list = nullptr;
|
||||
// the number of plots to draw
|
||||
int ys_count = 0;
|
||||
// colors for each plot
|
||||
const ImU32* colors = nullptr;
|
||||
} values;
|
||||
struct Scale {
|
||||
// Minimum plot value
|
||||
float min;
|
||||
// Maximum plot value
|
||||
float max;
|
||||
enum Type {
|
||||
Linear,
|
||||
Log10,
|
||||
};
|
||||
// How to scale the x-axis
|
||||
Type type = Linear;
|
||||
} scale;
|
||||
struct Tooltip {
|
||||
bool show = false;
|
||||
const char* format = "%g: %8.4g";
|
||||
} tooltip;
|
||||
struct Grid {
|
||||
bool show = false;
|
||||
float size = 100; // at which intervals to draw the grid
|
||||
int subticks = 10; // how many subticks in each tick
|
||||
} grid_x, grid_y;
|
||||
struct Selection {
|
||||
bool show = false;
|
||||
uint32_t* start = nullptr;
|
||||
uint32_t* length = nullptr;
|
||||
// "Sanitize" function. Give it selection length, and it will return
|
||||
// the "allowed" length. Useful for FFT, where selection must be
|
||||
// of power of two
|
||||
uint32_t(*sanitize_fn)(uint32_t) = nullptr;
|
||||
} selection;
|
||||
struct VerticalLines {
|
||||
bool show = false;
|
||||
const size_t* indices = nullptr; // at which indices to draw the lines
|
||||
size_t count = 0;
|
||||
} v_lines;
|
||||
ImVec2 frame_size = ImVec2(0.f, 0.f);
|
||||
float line_thickness = 1.f;
|
||||
bool skip_small_lines = true;
|
||||
const char* overlay_text = nullptr;
|
||||
};
|
||||
|
||||
enum class PlotStatus {
|
||||
nothing,
|
||||
selection_updated,
|
||||
};
|
||||
|
||||
IMGUI_API PlotStatus Plot(const char* label, const PlotConfig& conf);
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
Loaded 100 of 134 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user