Possible Use Model For Time Consuming Tasks

From: Per Bojsen <per.bojsen_at_.....>
Date: Thu Oct 12 2006 - 08:38:45 PDT
Hi,

to add to the debate about time consuming tasks, here is a description
of a possible use model.

BFMs are written such that they present time consuming tasks to the
C side.  They may define one or more time consuming tasks.  In the
simplest case, they define one task that might be called DoTransaction(),
for instance.  It accepts an opcode (which transaction to drive) and
associated data.  For a CPU interface, one might include opcode (read
or write), address, and data.  The C side calls the exported task
whenever it wants to do a transaction.  Since the exported task is
time consuming, the C side effectively blocks until the transaction
is complete.  The DoTransaction() task could return a status code to
indicate error states.  It could also return other info such as
read data by using output arguments.

This could easily be expanded by either layering convenience functions
on top of the common task or simply by defining more exported tasks
to do each op.

Here is an example of what the C side would look like:

   // Write an address.
   Write(0x1234, 0xdeadbeef);

   // Write another address.
   Write(0x5678, 0xabcd1234);

   // Wait some clock cycles.  Pause() causes the BFM to wait the
   // given number of cycles.
   Pause(10);

   // Read an address.
   uint32_t readData;
   readData = Read(0x1234);

The code above could be in a function that is imported and called
by the SystemVerilog side at the beginning of simulation.  That
way you could have one of these per BFM and SystemVerilog would
do the threading for you.  Here I am not sure, though, as I have
not actually tried this.  John, do you know if this would work?

Per
Received on Thu Oct 12 08:42:06 2006

This archive was generated by hypermail 2.1.8 : Thu Oct 12 2006 - 08:42:12 PDT