Thursday 3 March 2016

Processors

1.1 Structure and function of the processor
1.1.2 Types of processors

Context:
  • The processor is the brain of the computer, it carries out the mathematical and logical operations which are necessary.
  • It is one of the most expensive parts of a computer. Upgrading the processor will greatly improve the performance.
  • They can be found in mobile phones and washing machines and all electronic devices. The way in which they are constructed changes rapidly.
  • Processor designs are extremely complex.
Things that can be upgraded:
RAM- This will give the computer more main memory
Graphic cards-
Usually people swap a hard disk drive for a SSD
Purchasing a CPU with higher cores- this isn't generally done due to the cost and more technical acquisition is needed to improve and replace a CPU.

Creating processor architecture, specialists will have to design a specific circuitry.
Silicon discs will then be produced by melting and finely slicing- producing crystals.
Processor are produced in a special room called a clean room

It takes a few minutes for a processor to work at 300 centigrade.

Machine Language:
This is the target of which the processor or CPU can understand, this type of code is called machine code.
Source code is written and understandable for humans, it is a high level language.
In order for machine code to be created from the source code a compiler is needed. this coverts the high level language into the machine code.
A compiler converts the source code into machine code.

Each processor architecture has its own unique instruction set
The compiler has to know the target architecture (in the process of converting source code into machine code)

The length of the code varies when it is converted by the compiler:
For example - 1 line of source code may be multiple lines of machine code.



Machine code  is the binary representation of an instruction, that is split into to distinct parts :
  • Opcode -The action or operation to be performed on a set of data
  • Operand- the data itself or the location where the data is stored
Assembly language:
This is the use of text (small mnemonics) to represent machine code
More simplified than source code

The size of instructions differ from architecture to architecture

Every instruction that a processor architecture can understand has a unique binary representation/ value, which is known as an Opcode
When executed the Opcode is used to determine which instruction to execute (what action it is to perform)


An example of the Opcode and what will happen when execution occurs:
Opcode
Assembly mnemonic
Description
000 0001
MOV
Moves a value to a register
000 010
ADD
Adds a value and stores in ACC (accumulator)
000 100
SUB
Subtracts a value and stores in ACC (accumulator)
001 000
MLT
Multiplies a value and stores in ACC (accumulator)


Assembly code is the step above machine code, allowing the coder to write code using mnemonics which represent machine code instructions.
When converting assembly code to machine code you must use an assembler
Each assembly code instruction has a one- to- one mapping.

Mnemonic Instruction Alternative mnemonics accepted
ADD Add
SUB Subtract
STA Store STO
LDA Load LOAD
BRA Branch always BR
BRZ Branch if zero BZ
BRP Branch if positive BP
INP Input IN, INPUT
OUT Output
HLT End program COB, END
DAT Data location


An xx in the Opcode refers to the data part (operand) of the instructions (only if required as not every instruction needs data) For example in order to add, you first need to know what they are adding.
Mail boxes can be referred to directly or indirectly, through the use of labels. A label is a text symbol that represents a mailbox making coding in LMC easier.
When a label is used to represent a mailbox the LMC assembler assigns a suitable mailbox as the code is assembled

Little Man Computer:



















The Little Man Computer step by step:

Instruction Fetch

As a first step in the fixed routine, the "little man" must get the instruction telling him what he should do next. The input is taken and stored in the accumulator
  1. he reads and remembers the Mailbox number currently displayed as the Counter value
  2. he goes over to the Mailbox with the Mailbox number that he is remembering, reads the 3 digit value in that Mailbox, and remembers it as the current Instruction value (forgetting any previous Instruction value that he might have been remembering

Counter Increment

The incrementing of the Counter must occur before instruction execution, as will become obvious when we look at instructions whose execution modifies the value in the Counter.
  1. the "little man" pushes a button which increments the Counter value so that it contains the Mailbox number of the sequencially next Mailbox.

Instruction Execution

  1. the "little man" compares the first digit of the Instruction value that he is remembering with the list of values in the "Instruction Set Table" to find out what he should do.
  2. he then follows the directions given in the Instruction Set Table that correspond to the first digit of the Instruction value.




Comparison Operators
 


==
Equal to

!=
Not equal to

<
Less than

<=
Less than or equal to

>
Greater than

>=
Greater than or equal to

Arithmetic Operators
 

+ Addition e.g. x=6+5 gives 11
- Subtraction e.g. x=6-5 gives 1
* Multiplication e.g. x=12*2 gives 24
/ Division e.g. x=12/2 gives 6
MOD Modulus e.g. 12MOD5 gives 2
DIV Quotient e.g. 17DIV5 gives 3
^ Exponentiation e.g. 3^4 gives 81

3 comments: