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

Subversion Repositories srdydrdy_lib

[/] [srdydrdy_lib/] [trunk/] [rtl/] [verilog/] [closure/] [sd_output.v] - Diff between revs 2 and 30

Only display areas with differences | Details | Blame | View Log

Rev 2 Rev 30
//----------------------------------------------------------------------
//----------------------------------------------------------------------
// Srdy/Drdy output block
// Srdy/Drdy output block
//
//
// Halts timing on all signals except ic_drdy
// Halts timing on all signals except ic_drdy
// ic_drdy is a combinatorial path from p_drdy
// ic_drdy is a combinatorial path from p_drdy
//
//
// Naming convention: c = consumer, p = producer, i = internal interface
// Naming convention: c = consumer, p = producer, i = internal interface
//----------------------------------------------------------------------
//----------------------------------------------------------------------
// Author: Guy Hutchison
// Author: Guy Hutchison
//
//
// This block is uncopyrighted and released into the public domain.
// This block is uncopyrighted and released into the public domain.
//----------------------------------------------------------------------
//----------------------------------------------------------------------
 
 
// Clocking statement for synchronous blocks.  Default is for
// Clocking statement for synchronous blocks.  Default is for
// posedge clocking and positive async reset
// posedge clocking and positive async reset
`ifndef SDLIB_CLOCKING
`ifndef SDLIB_CLOCKING
 `define SDLIB_CLOCKING posedge clk or posedge reset
 `define SDLIB_CLOCKING posedge clk or posedge reset
`endif
`endif
 
 
// delay unit for nonblocking assigns, default is to #1
// delay unit for nonblocking assigns, default is to #1
`ifndef SDLIB_DELAY
`ifndef SDLIB_DELAY
 `define SDLIB_DELAY #1
 `define SDLIB_DELAY #1
`endif
`endif
 
 
module sd_output
module sd_output
  #(parameter width = 8)
  #(parameter width = 8)
  (
  (
   input              clk,
   input              clk,
   input              reset,
   input              reset,
   input              ic_srdy,
   input              ic_srdy,
   output reg         ic_drdy,
   output reg         ic_drdy,
   input [width-1:0]  ic_data,
   input [width-1:0]  ic_data,
 
 
   output reg         p_srdy,
   output reg         p_srdy,
   input              p_drdy,
   input              p_drdy,
   output reg [width-1:0] p_data
   output reg [width-1:0] p_data
   );
   );
 
 
  reg     load;   // true when data will be loaded into p_data
  reg     load;   // true when data will be loaded into p_data
  reg     drain;  // true when data will be emptied from p_data
 
  reg     hold;   // true when data will be held in p_data
 
  reg     nxt_p_srdy;
  reg     nxt_p_srdy;
 
 
  always @*
  always @*
    begin
    begin
      drain = p_srdy & p_drdy;
      ic_drdy = p_drdy | !p_srdy;
      hold  = p_srdy & !p_drdy;
 
      ic_drdy = drain | !p_srdy;
 
      load  = ic_srdy & ic_drdy;
      load  = ic_srdy & ic_drdy;
      nxt_p_srdy = load | hold;
      nxt_p_srdy = load | (p_srdy & !p_drdy);
    end
    end
 
 
  always @(`SDLIB_CLOCKING)
  always @(`SDLIB_CLOCKING)
    begin
    begin
      if (reset)
      if (reset)
        begin
        begin
          p_srdy <= `SDLIB_DELAY 0;
          p_srdy <= `SDLIB_DELAY 0;
        end
        end
      else
      else
        begin
        begin
          p_srdy <= `SDLIB_DELAY nxt_p_srdy;
          p_srdy <= `SDLIB_DELAY nxt_p_srdy;
        end // else: !if(reset)
        end // else: !if(reset)
    end // always @ (posedge clk)
    end // always @ (posedge clk)
 
 
  always @(posedge clk)
  always @(posedge clk)
    if (load)
    if (load)
      p_data <= `SDLIB_DELAY ic_data;
      p_data <= `SDLIB_DELAY ic_data;
 
 
endmodule // it_output
endmodule // it_output
 
 

powered by: WebSVN 2.1.0

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