Computer Systems

studied byStudied by 1 person
0.0(0)
get a hint
hint

Why are numbers in the computer represented in 2's complement?

1 / 104

encourage image

There's no tags or description

Looks like no one added any tags here yet for you.

105 Terms

1

Why are numbers in the computer represented in 2's complement?

The number of bits available for representing a number is limited; it is not clear how to represent a negative number

New cards
2

A byte is

8 bits

New cards
3

An ASCII length

7 bits and sign bit is always 0

New cards
4

When does overflow happen?

If you add two positives and the leftmost bit turns out negative; If you add two negatives and the leftmost bit turns out positive

New cards
5

How do you know there is a carry?

Extra leftmost bit

New cards
6

How do you know there is borrow?

In a substraction A - B, B is greater than A (need to take 2's complement and do addition A + 2's of B)

New cards
7

What is a BCD?

Binary coded decimal; each decimal digit has a representation of two numbers per byte (that look just like the decimal number) and zeros to fill in the missing bytes

New cards
8

What format is used for floating point numbers?

IEEE Single Point Precision Format

New cards
9

What are the steps for IEEE?

Convert floating point number to binary (for the decimal, multiply the value of the decimal times 2 and only count the number before the decimal point, then multiply the result by 2 and so on until you have an equal amount of results as number of decimals); decide sign bit; move the decimal point to the right of the leftmost bit; do "excess-127" (127 + binary exponent); put it together = sign bit + exponent + mantissa

New cards
10

What is the binary conversion of 128?

1000 0000

New cards
11

OR

New cards
12

AND

New cards
13

The hexadecimal system represents numbers using about ____ as many digits as the binary system.

1/4

New cards
14

What is CRLF? (ASCII)

Newline

New cards
15

What are the three basic types of instruction operands?

Constants, CPU register designations, and references to memory locations.

New cards
16

Why do we not use signed magnitude to represent signed numbers in a computer?

We do not use signed magnitude to represent signed numbers in a computer because adding or subtracting two values in sign magnitude does not always lead to the correct result. Another reason is because the left most bit is used to indicate if a value is positive or negative while the magnitude bits indicate a value. This can make interpreting the value in sign magnitude extremely confusing and lead to incorrect interpretations.

New cards
17

What is the difference between a "carry in" and a "carry out"?

"Carry in" means there was a carry into the left most bit (sign bit) while "carry out" means there was a carry out of the left most bit. This occurs when adding two signed values. (In other words. If two values are added such as A + 7 the sum in decimal would be 17. Thus, 17 - 16 = 1. As a result, you would put down 1 to indicate the difference between the sum and 16 and carry one over to the next numerical place value to indicate a carry of 16.)

New cards
18

What is the difference between the term, "two's complement representation", and "calculating the two's complement of a number"?

The two's complement representation is the signed fixed length representation of a value. Calculating the two's complement of a number is taking a number that is assumed to be in an unsigned form and converting to a signed form within a fixed length.

New cards
19

Justify your agreement or disagreement to the following: "Signed magnitude cannot be used as a means to represent signed numbers in a computer."

Sign magnitude cannot be used to represent signed numbers in a computer because if you add two values in sign magnitude you can get an incorrect answer. Also, it uses the left most bit (sign bit) as a 1 to indicate a negative value whilst all other bits in the magnitude are supposed to indicate an integer representation. This can be incredibly hard to distinguish thus signed magnitude should not be used as a means to represent signed numbers in a computer.

New cards
20

Six (cap, its five) basic components of a computer

CPU, Memory (RAM), input, output, and AUX memory

New cards
21

What are the parts of a CPU?

Control unit, arithmetic logic unit, registers (storage locations)

New cards
22

Is memory linear or a grid?

Linear

New cards
23

What terminates the information stored in RAM?

RAM will lose its memory after the computer is powered off.

New cards
24

What are some examples of input devices?

Keyboard, mouse, microphone

New cards
25

What are examples of output devices?

Monitor, speakers, printer

New cards
26

What are some examples of aux storage?

Harddrive, flashdrive

New cards
27

What does "byte-addresable" mean?

Each byte in memory has its own address

New cards
28

Flat Memory Model

