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

Subversion Repositories srdydrdy_lib

[/] [srdydrdy_lib/] [trunk/] [rtl/] [verilog/] [closure/] [sd_iohalf.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ghutchis
//----------------------------------------------------------------------
2
// Srdy/Drdy input/output block
3
//
4
// Halts timing on all signals.  Efficiency of block is only 0.5, so
5
// it can produce data at most on every other cycle.
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_iohalf
26
  #(parameter width = 8)
27
  (
28
   input              clk,
29
   input              reset,
30
   input              c_srdy,
31
   output             c_drdy,
32
   input [width-1:0]  c_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
      load  = c_srdy & !p_srdy;
45
      nxt_p_srdy = (p_srdy & !p_drdy) | (!p_srdy & c_srdy);
46
    end
47
  assign c_drdy = ~p_srdy;
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 c_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.