//
// Copyright 2011 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or 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 your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
//
module dcache
#(parameter AWIDTH=14,
parameter CWIDTH=6)
(input wb_clk_i,
input wb_rst_i,
input [AWIDTH-1:0] dwb_adr_i,
input dwb_stb_i,
input dwb_we_i,
input [3:0] dwb_sel_i,
input [31:0] dwb_dat_i,
output [31:0] dwb_dat_o,
output dwb_ack_o,
input [31:0] dram_dat_i,
output [31:0] dram_dat_o,
output [AWIDTH-1:0] dram_adr_o,
output dram_we_o,
output dram_en_o,
output [3:0] dram_sel_o );
localparam TAGWIDTH = AWIDTH-CWIDTH-2;
reg stb_d1, ack_d1, miss_d1;
reg [AWIDTH-1:0] held_addr;
reg [31:0] ddata [0:(1<