Data Representation

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/84

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

85 Terms

1
New cards

uint8_t

Unsigned 8-bit type, same as unsigned char.

2
New cards

Carry flag

Set if the result of an addition exceeds the maximum value that can be represented in the given number of bits.

3
New cards

Borrow flag

Set if the result of a subtraction is negative.

4
New cards

Unsigned Byte

Range: 0 to 255, Storage Size: 1 byte, Powers of 2: 0 to 28-1.

5
New cards

Unsigned Halfword

Range: 0 to 65,535, Storage Size: 2 bytes, Powers of 2: 0 to 216-1.

6
New cards

Unsigned Word

Range: 0 to 4,294,967,295, Storage Size: 4 bytes, Powers of 2: 0 to 232-1.

7
New cards

Unsigned Double-word

Range: 0 to 18,446,744,073,709,551,615, Storage Size: 8 bytes.

8
New cards

Binary to Decimal Conversion

For example, 0101102 = 0×24 + 1×23 + 0×22 + 1×21 + 1×20 = 8 + 2 + 1 = 11.

9
New cards

Decimal to Binary Conversion

Example: 52 = 32 + 20 = 32 + 16 + 4 = 1000002 + 0100002 + 0001002 = 1101002.

10
New cards

Five-bit binary code

A binary representation that uses 5 bits.

11
New cards

Carry in addition

Occurs if the result exceeds the maximum value for the given bits (i.e., c > 2n-1).

12
New cards

Borrow in subtraction

Occurs if the result is less than zero.

13
New cards

ARM Cortex-M processors

On these processors, the carry flag and the borrow flag are physically the same flag bit in the status register.

14
New cards

Addition crossing boundary

If the traverse crosses the boundary between 0 and 2n-1, the carry flag is set on addition.

15
New cards

Subtraction crossing boundary

If the traverse crosses the boundary between 0 and 2n-1, the carry flag is cleared on subtraction.

16
New cards

Example of carry flag

In the case of uint8_t a = 255 and b = 2, c = a + b results in c being 1 0000 0001.

17
New cards

Example of borrow flag

In the case of uint8_t a = 1 and b = 2, c = a - b results in c being 1 1111 1111.

18
New cards

Bit weight

For bit i, the weight is 2i.

19
New cards

Data representation

The method of representing data in binary form.

20
New cards

Number systems

Includes binary, octal, decimal, and hexadecimal.

21
New cards

Hexadecimal representation

Uses base 16, represented with digits 0-9 and letters A-F.

22
New cards

Octal representation

Uses base 8, represented with digits 0-7.

23
New cards

Decimal representation

Uses base 10, represented with digits 0-9.

24
New cards

Unsigned Integer Representation

Natural representation of unsigned integer

25
New cards

ARM Carry

On ARM, Carry = NOT Borrow, for subtraction

26
New cards

Signed Integer Representation

Three ways to represent signed binary integers

27
New cards

Signed Magnitude

value= (-1)sign × Magnitude

28
New cards

One's Complement

α + ᾱ = 2ⁿ−1

29
New cards

Two's Complement

α + ᾱ = 2ⁿ

30
New cards

Range of Signed Integers

Range [−2ⁿ−1 + 1, 2ⁿ−1 −1] for Signed Magnitude and One's Complement; [−2ⁿ−1, 2ⁿ−1 −1] for Two's Complement

31
New cards

Zero Representation

Two zeroes (±0) for Signed Magnitude and One's Complement; One zero for Two's Complement

32
New cards

Unique Numbers

2ⁿ−1 for Signed Magnitude and One's Complement; 2ⁿ for Two's Complement

33
New cards

Signed Byte Range

Range -128 to +127; Powers of 2: -2⁷ to 2⁷-1

34
New cards

Signed Halfword Range

Range -32,768 to +32,767; Powers of 2: -2¹⁵ to 2¹⁵-1

35
New cards

Signed Word Range

Range -2,147,483,648 to +2,147,483,647; Powers of 2: -2³¹ to 2³¹-1

36
New cards

Signed Double-word Range

Range -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807

37
New cards

Two's Complement Weight

The weight of the sign bit is -2(n-1)

38
New cards

Convert to Negative

A number can be converted to its negative counterpart by: 1) bitwise NOT, and 2) plus one

39
New cards

Example of Two's Complement

Example 1: TC(3) Binary 0b00011 Decimal 3 Step 1: Invert every bit 0b11100 Step 2: Add 1 + 0b00001 Two's complement 0b11101 -3

40
New cards

Overflow in Addition

Overflow happens in addition if and only if positive + positive => negative or negative + negative => positive

