Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Distinguish SystemVerilog Functions and Tasks

Hardware interview practice

Distinguish SystemVerilog Functions and Tasks

EasyTimingSystemVerilog

A testbench needs one reusable parity calculation and one reusable bus transaction that waits for clock edges and returns both data and status. Which choice assigns the two jobs correctly?

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Choose one

Answer choices

  1. A. Use functions for both because SystemVerilog functions may contain arbitrary timing controls when called from a testbench.
  2. B. Use tasks for both because functions cannot have arguments in SystemVerilog.
  3. C. Use a function for the zero-time parity calculation and a task for the clocked bus transaction; the task may consume simulation time and return multiple outputs, while synthesizable uses of either remain tool- and context-bounded.
  4. D. Use a task for parity because tasks are the only subprograms allowed to return a value, and a function for the bus transaction because functions may wait on clocks.
asic.fyi · Learn silicon end to end.info@asic.fyi