An approach to assigning memory addresses in which memory locations are described by single unsigned integers corresponding to linear positions.

New cards
29

Segmented Memory Model

An approach to assigning memory addresses in which primary storage is divided into equal sized segments called pages, identified by sequential nonnegative integers; each memory address depends on its segment number (chunks of memory)

New cards
30

Paging

A memory management scheme where a computer stores and retrieves data from secondary storage for use in main memory.

New cards
31

What is the instruction pointer?

eip; holds address of the next instruction to be performed.

New cards
32

What are the parts of "add sum, 5"? (Mneumonic + operand)

Add = mnemonic; sum, 5 = operand; both = instruction

New cards
33

Where are the instructions held in the instruction execution cycle?

RAM

New cards
34

Parts of Instruction Execution Cycle

Fetch (find out what is in eip and through address bus go into ram to get the corresponding bytes) Decode (In the control unit) Fetch operands Execute (Into the a/l unit) Store output

New cards
35

What are the 2 buses involved in the Instruction Execution Cycle?

Address and data

New cards
36

How are instructions stored in memory?

One byte has the mnemonic (opcode), the address of dest is stored, and then is source address (or value if it is immediate); information is stored in binary.

New cards
37

The bottleneck for the Instruction Execution Cycle

The system bus; everything we do goes through the system bus (CPU to MEMORY and back); 2^32 binary values at a time.

New cards
38

What does A/L Unit stand for?

Arithmetic/Logic Unit; gets information for memory or register receives data and perform calculation

New cards
39

What is the job of the CPU?

To direct traffic across the system bus.

New cards
40

What is the job of the CPU's control unit?

To interpret an opcode and directs the execution.

New cards
41

What is the control bus?

It tells us who is using the system bus at a point; monitors transmission of memory.

New cards
42

How many GB of data can be in the RAM?

4GB (2^32 = Address bus is 32-bit)

New cards
43

What is the unsigned range of values that can be addressed?

0 -> 4,294,967,295 (0 -> 2^32 - 1)

New cards
44

What are the 4 General Purpose Registers

eax, ebx, ecx, edx (32-bit)

New cards
45

What are the four Index Registers?

ESI (Source Index Registers), EDI (Destination Index Registers), ESP (Stack Pointer), EBP (Base Pointer); (32-bit) for both you can only get to the low orderword

New cards
46

What is the Instruction Pointer?

EIP

New cards
47

Pre-Fetching Instructions

CPU fetches instructions before a prior instruction is executed.

New cards
48

When does a stall in the pipeline occur?

When two instructions attempt to use the same register.

New cards
49

What bit is CF

0

New cards
50

What bit is PF

2

New cards
51

What bit is ZF

6

New cards
52

What bit is SF

7

New cards
53

What bit is DF

10

New cards
54

What bit is OF

11

New cards
55

What is the maximum capacity IN HEX on a 32-bit system bus?

00 00 00 00 -> FF FF FF FF

New cards
56

The EAX register is sometimes known as the _________. Why?

Accumulator; because it is the destination of arithmetic results.

New cards
57

What are the three parts of the accumulator?

AX (0-15 bit), AH (8-15), AL (0-7)

New cards
58

What criterion must be satisfied for a value to be stored in Little ENDian?

It must be a numerical value (scaled value), it must be stored in memory, and it must be multibyte.

New cards
59

What is an instruction?

Statement that is translated by the assembler into machine code

New cards
60

What is a directive?

Indicates where to take action but does not result in execution of machine code

New cards
61

What does a macro do?

Calls a chunk of code to be exevuted

New cards
62

What character starts a comment in assembly code?

;

New cards
63

Is .586 an instruction or a directive?

Directive

New cards
64

Is mov eax, val an instruction or a macro?

Instruction

New cards
65

Is input prompt1, string, 40 an instruction or a macro?

Macro

New cards
66

Do all directives start with a '.'?

No

New cards
67

Is DWORD a macro or a directive?

Directive (allocates memory)

New cards
68

What are the main parts of a typical instruction? (4)

Name, mnemonic, operands, comment

New cards
69

If we have EAX = 0x 00 00 10 04 and the instruction mov sum, eax, how is EAX value stored in sum?

