4.3 ProcessorFundamentals.bit_manipulation Flashcards

(32 cards)

1
Q

What is a shift operation in computing?

A

Moving the bits stored in a register a given number of places within the register.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What happens in a logical shift?

A

Bits shifted out of the register are replaced with zeros.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an arithmetic shift?

A

A shift operation where the sign of the number is preserved.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How does a cyclic shift work?

A

No bits are lost; bits shifted out of one end of the register are introduced at the other end.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a monitor in computing?

A

A system that automatically takes readings from a device.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is control in computing?

A

A system that automatically takes readings from a device and uses the data to adjust the device.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a mask in computing?

A

A number used with logical operators (AND, OR, XOR) to identify, remove, or set specific bits in an address or register.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a binary shift?

A

Moving the bits stored in a register a given number of places within the register.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How is shifting used in the IR (Instruction Register)?

A

Each bit in the IR may be used to identify a different interrupt.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Example: Logical left shift of 10101111 by 3 places?

A

01111000

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Example: Arithmetic right shift of 10101111 by 3 places?

A

11110101

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is an arithmetic shift used for?

A

Multiplication or division by powers of two.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Example: Cyclic left shift of 10101111 by 3 places?

A

01111101

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a left shift?

A

Bits are shifted to the left in logical, arithmetic, and cyclic shifts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a right shift?

A

Bits are shifted to the right in logical, arithmetic, and cyclic shifts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does the LSL instruction do?

A

LSL n shifts the bits in ACC logically left by n places, introducing zeros on the right.

17
Q

What does the LSR instruction do?

A

LSR n shifts the bits in ACC logically right by n places, introducing zeros on the left.

18
Q

Where are shifts always performed in assembly language?

A

On the ACC (Accumulator).

19
Q

How is bit manipulation used in monitoring and control?

A

Each bit in a register or memory location can be used as a flag to track the status of sensors or processes.

20
Q

How can a control system with eight sensors track processed data?

A

By using 8 different bits in the same memory location.

21
Q

What logical operation is used to check if a bit has been set?

22
Q

What logical operation is used to set a bit?

23
Q

What logical operation is used to clear a bit that has been set?

24
Q

What does the AND n instruction do?

A

Performs a bitwise AND operation between the contents of ACC and the operand n.

25
What does the `AND
` instruction do?
Performs a bitwise AND operation between the contents of ACC and the contents of *
*.
26
What does the `XOR n` instruction do?
Performs a bitwise XOR operation between the contents of ACC and the operand *n*.
27
What does the `XOR
` instruction do?
Performs a bitwise XOR operation between the contents of ACC and the contents of *
*.
28
What does the `OR
` instruction do?
Performs a bitwise OR operation between the contents of ACC and the contents of *
*.
29
Where are the results of logical bit manipulation stored?
In the *ACC (Accumulator)*.
30
What can `
` in bit manipulation instructions represent?
An absolute address or a symbolic address.
31
How is the operand used in logical bit manipulation?
As a *mask* to set or clear bits.
32
Example: Testing Sensor 3 in Assembly Language
**Opcode | Operand | Comment** - `LDD sensors` → Load content of *sensors* into ACC - `AND #B100` → Mask to select bit 3 only - `CMP #B100` → Check if bit 3 is set - `JPN process` → Jump to *process* routine if bit not set - `LDD sensors` → Load *sensors* into ACC - `XOR #B100` → Clear bit 3 as sensor 3 has been processed