Quantcast
Channel: Cadence Functional Verification Forum
Viewing all articles
Browse latest Browse all 1074

Can queues be used to drive RTL?

$
0
0

This may well be a case of my not being able to see the wood for the trees or generally doing something stupid, but I thought I'd ask anyway.

I'm trying to interface a bus driver with some DPI code and thought that using a queue would be the best way.  What I have on the DPI side is a function that is called when new data is available to be pushed onto the queue.  On the RTL side, I've got a module with a FIFO interface and data is popped off the queue as it is loaded into the receiving downstream flop.  So something like the following:

bit [31:0] queue[$];

function push_back;
  input bit [31:0] value;
  queue.push_back(value);
endfunction

always_ff@(posedge clk) begin
  if(fifo_pop)
    queue.pop_front();
end

assign din = queue[0];

always_ff@(posedge clk) begin
  if (fifo_pop)
    capture_r <= din;
end

What I'm seeing is that the queue is updated before din has been captured in the receiving flop.  Is that expected and if so, what should I be doing here?  I've not done a load of DPI work before and haven't seen too many examples of how to cleanly drive an interface like this.

Thanks.


Viewing all articles
Browse latest Browse all 1074

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>