//---------------------------------------------------------------------------------- //Copyright (c) 2014 // //Permission is hereby granted, free of charge, to any person obtaining a copy //of this software and associated documentation files (the "Software"), to deal //in the Software without restriction, including without limitation the rights //to use, copy, modify, merge, publish, distribute, sublicense, and/or sell //copies of the Software, and to permit persons to whom the Software is //furnished to do so, subject to the following conditions: // //The above copyright notice and this permission notice shall be included in //all copies or substantial portions of the Software. // //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN //THE SOFTWARE. //---------------------------------------------------------------------------------- //------------------------------------------------------------------------------ // Description : // Simple Flop shifting FIFO // //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ module flop_fifo ( // Inputs clk, rst_n, sync_rst_n, cfg_watermark, push, push_data, pop, // Outputs pop_data, half_full, watermark, data_valid ); parameter WIDTH = 8; parameter DEPTH = 16; //------------------------------- // Inputs //------------------------------- input clk; input rst_n; input sync_rst_n; input[31:0] cfg_watermark; input push; input [(WIDTH-1):0] push_data; input pop; //------------------------------- // Outputs //------------------------------- output [(WIDTH-1):0] pop_data; output half_full; output watermark; output data_valid; logic[WIDTH:0] fifo[0:(DEPTH-1)] = '{default:'0}; logic[WIDTH:0] nxt_fifo[0:(DEPTH-1)]; logic[(DEPTH-1):0] fifo_valid; //--------------------------------------------------- // MSB of the FIFO is the valid bit, create valid vector //--------------------------------------------------- always_comb begin for (int i=0;i> 1)-1)]; assign watermark = fifo_valid[cfg_watermark]; endmodule