DirtyBit
DirtyBit

Reputation: 65

Connecting program to module in SystemVerilog

I'm trying to connect between a top level module and a program block in SystemVeilog using interface.

I succeed in passing the wires, but I couldn't do it also for the parameters.

How can I pass the parameters in the module to the program? Is it possible in any way?

Upvotes: 1

Views: 922

Answers (1)

toolic
toolic

Reputation: 61937

You pass a parameter to a program in the same way as you pass one to a module. Refer to the IEEE Std 1800-2012, Section "24. Programs". For example:

module tb;
    test #(.WIDTH(8)) test ();
endmodule

program test;
    parameter WIDTH = 5;
    initial $display("WIDTH = %0d", WIDTH);
endprogram

Output:

WIDTH = 8

Upvotes: 2

Related Questions