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

Subversion Repositories srdydrdy_lib

[/] [srdydrdy_lib/] [trunk/] [rtl/] [verilog/] [utility/] [sd_scoreboard.v] - Blame information for rev 30

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 18 ghutchis
//----------------------------------------------------------------------
2
//  Scoreboard
3
//
4
// Keeps track of data regarding N items.  Allows multiple entities
5
// to track data about a particular item.  Supports masked writes,
6
// allowing only part of a record to be updated by a particular
7
// transaction.
8
//
9
// Naming convention: c = consumer, p = producer, i = internal interface
10
//----------------------------------------------------------------------
11
//  Author: Guy Hutchison
12
//
13
// This block is uncopyrighted and released into the public domain.
14
//----------------------------------------------------------------------
15
 
16
module sd_scoreboard
17
  #(parameter width=8,
18
    parameter items=64,
19
    parameter use_txid=0,
20
    parameter use_mask=0,
21
    parameter txid_sz=2,
22 24 ghutchis
    parameter asz=6)  //log2(items))
23 18 ghutchis
  (input      clk,
24
   input      reset,
25
 
26
   input      c_srdy,
27
   output     c_drdy,
28
   input      c_req_type, // 0=read, 1=write
29
   input [txid_sz-1:0] c_txid,
30
   input [width-1:0] c_mask,
31
   input [width-1:0] c_data,
32
   input [asz-1:0]   c_itemid,
33
 
34
   output     p_srdy,
35
   input      p_drdy,
36
   output [txid_sz-1:0] p_txid,
37
   output [width-1:0]   p_data
38
   );
39
 
40 24 ghutchis
  localparam tot_in_sz = ((use_mask)?width*2:width)+
41
                         ((use_txid)?txid_sz:0)+asz+1;
42 18 ghutchis
 
43
  wire                  ip_req_type; // 0=read, 1=write
44
  wire [txid_sz-1:0]    ip_txid;
45
  wire [width-1:0]      ip_mask;
46
  wire [width-1:0]      ip_data;
47
  wire [asz-1:0]        ip_itemid;
48
  wire [txid_sz-1:0]    ic_txid;
49
  wire [width-1:0]      ic_data;
50
 
51
  /*AUTOWIRE*/
52
  // Beginning of automatic wires (for undeclared instantiated-module outputs)
53 24 ghutchis
  wire [(asz)-1:0]      addr;                   // From fsm of sd_scoreboard_fsm.v
54
  wire [(width)-1:0]    d_in;                   // From fsm of sd_scoreboard_fsm.v
55
  wire [(width)-1:0]    d_out;                  // From sb_mem of behave1p_mem.v
56 18 ghutchis
  wire                  ic_drdy;                // From outhold of sd_output.v
57
  wire                  ic_srdy;                // From fsm of sd_scoreboard_fsm.v
58
  wire                  ip_drdy;                // From fsm of sd_scoreboard_fsm.v
59
  wire                  ip_srdy;                // From inhold of sd_input.v
60
  wire                  rd_en;                  // From fsm of sd_scoreboard_fsm.v
61
  wire                  wr_en;                  // From fsm of sd_scoreboard_fsm.v
62
  // End of automatics
63
 
64 24 ghutchis
  wire [tot_in_sz-1:0]  c_hold_data, p_hold_data;
65
 
66
  generate if ((use_txid == 1) && (use_mask == 1))
67
    begin : txid_and_mask
68
      assign c_hold_data = {c_txid,c_req_type,c_itemid,c_mask,c_data};
69
      assign {ip_txid,ip_req_type,ip_itemid,ip_mask,ip_data} = p_hold_data;
70
    end
71
  else if ((use_txid == 0) && (use_mask == 1))
72
    begin : no_txid_and_mask
73
      assign c_hold_data = {c_req_type,c_itemid,c_mask,c_data};
74
      assign {ip_req_type,ip_itemid,ip_mask,ip_data} = p_hold_data;
75 30 ghutchis
      assign ip_txid = 0;
76 24 ghutchis
    end
77
  else if ((use_txid == 1) && (use_mask == 0))
78
    begin : txid_and_no_mask
79
      assign c_hold_data = {c_txid,c_req_type,c_itemid,c_data};
80
      assign {ip_txid,ip_req_type,ip_itemid,ip_data} = p_hold_data;
