Is there a way to force an arbitrary wire to a certain value in a Verilog task without specifying what the wire's name is or its hierarchical path ahead of time? Preferably without having to write a ton of if-statements for each possible wire.
My goal is to be modular enough such that this task could be used to drive any wire from a testbench perspective.
Example of what I hope to do:
task force;
input value;
input [8*N-1:0] string; // Assume N is large enough
begin
force ... = value;
end
endtask
Where the three dots '...' would be the path of the wire passed in (e.g. counter0.clk0.in_enable).
Let's say I have 64 wires and I want to force some of them high. They are not on a single bus and they all have different names or hierarchical paths. In a testbench setup, I would write a C function that reads a table of the wires I care to drive to a certain value and pass each wire to this Verilog task, but how can I tell the simulator which wire to drive high without having to write out every single wire everytime in the task itself?
If I can do this, what is the correct way to do it? If I can't do this, what could you suggest instead?