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

Subversion Repositories srdydrdy_lib

[/] [srdydrdy_lib/] [trunk/] [rtl/] [verilog/] [forks/] [sd_ajoin2.v] - Diff between revs 18 and 30

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

Rev 18 Rev 30
//----------------------------------------------------------------------
//----------------------------------------------------------------------
//  Srdy/drdy assymetric join
//  Srdy/drdy assymetric join
//
//
//  Performs assymetric join of 2 inputs by concatination.  Efficiency
//  Performs assymetric join of 2 inputs by concatination.  Efficiency
//  of 0.5.
//  of 0.5.
//
//
// 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_ajoin2
module sd_ajoin2
  #(parameter c1_width=8,
  #(parameter c1_width=8,
    parameter c2_width=8)
    parameter c2_width=8)
  (
  (
   input              clk;
   input              clk,
   input              reset,
   input              reset,
 
 
   input              c1_srdy,
   input              c1_srdy,
   output             c1_drdy,
   output             c1_drdy,
   input [c1_width-1:0] c1_data,
   input [c1_width-1:0] c1_data,
 
 
   input              c2_srdy,
   input              c2_srdy,
   output             c2_drdy,
   output             c2_drdy,
   input [c2_width-1:0] c2_data,
   input [c2_width-1:0] c2_data,
 
 
   output             p_srdy,
   output             p_srdy,
 
 
   input              p_drdy,
   input              p_drdy,
   output reg [c1_width+c2_width-1:0] p_data
   output reg [c1_width+c2_width-1:0] p_data
   );
   );
  reg [c1_width+c2_width-1:0]    nxt_p_data;
  reg [c1_width+c2_width-1:0]    nxt_p_data;
 
 
  reg [1:0]          in_drdy, nxt_in_drdy;
  reg [1:0]          in_drdy, nxt_in_drdy;
 
 
  assign             {c2_drdy,c1_drdy} = in_drdy;
  assign             {c2_drdy,c1_drdy} = in_drdy;
 
 
  always @*
  always @*
    begin
    begin
      nxt_p_data = p_data;
      nxt_p_data = p_data;
      nxt_in_drdy = in_drdy;
      nxt_in_drdy = in_drdy;
 
 
      if (in_drdy[0])
      if (in_drdy[0])
        begin
        begin
          if (c1_srdy)
          if (c1_srdy)
            begin
            begin
              nxt_in_drdy[0] = 0;
              nxt_in_drdy[0] = 0;
              nxt_p_data[c1_width-1:0] = c1_data;
              nxt_p_data[c1_width-1:0] = c1_data;
            end
            end
        end
        end
      else if (p_srdy & p_drdy)
      else if (p_srdy & p_drdy)
        nxt_in_drdy[0] = 1;
        nxt_in_drdy[0] = 1;
 
 
      if (in_drdy[1])
      if (in_drdy[1])
        begin
        begin
          if (c2_srdy)
          if (c2_srdy)
            begin
            begin
              nxt_in_drdy[1] = 0;
              nxt_in_drdy[1] = 0;
              nxt_p_data[c2_width+c1_width-1:c1_width] = c2_data;
              nxt_p_data[c2_width+c1_width-1:c1_width] = c2_data;
            end
            end
        end
        end
      else if (p_srdy & p_drdy)
      else if (p_srdy & p_drdy)
        nxt_in_drdy[1] = 1;
        nxt_in_drdy[1] = 1;
    end
    end
 
 
  always @(`SDLIB_CLOCKING)
  always @(`SDLIB_CLOCKING)
    begin
    begin
      if (reset)
      if (reset)
        begin
        begin
          in_drdy  <= `SDLIB_DELAY 2'b11;
          in_drdy  <= `SDLIB_DELAY 2'b11;
          p_data <= `SDLIB_DELAY 0;
          p_data <= `SDLIB_DELAY 0;
        end
        end
      else
      else
        begin
        begin
          in_drdy  <= `SDLIB_DELAY nxt_in_drdy;
          in_drdy  <= `SDLIB_DELAY nxt_in_drdy;
          p_data <= `SDLIB_DELAY nxt_p_data;
          p_data <= `SDLIB_DELAY nxt_p_data;
        end // else: !if(reset)
        end // else: !if(reset)
    end // always @ (posedge clk)
    end // always @ (posedge clk)
 
 
  assign p_srdy = & (~in_drdy);
  assign p_srdy = & (~in_drdy);
 
 
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.