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 2

Go to most recent revision | 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     drain;  // true when data will be emptied from p_data
41
  reg     hold;   // true when data will be held in p_data
42
  reg     nxt_p_srdy;
43
 
44
  always @*
45
    begin
46
      drain = p_srdy & p_drdy;
47
      hold  = p_srdy & !p_drdy;
48
      ic_drdy = drain | !p_srdy;
49
      load  = ic_srdy & ic_drdy;
50
      nxt_p_srdy = load | hold;
51
    end
52
 
53
  always @(`SDLIB_CLOCKING)
54
    begin
55
      if (reset)
56
        begin
57
          p_srdy <= `SDLIB_DELAY 0;
58
        end
59
      else
60
        begin
61
          p_srdy <= `SDLIB_DELAY nxt_p_srdy;
62
        end // else: !if(reset)
63
    end // always @ (posedge clk)
64
 
65
  always @(posedge clk)
66
    if (load)
67
      p_data <= `SDLIB_DELAY ic_data;
68
 
69
endmodule // it_output

powered by: WebSVN 2.1.0

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