• No results found

CS100: Introduction to Computer Science

N/A
N/A
Protected

Academic year: 2021

Share "CS100: Introduction to Computer Science"

Copied!
5
0
0

Loading.... (view fulltext now)

Full text

(1)

CS100: Introduction to

Computer Science

Lecture 2: Data Storage -- Bits, their storage and main memory

Review: History of Computers

q Mainframes

q Minicomputers

q Personal Computers & Workstations

Review: The Role of Algorithms

n Algorithm: n Program: n n Programming: n Software: n n Hardware:

How are data stored inside computers?

n

1.1 Bits and Their Storage

n

1.2 Main Memory

Bits and Bit Patterns

n

Bit: Binary Digit (0 or 1)

n

Bit Patterns (strings of 0 and 1s) are used to

represent information.

q Numbers q Text characters q Images

Sound

Bits and Boolean Operations

n Boolean Operation: An operation that

manipulates one or more true/false values

n

Specific operations

q AND q OR

q XOR (exclusive or) q NOT

(2)

Bits and Boolean Operations

n

Boolean operations

q AND

n Based on compound statement of the form P AND Q n 1 AND 1 =1, 1 represents the value true, 0 represents false

q OR n P OR Q,

n The output is true when at lease one of them is true q XOR (exclusive or)

n The output is true when its inputs are different q NOT: the output is the opposite of the input

Figure 1.1 The Boolean operations

AND, OR, and XOR (exclusive or)

Gates

n

Gate: A device that computes a Boolean

operation

q implemented as (small) electronic circuits inside

today’s computes

q Other technologies to implement gates n Gears, relays, optic devices.

q Provide the building blocks from which computers

are constructed

Figure 1.2 A pictorial representation of

AND, OR, XOR, and NOT gates as well

as their input and output values

Flip-flops

n

Flip-flop: A circuit built from gates that can

store one bit.

q Has an input line which sets its stored value to 1 q Has an input line which sets its stored value to 0 q While both input lines are 0, the most recently

stored value is preserved

(3)

Figure 1.4 Setting the output of

a flip-flop to 1

Figure 1.4 Setting the output of

a flip-flop to 1 (continued)

Figure 1.4 Setting the output of

a flip-flop to 1 (continued)

What happens if 1 is placed on the lower input?

Figure 1.5 Another way of

constructing a flip-flop

How does this flip-flop work?

Flip-flops

n

The flip-flop is one means of storing a bit

within a computer.

q Can have the output value of either 1 or 0 q Other circuit can adjust the output value (write) q Other circuit can respond to the stored value

(read)

n

Flip-flops show how devices can be

Exercise:

Inputs

Output

What input bit patterns will cause the following circuit to produce an output of 1?

(4)

Main Memory

n A collection of integrated circuits to store data (such as

flip-flops)

n Needs to have electrical power in order to maintain its

information

n Computer can manipulate only data that in main

memory

q Copy programs into main memory from a storage device to

execute

q Copy files into main memory to access

n The amount of main memory is crucial

q How many programs can be executed

q How much data can be readily available to a program?

Main Memory Cells

n

Cell: A unit of main memory (typically 8 bits

which is one byte)

q Most significant bit: the bit at the left (high-order)

end of the conceptual row of bits in a memory cell

q Least significant bit: the bit at the right

(low-order) end of the conceptual row of bits in a memory cell

Figure 1.7 The organization of a

byte-size memory cell

Main Memory Addresses

n

Address: A “name” that uniquely identifies

one cell in the computer’s main memory

q The names are actually numbers.

q These numbers are assigned consecutively

starting at zero.

q Numbering the cells in this manner associates an

order with the memory cells.

Figure 1.8 Memory cells arranged by

address

Measuring Memory Capacity

n Kilobyte: 210bytes = 1024 bytes

q Example: 3 KB = 3 ×1024 bytes q Sometimes “kibi” rather than “kilo”

n Megabyte: 220bytes = 1,048,576 bytes

q Example: 3 MB = 3 ×1,048,576 bytes q Sometimes “megi” rather than “mega”

n Gigabyte: 230 bytes = 1,073,741,824 bytes

q Example: 3 GB = 3 ×1,073,741,824 bytes q Sometimes “gigi” rather than “giga”

(5)

Questions:

n

If the memory cell whose address is 5

contains the value 8, what is the difference

between writing the value 5 into cell number

6 and moving the contents of cell number 5

into cell number 6?

Questions:

n

Suppose we want to interchange the values

stored in memory cells 2 and 3. Does the

following algorithm perform the task

correctly?

q Step1: Move the contents of cell number 2 to cell

number 3.

q Step 2: Move the contents of cell number 3 to cell

number 2.

Questions:

n

How many bits would be in the memory of a

computer with 4KB memory

n

What is the amount of main memory inside

your computer?

Main Memory Technologies

n RAM (Random Access Memory)

q Allow the stored data to be accessed in any order q No physical movement of the storage medium or a physical

reading head

q Any piece of data can be returned quickly and in a constant time

n Modern computers use other technologies to

improve the performance of main memory (size, respond time)

q DRAM (Dynamic RAM) q SDRAM (Synchronous DRAM)

q DDR-SDRAM (Double Data Rate-SDRAM ) (doubled

standard SDRAM efficiency)

Summarization

n

Boolean operations

n

Gates

n

Flip-flops (store a single bit)

n

Main memory (RAM)

q Cell, Byte, Address

Next Lecture:

n

Mass (or secondary) storage & representing

information

Figure

Figure 1.1 The Boolean operations  AND, OR, and XOR (exclusive or)
Figure 1.4 Setting the output of  a flip-flop to 1
Figure 1.7 The organization of a

References

Related documents

Representing Numeric Values n Binary notation: Uses bits to represent a. number in

We know that every byte in computer science is created from 8 bit that first bit is Most-Significant-Bit (MSB) and last bit Least-Significant-Bit (LSB), the idea of

• With a 16-bit wide data bus, the user can program the EBI to control one 16-bit device (Byte Access Select Mode) or two 8-bit devices in parallel that emulate a 16- bit memory

Remember, the Sparkler is a byte-addressable machine with a 16-bit word size, an 8-bit bus between pro- cessor and memory, and a Main Memory access time of 6 cycles (in addition to

Tag = (16-6-4) = 6 Line – 6 bits Word – 4 bit.. Consider a memory system that uses a 32- bit address to address at the byte level, plus a cache memory that uses a 64-byte line size.

Voice packet size in bits (1712) = voice packet size (214) * bits per byte (8) Voice packets per second (50) = CODEC bit rate (64 Kbps) / voice payload size (1280 bits)..

• Memory address register, MAR, a 12-bit register that holds the memory address of an instruction or the operand of an instruction.. • Memory buffer register, MBR, a 16-bit

Which of the following addition problems cannot be solved accurately when using a floating-point system in which each value is encoded by a byte whose most significant bit is the