3 * Copyright (C) 2003 Matt Ettus
4 * Copyright (C) 2007 Corgan Enterprises LLC
6 * GNU Radio is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3, or (at your option)
11 * GNU Radio is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Radio; see the file COPYING. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street,
19 * Boston, MA 02110-1301, USA.
22 // Model of Altera FIFO with common clock domain
24 module fifo_1clk(data, wrreq, rdreq, clock, sclr, q,
28 parameter depth = 4096;
29 //`define rd_req 0; // Set this to 0 for rd_ack, 1 for rd_req
41 reg [width-1:0] mem [0:depth-1];
59 for(i=0;i<depth;i=i+1)
63 always @(posedge clock)
67 mem[wrptr] <= #1 data;
70 always @(posedge clock)
81 assign q = mem[rdptr];
84 always @(posedge clock)
85 usedw <= #1 wrptr - rdptr;
87 assign empty = (wrptr == rdptr);