Little ENDian; 04 10 00 00

New cards
70

In Little ENDian, the destination stores the least significant byte (rightmost) from the source in the ________ memory address.

Smallest

New cards
71

How many bytes of memory does a word allocate?

2

New cards
72

How many bytes of memory does a dword allocate?

4

New cards
73

How many bytes of memory does a qword allocate?

8

New cards
74

If in the data segment you declare: char1 BYTE 'q', and in the code segment it says mov ax, char1, what would be the error?

Size mismatch (or size ambiguity; ax is a 16-bit register while char1 is an 8-bit register)

New cards
75

What are the three types of instruction operands?

Constants (or immediate; add eax, 5), CPU Register (add eax, 5), memory location (add sum, eax)

New cards
76

What are the three general addressing modes?

Immediate, register, memory

New cards
77

What are the two types of memory addressing modes?

Direct and register indirect

New cards
78

What addressing mode is add sum, eax using?

Direct, register

New cards
79

What addressing mode is add [ebx], eax using?

Register indirect, register

New cards
80

What addressing mode is add ax, 6 using?

Immediate

New cards
81

What addressing mode is add 6, ax using?

N/A (An immediate value can not be a destination)

New cards
82

What addressing mode is add [ebx], 20 using?

Size mismatch (neither [ebx] or 20 indicate size, [ebx] because it is a pointer while 20 because it is an immediate value)

New cards
83

What addressing mode is add BYTE PTR [ebx], 20?

Register indirect

New cards
84

What could "io.h" be compared to in c++?

Header file

New cards
85

What does atod do?

It scans a string starting at source for digits and the 2's complement value is stored at eax (default destination)

New cards
86

What does dtoa do?

Takes doubleword at source and converts it into a string of ASCII characters at destination

New cards
87

If we are given dtoa dest, source and the source value is 103 (decimal) what is the ASCII value?

31 30 33 h

New cards
88

What does atow do?

Scans the string starting at source and turns into a 16-bit digit corresponding 2's complement value and places it at ax (default destination)

New cards
89

What does wtoa do?

Takes a numerical 16-bit value from source (register or memory) and converts it into ASCII characters, storing it into destination

New cards
90

How many ASCII characters are needed to store a range of 16-bit values? (wtoa)

6

New cards
91

A dtoa starts with a doubleword and produces a __-byte-long string

11

New cards
92
Input macro: What gets stored at destination when we hit

The input from the user and a null terminator character.

New cards
93

Input macro: What happens if you enter a string larger than the length specified?

The extra characters are truncated.

New cards
94

For instructions, you _____ have both source and destination in memory.

cannot

New cards
95

Does mov alter any flags?

No

New cards
96

What are the three fields of Mod R/M?

Mod, register, and R/M (register/memory)

New cards
97

In an AL accumulator, how many bytes are reserved for opcode? How many bytes are reserved for object code?

1; 5

New cards
98

In general, with direct memory mode "2+" always means "2 + __ "

4

New cards
99

In general, with indirect memory mode "2+" always means "2 + __ "

0

New cards
100

Is the REX Prefix part of the opcode for 64-bit processors? (Page 82, Figure 4.4)

No (it is still an extra byte though)

New cards

Explore top notes

note Note
studied byStudied by 43 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 27 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 18 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 8 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 30 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 25 people
Updated ... ago
5.0 Stars(1)
note Note
studied byStudied by 19 people
Updated ... ago
5.0 Stars(2)
note Note
studied byStudied by 101 people
Updated ... ago
5.0 Stars(3)

Explore top flashcards

flashcards Flashcard85 terms
studied byStudied by 16 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard36 terms
studied byStudied by 59 people
Updated ... ago
5.0 Stars(2)
flashcards Flashcard70 terms
studied byStudied by 3 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard71 terms
studied byStudied by 91 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard31 terms
studied byStudied by 9 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard35 terms
studied byStudied by 1 person
Updated ... ago
5.0 Stars(1)
flashcards Flashcard52 terms
studied byStudied by 12 people
Updated ... ago
5.0 Stars(1)
flashcards Flashcard59 terms
studied byStudied by 2331 people
Updated ... ago
4.8 Stars(30)