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

Subversion Repositories srdydrdy_lib

[/] [srdydrdy_lib/] [trunk/] [rtl/] [verilog/] [utility/] [sd_ring_node.v] - Blame information for rev 26

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

Line No. Rev Author Line
1 18 ghutchis
//----------------------------------------------------------------------
2
// Single Cycle RING Node [sd_ring_node]
3
//
4
// Halts timing on all interfaces, no combinational passthrough
5
// Inputs are used unregistered
6
// All outputs are registered
7
// Four Interfaces
8
//   RP -> Ring Previous : Ring data arrives on this interface
9
//   RP -> Ring Next : Ring Data leaves on this interface 
10
//   P  -> Producer : Destination offload interface
11
//   C  -> Consumer : Data Injection Interface
12
//----------------------------------------------------------------------
13
//
14
//  Author: Awais Nemat
15
//
16
// This block is uncopyrighted and released into the public domain.
17
//----------------------------------------------------------------------
18
 
19
module sd_ring_node
20
  #(parameter data_width = 8,
21
    parameter addr_width = 8,
22
    parameter my_addr    = 8'h1)
23
  (
24
   input                   clk,
25
   input                   reset,
26
 
27
   input                   rp_srdy,
28
   output                  rp_drdy,
29
   input [data_width-1:0]  rp_data,
30
   input [addr_width-1:0]  rp_addr,
31
 
32
   output                  rn_srdy,
33
   input                   rn_drdy,
34
   output [data_width-1:0] rn_data,
35
   output [addr_width-1:0] rn_addr,
36
 
37
   input                   c_srdy,
38
   output                  c_drdy,
39
   input [data_width-1:0]  c_data,
40
   input [addr_width-1:0]  c_addr,
41
 
42
   output                  p_srdy,
43
   input                   p_drdy,
44
   output [data_width-1:0] p_data,
45
   output [addr_width-1:0] p_addr
46
  );
47
 
48
  // All Combinational Signals
49
  // reg's  are functions of other signals
50
  // NOT registered though
51
 
52
  wire                     rp_srdy_o;
53
  reg                      rp_drdy_i;
54
  wire [data_width-1:0]    rp_data_o;
55
  wire [addr_width-1:0]    rp_addr_o;
56
 
57
  reg                      rn_srdy_i;
58
  wire                     rn_drdy_o;
59
 
60
  wire                     s_srdy_o;
61
  reg                      s_drdy_i;
62
  wire [data_width-1:0]    s_data_o;
63
  wire [addr_width-1:0]    s_addr_o;
64
 
65
  reg                      d_srdy_i;
66
  wire                     d_drdy_o;
67
  wire [data_width-1:0]    d_data_i = rp_data_o;
68
  wire [addr_width-1:0]    d_addr_i = rp_addr_o;
69
 
70
  reg                      d; // Asserted if address matches
71
  reg [data_width-1:0]     data_o; // Mux Selected Data,  S:RP  
72
  reg [addr_width-1:0]     addr_o; // Mux Selected Adda,  S:RP
73
 
74
  always @*
75
    begin
76
      // Compute if this module is the Destination
77
      d = rp_srdy_o & (rp_addr_o == my_addr);
78
 
79
      // Pop data from RP destined to this instance when space is available in 'D'
80
      // OR when not destined to this instance and space is available in RN 
81
      rp_drdy_i = (d) ? d_drdy_o : rn_drdy_o ;
82
 
83
      // Indicate data availability to RN, when S has data OR when RP has 
84
      // data that is NOT Destined to D
85
      rn_srdy_i = s_srdy_o | (rp_srdy_o & ~d);
86
 
87
      // Indicate data availability to D, when it becomes available in RP
88
      // and it is destined to this instance
89
      d_srdy_i  = rp_srdy_o & d;
90
 
91
      // Indicate space availability to S, when it becomes available is RN
92
      // and there is not Data in RP that needs to be passed on to RN. 
93
 
94
      if ( d & rp_srdy_o & rn_drdy_o ) s_drdy_i = 1;
95
      // Exception: When data in RP is destined  to this instance and 
96
      // space in RN is available, S could transmit to RN
97
      else if ( rp_srdy_o & rn_drdy_o ) s_drdy_i = 0;
98
      // When Data is present in RP and is NOT destined to this instance
99
      // S cannot transmit to RN. RP has absolute priority over S
100
      else if (rn_drdy_o) s_drdy_i = 1;
101
      // No Data is Present in RP and RN has space, S could transmit
102
      else s_drdy_i = 0;
103
      // this is the default behaviour <MAY CHANGE; DEADLOCK?>
104
 
105
      // Mux the Data and the Address
106
      data_o = (s_drdy_i) ? s_data_o : rp_data_o;
107
      addr_o = (s_drdy_i) ? s_addr_o : rp_addr_o;
108
 
109
    end
110
 
111
  // Instantiate the primitives
112
 
113
  sd_output #(.width  (data_width+addr_width))
114
  RN_i0 (.clk(clk),
115
         .reset (reset),
116
         .srdy_in(rn_srdy_i),
117
         .drdy_in(rn_drdy_o),
118
         .data_in({addr_o,data_o}),
119
         .srdy_out(rn_srdy),
120
         .drdy_out(rn_drdy),
121
         .data_out({rn_addr,rn_data}));
122
 
123
  sd_output #(.width  (data_width+addr_width))
124
  D_i0 (.clk(clk),
125
        .reset (reset),
126
        .srdy_in(d_srdy_i),
127
        .drdy_in(d_drdy_o),
128
        .data_in({d_addr_i,d_data_i}),
129
        .srdy_out(p_srdy),
130
        .drdy_out(p_drdy),
131
        .data_out({p_addr,p_data}));
132
 
133
  sd_input  #(.width  (data_width+addr_width))
134
  RP_i0 (.clk(clk),
135
         .reset (reset),
136
         .srdy_in(rp_srdy),
137
         .drdy_in(rp_drdy),
138
         .data_in({rp_addr,rp_data}),
139
         .srdy_out(rp_srdy_o),
140
         .drdy_out(rp_drdy_i),
141
         .data_out({rp_addr_o,rp_data_o}));
142
 
143
  sd_input  #(.width  (data_width+addr_width))
144
  S_i0 (.clk(clk),
145
        .reset (reset),
146
        .srdy_in(c_srdy),
147
        .drdy_in(c_drdy),
148
        .data_in({c_addr,c_data}),
149
        .srdy_out(s_srdy_o),
150
        .drdy_out(s_drdy_i),
151
        .data_out({s_addr_o,s_data_o}));
152
 
153
endmodule

powered by: WebSVN 2.1.0

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