def __setitem__(this, key, val):
    """
        note: by default this only caches updates locally
        """
    this.log.debug('RegWr: ' + str(key) + ':' + hex(val))
    if key in this.warn_names:
        this.log.warn('Writing: ' + str(key) + ' as 0')
        return 0
    elif key in this.warn_trans_names:
        this.log.warning('Writing' + str(this.warn_trans_names[key]) +
            ' in place of ' + str(key))
        key = this.warn_trans_names[key]
    elif key in this.trans_names:
        key = this.trans_names[key]
    assert key in this.names
    assert isinstance(val, int)
    if this.writeback:
        assert this.base_addr != None
        mem_addr = this.base_addr + this.offsets[key]
        this.mbus.write_mem(mem_addr, val, 32)
    else:
        this.local[key] = val
