OpenCores
URL https://opencores.org/ocsvn/qaz_libs/qaz_libs/trunk

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [basal/] [src/] [FIFOs/] [CummingsSNUG2002SJ_FIFO1/] [wptr_full.v] - Blame information for rev 47

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 34 qaztronic
// --------------------------------------------------------------------
2
//
3
 
4
 
5
module
6
  wptr_full
7
  #(
8
    parameter ADDRSIZE = 4
9
  )
10
  (
11
    output reg                  wfull,
12
    output      [ADDRSIZE-1:0]  waddr,
13
    output reg  [ADDRSIZE :0]   wptr,
14
    input       [ADDRSIZE :0]   wq2_rptr,
15
    input                       winc,
16
    input                       wclk,
17
    input                       wrst_n
18
  );
19
 
20
  reg [ADDRSIZE:0] wbin;
21
  wire [ADDRSIZE:0] wgraynext, wbinnext;
22
 
23
  // GRAYSTYLE2 pointer
24
  always @(posedge wclk or negedge wrst_n)
25
    if(!wrst_n)
26
      {wbin, wptr} <= 0;
27
    else
28
      {wbin, wptr} <= {wbinnext, wgraynext};
29
 
30
  // Memory write-address pointer (okay to use binary to address memory)
31
  assign waddr = wbin[ADDRSIZE-1:0];
32
  assign wbinnext = wbin + (winc & ~wfull);
33
  assign wgraynext = (wbinnext>>1) ^ wbinnext;
34
 
35
  //------------------------------------------------------------------
36
  // Simplified version of the three necessary full-tests:
37
  // assign wfull_val=((wgnext[ADDRSIZE] !=wq2_rptr[ADDRSIZE] ) &&
38
  // (wgnext[ADDRSIZE-1] !=wq2_rptr[ADDRSIZE-1]) &&
39
  // (wgnext[ADDRSIZE-2:0]==wq2_rptr[ADDRSIZE-2:0]));
40
  //------------------------------------------------------------------
41
  assign wfull_val = (wgraynext == {~wq2_rptr[ADDRSIZE:ADDRSIZE-1], wq2_rptr[ADDRSIZE-2:0]});
42
 
43
  always @(posedge wclk or negedge wrst_n)
44
    if(!wrst_n)
45
      wfull <= 1'b0;
46
    else
47
      wfull <= wfull_val;
48
 
49
endmodule
50
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.