Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d93c0501f | ||
|
|
00c42274fd | ||
|
|
05c2d86144 | ||
|
|
4b22017c93 | ||
|
|
da8a0af990 | ||
|
|
2a12d8a881 | ||
|
|
8a3b917576 |
No files matched your search
Binary file not shown.
@@ -164,5 +164,5 @@ set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_INVERSION_MASK=00
|
|||||||
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_INVERSION_MASK_LENGTH=73" -section_id auto_signaltap_0
|
set_global_assignment -name SLD_NODE_PARAMETER_ASSIGNMENT "SLD_INVERSION_MASK_LENGTH=73" -section_id auto_signaltap_0
|
||||||
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[7] -to auto_signaltap_0|gnd -section_id auto_signaltap_0
|
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[7] -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|gnd -section_id auto_signaltap_0
|
set_instance_assignment -name POST_FIT_CONNECT_TO_SLD_NODE_ENTITY_PORT crc[27] -to auto_signaltap_0|gnd -section_id auto_signaltap_0
|
||||||
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
|
|
||||||
set_global_assignment -name SLD_FILE db/Vsync_auto_stripped.stp
|
set_global_assignment -name SLD_FILE db/Vsync_auto_stripped.stp
|
||||||
|
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
|
||||||
@@ -12,6 +12,7 @@ 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 VHDL_FILE rtl/CPU09/cpu09l_128a.vhd
|
||||||
set_global_assignment -name SYSTEMVERILOG_FILE rtl/coco3fpga.sv
|
set_global_assignment -name SYSTEMVERILOG_FILE rtl/coco3fpga.sv
|
||||||
#set_global_assignment -name QIP_FILE CoCo3FPGA_Common/PH2_CLK.qip
|
#set_global_assignment -name QIP_FILE CoCo3FPGA_Common/PH2_CLK.qip
|
||||||
|
set_global_assignment -name VERILOG_FILE rtl/mc6809glb/mc6809glb.v
|
||||||
set_global_assignment -name VERILOG_FILE rtl/pll.v
|
set_global_assignment -name VERILOG_FILE rtl/pll.v
|
||||||
set_global_assignment -name VERILOG_FILE rtl/pll/pll_0002.v
|
set_global_assignment -name VERILOG_FILE rtl/pll/pll_0002.v
|
||||||
set_global_assignment -name VERILOG_FILE rtl/cassette.v
|
set_global_assignment -name VERILOG_FILE rtl/cassette.v
|
||||||
|
|||||||
+7
-7
@@ -191,13 +191,13 @@ assign OFFSET =
|
|||||||
({HVEN,COCO1,VID_CONT[3],V[0]} == 4'b0111) ? ROW_ADD + 11'd16: // WHEN V[0]=1 16 BYTES V[0]=0 32 BYTES
|
({HVEN,COCO1,VID_CONT[3],V[0]} == 4'b0111) ? ROW_ADD + 11'd16: // WHEN V[0]=1 16 BYTES V[0]=0 32 BYTES
|
||||||
|
|
||||||
// HR Text
|
// HR Text
|
||||||
({HVEN,COCO1,BP,HRES[3:2],CRES[0],HRES[0]} == 6'b0000001) ? ROW_ADD + 11'd40: // HR TEXT with no Attributes
|
({HVEN,COCO1,BP,HRES[3:2],CRES[0],HRES[0]} == 7'b0000001) ? ROW_ADD + 11'd40: // HR TEXT with no Attributes
|
||||||
({HVEN,COCO1,BP,HRES[3:2],CRES[0],HRES[0]} == 6'b0000010) ? ROW_ADD + 11'd64:
|
({HVEN,COCO1,BP,HRES[3:2],CRES[0],HRES[0]} == 7'b0000010) ? ROW_ADD + 11'd64:
|
||||||
({HVEN,COCO1,BP,HRES[3:2],CRES[0],HRES[0]} == 6'b0000011) ? ROW_ADD + 11'd80:
|
({HVEN,COCO1,BP,HRES[3:2],CRES[0],HRES[0]} == 7'b0000011) ? ROW_ADD + 11'd80:
|
||||||
({HVEN,COCO1,BP,HRES[3:2],CRES[0],HRES[0]} == 6'b0000100) ? ROW_ADD + 11'd64:
|
({HVEN,COCO1,BP,HRES[3:2],CRES[0],HRES[0]} == 7'b0000100) ? ROW_ADD + 11'd64:
|
||||||
({HVEN,COCO1,BP,HRES[3:2],CRES[0],HRES[0]} == 6'b0000101) ? ROW_ADD + 11'd80:
|
({HVEN,COCO1,BP,HRES[3:2],CRES[0],HRES[0]} == 7'b0000101) ? ROW_ADD + 11'd80:
|
||||||
({HVEN,COCO1,BP,HRES[3:2],CRES[0],HRES[0]} == 6'b0000110) ? ROW_ADD + 11'd128:
|
({HVEN,COCO1,BP,HRES[3:2],CRES[0],HRES[0]} == 7'b0000110) ? ROW_ADD + 11'd128:
|
||||||
({HVEN,COCO1,BP,HRES[3:2],CRES[0],HRES[0]} == 6'b0000111) ? ROW_ADD + 11'd160:
|
({HVEN,COCO1,BP,HRES[3:2],CRES[0],HRES[0]} == 7'b0000111) ? ROW_ADD + 11'd160:
|
||||||
|
|
||||||
// HR Graphics
|
// HR Graphics
|
||||||
({HVEN,COCO1,BP,HRES} == 7'b0010000) ? ROW_ADD + 11'd16:
|
({HVEN,COCO1,BP,HRES} == 7'b0010000) ? ROW_ADD + 11'd16:
|
||||||
|
|||||||
+230
-203
@@ -6,7 +6,7 @@
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// CPU section copyrighted by John Kent
|
// CPU section copyrighted by John Kent or Greg Miller dependant on selection
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -212,7 +212,7 @@ assign cas_relay = CAS_MTR;
|
|||||||
|
|
||||||
|
|
||||||
//Version 5 bits Major and 4 bits Minor
|
//Version 5 bits Major and 4 bits Minor
|
||||||
parameter Version_Hi = 8'h50;
|
parameter Version_Hi = 8'h51;
|
||||||
|
|
||||||
|
|
||||||
parameter Version_Lo = 8'h20; // MiSTer
|
parameter Version_Lo = 8'h20; // MiSTer
|
||||||
@@ -254,7 +254,7 @@ reg RESET_N;
|
|||||||
reg [6:0] CPU_RESET_SM;
|
reg [6:0] CPU_RESET_SM;
|
||||||
reg CPU_RESET;
|
reg CPU_RESET;
|
||||||
wire RESET_INS;
|
wire RESET_INS;
|
||||||
reg MUGS;
|
reg MUGS = 0;
|
||||||
wire RESET;
|
wire RESET;
|
||||||
wire RESET_P;
|
wire RESET_P;
|
||||||
wire [15:0] ADDRESS;
|
wire [15:0] ADDRESS;
|
||||||
@@ -724,37 +724,37 @@ assign BLOCK_ADDRESS = ({MMU_EN, MMU_TR, ADDRESS[15:13]} == 5'b1
|
|||||||
({VEC_PAG_RAM, MMU_EN, MMU_TR, ADDRESS[15:8]} ==11'b01111111110) ? SAM17: // 011 1111 1110 FE00-FEFF RAM Vector page
|
({VEC_PAG_RAM, MMU_EN, MMU_TR, ADDRESS[15:8]} ==11'b01111111110) ? SAM17: // 011 1111 1110 FE00-FEFF RAM Vector page
|
||||||
{9'h007, ADDRESS[15:13]};
|
{9'h007, ADDRESS[15:13]};
|
||||||
|
|
||||||
assign RAM_CS = (ADDRESS[15:0]== 16'hFFE8) ? 1'b1: // GART 1
|
assign RAM_CS = (ADDRESS[15:0]== 16'hFFE8) ? 1'b1: // GART 1
|
||||||
(ADDRESS[15:0]== 16'hFFE9) ? 1'b1: // GART 2
|
(ADDRESS[15:0]== 16'hFFE9) ? 1'b1: // GART 2
|
||||||
({ADDRESS[15:8]}== 8'hFF) ? 1'b0: // Hardware (FF00-FFFF) always Excluded
|
({ADDRESS[15:8]}== 8'hFF) ? 1'b0: // Hardware (FF00-FFFF) always Excluded
|
||||||
(ADDRESS[15:8] == 8'b11111110) ? 1'b1: // Always enabled in FEXX Secondary Vectors
|
({VEC_PAG_RAM, ADDRESS[15:8]} == 9'b111111110) ? 1'b1: // If VEC_PAG_RAM then include FEXX Secondary Vectors
|
||||||
ROM_SEL ? 1'b0: // Internal ROM
|
ROM_SEL ? 1'b0: // Internal ROM
|
||||||
// FLASH_CE_S ? 1'b0: // Cart ROM
|
CART_SEL ? 1'b0: // Cart ROM
|
||||||
CART_SEL ? 1'b0: // Cart ROM
|
1'b1;
|
||||||
1'b1;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* ROM signals
|
* ROM signals
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
// ROM_SEL is 1 when the system is accessing any cartridge "ROM" meaning the
|
// ROM_SEL is 1 when the system is accessing the internal "ROM"
|
||||||
|
// CART_SEL is 1 when the system is accessing any cartridge "ROM" meaning the
|
||||||
// 4 slots of the MPI, this is:
|
// 4 slots of the MPI, this is:
|
||||||
// Slot 1 Orchestra-90C
|
// Slot 1 Not Used
|
||||||
// Slot 2 Alternate Disk Controller ROM
|
// Slot 2 Disk Controller ROM
|
||||||
// Slot 3 Cart slot
|
// Slot 3 Cart slot
|
||||||
// Slot 4 Disk Controller ROM
|
// Slot 4 Disk Controller ROM
|
||||||
|
|
||||||
assign ROM_SEL = (ADDRESS[15:4] == 12'b111111111111) ? 1'b1: // Enable for Vectors
|
assign ROM_SEL = (ADDRESS[15:4] == 12'b111111111111) ? 1'b1: // Enable for Vectors
|
||||||
(ADDRESS[15:9] == 7'b1111111) ? 1'b0: // Disabled for FE00 - FFFF
|
(ADDRESS[15:9] == 7'b1111111) ? 1'b0: // Disabled for FE00 - FFFF
|
||||||
({ROM[1], RAM, BLOCK_ADDRESS[11:2], ADDRESS[14]} == 13'b0000000011110) ? 1'b1: // Enabled Read, 16K Int, Page 7, x1
|
({ROM[1], RAM, BLOCK_ADDRESS[11:2], ADDRESS[14]} == 13'b0000000011110) ? 1'b1: // Enabled Read, 16K Int, Page 7, x1 $78000-$7BFFF
|
||||||
({ROM, RAM, BLOCK_ADDRESS[11:2]} == 13'b1000000001111) ? 1'b1: // Enabled 32K int, Page 7, x
|
({ROM, RAM, BLOCK_ADDRESS[11:2]} == 13'b1000000001111) ? 1'b1: // Enabled 32K int, Page 7, x $78000-$7FFFF
|
||||||
1'b0;
|
1'b0;
|
||||||
|
|
||||||
assign CART_SEL = (ADDRESS[15:9] == 7'b1111111) ? 1'b0: // Disabled for FE00 - FFFF
|
assign CART_SEL = (ADDRESS[15:8] == 8'b11111111) ? 1'b0: // Disabled for FF00 - FFFF
|
||||||
({ROM[1], RAM, BLOCK_ADDRESS[11:2], ADDRESS[14]} == 13'b0000000011111) ? 1'b1: // Enabled Read, 16K Cart, Page 7, x1
|
({ROM[1], RAM, BLOCK_ADDRESS[11:2], ADDRESS[14]} == 13'b0000000011111) ? 1'b1: // Enabled Read, 16K Cart, Page 7, x1 $7C000-$7FEFF
|
||||||
({ROM, RAM, BLOCK_ADDRESS[11:2]} == 13'b1100000001111) ? 1'b1: // Enabled 32K Cart, Page 7, x1
|
({ROM, RAM, BLOCK_ADDRESS[11:2]} == 13'b1100000001111) ? 1'b1: // Enabled 32K Cart, Page 7, x1 $78000-$7FEFF
|
||||||
1'b0;
|
1'b0;
|
||||||
|
|
||||||
//ROM
|
//ROM
|
||||||
//00 16 Internal + 16 External
|
//00 16 Internal + 16 External
|
||||||
@@ -765,11 +765,10 @@ assign CART_SEL = (ADDRESS[15:9] == 7'b1
|
|||||||
|
|
||||||
assign FLASH_ADDRESS = ENA_DSK ? {9'b000000100, ADDRESS[12:0]}: //8K Disk BASIC 8K Slot 4
|
assign FLASH_ADDRESS = ENA_DSK ? {9'b000000100, ADDRESS[12:0]}: //8K Disk BASIC 8K Slot 4
|
||||||
ENA_DISK2 ? {9'b000000100, ADDRESS[12:0]}: //[maps to same disk rom]
|
ENA_DISK2 ? {9'b000000100, ADDRESS[12:0]}: //[maps to same disk rom]
|
||||||
ENA_ORCC ? {9'b000000101, ADDRESS[12:0]}: //8K Orchestra 8K 90CC Slot 1
|
ENA_ORCC ? {9'b000000101, ADDRESS[12:0]}: //8K Orchestra 8K 90CC Slot 1
|
||||||
({ENA_PAK, ROM[1]} == 2'b10) ? {5'b00000,ROM_BANK, ADDRESS[13:0]}: //16K External R CART ROM
|
({ENA_PAK, ROM[1]} == 2'b10) ? {5'b00000,ROM_BANK, ADDRESS[13:0]}: //16K External R CART ROM
|
||||||
({ENA_PAK, ROM} == 3'b111) ? {4'b0000,ROM_BANK, ~ADDRESS[14], ADDRESS[13:0]}: //32K External R CART ROM
|
({ENA_PAK, ROM} == 3'b111) ? {4'b0000,ROM_BANK, ~ADDRESS[14], ADDRESS[13:0]}: //32K External R CART ROM
|
||||||
// ROM_SEL
|
{7'b0000000,ADDRESS[14:0]}; //32K Internal COCO3 ROM
|
||||||
{7'b0000000,ADDRESS[14:0]};
|
|
||||||
|
|
||||||
|
|
||||||
//ROM
|
//ROM
|
||||||
@@ -835,24 +834,40 @@ COCO_ROM_CART CC3_ROM_CART(
|
|||||||
|
|
||||||
wire SDC_EN_CS;
|
wire SDC_EN_CS;
|
||||||
|
|
||||||
assign ENA_ORCC = ({CART_SEL, MPI_CTS} == 3'b100) ? 1'b1: // Orchestra-90CC C000-DFFF Slot 1
|
assign ENA_ORCC = ({CART_SEL, MPI_CTS} == 3'b100) ? 1'b1: // Orchestra-90CC C000-DFFF Slot 1
|
||||||
1'b0;
|
1'b0;
|
||||||
assign ENA_DISK2 = ({CART_SEL, MPI_CTS} == 3'b101) ? 1'b1: // Alternative Disk controller ROM up to 32K
|
assign ENA_DISK2 = ({CART_SEL, MPI_CTS} == 3'b101) ? 1'b1: // Alternative Disk controller ROM up to 32K
|
||||||
1'b0;
|
1'b0;
|
||||||
assign ENA_PAK = ({CART_SEL, MPI_CTS} == 3'b110) ? 1'b1: // ROM SLOT 3
|
assign ENA_PAK = ({CART_SEL, MPI_CTS} == 3'b110) ? 1'b1: // ROM SLOT 3
|
||||||
1'b0;
|
1'b0;
|
||||||
assign ENA_DSK = ({CART_SEL, MPI_CTS} == 3'b111) ? 1'b1: // Disk C000-DFFF Slot 4
|
assign ENA_DSK = ({CART_SEL, MPI_CTS} == 3'b111) ? 1'b1: // Disk C000-DFFF Slot 4
|
||||||
1'b0;
|
1'b0;
|
||||||
assign HDD_EN = ({MPI_SCS, ADDRESS[15:4]} == 14'b11111111110100) ? 1'b1: // FF40-FF4F with MPI switch = 4
|
`ifdef CoCo3_sdc_fix_os9_driver
|
||||||
1'b0;
|
assign HDD_EN = ({ext_response, MPI_SCS, ADDRESS[15:5]} == 15'b01111111111010) ? 1'b1: // FF40-FF5F with MPI switch = 4
|
||||||
assign SDC_EN_CS = ({MPI_SCS, ADDRESS[15:4]} == 14'b01111111110100) ? 1'b1: // FF40-FF4F with MPI switch = 2
|
1'b0;
|
||||||
1'b0;
|
|
||||||
assign RS232_EN = (ADDRESS[15:2] == 14'b11111111011010) ? 1'b1: //FF68-FF6B
|
assign SDC_EN_CS = (({MPI_SCS, ADDRESS[15:5]} == 13'b0111111111010) |
|
||||||
1'b0;
|
((ADDRESS[15:5] == 11'b11111111010) & ext_response)) ? 1'b1: // FF40-FF5F with MPI switch = 2
|
||||||
assign SLOT3_HW = ({MPI_SCS, ADDRESS[15:5]} == 13'b1011111111010) ? 1'b1: // FF40-FF5F
|
1'b0;
|
||||||
1'b0;
|
`else
|
||||||
assign VDAC_EN = ({RW_N,ADDRESS[15:0]} == 17'H0FF7E) ? 1'b1: // FF7E
|
assign HDD_EN = ({MPI_SCS, ADDRESS[15:5]} == 13'b1111111111010) ? 1'b1: // FF40-FF5F with MPI switch = 4
|
||||||
1'b0;
|
1'b0;
|
||||||
|
assign SDC_EN_CS = ({MPI_SCS, ADDRESS[15:5]} == 13'b0111111111010) ? 1'b1: // FF40-FF5F with MPI switch = 2
|
||||||
|
1'b0;
|
||||||
|
`endif
|
||||||
|
|
||||||
|
assign RS232_EN = ({MPI_SCS, ADDRESS[15:2]} == 16'b0011111111011010) ? 1'b1: //FF68-FF6B - Now in slot 1
|
||||||
|
1'b0;
|
||||||
|
|
||||||
|
assign SLOT3_HW = ({SWITCH[2:1], ADDRESS[15:5]} == 13'b1011111111010) ? 1'b1: // FF40-FF5F Ensure this only appears in slot 3 PHYSICALLY
|
||||||
|
1'b0;
|
||||||
|
|
||||||
|
assign VDAC_EN = ({RW_N,ADDRESS[15:0]} == 17'H0FF7E) ? 1'b1: // FF7E
|
||||||
|
1'b0;
|
||||||
|
/*
|
||||||
|
$FF40 - This is the bank latch. The same latch that is used by the Super Program Paks to bank 16K of the Pak ROM
|
||||||
|
at a time. This latch is set to $00 on reset or power up (same as the super program paks).
|
||||||
|
*/
|
||||||
|
|
||||||
always @(negedge clk_sys or negedge RESET_N)
|
always @(negedge clk_sys or negedge RESET_N)
|
||||||
begin
|
begin
|
||||||
@@ -872,55 +887,18 @@ begin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
/*
|
|
||||||
$FF40 - This is the bank latch. The same latch that is used by the Super Program Paks to bank 16K of the Pak ROM
|
|
||||||
at a time. The initial design simply used 32K banks - this would allow the Super Program Paks to function, but
|
|
||||||
wastes 16K per Bank. This was done so the banks could house any of the 32K CoCo 3 Program PAKs as well. This latch
|
|
||||||
is set to $00 on reset or power up (same as the super program paks).
|
|
||||||
|
|
||||||
$FF41 - the CTS* WRITE data latch. This was incorporated because the CTS* line is read only. I could have just
|
|
||||||
derived a new CTS* that is active on both reads and writes, however, some PAKs utilize a copy protection scheme
|
|
||||||
whereas they write to the PAK area. As long as the PAK was in ROM, nothing happened, but if trying to run from a
|
|
||||||
R/W* RAMPAK, or from disk (wheras the CoCo is placed in the allram mode and the PAK transferred there and executed),
|
|
||||||
then the PAK code would be corrupted and a crash would occur. This behavior could be patched out of the PAK but I
|
|
||||||
wanted to be able to execute the PAK code verbatim. Thus this latch at $FF41. A byte of data is written to $FF41.
|
|
||||||
It is latched and a flip-flop is triggered (this flip-flop starts up un-triggered - either at power on or reset).
|
|
||||||
Once the flip-flop is triggered, it indicates a valid byte has been stored at $FF41 and then any READ of the CTS*
|
|
||||||
area will WRITE the byte from $FF41 into the SRAM at the memory location that was READ, the flip-flop is also
|
|
||||||
reset by this action. This allows writing to the CTS* area while still providing the Read Only protection offered
|
|
||||||
by the CTS* signal.
|
|
||||||
$FF42 - BANK 0 latch - this was incorporated because Aaron wanted to be able to start up with his operating code in
|
|
||||||
bank $00, however, the super program PAKs must start at bank $00. So, whatever is written into this latch will
|
|
||||||
be the bank that is accessed as BANK 0. This is reset to $00 only at power on (Not reset). So, whatever is written
|
|
||||||
here will be the bank accessed as bank 00 from that point forward, until it is changed again. Reset will not change it.
|
|
||||||
$FF43 - Bank Size latch. Only two bits used.:
|
|
||||||
Bit 0 = 0 = 32K BANK SIZE, =1=16K Banks Size
|
|
||||||
Bit 1 = 0 = Use lower 16K of each 32K bank
|
|
||||||
Bit 1 = 1 = Use upper 16K of each 32K bank
|
|
||||||
Bit 1 is only effective if bank size is set to 16K by bit 0. This register is set to $00 at power on or reset,
|
|
||||||
and was added to reduce wasted memory. Under proper program control this allows two 16K or less program paks to
|
|
||||||
exist in each 32K bank.
|
|
||||||
|
|
||||||
$FF44-$FF4A = bank 1 through bank 7 latches. The largest super program pak that I am aware of was RoboCop,
|
|
||||||
consuming 8 banks of 16K for 128K total. These work just like the latch at $FF42 EXCEPT they affect banks 1-7.
|
|
||||||
They are also set to $01-$07 (respectively) on power up (but not reset). This allows a Super Program Pak to reside
|
|
||||||
in any banks in any order, by simply writing the proper data into these latches.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// If W_PROT[1] = 1 then ROM_RW is 0, else ROM_RW = !RW_N
|
|
||||||
|
|
||||||
|
|
||||||
`ifdef Config_Debug
|
`ifdef Config_Debug
|
||||||
wire Config_FLAG = `Config_Debug_FLAG;
|
wire[7:0] Config_FLAG = `Config_Debug_FLAG;
|
||||||
wire Config_Debug_Value = `Config_Debug_Value;
|
wire[7:0] Config_Debug_Value = `Config_Debug_Value;
|
||||||
`endif
|
`endif
|
||||||
|
|
||||||
assign DATA_IN =
|
assign DATA_IN =
|
||||||
(sdram_BE_0) ? hold_data_L[7:0]:
|
(sdram_BE_0) ? hold_data_L[7:0]:
|
||||||
(sdram_BE_1) ? hold_data_L[15:8]:
|
(sdram_BE_1) ? hold_data_L[15:8]:
|
||||||
FLASH_CE_S ? FLASH_DATA:
|
FLASH_CE_S ? FLASH_DATA:
|
||||||
|
SDC_EN_CS ? DATA_SDC: // needs priority due to nitros9 llcocosdc ddriver bug
|
||||||
HDD_EN ? DATA_HDD:
|
HDD_EN ? DATA_HDD:
|
||||||
SDC_EN_CS ? DATA_SDC:
|
|
||||||
RS232_EN ? DATA_RS232:
|
RS232_EN ? DATA_RS232:
|
||||||
SLOT3_HW ? {5'b00000, ROM_BANK}:
|
SLOT3_HW ? {5'b00000, ROM_BANK}:
|
||||||
// FF00, FF04, FF08, FF0C
|
// FF00, FF04, FF08, FF0C
|
||||||
@@ -1171,8 +1149,11 @@ wire cache_hit /* synthesis preserve */;
|
|||||||
assign cache_hit = (sdram_cpu_addr[24:1] == sdram_cpu_addr_L[24:1]);
|
assign cache_hit = (sdram_cpu_addr[24:1] == sdram_cpu_addr_L[24:1]);
|
||||||
//assign cache_hit = 1'b0;
|
//assign cache_hit = 1'b0;
|
||||||
|
|
||||||
//BANKS
|
// Master timing loop
|
||||||
// CPU clock / SRAM Signals for old SRAM
|
|
||||||
|
// This sig is only used for the cycle accurate 09
|
||||||
|
reg cpu_cycle_ena;
|
||||||
|
|
||||||
always @(negedge clk_sys or negedge RESET_N)
|
always @(negedge clk_sys or negedge RESET_N)
|
||||||
begin
|
begin
|
||||||
if(!RESET_N)
|
if(!RESET_N)
|
||||||
@@ -1195,12 +1176,14 @@ begin
|
|||||||
GART_WR <= 1'b0;
|
GART_WR <= 1'b0;
|
||||||
GART_RD <= 1'b0;
|
GART_RD <= 1'b0;
|
||||||
AMW_WR <= 1'b0;
|
AMW_WR <= 1'b0;
|
||||||
|
cpu_cycle_ena <= 1'b0;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
clear_data_ready <= 1'b0;
|
clear_data_ready <= 1'b0;
|
||||||
sdram_BE_0 <= 1'b0;
|
sdram_BE_0 <= 1'b0;
|
||||||
sdram_BE_1 <= 1'b0;
|
sdram_BE_1 <= 1'b0;
|
||||||
|
cpu_cycle_ena <= 1'b0; // This is only a single clock per cpu cycle
|
||||||
|
|
||||||
// If we are in hold were done @ data_ready.
|
// If we are in hold were done @ data_ready.
|
||||||
if (hold)
|
if (hold)
|
||||||
@@ -1210,6 +1193,7 @@ begin
|
|||||||
// Hold states are done - kill hold and set end hold to drive data
|
// Hold states are done - kill hold and set end hold to drive data
|
||||||
hold <= 1'b0;
|
hold <= 1'b0;
|
||||||
end_hold <= 1'b1;
|
end_hold <= 1'b1;
|
||||||
|
cpu_cycle_ena <= 1'b1; // Cycle at the end of a memory transaction
|
||||||
clear_data_ready <= 1'b1;
|
clear_data_ready <= 1'b1;
|
||||||
hold_data_L <= hold_data;
|
hold_data_L <= hold_data;
|
||||||
sdram_BE_0 <= RAM0_BE0_L;
|
sdram_BE_0 <= RAM0_BE0_L;
|
||||||
@@ -1244,10 +1228,14 @@ begin
|
|||||||
begin
|
begin
|
||||||
cpu_ena <= 1'b1;
|
cpu_ena <= 1'b1;
|
||||||
|
|
||||||
|
cpu_cycle_ena <= 1'b1; // Default cycle
|
||||||
|
|
||||||
if (AMW_EN) // Automated Memory Write ?
|
if (AMW_EN) // Automated Memory Write ?
|
||||||
begin
|
begin
|
||||||
AMW_WR <= 1'b1;
|
AMW_WR <= 1'b1;
|
||||||
cpu_ena <= 1'b0; // Kill cpu enable
|
cpu_ena <= 1'b0; // Kill cpu enable
|
||||||
|
cpu_cycle_ena <= 1'b0; // Kill (defer) cycle based on memory transaction
|
||||||
|
|
||||||
|
|
||||||
// Start AMW cycle
|
// Start AMW cycle
|
||||||
RAM0_BE0_L <= !AMW_Adrs[0];
|
RAM0_BE0_L <= !AMW_Adrs[0];
|
||||||
@@ -1260,6 +1248,9 @@ begin
|
|||||||
else if (VMA & RAM_CS) // FFE8 / FFE9 is now in RAM_CS
|
else if (VMA & RAM_CS) // FFE8 / FFE9 is now in RAM_CS
|
||||||
begin
|
begin
|
||||||
// sdram memory cycle
|
// sdram memory cycle
|
||||||
|
`ifdef CoCo3_disable_GART_in_GIMEX
|
||||||
|
if (0);
|
||||||
|
`else
|
||||||
if ((ADDRESS[15:0] == 16'hFFE8) | (ADDRESS[15:0] == 16'hFFE9)) // GART
|
if ((ADDRESS[15:0] == 16'hFFE8) | (ADDRESS[15:0] == 16'hFFE9)) // GART
|
||||||
begin
|
begin
|
||||||
if (~RW_N)
|
if (~RW_N)
|
||||||
@@ -1275,11 +1266,14 @@ begin
|
|||||||
GART_RD <= 1'b1;
|
GART_RD <= 1'b1;
|
||||||
end
|
end
|
||||||
hold <= 1'b1;
|
hold <= 1'b1;
|
||||||
|
cpu_cycle_ena <= 1'b0; // Kill (defer) cycle based on memory transaction
|
||||||
sdram_cpu_req <= 1'b1;
|
sdram_cpu_req <= 1'b1;
|
||||||
sdram_cpu_rnw <= RW_N;
|
sdram_cpu_rnw <= RW_N;
|
||||||
last_write <= 1'b1; // Kill cache hit on any access after GART
|
last_write <= 1'b1; // Kill cache hit on any access after GART
|
||||||
end
|
end
|
||||||
|
`endif
|
||||||
else // Normal CPU cycle
|
else // Normal CPU cycle
|
||||||
|
begin
|
||||||
// get which byte
|
// get which byte
|
||||||
RAM0_BE0_L <= !ADDRESS[0];
|
RAM0_BE0_L <= !ADDRESS[0];
|
||||||
RAM0_BE1_L <= ADDRESS[0];
|
RAM0_BE1_L <= ADDRESS[0];
|
||||||
@@ -1289,11 +1283,13 @@ begin
|
|||||||
end_hold <= 1'b1; // If so then end the cpu_ena cycle with the updated byte enable
|
end_hold <= 1'b1; // If so then end the cpu_ena cycle with the updated byte enable
|
||||||
sdram_BE_0 <= !ADDRESS[0];
|
sdram_BE_0 <= !ADDRESS[0];
|
||||||
sdram_BE_1 <= ADDRESS[0];
|
sdram_BE_1 <= ADDRESS[0];
|
||||||
|
// Allow cpu_cycke_ena previously set based upon cache tansaction
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
sdram_cpu_addr_L <= sdram_cpu_addr; // Else set hold and start a sdram cycle
|
sdram_cpu_addr_L <= sdram_cpu_addr; // Else set hold and start a sdram cycle
|
||||||
hold <= 1'b1;
|
hold <= 1'b1;
|
||||||
|
cpu_cycle_ena <= 1'b0; // Kill (defer) cycle based on memory transaction
|
||||||
sdram_cpu_req <= 1'b1;
|
sdram_cpu_req <= 1'b1;
|
||||||
sdram_cpu_rnw <= RW_N;
|
sdram_cpu_rnw <= RW_N;
|
||||||
last_write <= ~RW_N;
|
last_write <= ~RW_N;
|
||||||
@@ -1301,7 +1297,7 @@ begin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
6'h01:
|
6'h01:
|
||||||
begin
|
begin
|
||||||
PH_2_RAW <= 1'b0;
|
PH_2_RAW <= 1'b0;
|
||||||
@@ -1358,15 +1354,12 @@ begin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
assign PH_2 = PH_2_RAW;
|
|
||||||
|
|
||||||
|
|
||||||
assign RESET_P = !BUTTON_N[3] // Button
|
assign RESET_P = !BUTTON_N[3] // Button
|
||||||
| RESET; // CTRL-ALT-DEL or CTRL-ALT-INS
|
| RESET; // CTRL-ALT-DEL or CTRL-ALT-INS
|
||||||
|
|
||||||
// Make sure all resets are enabled for a long enough time to allow voltages to settle
|
// Make sure all resets are enabled for a long enough time to allow voltages to settle
|
||||||
|
|
||||||
|
|
||||||
always @ (posedge clk_sys)
|
always @ (posedge clk_sys)
|
||||||
begin
|
begin
|
||||||
if (RESET)
|
if (RESET)
|
||||||
@@ -1403,6 +1396,55 @@ begin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// CPU Selection
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
`ifdef CoCo3_CYC_ACC_6809
|
||||||
|
|
||||||
|
// Create VMA out of AVMA
|
||||||
|
wire AVMA;
|
||||||
|
|
||||||
|
always @(negedge clk_sys or negedge RESET_N)
|
||||||
|
begin
|
||||||
|
if(!RESET_N)
|
||||||
|
begin
|
||||||
|
VMA <= 1'b0;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if (cpu_cycle_ena)
|
||||||
|
begin
|
||||||
|
VMA <= AVMA;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
// Cycle Accurate CPU section copyrighted by Greg Miller
|
||||||
|
|
||||||
|
mc6809x GLBCPU09(
|
||||||
|
.D(DATA_IN),
|
||||||
|
.DOut(DATA_OUT),
|
||||||
|
.ADDR(ADDRESS),
|
||||||
|
.RnW(RW_N),
|
||||||
|
.MASTER(clk_sys),
|
||||||
|
.E(cpu_cycle_ena),
|
||||||
|
.Q(cpu_cycle_ena),
|
||||||
|
.nIRQ(CPU_IRQ_N),
|
||||||
|
.nFIRQ(CPU_FIRQ_N),
|
||||||
|
.nNMI(!NMI_09),
|
||||||
|
.AVMA(AVMA),
|
||||||
|
.nHALT(~HALT),
|
||||||
|
.nRESET(~CPU_RESET),
|
||||||
|
.nDMABREQ(1'b1)
|
||||||
|
);
|
||||||
|
|
||||||
|
assign PH_2 = cpu_cycle_ena;
|
||||||
|
|
||||||
|
`else
|
||||||
|
|
||||||
// CPU section copyrighted by John Kent
|
// CPU section copyrighted by John Kent
|
||||||
cpu09 GLBCPU09(
|
cpu09 GLBCPU09(
|
||||||
.clk(clk_sys),
|
.clk(clk_sys),
|
||||||
@@ -1420,6 +1462,10 @@ cpu09 GLBCPU09(
|
|||||||
.nmi(NMI_09)
|
.nmi(NMI_09)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
assign PH_2 = PH_2_RAW;
|
||||||
|
|
||||||
|
`endif
|
||||||
|
|
||||||
wire [8:0] BUFF_ADD_W;
|
wire [8:0] BUFF_ADD_W;
|
||||||
wire [8:0] BUFF_ADD;
|
wire [8:0] BUFF_ADD;
|
||||||
wire [15:0] BUFF_DATA_O;
|
wire [15:0] BUFF_DATA_O;
|
||||||
@@ -1474,6 +1520,7 @@ wire HALT_sdc, HALT_fdc;
|
|||||||
wire NMI_09_sdc, NMI_09_fdc;
|
wire NMI_09_sdc, NMI_09_fdc;
|
||||||
|
|
||||||
wire SDC_REG_W_ENA, SDC_REG_READ;
|
wire SDC_REG_W_ENA, SDC_REG_READ;
|
||||||
|
wire ext_response;
|
||||||
|
|
||||||
assign FF40_ENA = ({PH_2, RW_N, HDD_EN, ADDRESS[3:0]} == 7'B1010000) ? 1'b1:
|
assign FF40_ENA = ({PH_2, RW_N, HDD_EN, ADDRESS[3:0]} == 7'B1010000) ? 1'b1:
|
||||||
1'b0;
|
1'b0;
|
||||||
@@ -1565,6 +1612,10 @@ sdc_top coco_sdc_top(
|
|||||||
.SDC_REG_W_ENA(SDC_REG_W_ENA),
|
.SDC_REG_W_ENA(SDC_REG_W_ENA),
|
||||||
.SDC_REG_READ(SDC_REG_READ),
|
.SDC_REG_READ(SDC_REG_READ),
|
||||||
|
|
||||||
|
.ext_response(ext_response),
|
||||||
|
|
||||||
|
.SZ(GPIO),
|
||||||
|
|
||||||
// SD block level interface
|
// SD block level interface
|
||||||
.img_mounted(img_mounted[5:4]), // signaling that new image has been mounted
|
.img_mounted(img_mounted[5:4]), // signaling that new image has been mounted
|
||||||
.img_readonly(img_readonly), // mounted as read only. valid only for active bit in img_mounted
|
.img_readonly(img_readonly), // mounted as read only. valid only for active bit in img_mounted
|
||||||
@@ -1616,7 +1667,7 @@ end
|
|||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
// Interrupt Sources
|
// Interrupt Sources
|
||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
// Interrupt source for CART signal
|
// Org FPGA code
|
||||||
always @(negedge clk_sys or negedge RESET_N)
|
always @(negedge clk_sys or negedge RESET_N)
|
||||||
begin
|
begin
|
||||||
if(!RESET_N)
|
if(!RESET_N)
|
||||||
@@ -1630,26 +1681,21 @@ begin
|
|||||||
2'b00:
|
2'b00:
|
||||||
CART_INT_IN_N <= (!CART_INT_IN_N )
|
CART_INT_IN_N <= (!CART_INT_IN_N )
|
||||||
&(SER_IRQ);
|
&(SER_IRQ);
|
||||||
// CART_INT_IN_N <= (!CART_INT_IN_N | SWITCH[4])
|
|
||||||
// &(SER_IRQ);
|
|
||||||
2'b01:
|
2'b01:
|
||||||
CART_INT_IN_N <= (SER_IRQ);
|
CART_INT_IN_N <= (SER_IRQ);
|
||||||
2'b10:
|
2'b10:
|
||||||
CART_INT_IN_N <= (!CART_INT_IN_N | cart_firq_enable)
|
CART_INT_IN_N <= (!CART_INT_IN_N | cart_firq_enable)
|
||||||
&(SER_IRQ);
|
&(SER_IRQ);
|
||||||
// CART_INT_IN_N <= (!CART_INT_IN_N | SWITCH[4])
|
|
||||||
// &(SER_IRQ);
|
|
||||||
2'b11:
|
2'b11:
|
||||||
CART_INT_IN_N <= (SER_IRQ);
|
CART_INT_IN_N <= (SER_IRQ);
|
||||||
endcase
|
endcase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
//assign HSYNC_INT_N = (H_SYNC_N | !H_FLAG);
|
assign CART_INT_N = CART_INT_IN_N;
|
||||||
|
|
||||||
`ifdef CoCo3_Horz_INT_FIX
|
`ifdef CoCo3_Horz_INT_FIX
|
||||||
wire HBORDER_INT;
|
wire HBORDER_INT;
|
||||||
assign HSYNC_INT_N = HBORDER_INT;
|
assign HSYNC_INT_N = !HBORDER_INT;
|
||||||
`else
|
`else
|
||||||
assign HSYNC_INT_N = H_SYNC_N;
|
assign HSYNC_INT_N = H_SYNC_N;
|
||||||
`endif
|
`endif
|
||||||
@@ -1661,47 +1707,22 @@ end
|
|||||||
assign VSYNC_INT_N = V_SYNC_N;
|
assign VSYNC_INT_N = V_SYNC_N;
|
||||||
`endif
|
`endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
assign CART_INT_N = CART_INT_IN_N;
|
|
||||||
assign KEY_INT_N = (KEYBOARD_IN == 8'hFF);
|
assign KEY_INT_N = (KEYBOARD_IN == 8'hFF);
|
||||||
|
|
||||||
|
|
||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
// Interrupt Latch RESETs
|
// Interrupt Latch RESETs
|
||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
|
|
||||||
reg RST_FF93T_N;
|
|
||||||
reg RST_FF93H_N;
|
|
||||||
reg RST_FF93V_N;
|
|
||||||
reg RST_FF93C_N;
|
|
||||||
reg RST_FF93K_N;
|
|
||||||
reg RST_FF92V_N;
|
|
||||||
reg RST_FF92H_N;
|
|
||||||
reg RST_FF92C_N;
|
|
||||||
reg RST_FF92K_N;
|
|
||||||
reg RST_FF92T_N;
|
|
||||||
|
|
||||||
always @(negedge clk_sys or negedge RESET_N)
|
always @(negedge clk_sys or negedge RESET_N)
|
||||||
begin
|
begin
|
||||||
if(!RESET_N)
|
if(!RESET_N)
|
||||||
begin
|
begin
|
||||||
RST_FF00_N <= 1'b1;
|
RST_FF00_N <= 1'b1;
|
||||||
RST_FF02_N <= 1'b1;
|
RST_FF02_N <= 1'b1;
|
||||||
|
// RST_FF20_N <= 1'b1;
|
||||||
RST_FF22_N <= 1'b1;
|
RST_FF22_N <= 1'b1;
|
||||||
|
|
||||||
RST_FF92_N <= 1'b1;
|
RST_FF92_N <= 1'b1;
|
||||||
RST_FF92H_N <= 1'b1;
|
|
||||||
RST_FF92V_N <= 1'b1;
|
|
||||||
RST_FF92C_N <= 1'b1;
|
|
||||||
RST_FF92K_N <= 1'b1;
|
|
||||||
RST_FF92T_N <= 1'b1;
|
|
||||||
|
|
||||||
RST_FF93_N <= 1'b1;
|
RST_FF93_N <= 1'b1;
|
||||||
RST_FF93T_N <= 1'b1;
|
|
||||||
RST_FF93H_N <= 1'b1;
|
|
||||||
RST_FF93V_N <= 1'b1;
|
|
||||||
RST_FF93C_N <= 1'b1;
|
|
||||||
RST_FF93K_N <= 1'b1;
|
|
||||||
TMR_RST_N <= 1'b1;
|
TMR_RST_N <= 1'b1;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -1709,30 +1730,53 @@ begin
|
|||||||
if (PH_2)
|
if (PH_2)
|
||||||
case({RW_N,ADDRESS})
|
case({RW_N,ADDRESS})
|
||||||
17'h1FF00:
|
17'h1FF00:
|
||||||
if (!HSYNC1_CLK_N)
|
RST_FF00_N <= 1'b0;
|
||||||
RST_FF00_N <= 1'b0;
|
|
||||||
17'h1FF04:
|
17'h1FF04:
|
||||||
if (!HSYNC1_CLK_N)
|
RST_FF00_N <= 1'b0;
|
||||||
RST_FF00_N <= 1'b0;
|
|
||||||
17'h1FF08:
|
17'h1FF08:
|
||||||
if (!HSYNC1_CLK_N)
|
RST_FF00_N <= 1'b0;
|
||||||
RST_FF00_N <= 1'b0;
|
|
||||||
17'h1FF0C:
|
17'h1FF0C:
|
||||||
if (!HSYNC1_CLK_N)
|
RST_FF00_N <= 1'b0;
|
||||||
RST_FF00_N <= 1'b0;
|
17'h1FF10:
|
||||||
|
RST_FF00_N <= 1'b0;
|
||||||
|
17'h1FF14:
|
||||||
|
RST_FF00_N <= 1'b0;
|
||||||
|
17'h1FF18:
|
||||||
|
RST_FF00_N <= 1'b0;
|
||||||
|
17'h1FF1C:
|
||||||
|
RST_FF00_N <= 1'b0;
|
||||||
17'h1FF02:
|
17'h1FF02:
|
||||||
if (!VSYNC1_IRQ_N)
|
RST_FF02_N <= 1'b0;
|
||||||
RST_FF02_N <= 1'b0;
|
|
||||||
17'h1FF06:
|
17'h1FF06:
|
||||||
if (!VSYNC1_IRQ_N)
|
RST_FF02_N <= 1'b0;
|
||||||
RST_FF02_N <= 1'b0;
|
|
||||||
17'h1FF0A:
|
17'h1FF0A:
|
||||||
if (!VSYNC1_IRQ_N)
|
RST_FF02_N <= 1'b0;
|
||||||
RST_FF02_N <= 1'b0;
|
|
||||||
17'h1FF0E:
|
17'h1FF0E:
|
||||||
if (!VSYNC1_IRQ_N)
|
RST_FF02_N <= 1'b0;
|
||||||
RST_FF02_N <= 1'b0;
|
17'h1FF12:
|
||||||
|
RST_FF02_N <= 1'b0;
|
||||||
|
17'h1FF16:
|
||||||
|
RST_FF02_N <= 1'b0;
|
||||||
|
17'h1FF1A:
|
||||||
|
RST_FF02_N <= 1'b0;
|
||||||
|
17'h1FF1E:
|
||||||
|
RST_FF02_N <= 1'b0;
|
||||||
|
/* 17'h1FF20:
|
||||||
|
RST_FF20_N <= 1'b0;
|
||||||
|
17'h1FF24:
|
||||||
|
RST_FF20_N <= 1'b0;
|
||||||
|
17'h1FF28:
|
||||||
|
RST_FF20_N <= 1'b0;
|
||||||
|
17'h1FF2C:
|
||||||
|
RST_FF20_N <= 1'b0;
|
||||||
|
17'h1FF30:
|
||||||
|
RST_FF20_N <= 1'b0;
|
||||||
|
17'h1FF34:
|
||||||
|
RST_FF20_N <= 1'b0;
|
||||||
|
17'h1FF38:
|
||||||
|
RST_FF20_N <= 1'b0;
|
||||||
|
17'h1FF3C:
|
||||||
|
RST_FF20_N <= 1'b0; */
|
||||||
17'h1FF22:
|
17'h1FF22:
|
||||||
RST_FF22_N <= 1'b0;
|
RST_FF22_N <= 1'b0;
|
||||||
17'h1FF26:
|
17'h1FF26:
|
||||||
@@ -1741,7 +1785,14 @@ begin
|
|||||||
RST_FF22_N <= 1'b0;
|
RST_FF22_N <= 1'b0;
|
||||||
17'h1FF2E:
|
17'h1FF2E:
|
||||||
RST_FF22_N <= 1'b0;
|
RST_FF22_N <= 1'b0;
|
||||||
|
17'h1FF32:
|
||||||
|
RST_FF22_N <= 1'b0;
|
||||||
|
17'h1FF36:
|
||||||
|
RST_FF22_N <= 1'b0;
|
||||||
|
17'h1FF3A:
|
||||||
|
RST_FF22_N <= 1'b0;
|
||||||
|
17'h1FF3E:
|
||||||
|
RST_FF22_N <= 1'b0;
|
||||||
17'h0FF22:
|
17'h0FF22:
|
||||||
RST_FF22_N <= 1'b0;
|
RST_FF22_N <= 1'b0;
|
||||||
17'h0FF26:
|
17'h0FF26:
|
||||||
@@ -1750,36 +1801,18 @@ begin
|
|||||||
RST_FF22_N <= 1'b0;
|
RST_FF22_N <= 1'b0;
|
||||||
17'h0FF2E:
|
17'h0FF2E:
|
||||||
RST_FF22_N <= 1'b0;
|
RST_FF22_N <= 1'b0;
|
||||||
|
17'h0FF32:
|
||||||
|
RST_FF22_N <= 1'b0;
|
||||||
|
17'h0FF36:
|
||||||
|
RST_FF22_N <= 1'b0;
|
||||||
|
17'h0FF3A:
|
||||||
|
RST_FF22_N <= 1'b0;
|
||||||
|
17'h0FF3E:
|
||||||
|
RST_FF22_N <= 1'b0;
|
||||||
17'h1FF92:
|
17'h1FF92:
|
||||||
begin
|
|
||||||
RST_FF92_N <= 1'b0;
|
RST_FF92_N <= 1'b0;
|
||||||
if (!VSYNC_INT_N)
|
|
||||||
RST_FF92V_N <= 1'b0;
|
|
||||||
if (!HSYNC_INT_N)
|
|
||||||
RST_FF92H_N <= 1'b0;
|
|
||||||
if (!CART_INT_N)
|
|
||||||
RST_FF92C_N <= 1'b0;
|
|
||||||
if (!KEY_INT_N)
|
|
||||||
RST_FF92K_N <= 1'b0;
|
|
||||||
if (!TIMER_INT_N)
|
|
||||||
RST_FF92T_N <= 1'b0;
|
|
||||||
end
|
|
||||||
|
|
||||||
17'h1FF93:
|
17'h1FF93:
|
||||||
begin
|
|
||||||
RST_FF93_N <= 1'b0;
|
RST_FF93_N <= 1'b0;
|
||||||
if (!TIMER3_FIRQ_N)
|
|
||||||
RST_FF93T_N <= 1'b0;
|
|
||||||
if (!HSYNC_INT_N)
|
|
||||||
RST_FF93H_N <= 1'b0;
|
|
||||||
if (!VSYNC_INT_N)
|
|
||||||
RST_FF93V_N <= 1'b0;
|
|
||||||
if (!CART_INT_N)
|
|
||||||
RST_FF93C_N <= 1'b0;
|
|
||||||
if (!KEY_INT_N)
|
|
||||||
RST_FF93K_N <= 1'b0;
|
|
||||||
end
|
|
||||||
17'h0FF94:
|
17'h0FF94:
|
||||||
TMR_RST_N <= 1'b0;
|
TMR_RST_N <= 1'b0;
|
||||||
17'h0FF95:
|
17'h0FF95:
|
||||||
@@ -1788,19 +1821,10 @@ begin
|
|||||||
begin
|
begin
|
||||||
RST_FF00_N <= 1'b1;
|
RST_FF00_N <= 1'b1;
|
||||||
RST_FF02_N <= 1'b1;
|
RST_FF02_N <= 1'b1;
|
||||||
|
// RST_FF20_N <= 1'b1;
|
||||||
RST_FF22_N <= 1'b1;
|
RST_FF22_N <= 1'b1;
|
||||||
RST_FF92_N <= 1'b1;
|
RST_FF92_N <= 1'b1;
|
||||||
RST_FF92H_N <= 1'b1;
|
|
||||||
RST_FF92V_N <= 1'b1;
|
|
||||||
RST_FF92C_N <= 1'b1;
|
|
||||||
RST_FF92K_N <= 1'b1;
|
|
||||||
RST_FF92T_N <= 1'b1;
|
|
||||||
RST_FF93_N <= 1'b1;
|
RST_FF93_N <= 1'b1;
|
||||||
RST_FF93T_N <= 1'b1;
|
|
||||||
RST_FF93H_N <= 1'b1;
|
|
||||||
RST_FF93V_N <= 1'b1;
|
|
||||||
RST_FF93C_N <= 1'b1;
|
|
||||||
RST_FF93K_N <= 1'b1;
|
|
||||||
TMR_RST_N <= 1'b1;
|
TMR_RST_N <= 1'b1;
|
||||||
end
|
end
|
||||||
endcase
|
endcase
|
||||||
@@ -1986,9 +2010,9 @@ begin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
always @ (negedge clk_sys or negedge RST_FF93H_N)
|
always @ (negedge clk_sys or negedge RST_FF93_N)
|
||||||
begin
|
begin
|
||||||
if(!RST_FF93H_N)
|
if(!RST_FF93_N)
|
||||||
begin
|
begin
|
||||||
HSYNC3_FIRQ_STAT_N <= 1'b1; // no int
|
HSYNC3_FIRQ_STAT_N <= 1'b1; // no int
|
||||||
end
|
end
|
||||||
@@ -2026,9 +2050,9 @@ begin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
always @ (negedge clk_sys or negedge RST_FF93V_N)
|
always @ (negedge clk_sys or negedge RST_FF93_N)
|
||||||
begin
|
begin
|
||||||
if(!RST_FF93V_N)
|
if(!RST_FF93_N)
|
||||||
begin
|
begin
|
||||||
VSYNC3_FIRQ_STAT_N <= 1'b1; // no int
|
VSYNC3_FIRQ_STAT_N <= 1'b1; // no int
|
||||||
end
|
end
|
||||||
@@ -2066,9 +2090,9 @@ begin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
always @ (negedge clk_sys or negedge RST_FF93C_N)
|
always @ (negedge clk_sys or negedge RST_FF93_N)
|
||||||
begin
|
begin
|
||||||
if(!RST_FF93C_N)
|
if(!RST_FF93_N)
|
||||||
begin
|
begin
|
||||||
CART3_FIRQ_STAT_N <= 1'b1; // no int
|
CART3_FIRQ_STAT_N <= 1'b1; // no int
|
||||||
end
|
end
|
||||||
@@ -2106,9 +2130,9 @@ begin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
always @ (negedge clk_sys or negedge RST_FF93K_N)
|
always @ (negedge clk_sys or negedge RST_FF93_N)
|
||||||
begin
|
begin
|
||||||
if(!RST_FF93K_N)
|
if(!RST_FF93_N)
|
||||||
begin
|
begin
|
||||||
KEY3_FIRQ_STAT_N <= 1'b1; // no int
|
KEY3_FIRQ_STAT_N <= 1'b1; // no int
|
||||||
end
|
end
|
||||||
@@ -2146,9 +2170,9 @@ begin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
always @ (negedge clk_sys or negedge RST_FF93T_N)
|
always @ (negedge clk_sys or negedge RST_FF93_N)
|
||||||
begin
|
begin
|
||||||
if(!RST_FF93T_N)
|
if(!RST_FF93_N)
|
||||||
begin
|
begin
|
||||||
TIMER3_FIRQ_STAT_N <= 1'b1; // no int
|
TIMER3_FIRQ_STAT_N <= 1'b1; // no int
|
||||||
end
|
end
|
||||||
@@ -2187,9 +2211,9 @@ begin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
always @ (negedge clk_sys or negedge RST_FF92H_N)
|
always @ (negedge clk_sys or negedge RST_FF92_N)
|
||||||
begin
|
begin
|
||||||
if(!RST_FF92H_N)
|
if(!RST_FF92_N)
|
||||||
begin
|
begin
|
||||||
HSYNC3_IRQ_STAT_N <= 1'b1; // no int
|
HSYNC3_IRQ_STAT_N <= 1'b1; // no int
|
||||||
end
|
end
|
||||||
@@ -2225,9 +2249,9 @@ begin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
always @ (negedge clk_sys or negedge RST_FF92V_N)
|
always @ (negedge clk_sys or negedge RST_FF92_N)
|
||||||
begin
|
begin
|
||||||
if(!RST_FF92V_N)
|
if(!RST_FF92_N)
|
||||||
begin
|
begin
|
||||||
VSYNC3_IRQ_STAT_N <= 1'b1; // no int
|
VSYNC3_IRQ_STAT_N <= 1'b1; // no int
|
||||||
end
|
end
|
||||||
@@ -2339,9 +2363,9 @@ begin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
always @ (negedge clk_sys or negedge RST_FF92T_N)
|
always @ (negedge clk_sys or negedge RST_FF92_N)
|
||||||
begin
|
begin
|
||||||
if(!RST_FF92T_N)
|
if(!RST_FF92_N)
|
||||||
begin
|
begin
|
||||||
TIMER3_IRQ_STAT_N <= 1'b1; // no int
|
TIMER3_IRQ_STAT_N <= 1'b1; // no int
|
||||||
end
|
end
|
||||||
@@ -2352,6 +2376,7 @@ begin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
assign CPU_IRQ_N = ( GIME_IRQ | (HSYNC1_IRQ_N & VSYNC1_IRQ_N))
|
assign CPU_IRQ_N = ( GIME_IRQ | (HSYNC1_IRQ_N & VSYNC1_IRQ_N))
|
||||||
& (!GIME_IRQ | (TIMER3_IRQ_N & HSYNC3_IRQ_N & VSYNC3_IRQ_N & KEY3_IRQ_N & CART3_IRQ_N));
|
& (!GIME_IRQ | (TIMER3_IRQ_N & HSYNC3_IRQ_N & VSYNC3_IRQ_N & KEY3_IRQ_N & CART3_IRQ_N));
|
||||||
assign CPU_FIRQ_N = ( GIME_FIRQ | (CART1_FIRQ_N))
|
assign CPU_FIRQ_N = ( GIME_FIRQ | (CART1_FIRQ_N))
|
||||||
@@ -2440,6 +2465,8 @@ begin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
reg sync_rst1;
|
reg sync_rst1;
|
||||||
|
|
||||||
// Most of the latches for settings
|
// Most of the latches for settings
|
||||||
@@ -2500,7 +2527,7 @@ begin
|
|||||||
// MPI_CTS <= SWITCH[2:1];
|
// MPI_CTS <= SWITCH[2:1];
|
||||||
// FF8E-FF8F
|
// FF8E-FF8F
|
||||||
GPIO_DIR <= 8'h00;
|
GPIO_DIR <= 8'h00;
|
||||||
GPIO_OUT <= 8'h00;
|
// GPIO_OUT <= 8'h00;
|
||||||
// FF90
|
// FF90
|
||||||
ROM <= 2'b00;
|
ROM <= 2'b00;
|
||||||
ST_SCS <= 1'b0;
|
ST_SCS <= 1'b0;
|
||||||
@@ -3484,28 +3511,28 @@ begin
|
|||||||
dac_joya2[7:0] <= 8'd128;
|
dac_joya2[7:0] <= 8'd128;
|
||||||
|
|
||||||
if (joy1[0]) // right
|
if (joy1[0]) // right
|
||||||
dac_joya1[15:8] <= 8'd240;
|
dac_joya1[15:8] <= 8'd255;
|
||||||
|
|
||||||
if (joy1[1]) // left
|
if (joy1[1]) // left
|
||||||
dac_joya1[15:8] <= 8'd16;
|
dac_joya1[15:8] <= 8'd0;
|
||||||
|
|
||||||
if (joy1[2]) // down
|
if (joy1[2]) // down
|
||||||
dac_joya1[7:0] <= 8'd240;
|
dac_joya1[7:0] <= 8'd255;
|
||||||
|
|
||||||
if (joy1[3]) // up
|
if (joy1[3]) // up
|
||||||
dac_joya1[7:0] <= 8'd16;
|
dac_joya1[7:0] <= 8'd0;
|
||||||
|
|
||||||
if (joy2[0]) // right
|
if (joy2[0]) // right
|
||||||
dac_joya2[15:8] <= 8'd240;
|
dac_joya2[15:8] <= 8'd255;
|
||||||
|
|
||||||
if (joy2[1]) // left
|
if (joy2[1]) // left
|
||||||
dac_joya2[15:8] <= 8'd16;
|
dac_joya2[15:8] <= 8'd0;
|
||||||
|
|
||||||
if (joy2[2]) // down
|
if (joy2[2]) // down
|
||||||
dac_joya2[7:0] <= 8'd240;
|
dac_joya2[7:0] <= 8'd255;
|
||||||
|
|
||||||
if (joy2[3]) // upimg_mounted
|
if (joy2[3]) // upimg_mounted
|
||||||
dac_joya2[7:0] <= 8'd16;
|
dac_joya2[7:0] <= 8'd0;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
|||||||
+21
-54
@@ -9,6 +9,16 @@
|
|||||||
// CPU section copyrighted by John Kent
|
// CPU section copyrighted by John Kent
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Project Name: CoCo3FPGA Version 5.x.x
|
||||||
|
// File Name: config.v
|
||||||
|
//
|
||||||
|
// CoCo3 in an FPGA
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// CPU section copyrighted by John Kent
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Color Computer 3 compatible system on a chip
|
// Color Computer 3 compatible system on a chip
|
||||||
//
|
//
|
||||||
@@ -61,65 +71,22 @@
|
|||||||
// This file is a configuration definition file. The CoCo3FPGA for MiSTer source files
|
// This file is a configuration definition file. The CoCo3FPGA for MiSTer source files
|
||||||
// can be built into multiple objects which have mutually exclusive features.
|
// can be built into multiple objects which have mutually exclusive features.
|
||||||
|
|
||||||
// The debug value holds upto 8 feature settings [1 per bit] - when Config_Debug is set this appears at FFF1
|
`include "..\RTL\config_inc.v"
|
||||||
|
|
||||||
|
// 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
|
`define Config_Debug
|
||||||
`define Config_Debug_Value (`config_value_1 + `config_value_2 + `config_value_3 + `config_value_4 + `config_value_5 + `config_value_6 + `config_value_7 + `config_value_8)
|
|
||||||
`define Config_Debug_FLAG 8'h55
|
// Feature list - note only FEATURE_1 - FEATURE_8 are supported
|
||||||
// Feature list - note the support area below needs editing for debug support...
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
`define CoCo3_Horz_INT_FIX 8'h01 // Connection of the horz int to the Mister CoCo3 V5 rasterizer
|
`set_feature(CoCo3_Horz_INT_FIX, FEATURE_1) // Connection of the horz int to the Mister CoCo3 V5 rasterizer
|
||||||
|
|
||||||
`define CoCo3_Vert_INT_FIX 8'h02 // Connection of the vert int to the Mister CoCo3 V5 rasterizer
|
//`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, FEATURE_3) // Use cycle accurate 6809
|
||||||
|
|
||||||
|
`set_feature(CoCo3_sdc_override_size, FEATURE_4) // Define static size value
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
`set_feature(CoCo3_sdc_fix_os9_driver, FEATURE_5) // fix sdc query disk size issue in llcocosdc driver in multipak enviroment
|
||||||
// This is support info to create the Config_Debug_Value referenced above
|
|
||||||
`ifdef CoCo3_Horz_INT_FIX
|
|
||||||
`define config_value_1 `CoCo3_Horz_INT_FIX
|
|
||||||
`else
|
|
||||||
`define config_value_1 8'h00
|
|
||||||
`endif
|
|
||||||
|
|
||||||
`ifdef CoCo3_Vert_INT_FIX
|
`set_feature(CoCo3_disable_GART_in_GIMEX, FEATURE_6)// Disable GIMEX ram transfers [GIMEX detection in OS( EOU]
|
||||||
`define config_value_2 `CoCo3_Vert_INT_FIX
|
|
||||||
`else
|
|
||||||
`define config_value_2 8'h00
|
|
||||||
`endif
|
|
||||||
|
|
||||||
`ifdef NOT_DEFINED_YET
|
|
||||||
`define config_value_3 `NOT_DEFINED_YET
|
|
||||||
`else
|
|
||||||
`define config_value_3 8'h00
|
|
||||||
`endif
|
|
||||||
|
|
||||||
`ifdef NOT_DEFINED_YET
|
|
||||||
`define config_value_4 `NOT_DEFINED_YET
|
|
||||||
`else
|
|
||||||
`define config_value_4 8'h00
|
|
||||||
`endif
|
|
||||||
|
|
||||||
`ifdef NOT_DEFINED_YET
|
|
||||||
`define config_value_5 `NOT_DEFINED_YET
|
|
||||||
`else
|
|
||||||
`define config_value_5 8'h00
|
|
||||||
`endif
|
|
||||||
|
|
||||||
`ifdef NOT_DEFINED_YET
|
|
||||||
`define config_value_6 `NOT_DEFINED_YET
|
|
||||||
`else
|
|
||||||
`define config_value_6 8'h00
|
|
||||||
`endif
|
|
||||||
|
|
||||||
`ifdef NOT_DEFINED_YET
|
|
||||||
`define config_value_7 `NOT_DEFINED_YET
|
|
||||||
`else
|
|
||||||
`define config_value_7 8'h00
|
|
||||||
`endif
|
|
||||||
|
|
||||||
`ifdef NOT_DEFINED_YET
|
|
||||||
`define config_value_8 `NOT_DEFINED_YET
|
|
||||||
`else
|
|
||||||
`define config_value_8 8'h00
|
|
||||||
`endif
|
|
||||||
|
|
||||||
@@ -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
|
||||||
File diff suppressed because it is too large.
Load diff
+37
-17
@@ -59,15 +59,20 @@ module sdc(
|
|||||||
input SDC_WR,
|
input SDC_WR,
|
||||||
input SDC_RD,
|
input SDC_RD,
|
||||||
|
|
||||||
output sdc_always,
|
|
||||||
|
|
||||||
output reg sdc_HALT,
|
output reg sdc_HALT,
|
||||||
|
|
||||||
|
output reg ext_response,
|
||||||
|
|
||||||
|
input [7:0] SZ,
|
||||||
|
|
||||||
|
output reg sdc_always,
|
||||||
|
|
||||||
|
|
||||||
// SD block level interface
|
// SD block level interface
|
||||||
|
|
||||||
input [1:0] img_mounted, // signaling that new image has been mounted
|
input [1:0] img_mounted, // signaling that new image has been mounted
|
||||||
input img_readonly, // mounted as read only. valid only for active bit in img_mounted
|
input img_readonly, // mounted as read only. valid only for active bit in img_mounted
|
||||||
input [19:0] img_size, // size of image in bytes. 1MB MAX!
|
input [63:0] img_size, // size of image in bytes. 1MB MAX!
|
||||||
|
|
||||||
output [31:0] sd_lba[2],
|
output [31:0] sd_lba[2],
|
||||||
output reg [1:0] sd_rd,
|
output reg [1:0] sd_rd,
|
||||||
@@ -87,11 +92,12 @@ reg [7:0] transfer_address;
|
|||||||
|
|
||||||
reg new_cmd, new_cmd_d, cmd_done;
|
reg new_cmd, new_cmd_d, cmd_done;
|
||||||
reg data_inc, run;
|
reg data_inc, run;
|
||||||
|
reg rxt_res_end;
|
||||||
reg transfer_clear;
|
reg transfer_clear;
|
||||||
reg [3:0] sdc_data_reg;
|
reg [3:0] sdc_data_reg;
|
||||||
|
|
||||||
wire [7:0] sdc_status_reg = {sdc_data_reg, 4'h4};
|
wire [7:0] sdc_status_reg = {sdc_data_reg, 4'h4};
|
||||||
reg [15:0] drive_size[2];
|
reg [23:0] drive_size[2];
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@@ -133,13 +139,14 @@ begin
|
|||||||
command <= 8'h00;
|
command <= 8'h00;
|
||||||
new_cmd <= 1'b0;
|
new_cmd <= 1'b0;
|
||||||
data_inc <= 1'b0;
|
data_inc <= 1'b0;
|
||||||
|
rxt_res_end <= 1'b0;
|
||||||
transfer_address <= 8'h00;
|
transfer_address <= 8'h00;
|
||||||
sdc_data_reg <= 4'h0;
|
sdc_data_reg <= 4'h0;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
data_inc <= 1'b0;
|
data_inc <= 1'b0;
|
||||||
|
rxt_res_end <= 1'b0;
|
||||||
if (cmd_done)
|
if (cmd_done)
|
||||||
new_cmd <= 1'b0;
|
new_cmd <= 1'b0;
|
||||||
|
|
||||||
@@ -188,6 +195,9 @@ begin
|
|||||||
if (CLK_EN & SDC_RD & (ADDRESS[3:1] == 3'b101) & (run)) // Read @ $ff4A / $ff4B
|
if (CLK_EN & SDC_RD & (ADDRESS[3:1] == 3'b101) & (run)) // Read @ $ff4A / $ff4B
|
||||||
data_inc <= 1'b1;
|
data_inc <= 1'b1;
|
||||||
|
|
||||||
|
if (CLK_EN & SDC_RD & (ADDRESS[3:0] == 4'b1001) & (~run)) // Read @ $ff49 [last of size data]
|
||||||
|
rxt_res_end <= 1'b1;
|
||||||
|
|
||||||
if (data_inc)
|
if (data_inc)
|
||||||
transfer_address <= transfer_address + 1'b1;
|
transfer_address <= transfer_address + 1'b1;
|
||||||
|
|
||||||
@@ -205,7 +215,6 @@ localparam CMD_EXT = 5'b11000;
|
|||||||
|
|
||||||
reg wr_cmd;
|
reg wr_cmd;
|
||||||
reg ack_d;
|
reg ack_d;
|
||||||
reg ext_response;
|
|
||||||
reg [23:0] response_reg;
|
reg [23:0] response_reg;
|
||||||
wire end_ack = ~sd_ack[l_drive] & ack_d;
|
wire end_ack = ~sd_ack[l_drive] & ack_d;
|
||||||
reg l_drive, buffer_upper;
|
reg l_drive, buffer_upper;
|
||||||
@@ -250,6 +259,9 @@ begin
|
|||||||
sdc_ready <= 1'b0;
|
sdc_ready <= 1'b0;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (rxt_res_end) // If we read ff4b then we've read the ext_response
|
||||||
|
ext_response <= 1'b0;
|
||||||
|
|
||||||
case(state)
|
case(state)
|
||||||
state_idle:
|
state_idle:
|
||||||
begin
|
begin
|
||||||
@@ -271,7 +283,10 @@ begin
|
|||||||
state <= state_ext;
|
state <= state_ext;
|
||||||
end
|
end
|
||||||
else // no valid command found
|
else // no valid command found
|
||||||
|
begin
|
||||||
|
sdc_fail <= 1'b1;
|
||||||
cmd_done <= 1'b1;
|
cmd_done <= 1'b1;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
state_read:
|
state_read:
|
||||||
begin
|
begin
|
||||||
@@ -372,15 +387,16 @@ begin
|
|||||||
sdc_busy <= 1'b1;
|
sdc_busy <= 1'b1;
|
||||||
state <= state_e1;
|
state <= state_e1;
|
||||||
end
|
end
|
||||||
// else if (LSN[23:16] == 8'H67) // This is g [Disable FDC emulation]
|
else if (LSN[23:16] == 8'H67) // This is g [Disable FDC emulation]
|
||||||
// begin
|
begin
|
||||||
// cmd_done <= 1'b1;
|
cmd_done <= 1'b1;
|
||||||
// sdc_always <= 1'b1; // Disable floppy
|
sdc_always <= 1'b1; // Disable floppy
|
||||||
// state <= state_idle;
|
state <= state_idle;
|
||||||
// end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
cmd_done <= 1'b1; // All other ext commands...
|
cmd_done <= 1'b1; // All other ext commands...
|
||||||
|
sdc_fail <= 1'b1;
|
||||||
state <= state_idle;
|
state <= state_idle;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -389,7 +405,11 @@ begin
|
|||||||
begin
|
begin
|
||||||
sdc_busy <= 1'b0;
|
sdc_busy <= 1'b0;
|
||||||
ext_response <= 1'b1;
|
ext_response <= 1'b1;
|
||||||
response_reg <= {8'h00, drive_size[l_drive]};
|
`ifdef CoCo3_sdc_override_size
|
||||||
|
response_reg <= 24'H404040; // This fixes a redirect error in OS9EOU - Value=no hardware
|
||||||
|
`else
|
||||||
|
response_reg <= drive_size[l_drive][31:8]; // This returns the correct size of the mounted drive in sectors
|
||||||
|
`endif
|
||||||
state <= state_e2;
|
state <= state_e2;
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -436,8 +456,8 @@ assign sdc_status = {sdc_fail, drive_wp[l_drive], 1'b0, ~drive_ready[l_drive], 2
|
|||||||
|
|
||||||
assign SDC_READ_DATA = (ADDRESS == ADRS_FF42) ? {sdc_data_reg, 4'h0}:
|
assign SDC_READ_DATA = (ADDRESS == ADRS_FF42) ? {sdc_data_reg, 4'h0}:
|
||||||
(ADDRESS == ADRS_FF43) ? sdc_status_reg:
|
(ADDRESS == ADRS_FF43) ? sdc_status_reg:
|
||||||
((ADDRESS == ADRS_FF48) & ~ext_response) ? sdc_status:
|
(ADDRESS == ADRS_FF48) ? sdc_status:
|
||||||
((ADDRESS == ADRS_FF48) & ext_response) ? response_reg[23:16]:
|
(ADDRESS == ADRS_FF49) ? response_reg[23:16]:
|
||||||
((ADDRESS == ADRS_FF4A) & ~ext_response) ? hd_buff_data:
|
((ADDRESS == ADRS_FF4A) & ~ext_response) ? hd_buff_data:
|
||||||
((ADDRESS == ADRS_FF4A) & ext_response) ? response_reg[15:8]:
|
((ADDRESS == ADRS_FF4A) & ext_response) ? response_reg[15:8]:
|
||||||
((ADDRESS == ADRS_FF4B) & ~ext_response) ? hd_buff_data:
|
((ADDRESS == ADRS_FF4B) & ~ext_response) ? hd_buff_data:
|
||||||
@@ -450,7 +470,7 @@ always @(negedge img_mounted[0])
|
|||||||
begin
|
begin
|
||||||
drive_wp[0] <= img_readonly;
|
drive_wp[0] <= img_readonly;
|
||||||
drive_ready[0] <= 1'b1;
|
drive_ready[0] <= 1'b1;
|
||||||
drive_size[0] <= {4'h0, img_size[19:8]}; //Size / 256
|
drive_size[0] <= img_size[31:0];
|
||||||
end
|
end
|
||||||
|
|
||||||
// SD Drive 1
|
// SD Drive 1
|
||||||
@@ -459,7 +479,7 @@ always @(negedge img_mounted[1])
|
|||||||
begin
|
begin
|
||||||
drive_wp[1] <= img_readonly;
|
drive_wp[1] <= img_readonly;
|
||||||
drive_ready[1] <= 1'b1;
|
drive_ready[1] <= 1'b1;
|
||||||
drive_size[1] <= {4'h0, img_size[19:8]}; //Size / 256
|
drive_size[1] <= img_size[31:0];
|
||||||
end
|
end
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|||||||
+12
-3
@@ -77,6 +77,10 @@ module sdc_top(
|
|||||||
input SDC_REG_W_ENA,
|
input SDC_REG_W_ENA,
|
||||||
input SDC_REG_READ,
|
input SDC_REG_READ,
|
||||||
|
|
||||||
|
output ext_response,
|
||||||
|
|
||||||
|
input [7:0] SZ,
|
||||||
|
|
||||||
// SD block level interface
|
// SD block level interface
|
||||||
|
|
||||||
input [1:0] img_mounted, // signaling that new image has been mounted
|
input [1:0] img_mounted, // signaling that new image has been mounted
|
||||||
@@ -126,14 +130,14 @@ end
|
|||||||
localparam SDC_MAGIC_CMD = 8'h43;
|
localparam SDC_MAGIC_CMD = 8'h43;
|
||||||
|
|
||||||
wire [7:0] FF40_READ_VALUE = {HALT_EN, DRIVE_SEL_EXT[3], DENSITY, WRT_PREC, MOTOR, DRIVE_SEL_EXT[2:0]};
|
wire [7:0] FF40_READ_VALUE = {HALT_EN, DRIVE_SEL_EXT[3], DENSITY, WRT_PREC, MOTOR, DRIVE_SEL_EXT[2:0]};
|
||||||
wire SDC_EN = (FF40_READ_VALUE == SDC_MAGIC_CMD);
|
wire SDC_EN = ((FF40_READ_VALUE == SDC_MAGIC_CMD) | sdc_always);
|
||||||
wire [7:0] SDC_READ_DATA;
|
wire [7:0] SDC_READ_DATA;
|
||||||
wire sdc_always;
|
wire sdc_always;
|
||||||
wire FF40_RD = ({SDC_EN_CS, ADDRESS[3:0]} == 5'h10);
|
wire FF40_RD = ({SDC_EN_CS, ADDRESS[3:0]} == 5'h10);
|
||||||
|
|
||||||
|
|
||||||
//FDC read data path. =$ff40 or wd1793(s)
|
//FDC read data path. =$ff40 or wd1793(s)
|
||||||
assign DATA_HDD = (SDC_EN | sdc_always) ? SDC_READ_DATA:
|
assign DATA_HDD = (SDC_EN | ext_response) ? SDC_READ_DATA:
|
||||||
(SDC_EN_CS & (ADDRESS[3:1] == 3'b001)) ? SDC_READ_DATA: // FF42 & FF43
|
(SDC_EN_CS & (ADDRESS[3:1] == 3'b001)) ? SDC_READ_DATA: // FF42 & FF43
|
||||||
(FF40_RD) ? FF40_READ_VALUE:
|
(FF40_RD) ? FF40_READ_VALUE:
|
||||||
(WD1793_RD) ? DATA_1793: //(1793[s])
|
(WD1793_RD) ? DATA_1793: //(1793[s])
|
||||||
@@ -173,9 +177,14 @@ sdc coco_sdc(
|
|||||||
.SDC_WR(SDC_REG_W_ENA),
|
.SDC_WR(SDC_REG_W_ENA),
|
||||||
.SDC_RD(SDC_REG_READ),
|
.SDC_RD(SDC_REG_READ),
|
||||||
|
|
||||||
|
.sdc_HALT(sdc_HALT),
|
||||||
|
|
||||||
|
.ext_response(ext_response),
|
||||||
|
|
||||||
|
.SZ(SZ),
|
||||||
|
|
||||||
.sdc_always(sdc_always), // SDC is active [output from sdc (sdc is turning off fdc)]
|
.sdc_always(sdc_always), // SDC is active [output from sdc (sdc is turning off fdc)]
|
||||||
|
|
||||||
.sdc_HALT(sdc_HALT),
|
|
||||||
|
|
||||||
// SD block level interface
|
// SD block level interface
|
||||||
|
|
||||||
|
|||||||
+28
-4
@@ -226,7 +226,7 @@ video_calc video_calc
|
|||||||
.new_vmode(new_vmode),
|
.new_vmode(new_vmode),
|
||||||
.video_rotated(video_rotated),
|
.video_rotated(video_rotated),
|
||||||
|
|
||||||
.par_num(byte_cnt[3:0]),
|
.par_num(byte_cnt[4:0]),
|
||||||
.dout(vc_dout)
|
.dout(vc_dout)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -502,7 +502,7 @@ always@(posedge clk_sys) begin : uio_block
|
|||||||
'h22: RTC[(byte_cnt-6'd1)<<4 +:16] <= io_din;
|
'h22: RTC[(byte_cnt-6'd1)<<4 +:16] <= io_din;
|
||||||
|
|
||||||
//Video res.
|
//Video res.
|
||||||
'h23: if(!byte_cnt[MAX_W:4]) io_dout <= vc_dout;
|
'h23: if(!byte_cnt[MAX_W:5]) io_dout <= vc_dout;
|
||||||
|
|
||||||
//RTC
|
//RTC
|
||||||
'h24: TIMESTAMP[(byte_cnt-6'd1)<<4 +:16] <= io_din;
|
'h24: TIMESTAMP[(byte_cnt-6'd1)<<4 +:16] <= io_din;
|
||||||
@@ -872,7 +872,7 @@ module video_calc
|
|||||||
input new_vmode,
|
input new_vmode,
|
||||||
input video_rotated,
|
input video_rotated,
|
||||||
|
|
||||||
input [3:0] par_num,
|
input [4:0] par_num,
|
||||||
output reg [15:0] dout
|
output reg [15:0] dout
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -893,6 +893,9 @@ always @(posedge clk_sys) begin
|
|||||||
13: dout <= vid_vtime_hdmi[31:16];
|
13: dout <= vid_vtime_hdmi[31:16];
|
||||||
14: dout <= vid_ccnt[15:0];
|
14: dout <= vid_ccnt[15:0];
|
||||||
15: dout <= vid_ccnt[31:16];
|
15: dout <= vid_ccnt[31:16];
|
||||||
|
16: dout <= vid_pixrep;
|
||||||
|
17: dout <= vid_de_h;
|
||||||
|
18: dout <= vid_de_v;
|
||||||
default dout <= 0;
|
default dout <= 0;
|
||||||
endcase
|
endcase
|
||||||
end
|
end
|
||||||
@@ -902,24 +905,44 @@ reg [31:0] vid_vcnt = 0;
|
|||||||
reg [31:0] vid_ccnt = 0;
|
reg [31:0] vid_ccnt = 0;
|
||||||
reg [7:0] vid_nres = 0;
|
reg [7:0] vid_nres = 0;
|
||||||
reg [1:0] vid_int = 0;
|
reg [1:0] vid_int = 0;
|
||||||
|
reg [7:0] vid_pixrep;
|
||||||
|
reg [15:0] vid_de_h;
|
||||||
|
reg [7:0] vid_de_v;
|
||||||
|
|
||||||
always @(posedge clk_vid) begin
|
always @(posedge clk_vid) begin
|
||||||
integer hcnt;
|
integer hcnt;
|
||||||
integer vcnt;
|
integer vcnt;
|
||||||
integer ccnt;
|
integer ccnt;
|
||||||
reg old_vs= 0, old_de = 0, old_vmode = 0;
|
reg [7:0] pcnt;
|
||||||
|
reg [7:0] de_v;
|
||||||
|
reg [15:0] de_h;
|
||||||
|
reg old_vs = 0, old_hs = 0, old_hs_vclk = 0, old_de = 0, old_de_vclk = 0, old_de1 = 0, old_vmode = 0;
|
||||||
reg [3:0] resto = 0;
|
reg [3:0] resto = 0;
|
||||||
reg calch = 0;
|
reg calch = 0;
|
||||||
|
|
||||||
if(calch & de) ccnt <= ccnt + 1;
|
if(calch & de) ccnt <= ccnt + 1;
|
||||||
|
pcnt <= pcnt + 1'd1;
|
||||||
|
|
||||||
|
old_hs_vclk <= hs;
|
||||||
|
de_h <= de_h + 1'd1;
|
||||||
|
if(old_hs_vclk & ~hs) de_h <= 1;
|
||||||
|
|
||||||
|
old_de_vclk <= de;
|
||||||
|
if(calch & ~old_de_vclk & de) vid_de_h <= de_h;
|
||||||
|
|
||||||
if(ce_pix) begin
|
if(ce_pix) begin
|
||||||
old_vs <= vs;
|
old_vs <= vs;
|
||||||
|
old_hs <= hs;
|
||||||
old_de <= de;
|
old_de <= de;
|
||||||
|
old_de1 <= old_de;
|
||||||
|
pcnt <= 1;
|
||||||
|
|
||||||
if(~vs & ~old_de & de) vcnt <= vcnt + 1;
|
if(~vs & ~old_de & de) vcnt <= vcnt + 1;
|
||||||
if(calch & de) hcnt <= hcnt + 1;
|
if(calch & de) hcnt <= hcnt + 1;
|
||||||
if(old_de & ~de) calch <= 0;
|
if(old_de & ~de) calch <= 0;
|
||||||
|
if(~old_de1 & old_de) vid_pixrep <= pcnt;
|
||||||
|
if(old_hs & ~hs) de_v <= de_v + 1'd1;
|
||||||
|
if(calch & ~old_de & de) vid_de_v <= de_v;
|
||||||
|
|
||||||
if(old_vs & ~vs) begin
|
if(old_vs & ~vs) begin
|
||||||
vid_int <= {vid_int[0],f1};
|
vid_int <= {vid_int[0],f1};
|
||||||
@@ -939,6 +962,7 @@ always @(posedge clk_vid) begin
|
|||||||
hcnt <= 0;
|
hcnt <= 0;
|
||||||
ccnt <= 0;
|
ccnt <= 0;
|
||||||
calch <= 1;
|
calch <= 1;
|
||||||
|
de_v <= 0;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+1776
File diff suppressed because it is too large.
Load diff
@@ -4,3 +4,4 @@ set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) p
|
|||||||
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.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_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/altera_pll_reconfig_top.v ]
|
||||||
|
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) pll_cfg_hdmi.v ]
|
||||||
@@ -2,3 +2,4 @@ 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_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_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 ]
|
||||||
+64
-41
@@ -519,17 +519,6 @@ cyclonev_hps_interface_peripheral_uart uart
|
|||||||
.txd(uart_txd)
|
.txd(uart_txd)
|
||||||
);
|
);
|
||||||
|
|
||||||
wire aspi_sck,aspi_mosi,aspi_ss,aspi_miso;
|
|
||||||
cyclonev_hps_interface_peripheral_spi_master spi
|
|
||||||
(
|
|
||||||
.sclk_out(aspi_sck),
|
|
||||||
.txd(aspi_mosi), // mosi
|
|
||||||
.rxd(aspi_miso), // miso
|
|
||||||
|
|
||||||
.ss_0_n(aspi_ss),
|
|
||||||
.ss_in_n(1)
|
|
||||||
);
|
|
||||||
|
|
||||||
wire [63:0] f2h_irq = {video_sync,HDMI_TX_VS};
|
wire [63:0] f2h_irq = {video_sync,HDMI_TX_VS};
|
||||||
cyclonev_hps_interface_interrupts interrupts
|
cyclonev_hps_interface_interrupts interrupts
|
||||||
(
|
(
|
||||||
@@ -635,11 +624,13 @@ ddr_svc ddr_svc
|
|||||||
.ram_write(ram2_write),
|
.ram_write(ram2_write),
|
||||||
.ram_bcnt(ram2_bcnt),
|
.ram_bcnt(ram2_bcnt),
|
||||||
|
|
||||||
|
`ifndef MISTER_DISABLE_ALSA
|
||||||
.ch0_addr(alsa_address),
|
.ch0_addr(alsa_address),
|
||||||
.ch0_burst(1),
|
.ch0_burst(1),
|
||||||
.ch0_data(alsa_readdata),
|
.ch0_data(alsa_readdata),
|
||||||
.ch0_req(alsa_req),
|
.ch0_req(alsa_req),
|
||||||
.ch0_ready(alsa_ready),
|
.ch0_ready(alsa_ready),
|
||||||
|
`endif
|
||||||
|
|
||||||
.ch1_addr(pal_addr),
|
.ch1_addr(pal_addr),
|
||||||
.ch1_burst(128),
|
.ch1_burst(128),
|
||||||
@@ -1023,13 +1014,11 @@ reg [5:0] adj_address;
|
|||||||
reg [31:0] adj_data;
|
reg [31:0] adj_data;
|
||||||
|
|
||||||
`ifndef MISTER_DEBUG_NOHDMI
|
`ifndef MISTER_DEBUG_NOHDMI
|
||||||
pll_cfg pll_cfg
|
pll_cfg_hdmi pll_cfg_hdmi
|
||||||
(
|
(
|
||||||
.mgmt_clk(FPGA_CLK1_50),
|
.mgmt_clk(FPGA_CLK1_50),
|
||||||
.mgmt_reset(reset_req),
|
.mgmt_reset(reset_req),
|
||||||
.mgmt_waitrequest(cfg_waitrequest),
|
.mgmt_waitrequest(cfg_waitrequest),
|
||||||
.mgmt_read(0),
|
|
||||||
.mgmt_readdata(),
|
|
||||||
.mgmt_write(cfg_write),
|
.mgmt_write(cfg_write),
|
||||||
.mgmt_address(cfg_address),
|
.mgmt_address(cfg_address),
|
||||||
.mgmt_writedata(cfg_data),
|
.mgmt_writedata(cfg_data),
|
||||||
@@ -1194,11 +1183,12 @@ always @(posedge clk_vid) begin
|
|||||||
end
|
end
|
||||||
|
|
||||||
dv_de1 <= !{hss,dv_hs_osd} && vde;
|
dv_de1 <= !{hss,dv_hs_osd} && vde;
|
||||||
dv_hs1 <= csync_en ? dv_cs_osd : dv_hs_osd;
|
|
||||||
dv_vs1 <= dv_vs_osd;
|
|
||||||
end
|
end
|
||||||
|
|
||||||
dv_d1 <= dv_data_osd;
|
dv_d1 <= dv_data_osd;
|
||||||
|
dv_hs1 <= csync_en ? dv_cs_osd : dv_hs_osd;
|
||||||
|
dv_vs1 <= dv_vs_osd;
|
||||||
|
|
||||||
dv_d2 <= dv_d1;
|
dv_d2 <= dv_d1;
|
||||||
dv_de2 <= dv_de1;
|
dv_de2 <= dv_de1;
|
||||||
dv_hs2 <= dv_hs1;
|
dv_hs2 <= dv_hs1;
|
||||||
@@ -1333,6 +1323,33 @@ osd vga_osd
|
|||||||
wire vga_cs_osd;
|
wire vga_cs_osd;
|
||||||
csync csync_vga(clk_vid, vga_hs_osd, vga_vs_osd, vga_cs_osd);
|
csync csync_vga(clk_vid, vga_hs_osd, vga_vs_osd, vga_cs_osd);
|
||||||
|
|
||||||
|
`ifndef MISTER_DISABLE_YC
|
||||||
|
reg pal_en;
|
||||||
|
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_out yc_out
|
||||||
|
(
|
||||||
|
.clk(clk_vid),
|
||||||
|
.PAL_EN(pal_en),
|
||||||
|
.CVBS(cvbs),
|
||||||
|
.PHASE_INC(PhaseInc),
|
||||||
|
.COLORBURST_RANGE(ColorBurst_Range),
|
||||||
|
.hsync(vga_hs_osd),
|
||||||
|
.vsync(vga_vs_osd),
|
||||||
|
.csync(vga_cs_osd),
|
||||||
|
.dout(yc_o),
|
||||||
|
.din(vga_data_osd),
|
||||||
|
.hsync_o(yc_hs),
|
||||||
|
.vsync_o(yc_vs),
|
||||||
|
.csync_o(yc_cs)
|
||||||
|
);
|
||||||
|
`endif
|
||||||
|
|
||||||
`ifndef MISTER_DUAL_SDRAM
|
`ifndef MISTER_DUAL_SDRAM
|
||||||
wire VGA_DISABLE;
|
wire VGA_DISABLE;
|
||||||
wire [23:0] vgas_o;
|
wire [23:0] vgas_o;
|
||||||
@@ -1368,31 +1385,6 @@ csync csync_vga(clk_vid, vga_hs_osd, vga_vs_osd, vga_cs_osd);
|
|||||||
);
|
);
|
||||||
|
|
||||||
`ifndef MISTER_DISABLE_YC
|
`ifndef MISTER_DISABLE_YC
|
||||||
reg pal_en;
|
|
||||||
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_out yc_out
|
|
||||||
(
|
|
||||||
.clk(clk_vid),
|
|
||||||
.PAL_EN(pal_en),
|
|
||||||
.CVBS(cvbs),
|
|
||||||
.PHASE_INC(PhaseInc),
|
|
||||||
.COLORBURST_RANGE(ColorBurst_Range),
|
|
||||||
.hsync(vga_hs_osd),
|
|
||||||
.vsync(vga_vs_osd),
|
|
||||||
.csync(vga_cs_osd),
|
|
||||||
.dout(yc_o),
|
|
||||||
.din(vga_data_osd),
|
|
||||||
.hsync_o(yc_hs),
|
|
||||||
.vsync_o(yc_vs),
|
|
||||||
.csync_o(yc_cs)
|
|
||||||
);
|
|
||||||
|
|
||||||
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 };
|
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
|
`else
|
||||||
assign {vga_o, vga_hs, vga_vs, vga_cs } = {vga_o_t, vga_hs_t, vga_vs_t, vga_cs_t } ;
|
assign {vga_o, vga_hs, vga_vs, vga_cs } = {vga_o_t, vga_hs_t, vga_vs_t, vga_cs_t } ;
|
||||||
@@ -1477,8 +1469,10 @@ audio_out audio_out
|
|||||||
.core_l(audio_l),
|
.core_l(audio_l),
|
||||||
.core_r(audio_r),
|
.core_r(audio_r),
|
||||||
|
|
||||||
|
`ifndef MISTER_DISABLE_ALSA
|
||||||
.alsa_l(alsa_l),
|
.alsa_l(alsa_l),
|
||||||
.alsa_r(alsa_r),
|
.alsa_r(alsa_r),
|
||||||
|
`endif
|
||||||
|
|
||||||
.i2s_bclk(HDMI_SCLK),
|
.i2s_bclk(HDMI_SCLK),
|
||||||
.i2s_lrclk(HDMI_LRCLK),
|
.i2s_lrclk(HDMI_LRCLK),
|
||||||
@@ -1491,6 +1485,18 @@ audio_out audio_out
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
`ifndef MISTER_DISABLE_ALSA
|
||||||
|
wire aspi_sck,aspi_mosi,aspi_ss,aspi_miso;
|
||||||
|
cyclonev_hps_interface_peripheral_spi_master spi
|
||||||
|
(
|
||||||
|
.sclk_out(aspi_sck),
|
||||||
|
.txd(aspi_mosi), // mosi
|
||||||
|
.rxd(aspi_miso), // miso
|
||||||
|
|
||||||
|
.ss_0_n(aspi_ss),
|
||||||
|
.ss_in_n(1)
|
||||||
|
);
|
||||||
|
|
||||||
wire [28:0] alsa_address;
|
wire [28:0] alsa_address;
|
||||||
wire [63:0] alsa_readdata;
|
wire [63:0] alsa_readdata;
|
||||||
wire alsa_ready;
|
wire alsa_ready;
|
||||||
@@ -1517,6 +1523,7 @@ alsa alsa
|
|||||||
.pcm_l(alsa_l),
|
.pcm_l(alsa_l),
|
||||||
.pcm_r(alsa_r)
|
.pcm_r(alsa_r)
|
||||||
);
|
);
|
||||||
|
`endif
|
||||||
|
|
||||||
//////////////// User I/O (USB 3.0 connector) /////////////////////////
|
//////////////// User I/O (USB 3.0 connector) /////////////////////////
|
||||||
|
|
||||||
@@ -1758,6 +1765,21 @@ module sync_fix
|
|||||||
assign sync_out = sync_in ^ pol;
|
assign sync_out = sync_in ^ pol;
|
||||||
|
|
||||||
reg pol;
|
reg pol;
|
||||||
|
always @(posedge clk) begin
|
||||||
|
reg [31:0] cnt;
|
||||||
|
reg s1,s2;
|
||||||
|
|
||||||
|
s1 <= sync_in;
|
||||||
|
s2 <= s1;
|
||||||
|
cnt <= s2 ? (cnt - 1) : (cnt + 1);
|
||||||
|
|
||||||
|
if(~s2 & s1) begin
|
||||||
|
cnt <= 0;
|
||||||
|
pol <= cnt[31];
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
/*
|
||||||
always @(posedge clk) begin
|
always @(posedge clk) begin
|
||||||
integer pos = 0, neg = 0, cnt = 0;
|
integer pos = 0, neg = 0, cnt = 0;
|
||||||
reg s1,s2;
|
reg s1,s2;
|
||||||
@@ -1773,6 +1795,7 @@ always @(posedge clk) begin
|
|||||||
|
|
||||||
pol <= pos > neg;
|
pol <= pos > neg;
|
||||||
end
|
end
|
||||||
|
*/
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
|||||||
+20
-18
@@ -16,14 +16,16 @@ module vga_out
|
|||||||
output reg csync_o
|
output reg csync_o
|
||||||
);
|
);
|
||||||
|
|
||||||
wire [5:0] red = din[23:18];
|
wire [7:0] red = din[23:16];
|
||||||
wire [5:0] green = din[15:10];
|
wire [7:0] green = din[15:8];
|
||||||
wire [5:0] blue = din[7:2];
|
wire [7:0] blue = din[7:0];
|
||||||
|
|
||||||
// http://marsee101.blog19.fc2.com/blog-entry-2311.html
|
// http://marsee101.blog19.fc2.com/blog-entry-2311.html
|
||||||
// Y = 16 + 0.257*R + 0.504*G + 0.098*B (Y = 0.299*R + 0.587*G + 0.114*B)
|
|
||||||
// Pb = 128 - 0.148*R - 0.291*G + 0.439*B (Pb = -0.169*R - 0.331*G + 0.500*B)
|
|
||||||
// Pr = 128 + 0.439*R - 0.368*G - 0.071*B (Pr = 0.500*R - 0.419*G - 0.081*B)
|
// Y = 0.301*R + 0.586*G + 0.113*B (Y = 0.299*R + 0.587*G + 0.114*B)
|
||||||
|
// Pb = 128 - 0.168*R - 0.332*G + 0.500*B (Pb = -0.169*R - 0.331*G + 0.500*B)
|
||||||
|
// Pr = 128 + 0.500*R - 0.418*G - 0.082*B (Pr = 0.500*R - 0.419*G - 0.081*B)
|
||||||
|
|
||||||
reg [7:0] y, pb, pr;
|
reg [7:0] y, pb, pr;
|
||||||
reg [23:0] rgb;
|
reg [23:0] rgb;
|
||||||
@@ -36,25 +38,25 @@ always @(posedge clk) begin
|
|||||||
reg hsync2, vsync2, csync2;
|
reg hsync2, vsync2, csync2;
|
||||||
reg hsync1, vsync1, csync1;
|
reg hsync1, vsync1, csync1;
|
||||||
|
|
||||||
y_1r <= 19'd04096 + ({red, 8'd0} + {red, 3'd0});
|
y_1r <= {red, 6'd0} + {red, 3'd0} + {red, 2'd0} + red;
|
||||||
pb_1r <= 19'd32768 - ({red, 7'd0} + {red, 4'd0} + {red, 3'd0});
|
pb_1r <= 19'd32768 - ({red, 5'd0} + {red, 3'd0} + {red, 1'd0});
|
||||||
pr_1r <= 19'd32768 + ({red, 8'd0} + {red, 7'd0} + {red, 6'd0});
|
pr_1r <= 19'd32768 + {red, 7'd0};
|
||||||
|
|
||||||
y_1g <= {green, 9'd0} + {green, 2'd0};
|
y_1g <= {green, 7'd0} + {green, 4'd0} + {green, 2'd0} + {green, 1'd0};
|
||||||
pb_1g <= {green, 8'd0} + {green, 5'd0} + {green, 3'd0};
|
pb_1g <= {green, 6'd0} + {green, 4'd0} + {green, 2'd0} + green;
|
||||||
pr_1g <= {green, 8'd0} + {green, 6'd0} + {green, 5'd0} + {green, 4'd0} + {green, 3'd0};
|
pr_1g <= {green, 6'd0} + {green, 5'd0} + {green, 3'd0} + {green, 1'd0};
|
||||||
|
|
||||||
y_1b <= {blue, 6'd0} + {blue, 5'd0} + {blue, 2'd0};
|
y_1b <= {blue, 4'd0} + {blue, 3'd0} + {blue, 2'd0} + blue;
|
||||||
pb_1b <= {blue, 8'd0} + {blue, 7'd0} + {blue, 6'd0};
|
pb_1b <= {blue, 7'd0};
|
||||||
pr_1b <= {blue, 6'd0} + {blue, 3'd0};
|
pr_1b <= {blue, 4'd0} + {blue, 2'd0} + blue;
|
||||||
|
|
||||||
y_2 <= y_1r + y_1g + y_1b;
|
y_2 <= y_1r + y_1g + y_1b;
|
||||||
pb_2 <= pb_1r - pb_1g + pb_1b;
|
pb_2 <= pb_1r - pb_1g + pb_1b;
|
||||||
pr_2 <= pr_1r - pr_1g - pr_1b;
|
pr_2 <= pr_1r - pr_1g - pr_1b;
|
||||||
|
|
||||||
y <= ( y_2[18] || !y_2[17:12]) ? 8'd16 : (y_2[17:8] > 235) ? 8'd235 : y_2[15:8];
|
y <= y_2[18] ? 8'd0 : y_2[16] ? 8'd255 : y_2[15:8];
|
||||||
pb <= (pb_2[18] || !pb_2[17:12]) ? 8'd16 : (&pb_2[17:12]) ? 8'd240 : pb_2[15:8];
|
pb <= pb_2[18] ? 8'd0 : pb_2[16] ? 8'd255 : pb_2[15:8];
|
||||||
pr <= (pr_2[18] || !pr_2[17:12]) ? 8'd16 : (&pr_2[17:12]) ? 8'd240 : pr_2[15:8];
|
pr <= pr_2[18] ? 8'd0 : pr_2[16] ? 8'd255 : pr_2[15:8];
|
||||||
|
|
||||||
hsync_o <= hsync2; hsync2 <= hsync1; hsync1 <= hsync;
|
hsync_o <= hsync2; hsync2 <= hsync1; hsync1 <= hsync;
|
||||||
vsync_o <= vsync2; vsync2 <= vsync1; vsync1 <= vsync;
|
vsync_o <= vsync2; vsync2 <= vsync1; vsync1 <= vsync;
|
||||||
|
|||||||
+43
-3
@@ -173,7 +173,7 @@ 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;
|
wire [11:0] wideres = mul_res[11:0] + hsize;
|
||||||
|
|
||||||
always @(posedge CLK_VIDEO) begin
|
always @(posedge CLK_VIDEO) begin
|
||||||
reg [11:0] oheight,wres;
|
reg [11:0] oheight,htarget,wres;
|
||||||
reg [12:0] arxf,aryf;
|
reg [12:0] arxf,aryf;
|
||||||
reg [3:0] cnt;
|
reg [3:0] cnt;
|
||||||
reg narrow;
|
reg narrow;
|
||||||
@@ -188,11 +188,18 @@ always @(posedge CLK_VIDEO) begin
|
|||||||
else if(~div_start & ~div_run & ~mul_start & ~mul_run) begin
|
else if(~div_start & ~div_run & ~mul_start & ~mul_run) begin
|
||||||
cnt <= cnt + 1'd1;
|
cnt <= cnt + 1'd1;
|
||||||
case(cnt)
|
case(cnt)
|
||||||
|
// example ideal and non-ideal cases:
|
||||||
|
// [1] 720x400 4:3 VGA 80x25 text-mode (non-square pixels)
|
||||||
|
// [2] 640x480 4:3 VGA graphics mode (square pixels)
|
||||||
|
// [3] 512x512 4:3 X68000 graphics mode (non-square pixels)
|
||||||
0: begin
|
0: begin
|
||||||
div_num <= HDMI_HEIGHT;
|
div_num <= HDMI_HEIGHT;
|
||||||
div_den <= vsize;
|
div_den <= vsize;
|
||||||
div_start <= 1;
|
div_start <= 1;
|
||||||
end
|
end
|
||||||
|
// [1] 1080 / 400 -> 2
|
||||||
|
// [2] 1080 / 480 -> 2
|
||||||
|
// [3] 1080 / 512 -> 2
|
||||||
|
|
||||||
1: if(!div_res[11:0]) begin
|
1: if(!div_res[11:0]) begin
|
||||||
// screen resolution is lower than video resolution.
|
// screen resolution is lower than video resolution.
|
||||||
@@ -206,6 +213,9 @@ always @(posedge CLK_VIDEO) begin
|
|||||||
mul_arg2 <= div_res[11:0];
|
mul_arg2 <= div_res[11:0];
|
||||||
mul_start <= 1;
|
mul_start <= 1;
|
||||||
end
|
end
|
||||||
|
// [1] 1080 / 400 * 400 -> 800
|
||||||
|
// [2] 1080 / 480 * 480 -> 960
|
||||||
|
// [3] 1080 / 512 * 512 -> 1024
|
||||||
|
|
||||||
2: begin
|
2: begin
|
||||||
oheight <= mul_res[11:0];
|
oheight <= mul_res[11:0];
|
||||||
@@ -219,24 +229,39 @@ always @(posedge CLK_VIDEO) begin
|
|||||||
mul_arg2 <= arx_i;
|
mul_arg2 <= arx_i;
|
||||||
mul_start <= 1;
|
mul_start <= 1;
|
||||||
end
|
end
|
||||||
|
// [1] 1080 / 400 * 400 * 4 -> 3200
|
||||||
|
// [2] 1080 / 480 * 480 * 4 -> 3840
|
||||||
|
// [3] 1080 / 512 * 512 * 4 -> 4096
|
||||||
|
|
||||||
4: begin
|
4: begin
|
||||||
div_num <= mul_res;
|
div_num <= mul_res;
|
||||||
div_den <= ary_i;
|
div_den <= ary_i;
|
||||||
div_start <= 1;
|
div_start <= 1;
|
||||||
end
|
end
|
||||||
|
// [1] 1080 / 480 * 480 * 4 / 3 -> 1066
|
||||||
|
// [2] 1080 / 480 * 480 * 4 / 3 -> 1280
|
||||||
|
// [3] 1080 / 512 * 512 * 4 / 3 -> 1365
|
||||||
|
// saved as htarget
|
||||||
|
|
||||||
5: begin
|
5: begin
|
||||||
|
htarget <= div_res[11:0];
|
||||||
div_num <= div_res;
|
div_num <= div_res;
|
||||||
div_den <= hsize;
|
div_den <= hsize;
|
||||||
div_start <= 1;
|
div_start <= 1;
|
||||||
end
|
end
|
||||||
|
// computes wide scaling factor as a ceiling division
|
||||||
|
// [1] 1080 / 400 * 400 * 4 / 3 / 720 -> 1
|
||||||
|
// [2] 1080 / 480 * 480 * 4 / 3 / 640 -> 2
|
||||||
|
// [3] 1080 / 512 * 512 * 4 / 3 / 512 -> 2
|
||||||
|
|
||||||
6: begin
|
6: begin
|
||||||
mul_arg1 <= hsize;
|
mul_arg1 <= hsize;
|
||||||
mul_arg2 <= div_res[11:0] ? div_res[11:0] : 12'd1;
|
mul_arg2 <= div_res[11:0] ? div_res[11:0] : 12'd1;
|
||||||
mul_start <= 1;
|
mul_start <= 1;
|
||||||
end
|
end
|
||||||
|
// [1] 1080 / 400 * 400 * 4 / 3 / 720 * 720 -> 720
|
||||||
|
// [2] 1080 / 480 * 480 * 4 / 3 / 640 * 640 -> 1280
|
||||||
|
// [3] 1080 / 512 * 512 * 4 / 3 / 512 * 512 -> 1024
|
||||||
|
|
||||||
7: if(mul_res <= HDMI_WIDTH) begin
|
7: if(mul_res <= HDMI_WIDTH) begin
|
||||||
cnt <= 10;
|
cnt <= 10;
|
||||||
@@ -247,17 +272,32 @@ always @(posedge CLK_VIDEO) begin
|
|||||||
div_den <= hsize;
|
div_den <= hsize;
|
||||||
div_start <= 1;
|
div_start <= 1;
|
||||||
end
|
end
|
||||||
|
// [1] 1920 / 720 -> 2
|
||||||
|
// [2] 1920 / 640 -> 3
|
||||||
|
// [3] 1920 / 512 -> 3
|
||||||
|
|
||||||
9: begin
|
9: begin
|
||||||
mul_arg1 <= hsize;
|
mul_arg1 <= hsize;
|
||||||
mul_arg2 <= div_res[11:0] ? div_res[11:0] : 12'd1;
|
mul_arg2 <= div_res[11:0] ? div_res[11:0] : 12'd1;
|
||||||
mul_start <= 1;
|
mul_start <= 1;
|
||||||
end
|
end
|
||||||
|
// [1] 1920 / 720 * 720 -> 1440
|
||||||
|
// [2] 1920 / 640 * 640 -> 1920
|
||||||
|
// [3] 1920 / 512 * 512 -> 1536
|
||||||
|
|
||||||
10: begin
|
10: begin
|
||||||
narrow <= ((div_num[11:0] - mul_res[11:0]) <= (wideres - div_num[11:0])) || (wideres > HDMI_WIDTH);
|
narrow <= ((htarget - mul_res[11:0]) <= (wideres - htarget)) || (wideres > HDMI_WIDTH);
|
||||||
wres <= wideres;
|
wres <= mul_res[11:0] == htarget ? mul_res[11:0] : wideres;
|
||||||
end
|
end
|
||||||
|
// [1] 1066 - 720 = 346 <= 1440 - 1066 = 374 || 1440 > 1920 -> true
|
||||||
|
// [2] 1280 - 1280 = 0 <= 1920 - 1280 = 640 || 1920 > 1920 -> true
|
||||||
|
// [3] 1365 - 1024 = 341 <= 1536 - 1365 = 171 || 1536 > 1920 -> false
|
||||||
|
// 1. narrow flag is true when mul_res[11:0] narrow width is closer to
|
||||||
|
// htarget aspect ratio target width or when wideres wider width
|
||||||
|
// does not fit to the screen.
|
||||||
|
// 2. wres becomes wideres only when mul_res[11:0] narrow width not equal
|
||||||
|
// to target width, meaning it is not optimal for source aspect ratio.
|
||||||
|
// otherwise it is set to narrow width that is optimal.
|
||||||
|
|
||||||
11: begin
|
11: begin
|
||||||
case(SCALE)
|
case(SCALE)
|
||||||
|
|||||||
Reference in new issue
Block a user