Computer Architecture Personal Notes
Computer Architecture Personal Notes
2
First, we will need the following:
x ⊕ y ⊕ z is 1 when just one or all three of x, y, z, is 1.
xy + xz + yz = xy ⊕ xz ⊕ yz, and is 1 when at least two of x, y, z, is 1.
Half adder:
Symbol Function Truth table Outputs Circuit
_____ x ___ c
|x c| s = arith x + y x y s d s = x ⊕ y ------*-------|AND|-------
| HA | with carry out c 0 0 0 0 c = xy -------|---*---|___|
|y s| 0 1 1 0 y | | ___ s
|_____| 1 0 1 0 | |---|XOR|-------
1 1 0 1 |-------|___|
Full adder:
Symbol Function Truth table Outputs
_____
|c d| s = arith x + y x y c s d s = x ⊕ y ⊕ c
| | with carry in c 0 0 0 0 0 d = xy ⊕ xc ⊕ yc
|x | and carry out d 0 0 1 1 0
| FA | 0 1 0 1 0 noting s = 1 when 1 or all 3 of x,y,c = 1
|y s| 0 1 1 0 1 d = 1 when at least 2 of x,y,c = 1
|_____| 1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
Circuit
x ____ xy _____ d = xy ⊕ xc ⊕ yc
----------|x c|-----------------------------------| |----------------------
| HA | ____ | XOR |
----------|y s|--------|x c|---------------------|____ |
y |____| x ⊕
y | HA | c(x ⊕ y) = cx ⊕ cy
| |
------------------------|y s|------------------------------------------------
c |____| s = x ⊕ y ⊕ c
Subtraction ______
_
For integers x, y, we use : x - y = x + y , where + and - are arithmetic.
Eg 15 - 5 = 1 1 1 1 . Perform 0 0 0 0 . Invert output to get 1 0 1 0 = 10 dec
- 0 1 0 1 + 0 1 0 1
= 0 1 0 1
Full Subtracter
Symbol Function Truth table Outputs Circuit
_____ _ _ _ _ c ______ d
|c d| arith s = x - y x y c s d s x s = x ⊕ y ⊕ c ---------------|c d|---------------
| | with carry in c 0 0 0 0 0 1 1 ___ _ | |
|x | and carry out d 0 0 1 1 1 0 1 _ _ x |NOT| x | FA |
| FS | 0 1 0 1 1 0 1 d = xy ⊕ xc ⊕ yc ---|___|-------|x | ___
|y s| 0 1 1 0 1 1 1 | | |NOT| s
|_____| 1 0 0 1 0 0 0 ---------------|y s|---|___|-------
1 0 1 0 0 1 0 y |_____|
1 1 0 0 0 1 0
1 1 1 1 1 0 0
_ _ _
noting s = 1 when 1 or all 3 of x,y,c = 1, and d = 1 when at least 2 of x,y,c = 1 .
____ _ _ _
Alternatively, s = x ⊕ y ⊕ c, and using a ⊕ b = a ⊕ b, we get s = x ⊕ y ⊕ c .
4.3 Sequential logic : The R-S Latch Page 4.3
Truth table: (R,S) = current input, (Q, P) = current output, (Qp, Pp) = previous output
R S Q P
__
NO CHANGE 0 0 Qp Qp PROVIDED previous input was not (1,1)
S = SET 0 1 1 0
R = RESET 1 0 0 1
NOT PERMITTED 1 1 0 0 NOR logic
1 1 NAND logic
If the input is changed from (1,1) to (0,0) there is theoretically no steady state.
In fact the device will flicker & then settle down into an INDETERMINATE steady state.
Thus an input of (1,1) means row 1 of the truth table ceases to hold, and moreover
produces outputs which are not complements of one another, and which depend on whether
NOR or NAND logic is used. An input of (1,1) must NOT be allowed to occur.
Use of the R-S latch as a memory store.
Suppose R = S = 0.
Changing S to 1 and back to 0 STORES 1 in the latch.
Changing R to 1 and back to 0 STORES 0 in the latch.
Thus the latch LATCHES onto its input and stores it.
The Clock.
A CPU has CLOCK that controls an OSCILLATOR whose output is a SQUARE WAVE.
1 cycle
_________
Signal | |
1| ____ ____ ____
| | | | | | |
| | | | | | |
| | | | | | |
0|____| |____| |____| |____ Time
The FREQUENCY of the clock in Hertz (Hz) is the number of cycles per second.
Note that the square wave is not exactly square since it is impossible to change signal
from 0 to 1 in zero time, but an oscillator generated "square" wave is very nearly square
Clocked R-S Latch Page 4.4
Circuit Symbol Function
___ R.Cl _____ _______
R------------|AND|---------|R Q|-----Q |R Q| R = S = 0 except on a clock pulse.
|-----|___| | | | |
| | | |> | No change to Q except on a pulse.
Cl-----* | | | _|
| ___ S.Cl | _| _ |S Q|
|-----|AND|---------|S Q|-----Q |_______|
S------------|___| |_____|
Function
B = (b2 b1 b0) = OUTPUT
E = ENABLE. If E = 1, a pulse increases b by 1 mod 8.
If E = 0, a pulse leaves b unchanged.
CLR = CLEAR If CLR = 0 a pulse forces b to zero.
Note that a pulse outputs a new b, but the feed forward feeds the old b into the
T-latches.
An n-bit sequencer implements the following rule for increasing bn-1...b2 b1 b0 mod 2n :
b0 is always complemented.
bi is complemented if bi-1 = bi-2 = ... = b2 = b1 = b0 = 1, i > 0.
D0 D1 D2 D3 D0 D2n-1
| | | | | |
data data
b0 _|__|__|__|__ _|________|__
----------| | A = Di if (b1,b0) = i b | | A = Di if b = i
Select | 2 bit MUX |---------------------- -------| n bit mux |------------------
----------|_____________| n bit |_____________|
b1 select
__ __ __ __
A = D0 b1 b0 + D1 b1 b0 + D2 b1 b0 + D3 b1 b0