def set(self, value: int):
if not isinstance(value, int):<EOL><INDENT>raise self.exception("<STR_LIT>".format(value))<EOL><DEDENT>if self.lsb0 and self.value % <NUM_LIT:2> == <NUM_LIT:1>:<EOL><INDENT>raise self.exception("<STR_LIT>".format(value))<EOL><DEDENT>if not self.signed and value < <NUM_LIT:0>:<EOL><INDENT>raise self.exception("<STR_LIT>".format(value))<EOL><DEDENT>if value < self.min() or value > self.max():<EOL><INDENT>raise self.exception("<STR_LIT>".format(value, self.min(), self.max()))<EOL><DEDENT>self.value = value<EOL>
Set the immediate to a value. This function checks if the value is valid and will raise an
:class:`InvalidImmediateException` if it doesn't.

:param value: Value to set the immediate to
:type value: int

:raises InvalidImmediateException: value does not match immediate