mirror of
https://github.com/Polprzewodnikowy/SummerCart64.git
synced 2024-11-26 23:54:15 +01:00
ff69030643
* isv support + usb/dd improvements
* make room for saves
* update offset
* fixed debug address
* idk
* exception
* ironed out all broken stuff
* cleanup
* return epc fix
* better
* more cleanup
* even more cleanup
* mooore cleanup
* fixed printf
* no assert
* improved docker build, pyft232 instead of pyserial
* fixed displaying long message strings
description test
* just straight cleanup
* smallest cleanup
* PAL
* cpu buffer
* n64 bootloader done
* super slow usb storage reading implemented
* reduced buffer size
* usb gets fast
* little cleanup
* double buffered reads
* removed separate event id
* ISV in hardware finally
* small exception changes
* mac testing
* py spacing
* fsd write, rtc, isv and reset fixes
* fixxx
* good stopping point
* usb fixed?
* pretend we have 128 MB sdram
* backup
* chmod
* test
* test done
* more tests
* user rm
* help
* final fix
* updated component values
* nice asset names
* cic 64dd support
* ddipl enable separation
* pre DMA rewrite, created dedicated buffer memory space, simplified code
* dma rewrite, needs testing
* moved xml
* dd basics
* timing
* 64dd working yet again, isv brought back, dma fixes, usb path rewrite, pc code rewrite
* added usb read functionality, general cleanup
* changed mem addressing
* added fpga flash update access
* added mcu update
* chmod
* little cleanup
* update format and stuff
* fixes
* uninitialized fix
* small fixes
* update fixes
* update stuff done
* fpga update tested
* build time fix
* boot fix
* test timing
* readme test
* test 2
* reports
* testseet
* final
* build test
* forgot
* button and naming
* General cleanup
And multiline commit message test
* Exception screen UI touch ups
* display separation and tests beginning
* pc software update
* pc software done
* timing test
* delete launch.json
* sw fixes
* fixed button hole diameter in shell
* small cleanup, rpi testing
* shell fillet fix, pc rtc printing
* added cfg lock mechanism
* moved lock to cfg address space
* extended ROM and ISV fixes
* preliminary sd card support
* little sd card cleanup
* sd menu fixes
* 5 second limit
* reduced shell thickness
* basic led act blinking
* faster sd menu loading
* inst cache invalidate
* sd card writing is working
* SD card CSD and CID registers
* wait for previous command
* led error codes
* fixed cfg_translate_address use
* 64dd from sd card working
* 64dd speedup and button handling
* delayed address latching cycle - might break other builds, needs testing
* bootloader improvements
* small fixes
* return previous cfg when setting new
* cache stuff
* unfloader debug protocol support
* UNFLoader style debug command line support
* requirements.txt
* shell groove fillet
* reset state inside controller
* fixed fast PI read, added PI R/W fifo debug info
* PI access prioritize
* SD clock stop when RX FIFO is more than half full
* flash erase method change
* CFG error handling, TLOZ MM debug ISV support
* CIC5167 support
* general fixes
* USB unplugged cable handling
* turn off led when changing between error/act modes
* rtc 2 bit clock stop support
* line endings
* Revert "line endings"
This reverts commit d0ddfe5ec7
.
* PI address debug
* readme test
* diagram update
* diagram background
* diagram background
* diagram background
* updated readme
93 lines
2.4 KiB
Systemverilog
93 lines
2.4 KiB
Systemverilog
module mcu_spi (
|
|
input clk,
|
|
input reset,
|
|
|
|
output logic frame_start,
|
|
output logic data_ready,
|
|
output logic [7:0] rx_data,
|
|
input [7:0] tx_data,
|
|
|
|
input mcu_clk,
|
|
input mcu_cs,
|
|
input mcu_mosi,
|
|
output logic mcu_miso
|
|
);
|
|
|
|
logic [2:0] mcu_clk_ff;
|
|
logic [2:0] mcu_cs_ff;
|
|
|
|
always_ff @(posedge clk) begin
|
|
mcu_clk_ff <= {mcu_clk_ff[1:0], mcu_clk};
|
|
mcu_cs_ff <= {mcu_cs_ff[1:0], mcu_cs};
|
|
end
|
|
|
|
logic mcu_clk_falling;
|
|
logic mcu_clk_rising;
|
|
logic mcu_cs_falling;
|
|
logic mcu_cs_rising;
|
|
|
|
always_comb begin
|
|
mcu_clk_falling = mcu_clk_ff[2] && !mcu_clk_ff[1];
|
|
mcu_clk_rising = !mcu_clk_ff[2] && mcu_clk_ff[1];
|
|
mcu_cs_falling = mcu_cs_ff[2] && !mcu_cs_ff[1];
|
|
mcu_cs_rising = !mcu_cs_ff[2] && mcu_cs_ff[1];
|
|
end
|
|
|
|
logic mcu_dq_in;
|
|
logic mcu_dq_out;
|
|
logic mcu_miso_out;
|
|
|
|
assign mcu_miso = mcu_cs_ff[1] ? 1'bZ : mcu_miso_out;
|
|
|
|
always_ff @(posedge clk) begin
|
|
mcu_dq_in <= mcu_mosi;
|
|
mcu_miso_out <= mcu_dq_out;
|
|
end
|
|
|
|
logic [7:0] spi_tx_shift;
|
|
|
|
assign mcu_dq_out = spi_tx_shift[7];
|
|
|
|
logic spi_enabled;
|
|
logic [2:0] spi_bit_counter;
|
|
|
|
always_ff @(posedge clk) begin
|
|
frame_start <= 1'b0;
|
|
data_ready <= 1'b0;
|
|
|
|
if (reset) begin
|
|
spi_enabled <= 1'b0;
|
|
spi_bit_counter <= 3'd0;
|
|
end else begin
|
|
if (mcu_cs_falling) begin
|
|
spi_enabled <= 1'b1;
|
|
spi_bit_counter <= 3'd0;
|
|
frame_start <= 1'b1;
|
|
end
|
|
|
|
if (mcu_cs_rising) begin
|
|
spi_enabled <= 1'b0;
|
|
end
|
|
|
|
if (spi_enabled) begin
|
|
if (mcu_clk_rising) begin
|
|
if (spi_bit_counter == 3'd0) begin
|
|
spi_tx_shift <= tx_data;
|
|
end else begin
|
|
spi_tx_shift <= {spi_tx_shift[6:0], 1'b0};
|
|
end
|
|
end
|
|
|
|
if (mcu_clk_falling) begin
|
|
spi_bit_counter <= spi_bit_counter + 1'd1;
|
|
rx_data <= {rx_data[6:0], mcu_dq_in};
|
|
if (spi_bit_counter == 3'd7) begin
|
|
data_ready <= 1'b1;
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
endmodule
|