The easiest way to generate the code for your D/A simulation is to build an ideal ADC with a sinewave input source. Then use its output to drive your DAC. HSPICE should have macro model capability to handle this.
but I think use behavior A/D is better .. but how modeling behavior A/D ?
when I design flash A/D .. I use hspice and make a behavior D/A model .. I find I can not use "if else .. for decode circuit ..."
finally I use verilog and synthesis a real decode , and convert to spice
for behavior D/A model ...
if hspice support some behavior language (if else .. when .. for next ..)
I can make model easy ..