Skip to main content

Posts

Showing posts from 2017

Sequence Layering in UVM

What is Sequence Layering? Sequence layering is refered to as running sequences inside sequences.  So whats the big deal. There are virtual sequences we will use to run multiple sequences. A generic example of sequence layering. you have two sequences  Interrupt sequence register read write sequence. Generally when you have interrupt, we generally enter into interrupt service routine, which can be implemented as an interrupt sequence. So when you run an interrupt sequence, you might end up running register read /write sequence like polling or clearing interrupts. Well thats easy, just run one sequence in another. class top_seq extends uvm_sequence#(txn_item); //Two sequencers say.. sub sequences. sub_seq1 seq1; sub_seq2 seq2; ... task body(); seq1.start(some_seqr); seq2.start(some_seqr2); endtask endclass Killing sequences: That was great you are running nested sequences. But how to kill them when needed. UVM provides method cal

Virtual Sequence and Virtual Sequencer in UVM

Virtual sequences and sequencers in UVM are just virtual containers of multiple sequences and sequencers. Using virtual sequencers and sequences can be done in these three ways: Using only virtual Sequence and handles of sequencers inside the virtual sequence. Using Virtual sequencer to hold the sequencers Same as step 2, by using uvm_declare_p_sequencer. Virtual Sequencer does not create any sequencer objects, rather it points to other physical sequencers in different agents.  Virtual Sequencer extends from uvm_sequencer. Virtual sequence will create its sequences and start them. Running sequences can be controlled by user in the body() task. virtual sequence extends from uvm_sequence. METHOD-1: In this method, we will have one base virtual sequence which will hold the handles to different sequencers. Here we dont use any virtual sequencer. We just use the nested seqeunces with handles ot sequencers inside sequence itself. //This is the base virtual sequen

python process real time output

Real Time Output Issue resolved: I did encountered similar issue in Python, while capturing the real time output from c program. I added " fflush(stdout) ;" in my C code. It worked for me. Here is the snip the code << C Program >> #include <stdio.h> void main () { int count = 1 ; while ( 1 ) { printf ( " Count %d\n" , count ++); fflush ( stdout ); sleep ( 1 ); } } << Python Program >> #!/usr/bin/python import os , sys import subprocess procExe = subprocess . Popen ( ".//count" , shell = True , stdout = subprocess . PIPE , stderr = subprocess . PIPE , universal_newlines = True ) while procExe . poll () is None : line = procExe . stdout . readline () print ( "Print:" + line ) << OUTPUT>> Print: Count 1 Print: Count 2 Print: Count 3 UPDATE:: The above one has flaws as we are reading only oneline per poll iteratio

Starting a simple Web server

Looked around to have some simple way of getting a web server up on linux/mac. Python: With python 5.4 there is  a simple web server that it can run. Command to launch HTTP server with python: python -m SimpleHTTPServer This will use the document root top as the current directory. Php: with python 5.4 there is web server that is default built in. Command: php -S 127.0.0.1:80 -t . This will launch the webserver with document root as "."

Good uses of System Verilog DPI..

What is DPI?? Well, The easiest answer is Direct Programming Interface. The DPI is used to communicate the system verilog/ Verilog code to any other language. Well DPI has its own advantages over PLI.  You can check out the differences between the DPI and PLI   HERE . With DPI, you can directly call the c-functions from system verilog code and vice versa. With lot of SOCs and complicated chips in the silicon industry, sometimes you cannot completely live with the generic UVM/System verilog to write complete stimulus for complete chip.  Basics of DPI, Basics of DPI can be found when you google it.  There are some interesting cases where you will find the uses of DPI. I will get through some advanced take aways from IEEE 1800.2012 LRM. You cannot export the objects with in class. You can export only from static objects. exporting the tasks/functions should be in a module/program/interface scope.[or any static scope] . ..... Bear with me as this post might be so

Cross Platform UI application with Python

Today I came to know about the open source software called wxPython . This has basic core libraries for the Windows, MAC, Linux. The user has to write the UI/code in python using these wxPython APIs. These APIs will be common across all platforms. You can easily port this code into other platforms. URL for wxPython: wxPython I am a novice for this.. Some time in future I might use this to create some cross platform apps... There is one more library called tkInter . This also looks cool. There is a python IDE which looks super cool with the black theme i like so much. its called pyCharm

Convert to html in VIM batch mode

VIM has a beautiful feature of converting the code into a html formatted code. When you apply syntax highlighting, the code gets beautified. But when you need to copy and visualize the code some where else.. the copy does not actually copy the formatting along with it. Vim has a menu option of converting the code into html syntax. Syntax -> Convert to HTML. This looks cool, but if you have some bunch of files and you have to convert them to html.. The savior is writing some script to automate this The tag that does HTML conversion is this: :.,$TOhtml Now you can automate this: Write this in a vim script. Lets name it as "test.vim" zR :set autochdir :.,$TOhtml  :wqa How to run over a file: vim -s test.vim test.sv  Now this will generate test.sv.html file in the file directory. Point to note: Your .vimrc should contain the setting the automatic file type.  Now i took the file name as "sv". When i open GVIM/VIM, the sv (system v