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

Subversion Repositories srdydrdy_lib

[/] [srdydrdy_lib/] [trunk/] [rtl/] [verilog/] [closure/] [sd_output.v] - Blame information for rev 30

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ghutchis
//----------------------------------------------------------------------
2
// Srdy/Drdy output block
3
//
4
// Halts timing on all signals except ic_drdy
5
// ic_drdy is a combinatorial path from p_drdy
6
//
7
// Naming convention: c = consumer, p = producer, i = internal interface
8
//----------------------------------------------------------------------
9
// Author: Guy Hutchison
10
//
11
// This block is uncopyrighted and released into the public domain.
12
//----------------------------------------------------------------------
13
 
14
// Clocking statement for synchronous blocks.  Default is for
15
// posedge clocking and positive async reset
16
`ifndef SDLIB_CLOCKING
17
 `define SDLIB_CLOCKING posedge clk or posedge reset
18
`endif
19
 
20
// delay unit for nonblocking assigns, default is to #1
21
`ifndef SDLIB_DELAY
22
 `define SDLIB_DELAY #1
23
`endif
24
 
25
module sd_output
26
  #(parameter width = 8)
27
  (
28
   input              clk,
29
   input              reset,
30
   input              ic_srdy,
31
   output reg         ic_drdy,
32
   input [width-1:0]  ic_data,
33
 
34
   output reg         p_srdy,
35
   input              p_drdy,
36
   output reg [width-1:0] p_data
37
   );
38
 
39
  reg     load;   // true when data will be loaded into p_data
40
  reg     nxt_p_srdy;
41
 
42
  always @*
43
    begin
44 30 ghutchis
      ic_drdy = p_drdy | !p_srdy;
45 2 ghutchis
      load  = ic_srdy & ic_drdy;
46 30 ghutchis
      nxt_p_srdy = load | (p_srdy & !p_drdy);
47 2 ghutchis
    end
48
 
49
  always @(`SDLIB_CLOCKING)
50
    begin
51
      if (reset)
52
        begin
53
          p_srdy <= `SDLIB_DELAY 0;
54
        end
55
      else
56
        begin
57
          p_srdy <= `SDLIB_DELAY nxt_p_srdy;
58
        end // else: !if(reset)
59
    end // always @ (posedge clk)
60
 
61
  always @(posedge clk)
62
    if (load)
63
      p_data <= `SDLIB_DELAY ic_data;
64
 
65
endmodule // it_output

powered by: WebSVN 2.1.0

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