Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

2ND EXAMPLE

 Had 1 0 0 0 1 0 1 1 (written msb (Most Significant Bit) to lsb (Least Significant Bit))
 Value of positions is (lsb to msb) 1,2,4,8,16,32,64,128,256,512,…
 The powers of 2
 Value of the number above
 = 128 + 8 + 2 + 1
 = 139

41/90
BINARY ADDITION

 Follow the same rules as base 10


 carries  1111
 11001 (25)  00111 ( 7)
 + 00010 ( 2)  + 01011 (11)
 11011 (27)  10010 (18)

 More examples?

42/90
BINARY SUBTRACTION

 And we need to borrow – step 1


 Set the problem
 2
 10000 (16)
 10000 (16)
 - 00011 ( 3)
 - 00011 ( 3)

43/90
BINARY SUBRACTION

 The next steps work through to

 To allow answer to be done

44/90
BINARY MULTIPLICATION

1 0 0 0 0 16
 Just like multiplication in base 10 x 0 0 0 1 1 3
1 0 0 0 0
1 0 0 0 0 .
1 1 0 0 0 0 48

 More examples?

45/90
2’S COMPLEMENT

 For 4 bits can represent values -8 to 7 0 0 0 0 0 -0 0 0 0 0


1 0 0 0 1 -1 1 1 1 1
2 0 0 1 0 -2 1 1 1 0
3 0 0 1 1 -3 1 1 0 1
4 0 1 0 0 -4 1 1 0 0
5 0 1 0 1 -5 1 0 1 1
6 0 1 1 0 -6 1 0 1 0
7 0 1 1 1 -7 1 0 0 1
 In general can represent -8 1 0 0 0
 -2n-1  n  2n-1 - 1

46/90
ARITHMETIC WITH 2’S COMPLEMENT

1 1
0 1 0 1 5
1 1 0 1 -3
 Add 5 and -3
0 0 1 0
Carry out = 1

47/90
FINDING THE 2’S COMPLEMENT

 To generate the 2’s complement of n


 Say n is 3
 3 in binary (4 bits) is 0011
 Procedure
 1) Take the 1’s complement, then add 1
 1’s complement – complement all bits
 0011 → 1100 +1 = 1101

 2) Starting at the lsb (rightmost) bit


 Keep the 1st 1 and then complement the rest of the bits. Can easily see on previous example.

48/90
SUBTRACTION VIA 2’S COMPLEMENT

 14 – 6
 (need 5 bits to represent in 2’s complement form)
 01110 – 00110 or

 01110 + 11010 (i.e. 14 + (-6))

 01110
 +11010
 01000 and a carry out of 1 value is 8
49/90
OPERATING IN 2’S COMPLEMENT

 In general can represent


 -2n-1  n  2n-1 - 1
 So with 4 bits can represent values of -8  n  +7
 So with 8 bits can represent values of -128  n  +127
 So with 16 bits can represent values of -32768  n  +32767

50/90
A BASIC OVERVIEW OF COMPUTER ARCHITECTURE
A BASIC OVERVIEW OF COMPUTER ARCHITECTURE

 For your reference you can find much of this information on Wikipedia.
 But can you trust Wikipedia?

 When was the first computer created?

52/90
EARLY COMPUTING TECHNOLOGY

 Early computing could be traced back to the abacus. When was the abacus in use?
 Around 2700 B.C.

 In the mid 1600’s Blaise Pascal designed and implemented a mechanical calculator.

 Note: Today we use voltage level to represent a logical TRUE and FALSE. There is no reason that the physical
position of a mechanical component cannot do the same thing.

53/90
A LITTLE MORE MODERN

 Charles Babbage 1792-1871


 The Difference Engine
 The Difference Engine 2
 Basically a programmable calculator
 Calculated artillery tables

 The Analytic Engine – a more advanced machine


 Used punch cards for input
 A precursor to the modern computer

 Boole 1815-1864
 Boolean Algebra

54/90
STILL, A LITTLE MORE MODERN

 The von Neumann architecture – 1940s and 50s


 A stored-program computer that uses a central
processing unit and a single separate storage structure
that hold both instructions and data.

55/90
BASIC OPERATION OF ARCHITECTURE

 Instructions are executed in sequence


 First step during execution
 MEM(PC) ➔ IR
 Send contents of PC (Program counter) to memory

 Memory responds with the contents at that address placing


it on the data bus.

 Increment the PC (PC+1->PC)


 The values on the data bus are loaded into the
instruction register (IR)

56/90
DECODE INSTRUCTION AND EXECUTE

 Say the instruction was a load immediate


 This means that the next word in the instruction
stream is the data that we want loaded into the
accumulator
 Operation is now
 MEM(PC)→ Accum
 Also increment the PC

57/90
MORE VON NEUMANN

 Earliest computers had fixed programs – such as a desk calculator


 The von Neumann architecture introduced the concept of a stored program. In fact, in early computers, they
often wrote programs that self modified.
 Self-modifying code is now seen as a very bad programming practice (also, it really isn’t needed).
 von Neumann’s was very familiar with Alan Turing’s (1912-1954) work – the Turing Machine (1936).
 Both von Neumann and Turing wrote papers on stored program computers.

58/90
SOME EARLY VON NEUMANN ARCHITECTURES

 ORDVAC (U of Ill) - 1951


 IAS machine (Princeton) - 1952
 MANIAC I (Las Alamos) - 1952
 ILLIAC (U of Ill) - 1952
 AVIDAC (Argonne National Labs) – 1953
 ORACLE at Oak Ridge Ntl Lab– 1953
 JOHNNIAC at RAND Corp – 1954
 BESK in Stockholm – 1953
 PERM in Munich - 1956

59/90
EARLY MICROPROCESSORS

 The Intel 4004 – 1971


 16-pin DIP (Dual in-line package) package
 92,000 instructions per sec
 10.8 microseconds per instruction

 Processor had a small address space for data and a small address space for instructions
 Designed for use in calculators
 Was the core element for the early electronic calculators – early calculators did basic arithmetic.
 Early microprocessors were often programmed in assembler or machine code. Compilers and many modern
high-level programming languages just didn’t exist.

60/90

You might also like