Answered step by step
Verified Expert Solution
Question
1 Approved Answer
There is an 8-bit register named CTRL at memory location 0x8000102C. It has the following bit values: Bit 7 6 5 4 3 2 1
- There is an 8-bit register named CTRL at memory location 0x8000102C. It has the following bit values:
Bit 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
| EN | NEN | OPT | GX | FLG |
| WERR |
- Write one line of code to read the value of CTRL into inval. Assume that the IDE works in such a way that you can simply do something like inval = CTRL.
- 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. (This results in a situation in which inval is non-zero if FLG=1 and inval is zero if FLG=0.)
- Write one line of code to set (force to 1) the NEN bit without affecting any other bits. One way to do this is to read CTRL into inval (do it again CTRL might have changed since the last time you did it), manipulate inval, and then write it back to CTRL.
- Write one line of code to clear (force to 0) the EN bit without affecting any other bits.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started