Question

Q7 . Perform the following operations using bit masking. (a) Set the bits 2, 4 and...

Q7

. Perform the following operations using bit masking.

(a)

Set the bits 2, 4 and 6 of the register P1OUT simultaneously

(b)

Clear the bits 2, 4 and 6 of the register P1OUT simultaneously

(c)

Toggle the bits 2, 4 and 6 of the register P1OUT simultaneously

(d)

Toggle all the bits of P1OUT simultaneously except the bits 2, 4 and 6

Homework Answers

Answer #1

a.Setting a bit in kth position means making the bit in the kth position to 1 whether it is 0 or 1.

If P1OUT=11100011(i.e 227), then setting 2,4,6 bits makes it to 11101011 i.e 235

b.clearing a bit in kth popsition means making the bit in kth position to 0 whether it is 0 or 1.

If P1OUT = 11100011(i.e 227) then clearing 2,4,6 bits makes it to 11000001 i.e 193

c.Toggling a bit in kth position means making the bit in kth position to 0 if it is 1 and vice-versa.

if P1OUT = 11100011(i.e 227) toggling 2,4,6 bits makes it to 11001001 i.e 201

d.If P1OUT = 11100011(i.e 227) then toggling all bits except 2,4,6 bits means toggling 1,3,5,7,8 bits makes it to 01110110 i.e 118

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Using T-Flip-flops, design a 3-bit register/counter circuit with bits [A2 A1 A0]. The circuit operations are...
Using T-Flip-flops, design a 3-bit register/counter circuit with bits [A2 A1 A0]. The circuit operations are described in the following table. Show all design details, i.e., write down steps and equations and draw the detailed circuit diagram. S2 S1 S0 Operation 0 0 0 No change 0 0 1 Rotate left 0 1 0 Rotate right 0 1 1 Reset 1 0 0 Set 1 0 1 Count down 1 1 0 Count up 1 1 1 Load external bits...
5. Suppose we have a 32-bit computer with an instruction set that supports immediate instructions as...
5. Suppose we have a 32-bit computer with an instruction set that supports immediate instructions as shown below: Opcode Source Register Destination Register immediate 6 bits 5 bits 5 bits 16 bits (a) How many registers at most does this computer have? (5%) (b) How many operations at most can this computer have? (5%) (c) What is the range of the number in the “immediate” field in 2'scomplement format? (5%)
Multiplying two 2-bit numbers (X0X1 and Y0Y1) requires a 4-bit output (Z0Z1Z2Z3). They force us to...
Multiplying two 2-bit numbers (X0X1 and Y0Y1) requires a 4-bit output (Z0Z1Z2Z3). They force us to perform the multiplication with a two-bit state machine with flip flops type D. The present state of the machine will be one of the numbers to multiply (Y0Y1) and the next state will be two of the four bits of the multiplying ( Y0Y1 -> Z2Z3). The other two bits (Z0Z1) will be additional outputs that will be determined using the two input bits...
Design a 4-bit AND/OR unit that accepts two 4-bits numbers, A and B, and either AND...
Design a 4-bit AND/OR unit that accepts two 4-bits numbers, A and B, and either AND them or OR them depending on a control signal A/O (when the control signal is 0 perform AND,otherwise if the signal is 1 then perform OR–bitwiselogicaloperation). The result will be stored in C.
A set of parity-check equations for a distance-4 Hamming code with 64 data bits and 8...
A set of parity-check equations for a distance-4 Hamming code with 64 data bits and 8 parity-check bits are specified by the eight 72-bit constants below, each representing one row the parity-check matrix: C[1] = 72'h80000000000000007f; C[2] = 72'h400000003FFFFFFF80; C[3] = 72'h20001FFFC0007FFF80; C[4] = 72'h100FE03FC07F807F80; C[5] = 72'h0871E3C3C78787878F; C[6] = 72'h04B66CCCD9999999B3; C[7] = 72'h02DAB5556AAAAAAAD5; C[8] = 72'hFFFFFFFFFFFFFFFFFF; Assuming that bits are numbered D[17:0], bits D[71:64] are the check bits, D[63:0] are the data bits. Write a Verilog model for a...
A). Convert following decimal integers to 8-bit two's complement binary numbers using any method . Explain...
A). Convert following decimal integers to 8-bit two's complement binary numbers using any method . Explain why, If decimal number cannot be represented with 8 bits. a. -46 b. -63 c. 118 d. -128 e. 128 B). Perform following operations by converting the decimal numbers to 8-bit two’s complement binary. Check results by converting final result to decimal a. 94-53 b. 15–84
EE 263 Homework Assignment 1    Perform the following conversions: Convert 51 (decimal) to binary and...
EE 263 Homework Assignment 1    Perform the following conversions: Convert 51 (decimal) to binary and to hex Convert 0xD1 (hexadecimal) to binary and to decimal Convert 0b11001001 (binary) to hex and to decimal Find the 2’s complement of the following 4-bit numbers 1101 0101 Perform the following 4-bit unsigned operations. For each, indicate the 4-bit result and the carry bit, and indicate if the answer is correct or not. 5 + 8 2 + 12 13 – 7 4...
A digital computer has a memory unit with 32 bits per word. The instruction set consists...
A digital computer has a memory unit with 32 bits per word. The instruction set consists of 147 different operations. All instructions have an operation code part (opcode) and two address fields: one for a memory address and one for a register address. This particular system includes eight general-purpose, user-addressable registers. Registers may be loaded directly from memory, and memory may be updated directly from the registers. Direct memory-to-memory data movement operations are not supported. Each instruction stored in one...
Perform the following using 10-bit floating point notation having the format SEEEMMMMMM: a. Decode 1101110110 to...
Perform the following using 10-bit floating point notation having the format SEEEMMMMMM: a. Decode 1101110110 to decimal integer and/or fraction. b. Decode 0001100000 to decimal integer and/or fraction. c. Encode: -5/32 d. Encode: +6 and 5/8
4-bit register using jk flip flops. 1)What is the purpose of anding the clock signal and...
4-bit register using jk flip flops. 1)What is the purpose of anding the clock signal and the load input together in your circuit? 2) How would I be able to store 1011 into the 4-bit register? Explain the process. For example, what do your inputs should be? Should your clock be on or off? How about your load input? How does your load input work when you want to store bits into your register? 3) If your load input is...