You don't say how many positions you are going to switch, but if it is not too many then use the spectre switch statement with the switch position controlled by a variable in a definition file and load that definition file into your ocean testbench with definitionFiles(). You also place that voltage source in the same definition file. Before each run() in your ocean file, you do a desVar( "sw_pos" x) to set the switch to the correct position. This way you don't need to change your netlist at all.Originally posted in cdnusers.org by svenn
If you want to have a real switch in your schematic, then copy the sp1tswitch from analogLib to your home and change the cyclic nature of the switch position in the CDF and make it a string. Place lots of switches in your schematic, each with a different variable, and you can set these variables from ocean.
Or if you need a manyway switch, create one yourself and use a variable for the position.
Or if you know how to write skill, you can place a voltage source with a piece of wire and a label and use connect by name as your trick. Needs to check and save between each change and ocean will need to netlist again, which I think is only done with the design() statement. Lot's of work for something that is better done with the definitionFile() trick above.