Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
35 views5 pages

SystemVerilog Functions Tasks

The document explains the differences between Functions and Tasks in SystemVerilog, highlighting that Functions are used for calculations without time delays, while Tasks can involve time control. Functions return values and can only take input arguments, whereas Tasks do not return values and can have input, output, and inout arguments. Syntax examples for both Functions and Tasks are provided to illustrate their usage.

Uploaded by

18021ec202
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views5 pages

SystemVerilog Functions Tasks

The document explains the differences between Functions and Tasks in SystemVerilog, highlighting that Functions are used for calculations without time delays, while Tasks can involve time control. Functions return values and can only take input arguments, whereas Tasks do not return values and can have input, output, and inout arguments. Syntax examples for both Functions and Tasks are provided to illustrate their usage.

Uploaded by

18021ec202
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 5

SystemVerilog: Functions and

Tasks
Defined by: Sumedha IT | Format:
VLSIPoint, ChipVerify, TestBench.in
Functions vs Tasks – Overview
• • Functions and Tasks encapsulate reusable
logic.
• • Functions are used for calculations (no time
delay).
• • Tasks are used for operations involving time
control.
• • Both can be automatic or static (default:
static).
Differences Between Function and
Task
• • Functions return a value; Tasks do not.
• • Functions cannot contain time-consuming
constructs.
• • Tasks can include delay (#), event (@), or
wait.
• • Functions are called in expressions; Tasks are
not.
• • Tasks can have input, output, inout;
Functions have only input.
Function – Syntax & Example
• function [automatic] return_type name (input
args);
• // statements
• endfunction

• Example:
• function int get_parity(input bit [7:0] data);
• get_parity = ^data;
• endfunction
Task – Syntax & Example
• task [automatic] name (input/output/inout
args);
• // statements with delays
• endtask

• Example:
• task send_data(input bit [7:0] data);
• @(posedge clk);
• bus <= data;

You might also like