Friday 22 May 2009

Less known and less used Specman commands

There are quite a few Specman commands which are handy when it comes to debugging. Here I tried to summarize few less known but useful Specman commands. Here we go.
  1. If you have verification environment loaded on Specman and one method is extended in multiple files and you want to see all the extension of that method in a single place, "collect" command is what you are looking for.

  2. Specman> collect sys.mystruct.monitor
    Specman> collect sys.run

    File temp.erld - created by collecting:
    sys.run (after module specman)
    <'
    ----------------------- Reset sys.run:
    extend sys {
    run(
    ) is as was after specman;
    };
    ----------------------- From temp.e at line 6:
    extend sys {
    run() is also
    {
    var x : mystruct_s;
    gen x;
    };
    };
    ----------------------- End of sys.run
    '>

  3. If you want to debug temporal expression, you would like to visualise how different events are triggered. Event chart is basic but sometimes useful for debugging temporal expressions. To see the events you first have to collect events you are interested in by using "collect events" Specman command.

  4. Specman> collect events *.*
    Specman> collect events sys.mystruct.* //collects all events for the instance sys.mystruct
    Specman> collect events mystruct_s.* //collects all the events of struct mystruct_s

  5. If you want to see the events triggered during simulation, you can use Specman command "show events" after collecting the events as mentioned above.

  6. Specman> show events
    Specman> show events 100 //This command shows events since time 100
    Specman> show events 100..150 //This command shows events in the time range 100..150
    Specman> show events -chart //Pops up event chart

  7. If you want to have a summarized report about the events count, if it is associated with cover group, its source etc, you can use "show events def" command.

  8. Specman> show events def sys.any

    count echo col covr name source
    ------------------------------------------------------------------
    0 10000 FALSE TRUE FALSE sys.any @sn_te_tick

  9. Executing actions on command line. You can define variables or call methods or start a TCMs. (you can not call a TCM on command line). Remember, you can not give "gen" action on command line, but you can call a method which has gen action in it.

  10. Specman> var x : uint(bits: 4) = 5;
    Specman> var y : uint = x + 10;
    Specman> print x + y;
    Specman> sys.non_tcm()
    Specman> start sys.tcm()
    Specman> sys.non_tcm_with_arg(4, TRUE)

  11. You can search/grep within the loaded files using "search" command

  12. Specman> search mystruct_s

  13. You can open a file (known as "module" in Specman terms) in source browser by using "source" command. It will open a source browser with that perticular line number into focus.

  14. syntax: source

    Specman> source mystruct.e 50

  15. You can run unix commands using "shell" command.

  16. syntax: shell

    Specman> shell echo $SPECMAN_PATH
    Specman> shell pwd

  17. You can also get the value of define by issuing "show define" command.

  18. syntax: show define [-v] [-e]

    Specman> show define -v "*WIDTH*"

  19. If you want to know what are the modules that are loaded you can use "show modules" command.

  20. Specman> show modules

  21. You can get unix environment variables value within your e code by using get_symbol() method.

  22. my_method() is
    {
    outf ("SPECMAN_PATH=%s",get_symbol("SPECMAN_PATH"));
    };

  23. 12. If you wish to execute specman command in e code, then you can use specman() method as shown below.

  24. pre_generate() is
    {
    specman("break on error");
    };

  25. If you wish to execute unix command from your e code, you can use output_from() method.

  26. my_method() is
    {
    var list_of_files: string;
    list_of_files = output_from("ls");
    print list_of_files;
    };

  27. If you want to uderstand port binding in Specman, use "show ports" command.

  28. You can use "trace bind' to follow the binding process

  29. If you have executed a set of commands and want to see the history of executed commands, you can use "show redo" command.

  30. Specman> show redo
    show redo
    The redo buffer (default is 'redo 0..') =
    0. "restore specman.esv"
    1. "load temp.e"
    2. "test"
    3. "clear screen; restore; reload; test"

  31. Once you know the hisotry of executed command, you can reexecute them by issueing "redo" Specman command.

  32. Specman> redo 3 //this will execute command 3 (clear screen; restore; reload; test)
    Specman> redo 0..2 //this will execute command 0 to 2 (restore specman.esv, load temp.e, test)

  33. If you have wave command executed to view e fields into waveform and want to dump all these wave tracing commands into a file, you can use "write wave" command.

  34. syntax: write wave to

    Specman> write wave to trace_wave.ecom


    19. To debug, packing and unpacking, you can use "show pack" and "show unpack" command as shown below.

    Specman> var x : uint (bits: 3) = 3
    Specman> var y : uint (bits: 7) = 5
    Specman> show pack(packing.low, x, y);

    |9 8 7 6 5 4 3|2 1 0| +0
    +-------------+-----|
    |0 0 0 0 1 0 1|0 1 1|
    +-------------+-----|
    |y |x |

    Specman> var x : packet_s
    Specman> var data : list of bit = {1;1;0;1;0;0;0;1;1;1;0;1}
    Specman> show unpack(packing.low, data, x)

    |1 0 9 8 7 6 5 4|3 2 1 0| +0
    +---------------+-------|
    |1 0 1 1 1 0 0 0|1 0 1 1|
    +---------------+-------|
    |x.addr |x.len |

1 comment:

Anonymous said...

Great info!! Thanks!