enchanter Posted April 19, 2012 Report Share Posted April 19, 2012 (edited) I try to use uvm_tlm_analysis_fifo in my scoreboard. uvm_analysis_export #(spi_adc_item) before_export; uvm_analysis_export #(cpu_item) after_export; uvm_tlm_analysis_fifo #(spi_adc_item) before_fifo; uvm_tlm_analysis_fifo #(cpu_item) after_fifo; function void build_phase(uvm_phase phase); before_fifo = new("before_fifo", this); before_export = new("before_export", this); after_fifo = new("after_fifo", this); after_export = new("after_export", this); endfunction // build_phase function void connect_phase(uvm_phase phase); before_export.connect(before_fifo.analysis_export); after_export.connect(after_fifo.analysis_export); endfunction : connect_phase The before_fifo should have 8 items before the after_fifo is written one item. If I try to use before_fifo.get every time when item is written into, I can see all the item are good.: forever begin before_fifo.get(before_txn); $display("SPI_ADC_ITEM: %s", before_txn.sprint()); end But if I wait until after_fifo is not empty, the items get from before_fifo are all the last one be written into. forever begin after_fifo.get(after_txn); fifo_usage = before_fifo.used(); $display("Usage of before_fifo: %0d", fifo_usage); for (int i = 0; i < fifo_usage; i++) begin before_fifo.get(before_txn); before_txn.pack_ints(num_bits); $display("SPI_ADC_ITEM: %s", before_txn.sprint()); $display("Usage of before_fifo: %0d", before_fifo.used()); end end Log file: # UVM_INFO ../../src/spi_adc_monitor.sv(39) @ 10: uvm_test_top.sample_tb0.spi_adc0 [uvm_test_top.sample_tb0.spi_adc0] Transfer collected : # ----------------------------------------------------------------- # Name Type Size Value # ----------------------------------------------------------------- # spi_adc_item spi_adc_item - @548 # dout sa(integral) 4 - # [0] integral 1 'h0 # [1] integral 1 'h0 # [2] integral 1 'h1 # [3] integral 1 'h0 # len integral 32 'h4 # ----------------------------------------------------------------- # # UVM_INFO ../../src/spi_adc_monitor.sv(39) @ 30: uvm_test_top.sample_tb0.spi_adc0 [uvm_test_top.sample_tb0.spi_adc0] Transfer collected : # ----------------------------------------------------------------- # Name Type Size Value # ----------------------------------------------------------------- # spi_adc_item spi_adc_item - @548 # dout sa(integral) 4 - # [0] integral 1 'h0 # [1] integral 1 'h1 # [2] integral 1 'h1 # [3] integral 1 'h0 # len integral 32 'h4 # ----------------------------------------------------------------- # # FIFO Usage: 2 # SPI_ADC_ITEM: 'h6000 # FIFO Usage: 1 # SPI_ADC_ITEM: 'h6000 I pack the dout to integer so '0110' show '6' at the MSB. I have no idea what's wrong in my code. I attached my rubbish test code. Would please anyone give it look. Thanks Edited April 19, 2012 by enchanter add log and attached test code. Quote Link to comment Share on other sites More sharing options...
claudxiao Posted April 27, 2012 Report Share Posted April 27, 2012 (edited) Hi, No server by hands, so can't run simulation based on your code, just some general feeling about your issue.... typically I suspect that the reason you can only read the last one is that, though you might continously pushed 8 items into 'before_fifo' , but the element you pushed into the fifo is always the same item...Because when you push item into buffer, you normally need to 'clone' it and then push, instead of just push the original one.. otherwise, all the 8 items share the same pointer address, hence of course share the same content when you read;(I like 'factory mode'.. you know) And especially when you use some after_fifo use() as some trigger, that means, we can be sure, all 8 times 'push' has been done before your read attemp; but in your previous test (i.e. push->before_fifo, and get<-before_fifo), of course, even you are still only use one address, but you can read each times change before you write next one.... That's just assumption based on your description and some silly mistake of myself before, hope it can help... and all assumption is based on you forget to clone your elemetn before you push it into fifo...otherwise..just forget my words :cool: Edited April 27, 2012 by claudxiao Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.