Line 21... |
Line 21... |
// Creator: Dan Gisselquist, Ph.D.
|
// Creator: Dan Gisselquist, Ph.D.
|
// Gisselquist Technology, LLC
|
// Gisselquist Technology, LLC
|
//
|
//
|
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
//
|
//
|
// Copyright (C) 2015, Gisselquist Technology, LLC
|
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
|
//
|
//
|
// This program is free software (firmware): you can redistribute it and/or
|
// This program is free software (firmware): you can redistribute it and/or
|
// modify it under the terms of the GNU General Public License as published
|
// modify it under the terms of the GNU General Public License as published
|
// by the Free Software Foundation, either version 3 of the License, or (at
|
// by the Free Software Foundation, either version 3 of the License, or (at
|
// your option) any later version.
|
// your option) any later version.
|
Line 53... |
Line 53... |
// Input/master bus
|
// Input/master bus
|
input i_wb_cyc, i_wb_stb, i_wb_we;
|
input i_wb_cyc, i_wb_stb, i_wb_we;
|
input [(AW-1):0] i_wb_addr;
|
input [(AW-1):0] i_wb_addr;
|
input [(DW-1):0] i_wb_data;
|
input [(DW-1):0] i_wb_data;
|
output reg o_wb_ack;
|
output reg o_wb_ack;
|
output wire o_wb_stall;
|
output reg o_wb_stall;
|
output reg [(DW-1):0] o_wb_data;
|
output reg [(DW-1):0] o_wb_data;
|
output wire o_wb_err;
|
output reg o_wb_err;
|
// Delayed bus
|
// Delayed bus
|
output reg o_dly_cyc, o_dly_stb, o_dly_we;
|
output reg o_dly_cyc, o_dly_we;
|
|
output wire o_dly_stb;
|
output reg [(AW-1):0] o_dly_addr;
|
output reg [(AW-1):0] o_dly_addr;
|
output reg [(DW-1):0] o_dly_data;
|
output reg [(DW-1):0] o_dly_data;
|
input i_dly_ack;
|
input i_dly_ack;
|
input i_dly_stall;
|
input i_dly_stall;
|
input [(DW-1):0] i_dly_data;
|
input [(DW-1):0] i_dly_data;
|
input i_dly_err;
|
input i_dly_err;
|
|
|
|
reg loaded;
|
initial o_dly_cyc = 1'b0;
|
initial o_dly_cyc = 1'b0;
|
initial o_dly_stb = 1'b0;
|
initial loaded = 1'b0;
|
|
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
o_dly_cyc <= i_wb_cyc;
|
o_wb_stall <= (loaded)&&(i_dly_stall);
|
|
|
|
initial o_dly_cyc = 1'b0;
|
|
always @(posedge i_clk)
|
|
o_dly_cyc <= (i_wb_cyc);
|
// Add the i_wb_cyc criteria here, so we can simplify the o_wb_stall
|
// Add the i_wb_cyc criteria here, so we can simplify the o_wb_stall
|
// criteria below, which would otherwise *and* these two.
|
// criteria below, which would otherwise *and* these two.
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
if (~o_wb_stall)
|
loaded <= (i_wb_stb)||((loaded)&&(i_dly_stall)&&(~i_dly_err)&&(i_wb_cyc));
|
o_dly_stb <= ((i_wb_cyc)&&(i_wb_stb));
|
assign o_dly_stb = loaded;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
if (~o_wb_stall)
|
if (~i_dly_stall)
|
o_dly_we <= i_wb_we;
|
o_dly_we <= i_wb_we;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
if (~o_wb_stall)
|
if (~i_dly_stall)
|
o_dly_addr<= i_wb_addr;
|
o_dly_addr<= i_wb_addr;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
if (~o_wb_stall)
|
if (~i_dly_stall)
|
o_dly_data <= i_wb_data;
|
o_dly_data <= i_wb_data;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
o_wb_ack <= (i_dly_ack)&&(o_dly_cyc)&&(i_wb_cyc);
|
o_wb_ack <= (i_dly_ack)&&(o_dly_cyc)&&(i_wb_cyc);
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
o_wb_data <= i_dly_data;
|
o_wb_data <= i_dly_data;
|
|
|
// Our only non-delayed line, yet still really delayed. Perhaps
|
always @(posedge i_clk)
|
// there's a way to register this?
|
o_wb_err <= (i_dly_err)&&(o_dly_cyc)&&(i_wb_cyc);
|
// o_wb_stall <= (i_wb_cyc)&&(i_wb_stb) ... or some such?
|
|
// assign o_wb_stall=((i_wb_cyc)&&(i_dly_stall)&&(o_dly_stb));//&&o_cyc
|
|
assign o_wb_stall = ((i_dly_stall)&&(o_dly_stb));//&&o_cyc
|
|
assign o_wb_err = i_dly_err;
|
|
|
|
endmodule
|
endmodule
|
|
|
No newline at end of file
|
No newline at end of file
|