Question: There is an 8-bit register named CTRL at memory location 0times 8000102C . It has the following bit values: table[[Bit 7,6,5,4,3,2,1,0],[,NEN,EN,GX,FLG,OPT,WERR,TXEN]] Alice has written two
There is an 8-bit register named CTRL at memory location
0\\\\times 8000102C. It has the following bit values:\ \\\\table[[Bit 7,6,5,4,3,2,1,0],[,NEN,EN,GX,FLG,OPT,WERR,TXEN]]\ Alice has written two lines of
Ccode:\ char inval;\ inval = CTRL;\ In other words, the variable "inval" now contains the contents of the CTRL register.\ a. Write one line of code to set (force to 1) the NEN bit without affecting any other bits.\ b. Write one line of code to clear (force to 0 ) the OPT bit without affecting any other bits.\ c. Write one line of code to mask "inval" so that only the FLG bit is reflected. That is, after masking inval should be non-zero if FLG is 1 and zero if FLG is 0 . Hint: The value of the control register is already in the variable named "inval". Apply a masking operation to "inval" so that all bits besides the FLG bit are forced to zero.

3. There is an 8-bit register named CTRL at memory location 08000102C. It has the following bit values: Alice has written two lines of C code: char inval; inval = CTRL; In other words, the variable "inval" now contains the contents of the CTRL register. a. Write one line of code to set (force to 1) the NEN bit without affecting any other bits. b. Write one line of code to clear (force to 0 ) the OPT bit without affecting any other bits. c. Write one line of code to mask "inval" so that only the FLG bit is reflected. That is, after masking inval should be non-zero if FLG is 1 and zero if FLG is 0 . Hint: The value of the control register is already in the variable named "inval". Apply a masking operation to "inval" so that all bits besides the FLG bit are forced to zero
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
