/*! * Module:status_read * @file status_read.v * @date 2015-01-14 * @author Andrey Filippov * * @brief Receives status read data (low bandwidth) from multiple * subsystems byte-serial, stores in axi-addressable memory * 8-bita ddress is received from the source module, * as well as another (optional) byte of sequence number (set in write command) * Sequence number (received first afther the address) is stored as a high byte, * lower bytes are the actual payload, starting from lower byte (not all 3 are * required. Single-bit responsen can be combined in the same byte with the * sequence number to use just 2-byte packets? * TODO: add interrupt capabilities * * @copyright Copyright (c) 2015 Elphel, Inc. * * License: * * status_read.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. * * status_read.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 . * * Additional permission under GNU GPL version 3 section 7: * If you modify this Program, or any covered work, by linking or combining it * with independent modules provided by the FPGA vendor only (this permission * does not extend to any 3-rd party modules, "soft cores" or macros) under * different license terms solely for the purpose of generating binary "bitstream" * files and/or simulating the code, the copyright holders of this Program give * you the right to distribute the covered work without those independent modules * as long as the source code for them is available from the FPGA vendor free of * charge, and there is no dependence on any encrypted modules for simulating of * the combined code. This permission applies to you if the distributed code * contains all the components and scripts required to completely simulate it * with at least one of the Free Software programs. */ `timescale 1ns/1ps module status_read#( parameter STATUS_ADDR = 'h0800, // AXI read address of status read registers parameter STATUS_ADDR_MASK = 'h3c00, // AXI write address of status registers parameter AXI_RD_ADDR_BITS = 14, parameter integer STATUS_DEPTH= 8, // 256 cells, maybe just 16..64 are enough? parameter FPGA_VERSION = 32'h03930001 )( input mrst, // @posedge mclk - sync reset input arst, // @posedge axi_clk - sync reset input clk, input axi_clk, // common for read and write channels 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 [STATUS_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 // so with ren/regen it may be delayed 1 more cycle input [7:0] ad, // byte-serial status data from the sources input rq, // request from sources to transfer status data output start // acknowledge receiving of first byte (address), currently always ready ); localparam integer DATA_2DEPTH=(1<