/******************************************************************************* * Module: cmd_readback * Date:2015-05-05 * Author: Andrey Filippov * Description: Store control register data and readback * * Copyright (c) 2015 Elphel, Inc. * cmd_readback.v 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. * * cmd_readback.v 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 . *******************************************************************************/ `timescale 1ns/1ps module cmd_readback#( parameter AXI_WR_ADDR_BITS= 14, parameter AXI_RD_ADDR_BITS = 14, parameter CONTROL_RBACK_DEPTH= 11, // 10 - 1xbram, 11 - 2xbram parameter CONTROL_ADDR = 'h0000, // AXI write address of control write registers parameter CONTROL_ADDR_MASK = 'h3800, // AXI write address of control registers parameter CONTROL_RBACK_ADDR = 'h0000, // AXI write address of control write registers parameter CONTROL_RBACK_ADDR_MASK = 'h3800 // AXI write address of control registers )( input mrst, // @posedge mclk - sync reset input arst, // @posedge axi_clk - sync reset input mclk, input axi_clk, input [AXI_WR_ADDR_BITS-1:0] par_waddr, // parallel address input [31:0] par_data, // parallel 32-bit data input ad_stb, // low address output strobe (and parallel A/D) input [AXI_RD_ADDR_BITS-1:0] axird_pre_araddr, // status read address, 1 cycle ahead of read data input axird_start_burst, // start of read burst, valid pre_araddr, save externally to control ext. dev_ready multiplexer input [CONTROL_RBACK_DEPTH-1:0] axird_raddr, // .raddr(read_in_progress?read_address[9:0]:10'h3ff), // read address input axird_ren, // .ren(bram_reg_re_w) , // read port enable // input axird_regen, //==axird_ren?? - remove? .regen(bram_reg_re_w), // output register enable output [31:0] axird_rdata, // combinatorial multiplexed (add external register layer, modify axibram_read?) .data_out(rdata[31:0]), // data out output axird_selected // axird_rdata contains cvalid data from this module, vcalid next after axird_start_burst ); localparam integer DATA_2DEPTH = (1<