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 13

Go to most recent revision | 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
    parameter asz=$clog2(depth)
29
    )
30
    (
31
     input       clk,
32
     input       reset,
33
 
34
     input       c_srdy,
35
     output      c_drdy,
36
     input       c_commit,
37
     input       c_abort,
38
     input [width-1:0] c_data,
39
 
40
     output      p_srdy,
41
     input       p_drdy,
42
     input       p_commit,
43
     input       p_abort,
44
     output [width-1:0] p_data,
45
 
46
     output [asz:0] usage
47
     );
48
 
49
  wire [asz-1:0] com_rdptr;              // From tail of sd_fifo_tail_b.v
50
  wire [asz-1:0] com_wrptr;              // From head of sd_fifo_head_b.v
51
  wire [asz-1:0] cur_rdptr;              // From tail of sd_fifo_tail_b.v
52
  wire [asz-1:0] cur_wrptr;              // From head of sd_fifo_head_b.v
53
  wire [width-1:0]       mem_rd_data;
54
  wire                  mem_re;                 // From tail of sd_fifo_tail_b.v
55
  wire                  mem_we;                 // From head of sd_fifo_head_b.v
56
  wire [asz:0]           usage;                  // From tail of sd_fifo_tail_b.v
57
  wire [asz-1:0]         bound_high;
58
 
59
  assign bound_high = depth-1;
60
 
61
  sd_fifo_head_b #(depth, wr_commit) head
62
    (
63
     // Outputs
64
     .c_drdy                            (c_drdy),
65
     .cur_wrptr                         (cur_wrptr[asz-1:0]),
66
     .com_wrptr                         (com_wrptr[asz-1:0]),
67
     .mem_we                            (mem_we),
68
     // Inputs
69
     .clk                               (clk),
70
     .reset                             (reset),
71
     .enable                            (1'b1),
72
     .c_commit                          (c_commit),
73
     .c_abort                           (c_abort),
74
     .c_srdy                            (c_srdy),
75
     .bound_low                         (0),
76
     .bound_high                        (bound_high),
77
     .rdptr                             (com_rdptr));
78
 
79
  behave2p_mem #(width, depth) mem
80
    (
81
     // Outputs
82
     .d_out                             (mem_rd_data),
83
     // Inputs
84
     .wr_en                             (mem_we),
85
     .rd_en                             (mem_re),
86
     .wr_clk                            (clk),
87
     .rd_clk                            (clk),
88
     .d_in                              (c_data),
89
     .rd_addr                           (cur_rdptr),
90
     .wr_addr                           (cur_wrptr));
91
 
92
  sd_fifo_tail_b #(width, depth, rd_commit) tail
93
    (
94
     // Outputs
95
     .cur_rdptr                         (cur_rdptr[asz-1:0]),
96
     .com_rdptr                         (com_rdptr[asz-1:0]),
97
     .mem_re                            (mem_re),
98
     .usage                             (usage[asz:0]),
99
     .p_srdy                            (p_srdy),
100
     .p_data                            (p_data[width-1:0]),
101
     // Inputs
102
     .clk                               (clk),
103
     .reset                             (reset),
104
     .enable                            (1'b1),
105
     .bound_low                         (0),
106 13 ghutchis
     .mem_we                            (mem_we),
107 6 ghutchis
     .bound_high                        (bound_high),
108
     .wrptr                             (com_wrptr),
109
     .p_drdy                            (p_drdy),
110
     .p_commit                          (p_commit),
111
     .p_abort                           (p_abort),
112
     .mem_rd_data                       (mem_rd_data[width-1:0]));
113
 
114
endmodule // sd_fifo_b
115
// Local Variables:
116
// verilog-library-directories:("." "../memory" )
117
// End:  

powered by: WebSVN 2.1.0

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