/* * top.v * * vim: ts=4 sw=4 * * Copyright (C) 2019-2020 Sylvain Munaut * SPDX-License-Identifier: CERN-OHL-P-2.0 */ `default_nettype none module top ( // SPI inout wire spi_mosi, inout wire spi_miso, inout wire spi_clk, output wire spi_cs_n, // USB inout wire usb_dp, inout wire usb_dn, output wire usb_pu, // Debug UART input wire uart_rx, output wire uart_tx, // Button input wire btn, // LED output wire [2:0] rgb, // AMR interface output wire mc97_sdata_out, inout wire mc97_sdata_in, output wire mc97_sync, input wire mc97_bitclk, output wire mc97_reset_n, // Clock input wire clk_in ); localparam integer SPRAM_AW = 14; /* 14 => 64k, 15 => 128k */ localparam integer WB_N = 7; localparam integer WB_DW = 32; localparam integer WB_AW = 16; localparam integer WB_RW = WB_DW * WB_N; localparam integer WB_MW = WB_DW / 8; genvar i; // Signals // ------- // Wishbone wire [WB_AW-1:0] wb_addr; wire [WB_DW-1:0] wb_rdata [0:WB_N-1]; wire [WB_RW-1:0] wb_rdata_flat; wire [WB_DW-1:0] wb_wdata; wire [WB_MW-1:0] wb_wmsk; wire [WB_N -1:0] wb_cyc; wire wb_we; wire [WB_N -1:0] wb_ack; // USB wire usb_sof; // WarmBoot reg boot_now; reg [1:0] boot_sel; // Clock / Reset logic wire clk_24m; wire clk_48m; wire rst; // SoC // --- soc_picorv32_base #( .WB_N (WB_N), .WB_DW (WB_DW), .WB_AW (WB_AW), .SPRAM_AW(SPRAM_AW) ) base_I ( .wb_addr (wb_addr), .wb_rdata(wb_rdata_flat), .wb_wdata(wb_wdata), .wb_wmsk (wb_wmsk), .wb_we (wb_we), .wb_cyc (wb_cyc), .wb_ack (wb_ack), .clk (clk_24m), .rst (rst) ); for (i=0; i