Академический Документы
Профессиональный Документы
Культура Документы
Structure: The above diagram shows the flow of data and control between
partitioned HVL and HDL domains. Two decoupled processes are depicted,
namely the HVL domain write task (A1 and A2), and the sequential logic in the
HDL domain (B1).
significantly different from the current level. This is critical because the call to
update_fifo_limit() cannot be optimized and should therefore be called
only when necessary.
interface bfm_interface;
...
fifo_proxy proxy;
int read_index;
int write_index;
int write_limit;
...
function void write_fifo(input bits);
buffer[write_index++] = bits;
endfunction
...
function void do_update_limit();
write_limit = read_index+BUFFER_SIZE;
proxy.update_fifo_limit(write_limit);
endfunction
...
function bit read(output bits)
if ( read_index== write_index ) return 0;
bits = buffer[read_index++];
if (read_index+BUFFER_SIZE-write_limit>BUFFER_SIZE-1)
begin
do_update_limit();
end
return 1;
endfunction
...
always @(posedge clock) begin
// On 1st pass call do_update_limit()
// to update proxy state.
// Call read(bits) to get the next item;
// returns 0 if queue is empty.
end;
eninterface
class fifo_proxy;
int buffer_write_level;
int buffer_write_limit;
event buffer_event;
...
function void update_fifo_limit(input int limit);
buffer_write_limit = limit;
-> buffer_event;
endfunction
...
task wait_fifo();
while( buffer_write_level==buffer_write_limit )
@(buffer_event);
buffer_write_level++;
endtask
endclass
Consequences: The SW-HW Pipe Pattern can significantly reduce cross domain
communication, as compared to two-way calls, by reducing synchronization
events in emulation. The return path function call cannot be optimized, but the
number of invocations can be reduced. The performance savings ultimately
depend on usage and buffer depth, but the SW-HW Pipe Pattern never performs
worse than a blocking task call.
Related Patterns: The HW-SW Pipe Pattern implements the BFM-Proxy Pair
Pattern.