Professional Documents
Culture Documents
Data manipulation refers to moving data from one location to another, as well as performing operations,
such as arithmetic and logic calculations.
Computer architecture
o Get the values from the main memory and place them in the register
o Perform the operation
o Place the result into main memory
*Many machines contain cache memory – located in the CPU – to avoid frequent data transfers
between CPU and main memory
Stored-program concept
The idea of storing a computer's program in main memory – von Neumann architecture is built upon this
concept.
Historical background:
Early computers were very inflexible – things they could do were built into the control units.
Some were designed so that the CPU could be rewired – allowing for a little more flexibility. A
breakthrough came with the realization that a program can be stored in the main memory just
like data – in this way the control unit can extract the program from main memory – to change
what we want the computer to do we simply need to change the content of main memory
instead of having to rewire the CPU. Stored-program concept is the standard approach used
today. Originally it was difficult for people to understand as they thought of programs and data
as two different entities – with data stored in the memory and programs as parts of the CPU.
The main memory is a temporary storage where running programs and data are stored.
Also called random access memory (RAM) - it is organized as individual cells that can be accessed
randomly and independently of each other. RAM can be static (SRAM) or dynamic (DRAM).
Main memory consists of a number of cells, each of which can store a piece of information. Each cell has
a unique address to which the program can refer in execution
Memory cell – a storage space of n bits which can hold 2 n different bit combinations. Almost all
computers have 8-bit cells, although in theory they can be of any size.
Each memory cell has an address – a number uniquely identifying the cell in the main
memory. The addresses are numbers assigned consecutively, starting at 0. Address
space is the range of possible addresses. It is determined by the number of bits used to
represent the address.
The memory cells are normally envisioned as being arranged in a row. The left end of this row is called
high-order end, whereas the right end is called low-order end.
An important consequence of assigning an order to both the cells in main memory and the bits within
each cell is that the entire collection of bits is essentially ordered in one long row. Parts of this row can
therefore store bit patterns longer that the content of an individual cell.
Secondary storage
Due to the volatility(data loaded into RAM disappear as the computer is shut down) and limited size of
the main memory, most computers have additional memory devices called mass storage or secondary
storage.
A byte is 8 bits. Bytes are grouped into words and stored in main memory and registers
In 32-bit architecture a word is 4 bytes.
In 64-bit architecture a word is 8 bytes.
Example: if a word is 32 bits, we require 4 8-bit cells to store it. Suppose the word is 90AB12CD16 - 2 digit
in hex is one byte. There are two ways to store this word:
Big endian – the most significant byte is stored in the smallest address:
Cell 1 – 90
Cell 2 – AB
Cell 3 – 12
Cell 4 – CD
Little endian – the least significant byte is stored in the smallest address:
Cell 1 – CD
Cell 2 – 12
Cell 3 – AB
Cell 4 – 90
Machine instructions
A program encoded as bit patterns and stored in main memory is called instructions. The CPU can
extract the instructions from main memory and execute them.
A machine language is a set of machine instructions along with the encoding system. An instruction
expressed in a machine language is a machine-level instruction.
A list of instructions a typical CPU must be able to decode and execute is quite short. Once a machine
can perform certain elementary tasks, adding more features does not increase machine's fundamental
capabilities.
Parts of an instruction
Op-code – indicates which of the operations is requested
Operand – contains more detailed information about the operation specified in the op-code
Addressing mode – shows where to fetch the data to be operated on
There are 2 special purpose registers that control the program execution:
Instruction register – holds the instruction currently being executed
Program counter – contains the address of the next instruction to be executed
Machine cycle
Fetch – CPU requests that main memory provide it with the instruction that is stored at the
address indicated by the program counter. The instruction is retrieved from main memory and
placed in the instruction register. Program counter is incremented by 2 to contain the address of
the next instruction (each instruction takes 2 memory cells).
Decode – the instruction is now in the instruction register. It is decoded – the operand field is
broken into components based on the instruction's op-code.
Execute – activate the appropriate circuitry to perform the requested task.
Once the instruction has been executed, the cycle for the current instruction is complete. The CPU
begins the cycle again for the next instruction.
Example of decoding an instruction:
16-bit instruction: 306E
Op-code: 3 – means: store the content of a register in a memory cell
Operand: 0 – identifies the register(R0) whose content is to be stored
6E – identifies the address of a memory cell where the data will be sent
Many programs can be stored simultaneously in main memory, as long as they occupy different
locations. As data is also kept there, the machine cannot distinguish what is data and what is a program.
This allows one program to manipulate another in the same way as it would manipulate data.