# File lib/ruby-vpi/vpi.rb, line 160
160:     def put_value aValue, aFormat = nil, aTime = nil, aDelay = VpiNoDelay
161:       if vpi_get(VpiType, self) == VpiNet
162:         aDelay = VpiForceFlag
163: 
164:         if driver = self[VpiDriver].find {|d| d.vpiType != VpiForce}
165:           warn "forcing value #{aValue.inspect} onto wire #{self} that is already driven by #{driver.inspect}"
166:         end
167:       end
168: 
169:       aFormat =
170:         if aFormat
171:           resolve_prop_type(aFormat)
172: 
173:         elsif aValue.respond_to? :to_int
174:           VpiIntVal
175: 
176:         elsif aValue.respond_to? :to_float
177:           VpiRealVal
178: 
179:         elsif aValue.respond_to? :to_str
180:           VpiStringVal
181: 
182:         elsif aValue.is_a? S_vpi_time
183:           VpiTimeVal
184: 
185:         elsif aValue.is_a? S_vpi_vecval
186:           VpiVectorVal
187: 
188:         elsif aValue.is_a? S_vpi_strengthval
189:           VpiStrengthVal
190: 
191:         else
192:           get_value_wrapper(VpiObjTypeVal).format
193:         end
194: 
195:       newVal = S_vpi_value.new(:format => aFormat)
196: 
197:       writtenVal =
198:         case aFormat
199:         when VpiBinStrVal, VpiOctStrVal, VpiDecStrVal, VpiHexStrVal, VpiStringVal
200:           newVal.value.str      = aValue.to_s
201: 
202:         when VpiScalarVal
203:           newVal.value.scalar   = aValue.to_i
204: 
205:         when VpiIntVal
206:           @size ||= vpi_get(VpiSize, self)
207: 
208:           if @size < INTEGER_BITS
209:             newVal.format        = VpiIntVal
210:             newVal.value.integer = aValue.to_i
211:           else
212:             newVal.format        = VpiHexStrVal
213:             newVal.value.str     = aValue.to_i.to_s(16)
214:           end
215: 
216:         when VpiRealVal
217:           newVal.value.real     = aValue.to_f
218: 
219:         when VpiTimeVal
220:           newVal.value.time     = aValue
221: 
222:         when VpiVectorVal
223:           newVal.value.vector   = aValue
224: 
225:         when VpiStrengthVal
226:           newVal.value.strength = aValue
227: 
228:         else
229:           raise "unknown S_vpi_value.format: #{newVal.format.inspect}"
230:         end
231: 
232:       vpi_put_value(self, newVal, aTime, aDelay)
233: 
234:       writtenVal
235:     end