In the article, Blocking And Non-blocking in Verilog, we will discuss the topics of Verilog blocking and non-blocking.
Blocking And Non-blocking In Verilog:
The execution of the blocking statements will be in series. This blocking statement will block the next statement until the present statement executes successfully.
Defines the size of the memory block. Note the use of the Verilog as there is in VHDL. Just like the shift register model from November, the parameterisable bidirectional port.
- Verilog - Modules The module is the basic unit of hierarchy in Verilog I Modules describe: I boundaries module, endmodule I inputs and outputs ports I how it works behavioral or RTL code I Can be a single element or collection of lower level modules I Module can describe a hierarchical design (a module of modules).
- Interfaces are a major new construct in SystemVerilog, created specifically to encapsulate the communication between blocks, allowing a smooth refinement from abstract system-level through successive steps down to lower RTL and structural levels of.
The execution of the non-blocking statements will be in parallel. This non-blocking statement first it will evaluate all RHS values after that all this will be assigned to the LHS at a time.
Systemverilog Spec
The Eda playground example for the Blocking:
module blocking_example; int asic,verif; initialbegin asic =10; verif =15; $display('!! @%gns !! BLOCKING :: First Assignment Value of asic is :: %0d',$time,asic); $display('!! @%gns !! BLOCKING :: First Assignment Value of verif is :: %0d',$time,verif); asic = verif; verif =25; $display('!! @%gns !! BLOCKING :: Second Assignment Value of asic is :: %0d',$time,asic); $display('!! @%gns !! BLOCKING :: Second Assignment Value of verif is :: %0d',$time,verif); end endmodule: blocking_example |
RESULT: !!@0ns !! BLOCKING :: First Assignment Value of asic is ::10 !!@0ns !! BLOCKING :: First Assignment Value of verif is ::15 !!@0ns !! BLOCKING :: Second Assignment Value of asic is ::15 !!@0ns !! BLOCKING :: Second Assignment Value of verif is ::25 |
The Eda playground example for the Non-blocking:
module NONblocking_example; int asic,verif; int world,verification; initialbegin asic =15; verif =25; world <= asic + verif; verification <= asic + verif + world; $display('!! @%gns !! NON-BLOCKING :: First Assignment Value of world is :: %0d',$time,world); $display('!! @%gns !! NON-BLOCKING :: First Assignment Value of verification is :: %0d',$time,verification); #10ns; $display('!! @%gns !! NON-BLOCKING :: After 10ns First Assignment Value of world is :: %0d',$time,world); $display('!! @%gns !! NON-BLOCKING :: After 10ns First Assignment Value of verification is :: %0d',$time,verification); end finalbegin $display('!! @%gns !! NON-BLOCKING :: Final Assignment Value of world is :: %0d',$time,world); $display('!! @%gns !! NON-BLOCKING :: Final Assignment Value of verification is :: %0d',$time,verification); end endmodule: NONblocking_example |
RESULT: !!@0ns !! NON-BLOCKING :: First Assignment Value of world is ::0 !!@0ns !! NON-BLOCKING :: First Assignment Value of verification is ::0 !!@10ns!! NON-BLOCKING :: After 10ns First Assignment Value of world is ::40 !!@10ns!! NON-BLOCKING :: After 10ns First Assignment Value of verification is ::40 !!@10ns!! NON-BLOCKING ::Final Assignment Value of world is ::40 !!@10ns!! NON-BLOCKING ::Final Assignment Value of verification is ::40 We can add some delay after displaying each statement. |
The following process will explain how blocking and non-blocking procedural statements will execute:
Define In Systemverilog
- At the current time-slot, the simulator will evaluate the right-hand side of all assignment statements, those are related to Non-blocking statements.
- All the blocking procedural statements will execute at the same time, all the non-blocking statements are set aside for processing.
- The non-blocking procedural statements with no timing controls will execute in this third stage.
- The non-blocking procedural statements with timing controls will execute in this 4th stage.
- Advance the simulation clock.
Finally, we completed the article blocking and non-blocking in Verilog with the topics of Verilog blocking and non-blocking. In the next post, we will discuss the event Scheduling in Verilog.
(30)Without using randomize method or rand,generate an array of unique values?
Ans:-
(32)What is the difference between byte and bit [7:0]?
Ans:-
byte is signed whereas bit [7:0] is unsigned.
(33)What is the difference between program block and module?
Ans:-
Program block is newly added in SystemVerilog. It serves these purposes
- It separates testbench from DUT
- It helps in ensuring that testbench doesn't have any race condition with DUT
- It provides an entry point for execution of testbench
- It provides syntactic context (via program ... endprogram) that specifies scheduling in the Reactive Region.
- Program blocks can't have always block inside them, modules can have.
- Program blocks can't contain UDP, modules, or other instance of program block inside them. Modules don't have any such restrictions.
- Inside a program block, program variable can only be assigned using blocking assignment and non-program variables can only be assigned using non-blocking assignments. No such restrictions on module
- Program blocks get executed in the re-active region of scheduling queue, module blocks get executed in the active region
- A program can call a task or function in modules or other programs. But a module can not call a task or function in a program.
- http://www.project-veripage.com/program_blocks_1.php and few more next/next !!!
- Section 16, SystemVerilog LRM 3.1a ... It's worth the effort reading line-by-line (and between the lines if you can :) ).
Ans:-
Modports are part of Interface. Modports are used for specifing the direction of the signals with respect to various modules the interface connects to.
Please refer section 19.4 of SV LRM for more details
11. Explain about the virtual task and methods .
Verilog Vs Systemverilog
Ans:-See http://www.testbench.in/CL_07_POLYMORPHISM.html