📄 pci_wbw_wbr_fifos.v
字号:
.rst_b(reset_in), .ce_b(wbr_read_enable), .we_b(1'b0), .oe_b(1'b1), .addr_b(wbr_whole_raddr), .di_b(40'h00_0000_0000), .do_b(dpram_portA_output) `ifdef PCI_BIST , .mbist_si_i (mbist_si_i_internal), .mbist_so_o (mbist_so_o), .mbist_ctrl_i (mbist_ctrl_i) `endif );`else // RAM blocks sharing between two fifos /*----------------------------------------------------------------------------------------------------------- Code section under this ifdef is used for implementation where RAM instances are too expensive. In this case one RAM instance is used for both - WISHBONE read and WISHBONE write fifo. -----------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------- Address prefix definition - since both FIFOs reside in same RAM instance, storage is separated by MSB addresses. WISHBONE write fifo addresses are padded with zeros on the MSB side ( at least one address line must be used for this ), WISHBONE read fifo addresses are padded with ones on the right ( at least one ). -----------------------------------------------------------------------------------------------------------*/ wire [(`WB_FIFO_RAM_ADDR_LENGTH - WBW_ADDR_LENGTH - 1):0] wbw_addr_prefix = {( `WB_FIFO_RAM_ADDR_LENGTH - WBW_ADDR_LENGTH){1'b0}} ; wire [(`WB_FIFO_RAM_ADDR_LENGTH - WBR_ADDR_LENGTH - 1):0] wbr_addr_prefix = {( `WB_FIFO_RAM_ADDR_LENGTH - WBR_ADDR_LENGTH){1'b1}} ; /*----------------------------------------------------------------------------------------------------------- Port A address generation for RAM instance. RAM instance must be full two port RAM - read and write capability on both sides. Port A is clocked by WISHBONE clock, DIA is input for wbw_fifo, DOA is output for wbr_fifo. Address is multiplexed so operation can be switched between fifos. Default is a read on port. -----------------------------------------------------------------------------------------------------------*/ wire [(`WB_FIFO_RAM_ADDR_LENGTH-1):0] portA_addr = wbw_wallow ? {wbw_addr_prefix, wbw_waddr} : {wbr_addr_prefix, wbr_raddr} ; /*----------------------------------------------------------------------------------------------------------- Port B is clocked by PCI clock, DIB is input for wbr_fifo, DOB is output for wbw_fifo. Address is multiplexed so operation can be switched between fifos. Default is a read on port. -----------------------------------------------------------------------------------------------------------*/ wire [(`WB_FIFO_RAM_ADDR_LENGTH-1):0] portB_addr = wbr_wallow ? {wbr_addr_prefix, wbr_waddr} : {wbw_addr_prefix, wbw_raddr} ; wire portA_enable = 1'b1 ; wire portB_enable = 1'b1 ; // instantiate RAM for these two fifos pci_wb_tpram #(`WB_FIFO_RAM_ADDR_LENGTH, 40) wbu_fifo_storage ( // Generic synchronous two-port RAM interface .clk_a(wb_clock_in), .rst_a(reset_in), .ce_a(portA_enable), .we_a(wbw_wallow), .oe_a(1'b1), .addr_a(portA_addr), .di_a(dpram_portA_input), .do_a(dpram_portA_output), .clk_b(pci_clock_in), .rst_b(reset_in), .ce_b(portB_enable), .we_b(wbr_wallow), .oe_b(1'b1), .addr_b(portB_addr), .di_b(dpram_portB_input), .do_b(dpram_portB_output) `ifdef PCI_BIST , .mbist_si_i (mbist_si_i), .mbist_so_o (mbist_so_o), .mbist_ctrl_i (mbist_ctrl_i) `endif );`endif/*-----------------------------------------------------------------------------------------------------------Instantiation of two control logic modules - one for WBW_FIFO and one for WBR_FIFO-----------------------------------------------------------------------------------------------------------*/pci_wbw_fifo_control #(WBW_ADDR_LENGTH) wbw_fifo_ctrl( .rclock_in(pci_clock_in), .wclock_in(wb_clock_in), .renable_in(wbw_renable_in), .wenable_in(wbw_wenable_in), .reset_in(reset_in),////////////////////////////// .flush_in(wbw_flush_in), .almost_full_out(wbw_almost_full_out), .full_out(wbw_full_out), .empty_out(wbw_empty), .waddr_out(wbw_waddr), .raddr_out(wbw_raddr), .rallow_out(wbw_rallow), .wallow_out(wbw_wallow), .half_full_out(wbw_half_full_out) ////Robert, burst issue);pci_wbr_fifo_control #(WBR_ADDR_LENGTH) wbr_fifo_ctrl( .rclock_in(wb_clock_in), .wclock_in(pci_clock_in), .renable_in(wbr_renable_in), .wenable_in(wbr_wenable_in), .reset_in(reset_in), .flush_in(wbr_flush_in), .empty_out(wbr_empty), .waddr_out(wbr_waddr), .raddr_out(wbr_raddr), .rallow_out(wbr_rallow), .wallow_out(wbr_wallow));// in and out transaction counters and grey codesreg [(WBW_ADDR_LENGTH-2):0] inGreyCount ;reg [(WBW_ADDR_LENGTH-2):0] outGreyCount ;wire [(WBW_ADDR_LENGTH-2):0] inNextGreyCount = {wbw_inTransactionCount[(WBW_ADDR_LENGTH-2)], wbw_inTransactionCount[(WBW_ADDR_LENGTH-2):1] ^ wbw_inTransactionCount[(WBW_ADDR_LENGTH-3):0]} ;wire [(WBW_ADDR_LENGTH-2):0] outNextGreyCount = {wbw_outTransactionCount[(WBW_ADDR_LENGTH-2)], wbw_outTransactionCount[(WBW_ADDR_LENGTH-2):1] ^ wbw_outTransactionCount[(WBW_ADDR_LENGTH-3):0]} ;// input transaction counter increment - when last data of transaction is written to fifowire in_count_en = wbw_wallow && wbw_last_in ;// output transaction counter increment - when last data is on top of fifo and read from itwire out_count_en = wbw_renable_in && wbw_last_out ;// register holding grey coded count of incoming transactionsalways@(posedge wb_clock_in or posedge wbw_clear)begin if (wbw_clear) begin inGreyCount <= #3 0 ; end else if (in_count_en) inGreyCount <= #3 inNextGreyCount ;endwire [(WBW_ADDR_LENGTH-2):0] pci_clk_sync_inGreyCount ;reg [(WBW_ADDR_LENGTH-2):0] pci_clk_inGreyCount ;pci_synchronizer_flop #((WBW_ADDR_LENGTH - 1), 0) i_synchronizer_reg_inGreyCount( .data_in (inGreyCount), .clk_out (pci_clock_in), .sync_data_out (pci_clk_sync_inGreyCount), .async_reset (wbw_clear)) ;always@(posedge pci_clock_in or posedge wbw_clear)begin if (wbw_clear) pci_clk_inGreyCount <= #`FF_DELAY 0 ; else pci_clk_inGreyCount <= # `FF_DELAY pci_clk_sync_inGreyCount ;end// register holding grey coded count of outgoing transactionsalways@(posedge pci_clock_in or posedge wbw_clear)begin if (wbw_clear) begin outGreyCount <= #`FF_DELAY 0 ; end else if (out_count_en) outGreyCount <= #`FF_DELAY outNextGreyCount ;end// incoming transactions counteralways@(posedge wb_clock_in or posedge wbw_clear)begin if (wbw_clear) wbw_inTransactionCount <= #`FF_DELAY 1 ; else if (in_count_en) wbw_inTransactionCount <= #`FF_DELAY wbw_inTransactionCount + 1'b1 ;end// outgoing transactions counteralways@(posedge pci_clock_in or posedge wbw_clear)begin if (wbw_clear) wbw_outTransactionCount <= 1 ; else if (out_count_en) wbw_outTransactionCount <= #`FF_DELAY wbw_outTransactionCount + 1'b1 ;endassign wbw_transaction_ready_out = pci_clk_inGreyCount != outGreyCount ;endmodule</pre><hr /><address><span style="font-size: smaller">FreeBSD-CVSweb <<a href="mailto:freebsd-cvsweb@FreeBSD.org">freebsd-cvsweb@FreeBSD.org</a>></span></address></body></html><!-- pf_body_end --></td><td><img width=15 src="/images/dotty.gif"></td></tr></table><xcenter><p><table width=100% cellpadding=0 cellspacing=0 border=0> <tr><td align=right valign=bottom><a title='Top' href='#top'><img border=0 alt='Top' src='/images/hr_up.gif'></a></td></tr> <tr><td background='/images/hpd.gif'><img height=1 border=0 src='/images/dotty.gif'></td></tr><tr><td height=4><img height=4 src='/images/dotty.gif'></td></tr></table> <br><!--<table border=0 cellpadding=0 cellspacing=1 bgcolor=#ffffff><tr><td><table cellpadding=0 cellspacing=0 border=0 bgcolor=#ffffff><tr><td>//--><script type="text/javascript"><!--google_ad_client = "pub-9285819221080148";google_alternate_color = "FFFFFF";google_ad_width = 728;google_ad_height = 90;google_ad_format = "728x90_as";google_ad_type = "text_image";google_ad_channel ="3034172958";google_color_border = "ffffff";google_color_bg = "ffffff";google_color_link = "444488";google_color_url = "b00000";google_color_text = "666666";//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script><!--</td></tr></table></td></tr></table>//--></center><img border=0 src="/images/dotty.gif" height=1 width=400><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30><img border=0 src="/images/dotty.gif" height=1 width=30></td></tr></table> </td></tr><tr bgcolor=#000000><td><img height=1 src="/images/dotty.gif"></td></tr></table><table background="/images/topbg.gif" width=100% cellpadding=0 cellspacing=0 border=0 bgcolor=#aaddff><tr><td align=right>Copyright (c) 1999-2007 OPENCORES.ORG. All rights reserved. </td></tr><tr><td> </td></tr></table></td><td width=1 bgcolor=#000000><img width=1 src="/images/dotty.gif"></td><td width=1 bgcolor=#f0f0c8><img width=1 src="/images/dotty.gif"></td></tr></table></center><!-- pf_footer_start --> </body></html><!-- pf_footer_end -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -