From 31347a54ac571ded6177b68e24aa2d0c2f2cab28 Mon Sep 17 00:00:00 2001 From: Wojciech Kosior Date: Tue, 3 Nov 2020 22:01:29 +0100 Subject: incorporate SPI module into main design --- design/soc.v | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) (limited to 'design/soc.v') diff --git a/design/soc.v b/design/soc.v index d4a5962..c7312f3 100644 --- a/design/soc.v +++ b/design/soc.v @@ -13,7 +13,12 @@ * h100A00 - h100A01 - VGA power-on register * h100A02 - h100FFF - undefined (actually, repetitions of VGA power-on reg) * h101000 - h17FFFF - undefined (actually, repetitions of VGA memory) - * h180000 - h1FFFFF - read as 0, write as don't care + * h180000 - h1801FF - SPI data transfer memory + * h180200 - h180201 - SPI bytes_to_output reg + * h180202 - h180203 - SPI bytes_to_receive reg + * h180204 - h180207 - SPI operating reg + * h180208 - h1803FF - undefined (actually, repetitions of SPI regs) + * h180400 - h1FFFFF - undefined (actually, repetitions of SPI memory) */ `default_nettype none @@ -43,6 +48,11 @@ module soc output wire [2:0] vga_green, output wire [2:0] vga_blue, + output wire spi_sdo, + input wire spi_sdi, + output wire spi_sck, + output wire spi_ss_n, + input wire button1, input wire button2, @@ -168,10 +178,27 @@ module soc .blue(vga_blue) ); - /* Slave 3 will be SPI controller, but for now - it's omitted */ - assign S3_ACK_O = 1; - assign S3_DAT_O = 0; - assign S3_STALL_O = 0; + spi_slave + #( + .MEMORY_BLOCKS(1) + ) slave3 + ( + .ACK_O(S3_ACK_O), + .CLK_I(CLK), + .ADR_I(S3_ADR_I[8:0]), + .DAT_I(S3_DAT_I), + .DAT_O(S3_DAT_O), + .RST_I(RST), + .STB_I(S3_STB_I), + .WE_I(S3_WE_I), + .STALL_O(S3_STALL_O), + + /* Non-wishbone */ + .sdo(spi_sdo), + .sdi(spi_sdi), + .sck(spi_sck), + .ss_n(spi_ss_n) + ); intercon intercon ( -- cgit v1.2.3