Skip to main content

Posts

Showing posts with the label SystemVerilog

Object oriented concept

Have been kept this post in draft for quite some times. Not sure when I'll start with my next topic. So, I decided to post this first. Here's the first chapter, object oriented concept. Let’s go through an example before explore the object oriented jargons. Say, there is a book shelf. We have some books, a pen holder, pens, pencils, sharpener in the book shelf as illustrated below. These objects are related to each other in some ways. The bookshelf contains books, pens, pencils, pen holder and sharpener. The sharpener is used to sharpen the pencil. The pen holder holds the pens and pencils. There is variety of books in the bookshelf. How is this related to object oriented concept? Class A class is a collection of objects that has something in common. Say, we have a class of book. All books are classified in the class of book. Object Object is something real that exists. It is classified with other objects that share some common attributes into class. We can ...

Task and Function in SystemVerilog

This is my first post. I put on hold to start write anything as I am still not sure how shall I organize this, or what to put in this blog. Anyway, I should have starting point, and just go ahead from it. Let me start with the question asked by a DE today. Question : What is the difference between task and function in SystemVerilog? Task can have time control statements and delay, while function doesn’t support time control statement. Function can have return value, but task cannot. Task can call other task/functions, but function cannot call a task. (This limitation is on Verilog, SystemVerilog allow function to call a task using spawned thread.) A function must have at least one input argument, while task can have no arguments at all. Some notes. Both task and function support input, output, inout as their argument. For inout type, the argument act as input at the beginning and as output at the end of the routine. If a task that does not consume time, it is advisable to make it a voi...