81 30 ghutchis
      assign ip_mask = 0;
82 24 ghutchis
    end
83
  else if ((use_txid == 0) && (use_mask == 0))
84
    begin : no_txid_no_mask
85
      assign c_hold_data = {c_req_type,c_itemid,c_data};
86
      assign {ip_req_type,ip_itemid,ip_data} = p_hold_data;
87
      assign ip_mask = 0;
88
      assign ip_txid = 0;
89
    end
90
  endgenerate
91
 
92 18 ghutchis
  sd_input #(.width(tot_in_sz)) inhold
93
    (
94 24 ghutchis
     .c_data     (c_hold_data),
95
     .ip_data    (p_hold_data),
96 18 ghutchis
     /*AUTOINST*/
97
     // Outputs
98
     .c_drdy                            (c_drdy),
99
     .ip_srdy                           (ip_srdy),
100
     // Inputs
101
     .clk                               (clk),
102
     .reset                             (reset),
103
     .c_srdy                            (c_srdy),
104
     .ip_drdy                           (ip_drdy));
105
 
106 24 ghutchis
  behave1p_mem #(.depth(items),
107
                 .addr_sz               (asz), /*AUTOINSTPARAM*/
108
                 // Parameters
109
                 .width                 (width)) sb_mem
110 18 ghutchis
    (
111
     .addr                              (addr[asz-1:0]),
112
     /*AUTOINST*/
113
     // Outputs
114 24 ghutchis
     .d_out                             (d_out[(width)-1:0]),
115 18 ghutchis
     // Inputs
116
     .wr_en                             (wr_en),
117
     .rd_en                             (rd_en),
118
     .clk                               (clk),
119 24 ghutchis
     .d_in                              (d_in[(width)-1:0]));
120 18 ghutchis
 
121 24 ghutchis
  sd_scoreboard_fsm #(/*AUTOINSTPARAM*/
122
                      // Parameters
123
                      .width            (width),
124
                      .items            (items),
125
                      .use_txid         (use_txid),
126
                      .use_mask         (use_mask),
127
                      .txid_sz          (txid_sz),
128
                      .asz              (asz)) fsm
129 18 ghutchis
    (/*AUTOINST*/
130
     // Outputs
131
     .ip_drdy                           (ip_drdy),
132
     .ic_srdy                           (ic_srdy),
133 24 ghutchis
     .ic_txid                           (ic_txid[(txid_sz)-1:0]),
134
     .ic_data                           (ic_data[(width)-1:0]),
135 18 ghutchis
     .wr_en                             (wr_en),
136
     .rd_en                             (rd_en),
137 24 ghutchis
     .d_in                              (d_in[(width)-1:0]),
138
     .addr                              (addr[(asz)-1:0]),
139 18 ghutchis
     // Inputs
140
     .clk                               (clk),
141
     .reset                             (reset),
142
     .ip_srdy                           (ip_srdy),
143
     .ip_req_type                       (ip_req_type),
144 24 ghutchis
     .ip_txid                           (ip_txid[(txid_sz)-1:0]),
145
     .ip_mask                           (ip_mask[(width)-1:0]),
146
     .ip_data                           (ip_data[(width)-1:0]),
147
     .ip_itemid                         (ip_itemid[(asz)-1:0]),
148 18 ghutchis
     .ic_drdy                           (ic_drdy),
149 24 ghutchis
     .d_out                             (d_out[(width)-1:0]));
150 18 ghutchis
 
151
  sd_output #(.width(width+txid_sz)) outhold
152
    (
153
     .p_data                            ({p_txid,p_data}),
154
     .ic_data                           ({ic_txid,ic_data}),
155
     /*AUTOINST*/
156
     // Outputs
157
     .ic_drdy                           (ic_drdy),
158
     .p_srdy                            (p_srdy),
159
     // Inputs
160
     .clk                               (clk),
161
     .reset                             (reset),
162
     .ic_srdy                           (ic_srdy),
163
     .p_drdy                            (p_drdy));
164
 
165
endmodule // sd_scoreboard
166
// Local Variables:
167
// verilog-library-directories:("." "../closure" "../memory")
168
// End:  
169
 
170 24 ghutchis
 

powered by: WebSVN 2.1.0

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