Line 35... |
Line 35... |
// License: GPL, v3, as defined and found on www.gnu.org,
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
// http://www.gnu.org/licenses/gpl.html
|
// http://www.gnu.org/licenses/gpl.html
|
//
|
//
|
//
|
//
|
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
|
//
|
|
//
|
|
`default_nettype none
|
|
//
|
`define QSPI_IDLE 3'h0
|
`define QSPI_IDLE 3'h0
|
`define QSPI_START 3'h1
|
`define QSPI_START 3'h1
|
`define QSPI_BITS 3'h2
|
`define QSPI_BITS 3'h2
|
`define QSPI_READY 3'h3
|
`define QSPI_READY 3'h3
|
`define QSPI_HOLDING 3'h4
|
`define QSPI_HOLDING 3'h4
|
Line 54... |
Line 58... |
// Module interface
|
// Module interface
|
i_wr, i_hold, i_word, i_len, i_spd, i_dir,
|
i_wr, i_hold, i_word, i_len, i_spd, i_dir,
|
o_word, o_valid, o_busy,
|
o_word, o_valid, o_busy,
|
// QSPI interface
|
// QSPI interface
|
o_sck, o_cs_n, o_mod, o_dat, i_dat);
|
o_sck, o_cs_n, o_mod, o_dat, i_dat);
|
input i_clk;
|
input wire i_clk;
|
// Chip interface
|
// Chip interface
|
// Can send info
|
// Can send info
|
// i_dir = 1, i_spd = 0, i_hold = 0, i_wr = 1,
|
// i_dir = 1, i_spd = 0, i_hold = 0, i_wr = 1,
|
// i_word = { 1'b0, 32'info to send },
|
// i_word = { 1'b0, 32'info to send },
|
// i_len = # of bytes in word-1
|
// i_len = # of bytes in word-1
|
input i_wr, i_hold;
|
input wire i_wr, i_hold;
|
input [31:0] i_word;
|
input wire [31:0] i_word;
|
input [1:0] i_len; // 0=>8bits, 1=>16 bits, 2=>24 bits, 3=>32 bits
|
input wire [1:0] i_len; // 0=>8bits, 1=>16 bits, 2=>24 bits, 3=>32 bits
|
input i_spd; // 0 -> normal QPI, 1 -> QSPI
|
input wire i_spd; // 0 -> normal QPI, 1 -> QSPI
|
input i_dir; // 0 -> read, 1 -> write to SPI
|
input wire i_dir; // 0 -> read, 1 -> write to SPI
|
output reg [31:0] o_word;
|
output reg [31:0] o_word;
|
output reg o_valid, o_busy;
|
output reg o_valid, o_busy;
|
// Interface with the QSPI lines
|
// Interface with the QSPI lines
|
output reg o_sck;
|
output reg o_sck;
|
output reg o_cs_n;
|
output reg o_cs_n;
|