Method: Origen::Registers::Bit#write
- Defined in:
- lib/origen/registers/bit.rb
#write(value, options = {}) ⇒ Object
Set the data value of the bit to the given value (1 or 0) If the bit is read-only, the value of the bit can be forced with ‘force: true’
301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/origen/registers/bit.rb', line 301 def write(value, = {}) # If an array is written it means a data value and an overlay have been supplied # in one go... if value.is_a?(Array) (value[1]) value = value[0] end if (@data != value & 1 && @writable) || (@data != value & 1 && [:force] == true) if ((set?) && (!@set_only)) || ((!set?) && (!@clr_only)) @data = value & 1 @update_required = true @updated_post_reset = true end end self end |