SYSTEM VERILOG LABS # WEEK1

DAY#1

  1. GVIM
    1. Install GVIM
    1. What is GVIM, how is it different from Microsoft Word, Notepad?
    1. How to open a file using GVIM?
    1. How to enable syntax in GVIM for Verilog and SV files?
      1. https://www.vim.org/scripts/script.php?script_id=1586
      1. Download verilog_systemverilog.tar.gz
      1. $HOME below will be C:/Program files/VIM (similar path)
      1. Untar the package verilog_systemverilog.tar.gz 
        Copy  verilog_systemverilog/ftdetect/verilog_systemverilog.vim to your $HOME/.vim/ftdetect directory.  
        Copy verilog_systemverilog/syntax/verilog_systemverilog.vim to your $HOME/.vim/syntax directory. 
        Copy verilog_systemverilog/indent/* to your $HOME/.vim/indent directory
    1. How to work with GVIM effectively?
      1. https://www.youtube.com/watch?v=TWBgScnFurw  (Starts from 49th min)
      1. https://www.youtube.com/watch?v=NPtLV_hqomI  (Advanced GVIM usage)
  2. GVIM Labs
    1. https://www.vlsiguru.com/unix-labs/
      1. Step#6, Step#11,12,13,14,15
  3. www.edaplayground.com
    1. https://www.youtube.com/watch?v=A1qhavaVlnw
  4. EDA Playground Labs
    1. www.edaplayground.com
    1. Make note : design.sv, testbench.sv
      1. What are those windows?
      1. What is + symbol for?
    1. Lab
      1. Develop mux2x1 Verilog code in design.sv
      1. Develop TB for mux2x1 in testbench.sv with different inputs at various times
      1. Run the same using edaplayground
      1. Now observe the waveforms
        1. How to enable waveforms in edaplayground?
  5. System Verilog Basics
    1. How System Verilog differs from Verilog?
      1. What are the new language constructs added?
    1. What is Object Oriented Programming?
      1. Why it is important concept in Testbench setup
        1. Modularity and reusablity
    1. What is design?
    1. What is testbench?
      1. What is the code written in to testbench?
    1. Design & Testbench example
      1. Implement 2X1 Mux using Gates
      1. Write the testbench for 2X1 Mux
        1. Apply various inputs and notice the waveform

DAY2.  (Trainer will cover all below topics in further sessions, we are covering this as basic lab session before OOP based labs)

This session will introduce you to basic data types that will be used in OOP sessions. These topics will be covered by the trainer in depth during main theory sessions(around 6th session of the course)

  1. Before starting this lab session, you should be comfortable with using edaplayground.com or Questasim tool.
  2. How to declare various Arrays (this will be used in next set of questions)
    1. Fixed size array; int intA[fixed_number];
    1. Dynamic array; int intDA[];  //no number passed
      1. intDA= new[size_we_want];
    1. Queue; int intQ[$];
    1. Mailbox mbox;
    2. packed array of logic : logic [3:0] logicVec; //dimension on LHS is packed array
    3. Unpacked array of logic: logic logicArr[3:0]; //dimension on RHS
  3. Data types
    1. Integer, int, byte, bit, logic
      1. Integer: signed, 4 state variable (0,1,x,z)
      1. Int: signed, 2 state variable (used for quicker simulation performance)
      1. Byte : signed 8 bit, 2 state
      1. Bit : unsigned, 2 state
      1. Logic: unsigned, 4 state
  4. Arrays (based on when memory is allocated)      
    1. Packed arrays
      1. Memory is allocated in to single address location
      1. Ex: bit [3:0] bitvar;  //4 bits stored in 1 address location
    1. Unpacked arrays
      1. Memory is allocated in to multiple address locations
      1. Ex: integer intArr[4:0];   //5 address locations
  5. Arrays (based on how memory is allocated)
    1. Fixed size arrays
      1. Memory allocation is fixed at compile time
      1. Ex: integer intArr[4:0]; //5 locations are allocated at compile time
    1. Dynamic arrays
      1. Memory allocation happens at run time
      1. Ex: integer intDA[];  //memory is not allocated at compile time, it is allocated at run time using intDA = new[5] or new[10], etc, 5/10 being the size to allocate.

LABS:

Arrays

  1. Unpacked arrays
    1. Declare int unpacked array
    1. Declare fixed size array of int data type int size is 5.
    1. Initialize all the random values between 50 ,100
    1. Display all the values
      1. Display all using %p to, display packed format
      1. Used %d to display all the value use foreach
      1. Using for loop to display
    1. Declare one more integer array of size 5 int data type, assign random value between 10,20 for each element
      1. Compare both the array using foreach  
      1. Compare both the array using for loop
      1. Copy first array content to second array using for loop
      1. Compare first array content to second array using for loop
  1. Queues
    1. Declare a Queue of integer data type
      1. Integer intQ[$];
        1. intQ does not indicate Q, $ is what indicates it is a Queue
    1. Fill Queue with the random values between 50 ,100
    1. Display all the values
      1. Display all using %p to, display packed format
      1. Used %d to display all the value use foreach
      1. Using for loop to display
    1. Declare one more Queue of size 5 int data type, assign random values between 10,20
      1. Integer intQ[$:4];  //this is a Queue of maximum size 5
      1. Compare both the queue elements using foreach  
      1. Compare both the queue elements using for loop
      1. Copy first queue elements to second Queue using for loop
      1. Compare first queue elements to second queue elements using for loop
  1. Mailbox
    1. Declare a mailbox of int data type
    1. Allocate memory to mailbox
    1. Fill 5 integers in to mailbox using put method
    1. Get above integers using get method
    1. Print the values
  1. Summary
    1. Arrays
      1. Fixed size array; int intA[fixed_number];
      1. Dynamic array; int intDA[];  //no number passed
        1. intDA= new[size_we_want];
      1. Queue; int intQ[$];
      1. Mailbox mbox;

DAY3

Revision:

  1. Different data types
    1. Logic, Bit, reg, wire
    1. Int, Integer
  2. Different arrays
    1. Based on how memory is allocated
      1. Packed arrays
      1. Unpacked arrays
    1. Based on when memory is allocated
      1. Fixed size arrays
      1. Dynamic arrays

Questions:

  1. Where do we use Dynamic arrays?
    1. Hint: when packet size is variable, ex: ethernet
  2. Where do we use logic?
  3. Where do we use bit?
    1. When the variable will not require to take 4 state values, bit improves simulation performance.
  4. How packed arrays are different from unpacked arrays?
  5. What are the various in-built methods implemented for Queues?
  6. What are the various in-built methods implemented for Dynamic arrays?
  7. What are the various in-built methods for mailbox?
  8. When we use mailbox with allocated memory to its handle, what will happen
  9. Declare queue of byte data type with maximum size of 15
  10. Tool related questions
    1. What is compilation?
    1. What is elaboration?
    1. What is library in tool?
    1. What is significance of work library?

LABS:

  1. Declare a Queue of integers, Dynamic array of integers, copy the elements of dynamic array to Queue. Print both the elements to confirm if copy is done properly
    1. How to print all elements: $display(“intQ=%p”,intQ);
  2. Declare a Dynamic array of integer data type
    1. Integer  intDA[];
    1. Try to put random number in to intDA without doing new to array
      1. What error do you get?
  3. Declare a mailbox
    1. Try to put a number in to mailbox without doing memory allocation to mailbox handle
    1. Notice the error
  4. Declare a Queue of integer data type
    1. Try to push back a number in to Queue without doing memory allocation to Queue handle
    1. Do you get any error?
      1. Hint: Queue does not require to use new, it is automatically allocated
  5. Function
    1. Declare a function (with output argument)
      1. Name: sum
      1. Input: 2 integers
      1. Output: integer (sum of above 2 numbers)
        1. Output is returned as function argument
      1. Declare an array of integers (size 5) : intA1
      1. Declare another array of integers (size 5) : intA2
      1. Use above sum function to add integers from 2 arrays and put in to 3rd array : intA3
    1. Declare a function (with return value of function)
      1. Implement above example, with function sum returning value as a function return (not as output argument)
  6. Write a function to print fabanicy series
  7. Implementing FIFO using Queue(DO NOT USE CLASS FOR FIFO IMPLEMENTATION)
    1. Declare a module FIFO
    1. Declare a Queue of integers of size 10
    1. Implement two methods: put, get
      1. Put : push_back integer in to Queue
      1. Get: pop_front integers from Queue
    1. This module FIFO can be now used as a FIFO
    1. Instantiate FIFO module in to module top
    1. Put 10 random numbers in to FIFO(using put method) and get those numbers from FIFO(using get method), print those.
  8. Implementing Stack using Queue
    1. How stack is different from FIFO?
    1. Declare a module FIFO
    1. Declare a Queue of integers of size 10
    1. Implement two methods: put, get
      1. Put : push_back integer in to Queue
      1. Get: pop_back integers from Queue
    1. This module FIFO can be now used as a FIFO
    1. Instantiate FIFO module in to module top
    1. Put 10 random numbers in to FIFO(using put method) and get those numbers from FIFO(using get method), print those.

Class, OOP

DAY4

  1. Revision
    1. How to working with different types arrays, mailbox and queues
    1. Declaring function and calling the function
    1. Declare implementing FIFO and stack using queue
    1. Various queue dynamic array methods
  2. Questions
  3. What is function new in class
  4. What is %p in $display
  5. Class is a dynamic constraints or static constraints
  6. What is the difference between FIFO and stack
  7. What is the difference between function in Verilog and system Verilog
  8. What is the default function argument (int: function sum (int a,int b))

LABS

Course Registration