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

Subversion Repositories srdydrdy_lib

[/] [srdydrdy_lib/] [trunk/] [rtl/] [verilog/] [buffers/] [sd_fifo_b.v] - Blame information for rev 19

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 ghutchis
//----------------------------------------------------------------------
2
// Srdy/Drdy FIFO "B"
3
//
4
// The "B" (big) FIFO is design for larger FIFOs
5
// based around memories, with sizes that may not be a power of 2.
6
//
7
// The bound inputs allow multiple FIFO controllers to share a single
8
// memory.  The enable input is for arbitration between multiple FIFO
9
// controllers, or between the fifo head and tail controllers on a
10
// single port memory.
11
//
12
// The commit parameter enables write/commit behavior.  This creates
13
// two write pointers, one which is used for writing to memory and
14
// a commit pointer which is sent to the tail block.
15
//
16
// Naming convention: c = consumer, p = producer, i = internal interface
17
//----------------------------------------------------------------------
18
// Author: Guy Hutchison
19
//
20
// This block is uncopyrighted and released into the public domain.
21
//----------------------------------------------------------------------
22
 
23
module sd_fifo_b
24
  #(parameter width=8,
25
    parameter depth=256,
26
    parameter rd_commit=0,
27
    parameter wr_commit=0,
28 19 ghutchis
    parameter asz=$clog2(depth),
29
    parameter usz=$clog2(depth+1)
30 6 ghutchis
    )
31
    (
32
     input       clk,
33
     input       reset,
34
 
35
     input       c_srdy,
36
     output      c_drdy,
37
     input       c_commit,
38
     input       c_abort,
39
     input [width-1:0] c_data,
40
 
41
     output      p_srdy,
42
     input       p_drdy,
43
     input       p_commit,
44
     input       p_abort,
45
     output [width-1:0] p_data,
46
 
47 19 ghutchis
     output [usz-1:0] p_usage,
48
     output [usz-1:0] c_usage
49 6 ghutchis
     );
50
 
51
  wire [asz-1:0] com_rdptr;              // From tail of sd_fifo_tail_b.v
52
  wire [asz-1:0] com_wrptr;              // From head of sd_fifo_head_b.v
53
  wire [asz-1:0] cur_rdptr;              // From tail of sd_fifo_tail_b.v
54
  wire [asz-1:0] cur_wrptr;              // From head of sd_fifo_head_b.v
55
  wire [width-1:0]       mem_rd_data;
56
  wire                  mem_re;                 // From tail of sd_fifo_tail_b.v
57
  wire                  mem_we;                 // From head of sd_fifo_head_b.v
58
  wire [asz-1:0]         bound_high;
59
 
60
  assign bound_high = depth-1;
61
 
62
  sd_fifo_head_b #(depth, wr_commit) head
63
    (
64
     // Outputs
65
     .c_drdy                            (c_drdy),
66
     .cur_wrptr                         (cur_wrptr[asz-1:0]),
67
     .com_wrptr                         (com_wrptr[asz-1:0]),
68
     .mem_we                            (mem_we),
69 16 ghutchis
     .c_usage                           (c_usage),
70 6 ghutchis
     // Inputs
71
     .clk                               (clk),
72
     .reset                             (reset),
73
     .enable                            (1'b1),
74
     .c_commit                          (c_commit),
75
     .c_abort                           (c_abort),
76
     .c_srdy                            (c_srdy),
77
     .bound_low                         (0),
78
     .bound_high                        (bound_high),
79
     .rdptr                             (com_rdptr));
80
 
81
  behave2p_mem #(width, depth) mem
82
    (
83
     // Outputs
84
     .d_out                             (mem_rd_data),
85
     // Inputs
86
     .wr_en                             (mem_we),
87
     .rd_en                             (mem_re),
88
     .wr_clk                            (clk),
89
     .rd_clk                            (clk),
90
     .d_in                              (c_data),
91
     .rd_addr                           (cur_rdptr),
92
     .wr_addr                           (cur_wrptr));
93
 
94
  sd_fifo_tail_b #(width, depth, rd_commit) tail
95
    (
96
     // Outputs
97
     .cur_rdptr                         (cur_rdptr[asz-1:0]),
98
     .com_rdptr                         (com_rdptr[asz-1:0]),
99
     .mem_re                            (mem_re),
100 16 ghutchis
     .p_usage                           (p_usage[asz:0]),
101 6 ghutchis
     .p_srdy                            (p_srdy),
102
     .p_data                            (p_data[width-1:0]),
103
     // Inputs
104
     .clk                               (clk),
105
     .reset                             (reset),
106
     .enable                            (1'b1),
107
     .bound_low                         (0),
108 13 ghutchis
     .mem_we                            (mem_we),
109 6 ghutchis
     .bound_high                        (bound_high),
110
     .wrptr                             (com_wrptr),
111
     .p_drdy                            (p_drdy),
112
     .p_commit                          (p_commit),
113
     .p_abort                           (p_abort),
114
     .mem_rd_data                       (mem_rd_data[width-1:0]));
115
 
116
endmodule // sd_fifo_b
117
// Local Variables:
118
// verilog-library-directories:("." "../memory" )
119
// End:  

powered by: WebSVN 2.1.0

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