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

Subversion Repositories pci

[/] [pci/] [tags/] [rel_3/] [rtl/] [verilog/] [wbr_fifo_control.v] - Diff between revs 58 and 59

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

Rev 58 Rev 59
Line 40... Line 40...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.4  2002/09/25 15:53:52  mihad
 
// Removed all logic from asynchronous reset network
 
//
// Revision 1.3  2002/02/01 15:25:13  mihad
// Revision 1.3  2002/02/01 15:25:13  mihad
// Repaired a few bugs, updated specification, added test bench files and design document
// Repaired a few bugs, updated specification, added test bench files and design document
//
//
// Revision 1.2  2001/10/05 08:14:30  mihad
// Revision 1.2  2001/10/05 08:14:30  mihad
// Updated all files with inclusion of timescale file for simulation purposes.
// Updated all files with inclusion of timescale file for simulation purposes.
Line 120... Line 123...
 
 
// next read gray address calculation - bitwise xor between address and shifted address
// next read gray address calculation - bitwise xor between address and shifted address
wire [(ADDR_LENGTH - 2):0] calc_rgrey_next  = raddr[(ADDR_LENGTH - 1):1] ^ raddr[(ADDR_LENGTH - 2):0] ;
wire [(ADDR_LENGTH - 2):0] calc_rgrey_next  = raddr[(ADDR_LENGTH - 1):1] ^ raddr[(ADDR_LENGTH - 2):0] ;
 
 
// FF for registered empty flag
// FF for registered empty flag
reg empty ;
wire empty ;
 
 
// write allow wire
// write allow wire
wire wallow = wenable_in ;
wire wallow = wenable_in ;
 
 
// write allow output assignment
// write allow output assignment
Line 144... Line 147...
    else
    else
        wclock_nempty_detect <= #`FF_DELAY (rgrey_addr != wgrey_addr) ;
        wclock_nempty_detect <= #`FF_DELAY (rgrey_addr != wgrey_addr) ;
end
end
 
 
// special synchronizing mechanism for different implementations - in synchronous imp., empty is prolonged for 1 clock edge if no write clock comes after initial write
// special synchronizing mechanism for different implementations - in synchronous imp., empty is prolonged for 1 clock edge if no write clock comes after initial write
reg stretched_empty ;
wire stretched_empty ;
always@(posedge rclock_in or posedge clear)
 
begin
wire stretched_empty_flop_i = empty && !wclock_nempty_detect ;
    if(clear)
 
        stretched_empty <= #`FF_DELAY 1'b1 ;
meta_flop #(1) i_meta_flop_stretched_empty
    else
(
        stretched_empty <= #`FF_DELAY empty && ~wclock_nempty_detect ;
    .rst_i      (clear),
end
    .clk_i      (rclock_in),
 
    .ld_i       (1'b0),
 
    .ld_val_i   (1'b0),
 
    .en_i       (1'b1),
 
    .d_i        (stretched_empty_flop_i),
 
    .meta_q_o   (stretched_empty)
 
) ;
 
 
// empty output is actual empty + 1 read clock cycle ( stretched empty )
// empty output is actual empty + 1 read clock cycle ( stretched empty )
assign empty_out = empty  || stretched_empty ;
assign empty_out = empty  || stretched_empty ;
 
 
//rallow generation
//rallow generation
assign rallow = renable_in && ~empty && ~stretched_empty ; // reads allowed if read enable is high and FIFO is not empty
assign rallow = renable_in && !empty && !stretched_empty ; // reads allowed if read enable is high and FIFO is not empty
 
 
// rallow output assignment
// rallow output assignment
assign rallow_out = renable_in ;
assign rallow_out = renable_in ;
 
 
// at any clock edge that rallow is high, this register provides next read address, so wait cycles are not necessary
// at any clock edge that rallow is high, this register provides next read address, so wait cycles are not necessary
Line 276... Line 285...
the next read clock.
the next read clock.
--------------------------------------------------------------------------------------------------------------------------------*/
--------------------------------------------------------------------------------------------------------------------------------*/
// combinatorial input for registered emty FlipFlop
// combinatorial input for registered emty FlipFlop
wire reg_empty = (rallow && (rgrey_next == wgrey_addr)) || (rgrey_addr == wgrey_addr) ;
wire reg_empty = (rallow && (rgrey_next == wgrey_addr)) || (rgrey_addr == wgrey_addr) ;
 
 
always@(posedge rclock_in or posedge clear)
meta_flop #(1) i_meta_flop_empty
begin
(
    if (clear)
    .rst_i      (clear),
        empty <= #`FF_DELAY 1'b1 ;
    .clk_i      (rclock_in),
    else if (flush_in)
    .ld_i       (flush_in),
        empty <= #1 1'b1 ;  // when flushed, set empty to active
    .ld_val_i   (1'b1),
        else
    .en_i       (1'b1),
        empty <= #`FF_DELAY reg_empty ;
    .d_i        (reg_empty),
end
    .meta_q_o   (empty)
 
) ;
 
 
endmodule
endmodule
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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