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:12 mihad
|
// Revision 1.6 2002/11/27 20:36:12 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 233... |
Line 236... |
Gray coded write address pointer is synchronized to read clock domain and compared to Gray coded read address pointer.
|
Gray coded write address pointer is synchronized to read clock domain and compared to Gray coded read address pointer.
|
If they are equal, fifo is empty.
|
If they are equal, fifo is empty.
|
--------------------------------------------------------------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------------------------------------------------------------*/
|
wire [(ADDR_LENGTH - 1):0] rclk_sync_wgrey_addr ;
|
wire [(ADDR_LENGTH - 1):0] rclk_sync_wgrey_addr ;
|
reg [(ADDR_LENGTH - 1):0] rclk_wgrey_addr ;
|
reg [(ADDR_LENGTH - 1):0] rclk_wgrey_addr ;
|
synchronizer_flop #(ADDR_LENGTH) i_synchronizer_reg_wgrey_addr
|
synchronizer_flop #(ADDR_LENGTH, 0) i_synchronizer_reg_wgrey_addr
|
(
|
(
|
.data_in (wgrey_addr),
|
.data_in (wgrey_addr),
|
.clk_out (rclock_in),
|
.clk_out (rclock_in),
|
.sync_data_out (rclk_sync_wgrey_addr),
|
.sync_data_out (rclk_sync_wgrey_addr),
|
.async_reset (1'b0)
|
.async_reset (clear)
|
) ;
|
) ;
|
|
|
always@(posedge rclock_in)
|
always@(posedge rclock_in or posedge clear)
|
begin
|
begin
|
|
if (clear)
|
|
rclk_wgrey_addr <= #`FF_DELAY 0 ;
|
|
else
|
rclk_wgrey_addr <= #`FF_DELAY rclk_sync_wgrey_addr ;
|
rclk_wgrey_addr <= #`FF_DELAY rclk_sync_wgrey_addr ;
|
end
|
end
|
|
|
assign empty = (rgrey_addr == rclk_wgrey_addr) ;
|
assign empty = (rgrey_addr == rclk_wgrey_addr) ;
|
endmodule
|
endmodule
|