Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Direct Programming Interface (DPI) 4-state data mapping

Hardware interview practice

Direct Programming Interface (DPI) 4-state data mapping

MediumVerification UtilitiesSystemVerilog

A C model must distinguish 0, 1, X, and Z for every bit of a 32-bit bus. Which SystemVerilog Direct Programming Interface (DPI) boundary choice preserves that information?

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 →
Starting point

Question code

// SystemVerilog declaration
import "DPI-C" function void inspect_bus(
  input logic [31:0] bus
);

// Matching C declaration from svdpi.h
// void inspect_bus(const svLogicVecVal* bus);
Choose one

Answer choices

  1. A. Use bit [31:0] and an svBitVecVal representation; X and Z are preserved
  2. B. Use logic [31:0] and an svLogicVecVal representation carrying value and unknown-state information
  3. C. Use int unsigned; all four states are encoded automatically in its numeric value
  4. D. Use real and reinterpret its mantissa as four-state bits
Continue practicing

Related questions

Verification UtilitiesDirect Programming Interface (DPI) imports→
asic.fyi · Learn silicon end to end.info@asic.fyi