📄 pci_wbw_wbr_fifos.v
字号:
`include "pci_constants.v"// synopsys translate_off`include "timescale.v"// synopsys translate_onmodule pci_wbw_wbr_fifos( wb_clock_in, pci_clock_in, reset_in, wbw_wenable_in, wbw_addr_data_in, wbw_cbe_in, wbw_control_in, wbw_renable_in, wbw_addr_data_out, wbw_cbe_out, wbw_control_out,// wbw_flush_in, write fifo flush not used wbw_almost_full_out, wbw_full_out, wbw_empty_out, wbw_transaction_ready_out, wbw_half_full_out, ////Robert, burst issue wbr_wenable_in, wbr_data_in, wbr_be_in, wbr_control_in, wbr_renable_in, wbr_data_out, wbr_be_out, wbr_control_out, wbr_flush_in, wbr_empty_out `ifdef PCI_BIST , // debug chain signals mbist_si_i, // bist scan serial in mbist_so_o, // bist scan serial out mbist_ctrl_i // bist chain shift control`endif ) ;/*-----------------------------------------------------------------------------------------------------------System inputs:wb_clock_in - WISHBONE bus clockpci_clock_in - PCI bus clockreset_in - reset from control logic-------------------------------------------------------------------------------------------------------------*/input wb_clock_in, pci_clock_in, reset_in ;/*-----------------------------------------------------------------------------------------------------------WISHBONE WRITE FIFO interface signals prefixed with wbw_ - FIFO is used for posted writes initiated byWISHBONE master, traveling through FIFO and are completed on PCI by PCI master interfacewrite enable signal:wbw_wenable_in = write enable input for WBW_FIFO - driven by WISHBONE slave interfacedata input signals:wbw_addr_data_in = data input - data from WISHBONE bus - first entry of transaction is address others are data entrieswbw_cbe_in = bus command/byte enable(~SEL[3:0]) input - first entry of transaction is bus command, other are byte enableswbw_control_in = control input - encoded control bus inputread enable signal:wbw_renable_in = read enable input driven by PCI master interfacedata output signals:wbw_addr_data_out = data output - data from WISHBONE bus - first entry of transaction is address, others are data entrieswbw_cbe_out = bus command/byte enable output - first entry of transaction is bus command, others are byte enableswbw_control_out = control input - encoded control bus inputstatus signals - monitored by various resources in the corewbw_flush_in = flush signal input for WBW_FIFO - when asserted, fifo is flushed(emptied)wbw_almost_full_out = almost full output from WBW_FIFOwbw_full_out = full output from WBW_FIFOwbw_empty_out = empty output from WBW_FIFOwbw_transaction_ready_out = output indicating that one complete transaction is waiting in WBW_FIFO-----------------------------------------------------------------------------------------------------------*/// input control and datainput wbw_wenable_in ;input [31:0] wbw_addr_data_in ;input [3:0] wbw_cbe_in ;input [3:0] wbw_control_in ;// output control and datainput wbw_renable_in ;output [31:0] wbw_addr_data_out ;output [3:0] wbw_cbe_out ;output [3:0] wbw_control_out ;// flush input// input wbw_flush_in ; // not used// status outputsoutput wbw_almost_full_out ;output wbw_full_out ;output wbw_empty_out ;output wbw_transaction_ready_out ;output wbw_half_full_out; ////Robert, burst issue/*-----------------------------------------------------------------------------------------------------------WISHBONE READ FIFO interface signals prefixed with wbr_ - FIFO is used for holding delayed read completionsinitiated by master on WISHBONE bus and completed on PCI bus,write enable signal:wbr_wenable_in = write enable input for WBR_FIFO - driven by PCI master interfacedata input signals:wbr_data_in = data input - data from PCI bus - there is no address entry here, since address is stored in separate registerwbr_be_in = byte enable(~BE#[3:0]) input - byte enables - same through one transactionwbr_control_in = control input - encoded control bus inputread enable signal:wbr_renable_in = read enable input driven by WISHBONE slave interfacedata output signals:wbr_data_out = data output - data from PCI buswbr_be_out = byte enable output(~#BE)wbr_control_out = control output - encoded control bus outputstatus signals - monitored by various resources in the corewbr_flush_in = flush signal input for WBR_FIFO - when asserted, fifo is flushed(emptied)wbr full_out = full output from WBR_FIFOwbr_empty_out = empty output from WBR_FIFO-----------------------------------------------------------------------------------------------------------*/// input control and datainput wbr_wenable_in ;input [31:0] wbr_data_in ;input [3:0] wbr_be_in ;input [3:0] wbr_control_in ;// output control and datainput wbr_renable_in ;output [31:0] wbr_data_out ;output [3:0] wbr_be_out ;output [3:0] wbr_control_out ;// flush inputinput wbr_flush_in ;output wbr_empty_out ;`ifdef PCI_BIST/*-----------------------------------------------------BIST debug chain port signals-----------------------------------------------------*/input mbist_si_i; // bist scan serial inoutput mbist_so_o; // bist scan serial outinput [`PCI_MBIST_CTRL_WIDTH - 1:0] mbist_ctrl_i; // bist chain shift control`endif/*-----------------------------------------------------------------------------------------------------------FIFO depth parameters:WBW_DEPTH = defines WBW_FIFO depthWBR_DEPTH = defines WBR_FIFO depthWBW_ADDR_LENGTH = defines WBW_FIFO's location address length = log2(WBW_DEPTH)WBR_ADDR_LENGTH = defines WBR_FIFO's location address length = log2(WBR_DEPTH)-----------------------------------------------------------------------------------------------------------*/parameter WBW_DEPTH = `WBW_DEPTH ;parameter WBW_ADDR_LENGTH = `WBW_ADDR_LENGTH ;parameter WBR_DEPTH = `WBR_DEPTH ;parameter WBR_ADDR_LENGTH = `WBR_ADDR_LENGTH ;/*-----------------------------------------------------------------------------------------------------------wbw_wallow = WBW_FIFO write allow wire - writes to FIFO are allowed when FIFO isn't full and write enable is 1wbw_rallow = WBW_FIFO read allow wire - reads from FIFO are allowed when FIFO isn't empty and read enable is 1-----------------------------------------------------------------------------------------------------------*/wire wbw_wallow ;wire wbw_rallow ;/*-----------------------------------------------------------------------------------------------------------wbr_wallow = WBR_FIFO write allow wire - writes to FIFO are allowed when FIFO isn't full and write enable is 1wbr_rallow = WBR_FIFO read allow wire - reads from FIFO are allowed when FIFO isn't empty and read enable is 1-----------------------------------------------------------------------------------------------------------*/wire wbr_wallow ;wire wbr_rallow ;/*-----------------------------------------------------------------------------------------------------------wires for address port conections from WBW_FIFO control logic to RAM blocks used for WBW_FIFO-----------------------------------------------------------------------------------------------------------*/wire [(WBW_ADDR_LENGTH - 1):0] wbw_raddr ;wire [(WBW_ADDR_LENGTH - 1):0] wbw_waddr ;/*-----------------------------------------------------------------------------------------------------------wires for address port conections from WBR_FIFO control logic to RAM blocks used for WBR_FIFO-----------------------------------------------------------------------------------------------------------*/wire [(WBR_ADDR_LENGTH - 1):0] wbr_raddr ;wire [(WBR_ADDR_LENGTH - 1):0] wbr_waddr ;/*-----------------------------------------------------------------------------------------------------------WBW_FIFO transaction counters: used to count incoming transactions and outgoing transactions. When number ofinput transactions is equal to number of output transactions, it means that there isn't any complete transactioncurrently present in the FIFO.-----------------------------------------------------------------------------------------------------------*/reg [(WBW_ADDR_LENGTH - 2):0] wbw_inTransactionCount ;reg [(WBW_ADDR_LENGTH - 2):0] wbw_outTransactionCount ;/*-----------------------------------------------------------------------------------------------------------wires monitoring control bus. When control bus on a write transaction has a value of `LAST, it means thatcomplete transaction is in the FIFO. When control bus on a read transaction has a value of `LAST,it means that there was one complete transaction taken out of FIFO.-----------------------------------------------------------------------------------------------------------*/wire wbw_last_in = wbw_control_in[`LAST_CTRL_BIT] ;wire wbw_last_out = wbw_control_out[`LAST_CTRL_BIT] ;wire wbw_empty ;wire wbr_empty ;assign wbw_empty_out = wbw_empty ;assign wbr_empty_out = wbr_empty ;// clear wires for fifoswire wbw_clear = reset_in /*|| wbw_flush_in*/ ; // WBW_FIFO clear flush not usedwire wbr_clear = reset_in /*|| wbr_flush_in*/ ; // WBR_FIFO clear - flush changed from asynchronous to synchronous/*-----------------------------------------------------------------------------------------------------------Definitions of wires for connecting RAM instances-----------------------------------------------------------------------------------------------------------*/wire [39:0] dpram_portA_output ;wire [39:0] dpram_portB_output ;wire [39:0] dpram_portA_input = {wbw_control_in, wbw_cbe_in, wbw_addr_data_in} ;wire [39:0] dpram_portB_input = {wbr_control_in, wbr_be_in, wbr_data_in} ;/*-----------------------------------------------------------------------------------------------------------Fifo output assignments - each ram port provides data for different fifo-----------------------------------------------------------------------------------------------------------*/assign wbw_control_out = dpram_portB_output[39:36] ;assign wbr_control_out = dpram_portA_output[39:36] ;assign wbw_cbe_out = dpram_portB_output[35:32] ;assign wbr_be_out = dpram_portA_output[35:32] ;assign wbw_addr_data_out = dpram_portB_output[31:0] ;assign wbr_data_out = dpram_portA_output[31:0] ;`ifdef WB_RAM_DONT_SHARE /*----------------------------------------------------------------------------------------------------------- Piece of code in this ifdef section is used in applications which can provide enough RAM instances to accomodate four fifos - each occupying its own instance of ram. Ports are connected in such a way, that instances of RAMs can be changed from two port to dual port ( async read/write port ). In that case, write port is always port a and read port is port b. -----------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------- Pad redundant address lines with zeros. This may seem stupid, but it comes in perfect for FPGA impl. -----------------------------------------------------------------------------------------------------------*/ /* wire [(`WBW_FIFO_RAM_ADDR_LENGTH - WBW_ADDR_LENGTH - 1):0] wbw_addr_prefix = {( `WBW_FIFO_RAM_ADDR_LENGTH - WBW_ADDR_LENGTH){1'b0}} ; wire [(`WBR_FIFO_RAM_ADDR_LENGTH - WBR_ADDR_LENGTH - 1):0] wbr_addr_prefix = {( `WBR_FIFO_RAM_ADDR_LENGTH - WBR_ADDR_LENGTH){1'b0}} ; */ // compose complete port addresses wire [(`WB_FIFO_RAM_ADDR_LENGTH-1):0] wbw_whole_waddr = wbw_waddr ; wire [(`WB_FIFO_RAM_ADDR_LENGTH-1):0] wbw_whole_raddr = wbw_raddr ; wire [(`WB_FIFO_RAM_ADDR_LENGTH-1):0] wbr_whole_waddr = wbr_waddr ; wire [(`WB_FIFO_RAM_ADDR_LENGTH-1):0] wbr_whole_raddr = wbr_raddr ; wire wbw_read_enable = 1'b1 ; wire wbr_read_enable = 1'b1 ; `ifdef PCI_BIST wire mbist_so_o_internal ; // wires for connection of debug ports on two rams wire mbist_si_i_internal = mbist_so_o_internal ; `endif // instantiate and connect two generic rams - one for wishbone write fifo and one for wishbone read fifo pci_wb_tpram #(`WB_FIFO_RAM_ADDR_LENGTH, 40) wbw_fifo_storage ( /////////////////Generic synchronous two-port RAM interface .clk_a(wb_clock_in), .rst_a(reset_in), .ce_a(1'b1), .we_a(wbw_wallow), .oe_a(1'b1), .addr_a(wbw_whole_waddr), .di_a(dpram_portA_input), .do_a(), .clk_b(pci_clock_in), .rst_b(reset_in), .ce_b(wbw_read_enable), .we_b(1'b0), .oe_b(1'b1), .addr_b(wbw_whole_raddr), .di_b(40'h00_0000_0000), .do_b(dpram_portB_output) `ifdef PCI_BIST , .mbist_si_i (mbist_si_i), .mbist_so_o (mbist_so_o_internal), .mbist_ctrl_i (mbist_ctrl_i) `endif ); pci_wb_tpram #(`WB_FIFO_RAM_ADDR_LENGTH, 40) wbr_fifo_storage ( // Generic synchronous two-port RAM interface .clk_a(pci_clock_in), .rst_a(reset_in), .ce_a(1'b1), .we_a(wbr_wallow), .oe_a(1'b1), .addr_a(wbr_whole_waddr), .di_a(dpram_portB_input), .do_a(), .clk_b(wb_clock_in),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -