From 3038edc09a2eb15762f2e58533f429489107520b Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Wed, 6 Mar 2024 02:38:24 -0600 Subject: rtl/wb2axip: add to version control --- rtl/wb2axip/sfifothresh.v | 100 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 rtl/wb2axip/sfifothresh.v (limited to 'rtl/wb2axip/sfifothresh.v') diff --git a/rtl/wb2axip/sfifothresh.v b/rtl/wb2axip/sfifothresh.v new file mode 100644 index 0000000..5d4a156 --- /dev/null +++ b/rtl/wb2axip/sfifothresh.v @@ -0,0 +1,100 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Filename: sfifothresh.v +// {{{ +// Project: WB2AXIPSP: bus bridges and other odds and ends +// +// Purpose: A synchronous data FIFO, generated from sfifo.v. This +// particular version extends the FIFO interface with a threshold +// calculator, to create an interrupt/signal when the FIFO has greater +// than the threshold elements within it. +// +// Creator: Dan Gisselquist, Ph.D. +// Gisselquist Technology, LLC +// +//////////////////////////////////////////////////////////////////////////////// +// }}} +// Copyright (C) 2019-2024, Gisselquist Technology, LLC +// {{{ +// This file is part of the WB2AXIP project. +// +// The WB2AXIP project contains free software and gateware, licensed under the +// Apache License, Version 2.0 (the "License"). You may not use this project, +// or this file, except in compliance with the License. You may obtain a copy +// of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations +// under the License. +// +//////////////////////////////////////////////////////////////////////////////// +// +// +`default_nettype none +// }}} +module sfifothresh(i_clk, i_reset, + i_wr, i_data, o_full, o_fill, + i_rd, o_data, o_empty, + i_threshold, o_int); + parameter BW=8; // Byte/data width + parameter LGFLEN=4; + parameter [0:0] OPT_ASYNC_READ = 1'b1; + localparam FLEN=(1<= i_threshold); + 2'b10: o_int <= (o_fill+1 >= i_threshold); + default: o_int <= o_fill >= i_threshold; + endcase + +`ifdef FORMAL + reg f_past_valid; + + initial f_past_valid = 0; + always @(posedge i_clk) + f_past_valid <= 1'b1; + + always @(posedge i_clk) + if (!f_past_valid || $past(i_reset)) + assert(!o_int); + else + assert(o_int == (o_fill >= $past(i_threshold))); +`endif +endmodule -- cgit v1.2.3