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

Subversion Repositories pci

[/] [pci/] [tags/] [rel_11/] [rtl/] [verilog/] [pci_wbw_fifo_control.v] - Diff between revs 77 and 88

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 77 Rev 88
Line 40... Line 40...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.1  2003/01/27 16:49:31  mihad
 
// Changed module and file names. Updated scripts accordingly. FIFO synchronizations changed.
 
//
// Revision 1.6  2002/11/27 20:36:13  mihad
// Revision 1.6  2002/11/27 20:36:13  mihad
// Changed the code a bit to make it more readable.
// Changed the code a bit to make it more readable.
// Functionality not changed in any way.
// Functionality not changed in any way.
// More robust synchronization in fifos is still pending.
// More robust synchronization in fifos is still pending.
//
//
Line 258... Line 261...
wire [(ADDR_LENGTH - 1):0] wclk_sync_rgrey_addr ;
wire [(ADDR_LENGTH - 1):0] wclk_sync_rgrey_addr ;
reg  [(ADDR_LENGTH - 1):0] wclk_rgrey_addr ;
reg  [(ADDR_LENGTH - 1):0] wclk_rgrey_addr ;
wire [(ADDR_LENGTH - 1):0] wclk_sync_rgrey_minus1 ;
wire [(ADDR_LENGTH - 1):0] wclk_sync_rgrey_minus1 ;
reg  [(ADDR_LENGTH - 1):0] wclk_rgrey_minus1 ;
reg  [(ADDR_LENGTH - 1):0] wclk_rgrey_minus1 ;
 
 
synchronizer_flop #(2 * ADDR_LENGTH) i_synchronizer_reg_rgrey_addr
synchronizer_flop #(ADDR_LENGTH, 1) i_synchronizer_reg_rgrey_addr
 
(
 
    .data_in        (rgrey_addr),
 
    .clk_out        (wclock_in),
 
    .sync_data_out  (wclk_sync_rgrey_addr),
 
    .async_reset    (clear)
 
) ;
 
 
 
synchronizer_flop #(ADDR_LENGTH, 0) i_synchronizer_reg_rgrey_minus1
(
(
    .data_in        ({rgrey_addr, rgrey_minus1}),
    .data_in        (rgrey_minus1),
    .clk_out        (wclock_in),
    .clk_out        (wclock_in),
    .sync_data_out  ({wclk_sync_rgrey_addr, wclk_sync_rgrey_minus1}),
    .sync_data_out  (wclk_sync_rgrey_minus1),
    .async_reset    (1'b0)
    .async_reset    (clear)
) ;
) ;
 
 
always@(posedge wclock_in)
always@(posedge wclock_in or posedge clear)
 
begin
 
    if (clear)
 
    begin
 
        wclk_rgrey_addr   <= #`FF_DELAY 1 ;
 
        wclk_rgrey_minus1 <= #`FF_DELAY 0 ;
 
    end
 
    else
begin
begin
    wclk_rgrey_addr   <= #`FF_DELAY wclk_sync_rgrey_addr ;
    wclk_rgrey_addr   <= #`FF_DELAY wclk_sync_rgrey_addr ;
    wclk_rgrey_minus1 <= #`FF_DELAY wclk_sync_rgrey_minus1 ;
    wclk_rgrey_minus1 <= #`FF_DELAY wclk_sync_rgrey_minus1 ;
end
end
 
end
 
 
assign full         = (wgrey_next == wclk_rgrey_addr) ;
assign full         = (wgrey_next == wclk_rgrey_addr) ;
assign almost_full  = (wgrey_next == wclk_rgrey_minus1) ;
assign almost_full  = (wgrey_next == wclk_rgrey_minus1) ;
 
 
/*------------------------------------------------------------------------------------------------------------------------------
/*------------------------------------------------------------------------------------------------------------------------------
Line 282... Line 301...
Gray coded address of next write address is synchronized to read clock domain and compared to Gray coded next read address.
Gray coded address of next write address is synchronized to read clock domain and compared to Gray coded next read address.
If they are equal, fifo is empty.
If they are equal, fifo is empty.
--------------------------------------------------------------------------------------------------------------------------------*/
--------------------------------------------------------------------------------------------------------------------------------*/
wire [(ADDR_LENGTH - 1):0] rclk_sync_wgrey_next ;
wire [(ADDR_LENGTH - 1):0] rclk_sync_wgrey_next ;
reg  [(ADDR_LENGTH - 1):0] rclk_wgrey_next ;
reg  [(ADDR_LENGTH - 1):0] rclk_wgrey_next ;
synchronizer_flop #(ADDR_LENGTH) i_synchronizer_reg_wgrey_next
synchronizer_flop #(ADDR_LENGTH, 3) i_synchronizer_reg_wgrey_next
(
(
    .data_in        (wgrey_next),
    .data_in        (wgrey_next),
    .clk_out        (rclock_in),
    .clk_out        (rclock_in),
    .sync_data_out  (rclk_sync_wgrey_next),
    .sync_data_out  (rclk_sync_wgrey_next),
    .async_reset    (1'b0)
    .async_reset    (clear)
) ;
) ;
 
 
always@(posedge rclock_in)
always@(posedge rclock_in or posedge clear)
begin
begin
 
    if (clear)
 
        rclk_wgrey_next <= #`FF_DELAY 3 ;
 
    else
    rclk_wgrey_next <= #`FF_DELAY rclk_sync_wgrey_next ;
    rclk_wgrey_next <= #`FF_DELAY rclk_sync_wgrey_next ;
end
end
 
 
assign empty = (rgrey_next == rclk_wgrey_next) ;
assign empty = (rgrey_next == rclk_wgrey_next) ;
 
 

powered by: WebSVN 2.1.0

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