File parsing in System Verilog

In reply to dave_59:

Thanks Dave.

I shall try with Queue approach first.
Could you let me know how the pseudo for this DPI would look like? Or Could you point me some references that helps to build this DPI quickly?

I’ve another two questions regarding this file parsing.

  1. If the elements are separated by ‘,’ instead of spaces, how to extract them. The above code doesn’t seems to work with ‘,’.
  2. I want to extract the command and process the data based on number of arguments returned successfully. Can I do that? Currently sscanf is returning ‘0’ always.
    Eg:
    command.txt:
    READ ADDR // Perform read from the address specified
    READ ADDR EXP_DATA // Perform read from the address and match with EXP_DATA. Trigger an error in case of mismatch

Thanks,
Somasekhar M