41
New cards

Overflow in Subtraction

Overflow happens in subtraction if and only if positive - negative => negative or negative - positive => positive

42
New cards

Overflow Condition

Overflow cannot occur when adding operands with different signs or when subtracting operands with the same signs

43
New cards

8-bit Signed Addition Example

int8_t a, b, c; a = 127; b = 3; c = a + b; What is the value of c as signed decimal?

44
New cards

8-bit Signed Subtraction Example

int8_t a, b, c; a = -128; b = 2; c = a - b; What is the value of c as signed decimal?

45
New cards

Overflow flag for signed numbers

Indicates that the result of an operation has exceeded the range that can be represented with the given number of bits.

46
New cards

Two's complement

A method for representing signed integers in binary, where the most significant bit indicates the sign of the number.

47
New cards

Sign bit weight

The weight of the sign bit is negative, specifically -2^(n-1), where n is the total number of bits.

48
New cards

Overflow flag

A flag set by the ALU to indicate that an arithmetic operation has resulted in a value that cannot be represented within the given number of bits.

49
New cards

ALU

Arithmetic and Logic Unit, a digital circuit used to perform arithmetic and logic operations.

50
New cards

High-level languages

Programming languages that provide abstraction from the hardware, allowing programmers to write code without needing to manage hardware details.

51
New cards

Expression: 0100 + 0010

Results in 0110 with no carry or overflow.

52
New cards

Expression: 0100 + 0110

Results in 1010 with no carry but an overflow.

53
New cards

Expression: 1100 + 1110

Results in 1010 with a carry but no overflow.

54
New cards

Expression: 1100 + 1010

Results in 0110 with both a carry and an overflow.

55
New cards

Hardware adder for signed numbers

The same hardware adder designed for unsigned numbers can also correctly add signed numbers.

56
New cards

Simple Addition example

For unsigned addition: 23 + 6 = 29.

57
New cards

Signed Addition example

For signed addition: -9 + 6 = -3.

58
New cards

Unsigned number representation

If 11101 represents an unsigned number, then 11101 in decimal is 29.

59
New cards

Signed number representation

If 11101 represents a signed number, then 11101 in decimal is -3.

60
New cards

Subtraction hardware

The same hardware designed for subtraction works correctly for both signed and unsigned subtraction.

61
New cards

Minuend and subtrahend

In subtraction, the minuend is the number from which another number (the subtrahend) is to be subtracted.

62
New cards

Signed Integer Representation summary

The CPU and ALU do not differentiate between signed and unsigned types for addition and subtraction.

63
New cards

Condition Flags in ALU

The ALU sets up both the carry flag and the overflow flag, but it is the programmer's responsibility to interpret these flags.

64
New cards

Unsigned Subtraction

minuend - subtrahend

65
New cards

Difference

The result of subtraction

66
New cards

Cortex-M4 Condition Flags

Flags that indicate the result of arithmetic/logic operations: N (negative), Z (zero), V (overflow), C (carry).

67
New cards

N Flag

Indicates the result is negative.

68
New cards

Z Flag

Indicates the result is zero.

69
New cards

V Flag

Indicates signed overflow.

70
New cards

C Flag

Indicates unsigned overflow.

71
New cards

ASCII

American Standard Code for Information Interchange.

72
New cards

String Comparison

Strings are compared based on their ASCII values.

73
New cards

String Length

Determined by counting characters until the null character (NUL, ASCII value 0x00) is reached.

74
New cards

Convert to Upper Case

Changing lowercase letters to uppercase by adjusting their ASCII values.

75
New cards

Memory Address

The location in memory where data is stored.

76
New cards

Character Array

An array of characters, often used to store strings.

77
New cards

Null Terminator

A special character (ASCII value 0x00) that indicates the end of a string.

78
New cards

ADDS Instruction

An instruction that adds two registers and sets condition flags.

79
New cards

Subtraction Conversion

Subtraction can be converted to addition by inversion and plus-one.

80
New cards

Unsigned Multiplication Hardware

Works correctly for signed numbers if the product keeps the same number of bits as operands.

81
New cards

ASCII Character Set

A set of 128 characters represented by specific decimal and hexadecimal values.

82
New cards

Example of ASCII Values

For instance, 'A' is 65 in decimal and 41 in hexadecimal.

83
New cards

Pointer Dereference Operator

Used to access the value at the address pointed to by a pointer.

84
New cards

Array Subscript Operator

Used to access elements in an array using an index.

85
New cards

Loop Until NULL

A method to iterate through a string until the null character is encountered.