Jul 21, 2013

A sample of SV

I've recently migrated my blog from Typepad to Pelican, hosted on GitHub. One nice feature of that is that I can write simple posts in Markdown syntax and it uses the Pygments syntax highlighting engine. A while ago I added SystemVerilog support to Pygments and looking below, it seems to be working!

module top;
    import user_pkg::*;
    import uvm_pkg::*;
    env e;

    initial begin
        `uvm_info("top","In top initial block",UVM_MEDIUM)
        e = new("env", null);
        run_test();
    end
endmodule

There are comments.

Jul 18, 2013

A VCD Parser

A co-worker mentioned that a generic VCD parser might be useful. So I wrote one. It is mostly functional, after a few tweaks and some valuable suggestions from colleagues.

The tokenizer got particular attention, due to the rather neat generator expression, assigned to tokeniser

def extract(self, fh):
    '''Tokenize and parse the VCD file'''
    # open the VCD file and create a token generator
    tokeniser = (word for line in fh for word in line.split() if word)

    for count, token in enumerate(tokeniser):

There are comments.