Line 68... |
Line 68... |
input [1:0] i_len; // 0=>8bits, 1=>16 bits, 2=>24 bits, 3=>32 bits
|
input [1:0] i_len; // 0=>8bits, 1=>16 bits, 2=>24 bits, 3=>32 bits
|
input i_spd; // 0 -> normal QPI, 1 -> QSPI
|
input i_spd; // 0 -> normal QPI, 1 -> QSPI
|
input i_dir; // 0 -> read, 1 -> write to SPI
|
input i_dir; // 0 -> read, 1 -> write to SPI
|
input i_recycle; // 0 = 20ns, 1 = 50ns
|
input i_recycle; // 0 = 20ns, 1 = 50ns
|
output reg [31:0] o_word;
|
output reg [31:0] o_word;
|
output wire o_valid;
|
output reg o_valid;
|
output reg o_busy;
|
output reg 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;
|
output reg [1:0] o_mod;
|
output reg [1:0] o_mod;
|
Line 296... |
Line 296... |
end
|
end
|
*/
|
*/
|
end
|
end
|
|
|
`define EXTRA_DELAY
|
`define EXTRA_DELAY
|
|
wire rd_input_N, rd_valid_N, r_spd_N;
|
`ifdef EXTRA_DELAY
|
`ifdef EXTRA_DELAY
|
reg rd_input_2, rd_valid_2, r_spd_2;
|
reg [2:0] rd_input_p, rd_valid_p, r_spd_p;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
rd_input_2 <= rd_input;
|
rd_input_p <= { rd_input_p[1:0], rd_input };
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
rd_valid_2 <= rd_valid;
|
rd_valid_p <= { rd_valid_p[1:0], rd_valid };
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
r_spd_2 <= r_spd;
|
r_spd_p <= { r_spd_p[1:0], r_spd };
|
|
|
|
assign rd_input_N = rd_input_p[2];
|
|
assign rd_valid_N = rd_valid_p[2];
|
|
assign r_spd_N = r_spd_p[2];
|
`else
|
`else
|
wire rd_input_2, rd_valid_2, r_spd_2;
|
assign rd_input_N = rd_input;
|
assign rd_input_2 = rd_input;
|
assign rd_valid_N = rd_valid;
|
assign rd_valid_2 = rd_valid;
|
assign r_spd_N = rd_spd;
|
assign r_spd_2 = rd_spd;
|
|
`endif
|
`endif
|
|
|
|
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
begin
|
begin
|
if ((state == `EQSPI_IDLE)||(rd_valid_2))
|
// if ((state == `EQSPI_IDLE)||(rd_valid_N))
|
|
if (o_valid)
|
r_input <= 31'h00;
|
r_input <= 31'h00;
|
else if ((rd_input_2)&&(r_spd_2))
|
if ((rd_input_N)&&(r_spd_N))
|
r_input <= { r_input[26:0], i_dat };
|
r_input <= { r_input[26:0], i_dat };
|
else if (rd_input_2)
|
else if (rd_input_N)
|
r_input <= { r_input[29:0], i_miso };
|
r_input <= { r_input[29:0], i_miso };
|
|
|
if ((rd_valid)&&(rd_spd))
|
if ((rd_valid_N)&&(r_spd_N))
|
o_word <= { r_input[27:0], i_dat };
|
o_word <= { r_input[27:0], i_dat };
|
else if (rd_valid)
|
else if (rd_valid_N)
|
o_word <= { r_input[30:0], i_miso };
|
o_word <= { r_input[30:0], i_miso };
|
|
o_valid <= rd_valid_N;
|
end
|
end
|
|
|
assign o_valid = rd_valid_2;
|
|
|
|
endmodule
|
endmodule
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|