1 The Design of a Relay Computer Harry Porter, Ph.D. Portland State University April 24, 2006
2
3 +V
4 Double Throw Relay
5 +V Double Throw Relay
6 Four Pole, Double Throw Relay
7 +V Four Pole, Double Throw Relay
8
9 Schematic Diagrams
10 Schematic Diagrams Assume other terminal is connected to ground
11 Schematic Diagrams Assume other terminal is connected to ground +V
12 The “NOT” Circuit inout in out in out +V
13 The “NOT” Circuit inout in out +V in out Convention: “1” = +12V “0” = not connected
14 The “NOT” Circuit inout in out +V in out Convention: “1” = +12V “0” = not connected
15 c The “OR” Circuit b b or c +V b c OUT b c b or c
16 An Optimization? c b b or c b c
17 c An Optimization? b b or c b c c or d d d
18 c An Optimization? b b or c b c c or d d d Whoops!
19 c An Optimization? b b or c b c c or d d d Whoops!
20 An Optimization? b or c c b +V d c or d b b or c c c or d d
21 1-Bit Logic Circuit b c NOT b c NOT AND OR XOR AND OR XOR
22 1-Bit Logic Circuit b V NOT AND OR XOR c b c NOT AND OR XOR
23 1-Bit Logic Circuit b V c NOT AND OR XOR b c NOT AND OR XOR
24 1-Bit Logic Circuit b V c NOT AND OR XOR b c NOT AND OR XOR
25 1-Bit Logic Circuit b V c NOT AND OR XOR b c NOT AND OR XOR
26 1-Bit Logic Circuit b V c NOT AND OR XOR b c NOT AND OR XOR
27 1-Bit Logic Circuit b V c NOT AND OR XOR b c NOT AND OR XOR
28 1-Bit Logic Circuit b V c NOT AND OR XOR b c NOT AND OR XOR
29 AND 7 OR 7 Eight 1-bit circuits can be combined to build an... 8-Bit Logic Circuit Logic Circuit NOT 7 B7B7 C7C7 XOR 7 AND 1 OR 1 Logic Circuit NOT 1 B1B1 C1C1 XOR 1 AND 0 OR 0 Logic Circuit NOT 0 B0B0 C0C0 XOR 0
30 The “Full Adder” Circuit Carry in Carry out Full Adder Sum BC Cy in B C Cy out Sum
31 Carry in Carry out Full Adder Sum BC 8 full-adders can be combined to build an... 8-Bit Adder
32 8 full-adders can be combined to build an... 8-Bit Adder Carry Full Adder Full Adder B0B0 C0C0 Sum 0 Sum 1 B1B1 C1C1 Full Adder Sum 7 B7B7 C7C7 0 Carry
33 8 full-adders can be combined to build an... 8-Bit Adder Carry Full Adder Full Adder B0B0 C0C0 Sum 0 Sum 1 B1B1 C1C1 Carry Full Adder Sum 7 B7B7 C7C7 + B C Sum Carry 0
34 The Zero-Detect Circuit Result Bus Zero V+
35 The Zero-Detect Circuit Result Bus Zero V+ Sign
36 Enable Circuit Enable
37 Enable Circuit Enable Bus
38 Enable Circuit x7x7 x6x6 x5x5 x4x4 x3x3 x2x2 x1x1 x0x0 Result Bus B XOR C Enable
39 Enable Shift Left Circular (SHL) b7b7 b6b6 b5b5 b4b4 b3b3 b2b2 b1b1 b0b0 Result Bus B
40 3-to-8 Decoder f 0 f 1 f 2 OUTPUT
41 3-to-8 Decoder f1f1 V f0f0 f2f2 f 0 f 1 f 2 OUTPUT
42 3-to-8 Decoder f1f1 V f0f0 f2f2 INC AND OR XOR NOT SHL ADD f 0 f 1 f 2 OUTPUT :59
43 Carry Sign Arithmetic Logic Unit (ALU) B C Data Bus 3 Zero 8-bit Logic 8-bit Adder EnableEn AND OR XOR NOT SHL INC ADD Function 3-to-8 Decoder Zero-Detect
44 Carry Sign An 8-Bit ALU ALU B C Result Function Code 000 add 001 inc 010 and 011 or 100 xor 101 not 110 shl Zero
45 Register Storage +V A
46 Register Storage +V A7A7 A0A0 A6A6
47 Register Storage +V Bus Enable A7A7 A0A0 A6A6 Select
48 Register Storage A7A7 Select Load A0A0 Enable A6A6 Bus
49 Register Storage A7A7 Select Load A0A0 Enable A6A6 Bus
50 8-Bit “Data” Bus Load Select “X” Register 8-Bit Registers
51 8-Bit “Data” Bus Load Select Load Select “X” Register “Y” Register 8-Bit Registers
52 16-Bit “Address” Bus 8-Bit “Data” Bus “X” Register “Y” Register Load Select Load Select Load Select
53 System Architecture M1M1 M2M2 X Y 8-bit Data Bus A B C D
54 System Architecture M1M1 M2M2 X Y 8-bit ALU 8-bit Data Bus ZCyS A B C D
55 System Architecture A B C D M1M1 M2M2 M X Y XY 8-bit ALU 8-bit Data Bus ZCyS 16-bit Address Bus
56 System Architecture A B C D M1M1 M2M2 M X Y XY 8-bit ALU 8-bit Data Bus ZCyS Inst PC 16-bit Address Bus
57 System Architecture M1M1 M2M2 M X Y XY 8-bit ALU 8-bit Data Bus ZCyS Inst PC Memory Addr Data A B C D 16-bit Address Bus
58 System Architecture M1M1 M2M2 M X Y XY 8-bit ALU 8-bit Data Bus ZCyS Inst PC Memory Addr Data 16-bit Increment Inc A B C D 16-bit Address Bus
59 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc 8-bit ALU Memory Addr Data ZCyS System Architecture 8-bit Data Bus A B C D 16-bit Address Bus
60 32K Byte Static RAM Chip LEDs 8 FET Power Transistors (to drive relays during a memory-read operation)
61 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc 8-bit ALU Memory Addr Data ZCyS 8-bit Data Bus A B C D 16-bit Address Bus Example: The ALU Instruction
62 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc 8-bit ALU Memory Addr Data ZCyS 8-bit Data Bus A B C D Step 1: Fetch Instruction 16-bit Address Bus
63 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc 8-bit ALU Memory Addr Data ZCyS 8-bit Data Bus A B C D Step 1: Fetch Instruction SELECT 16-bit Address Bus
64 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc 8-bit ALU Memory Addr Data ZCyS 8-bit Data Bus A B C D Step 1: Fetch Instruction SELECT 16-bit Address Bus
65 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J Inc 8-bit ALU Memory Addr Data ZCyS 8-bit Data Bus A B C D Step 1: Fetch Instruction MEM-READ PC SELECT 16-bit Address Bus
66 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J Inc 8-bit ALU Memory Addr Data ZCyS 8-bit Data Bus A B C D Step 1: Fetch Instruction MEM-READ PC SELECT 16-bit Address Bus
67 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J Inc 8-bit ALU Memory Addr Data ZCyS 8-bit Data Bus A B C D Step 1: Fetch Instruction MEM-READ PC SELECT LOAD 16-bit Address Bus
68 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc 8-bit ALU Memory Addr Data ZCyS Step 1: Fetch Instruction 8-bit Data Bus A B C D MEM-READ SELECT LOAD 16-bit Address Bus
69 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc 8-bit ALU Memory Addr Data ZCyS 8-bit Data Bus A B C D Step 2: Increment PC 16-bit Address Bus
70 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc 8-bit ALU Memory Addr Data ZCyS 8-bit Data Bus A B C D Step 2: Increment PC SELECT 16-bit Address Bus
71 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc 8-bit ALU Memory Addr Data ZCyS 8-bit Data Bus A B C D Step 2: Increment PC SELECT 16-bit Address Bus
72 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc 8-bit ALU Memory Addr Data ZCyS 8-bit Data Bus A B C D Step 2: Increment PC SELECT LOAD 16-bit Address Bus
73 Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc 8-bit ALU Memory Addr Data ZCyS 8-bit Data Bus A B C D Step 2: Increment PC SELECT LOAD 16-bit Increment 16-bit Address Bus
74 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc 8-bit ALU Memory Addr Data ZCyS 8-bit Data Bus A B C D Step 3: Update PC 16-bit Address Bus
75 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc 8-bit ALU Memory Addr Data ZCyS 8-bit Data Bus A B C D SELECT Step 3: Update PC 16-bit Address Bus
76 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc 8-bit ALU Memory Addr Data ZCyS 8-bit Data Bus A B C D SELECT Step 3: Update PC 16-bit Address Bus
77 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc 8-bit ALU Memory Addr Data ZCyS 8-bit Data Bus A B C D LOAD SELECT Step 3: Update PC 16-bit Address Bus
78 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc 8-bit ALU Memory Addr Data ZCyS 8-bit Data Bus A B C D LOAD SELECT Step 3: Update PC 16-bit Address Bus
79 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc Memory Addr Data ZCyS 8-bit Data Bus A D Step 4: Execute Instruction B C 8-bit ALU 16-bit Address Bus
80 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc Memory Addr Data ZCyS 8-bit Data Bus A D Step 4: Execute Instruction FUNCTION B C 8-bit ALU 16-bit Address Bus
81 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc Memory Addr Data ZCyS 8-bit Data Bus A D Step 4: Execute Instruction FUNCTION B C 8-bit ALU 16-bit Address Bus
82 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc Memory Addr Data ZCyS 8-bit Data Bus A D Step 4: Execute Instruction FUNCTION B C 8-bit ALU 16-bit Address Bus
83 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc Memory Addr Data ZCyS 8-bit Data Bus A D Step 4: Execute Instruction FUNCTION LOAD B C 8-bit ALU 16-bit Address Bus
84 16-bit Increment Inst M1M1 M2M2 M X Y XY J1J1 J2J2 J PC Inc Memory Addr Data ZCyS 8-bit Data Bus A D Step 4: Execute Instruction FUNCTION LOAD B C 8-bit ALU 16-bit Address Bus 11:59
85 Clock Switch +V Output +V
86 Clock Switch +V Output +V Charging
87 Clock Switch +V Output +V Discharging
88 Clock Switch +V Output +V
89 +V Clock +V A BCD
90 +V Clock Charging +V On Discharging A BCD
91 +V Clock Charging +V On Discharging On A BCD
92 +V Clock Charging +V On Discharging On A BCD
93 +V Clock Charging +V On Discharging On A BCD
94 +V Clock Charging +V On Discharging On A BCD
95 Clock Timing Diagram A B C D
96 Clock Timing Diagram A B C D Clock
97 Clock Timing Diagram A B C D Clock Clock = (A and B) or (C and D)
98 Finite State Machine clock
99 t7t7 t5t5 t4t4 t3t3 t2t2 t1t1 Finite State Machine t6t6 t8t8 Outputs clock
100 t7t7 t5t5 t4t4 t3t3 t2t2 t1t1 Finite State Machine t6t6 t8t8 Outputs clock
101 t7t7 t5t5 t4t4 t3t3 t2t2 t1t1 Finite State Machine t6t6 t8t8 Outputs clock
102 t7t7 t5t5 t4t4 t3t3 t2t2 t1t1 Finite State Machine t6t6 t8t8 Outputs clock
103 t7t7 t5t5 t4t4 t3t3 t2t2 t1t1 Finite State Machine t6t6 t8t8 Outputs clock
104 t7t7 t5t5 t4t4 t3t3 t2t2 t1t1 Finite State Machine t6t6 t8t8 Outputs clock
105 t7t7 t5t5 t4t4 t3t3 t2t2 t1t1 Finite State Machine t6t6 t8t8 Outputs clock
106 t7t7 t5t5 t4t4 t3t3 t2t2 t1t1 Finite State Machine t6t6 t8t8 Outputs clock
107 t7t7 t5t5 t4t4 t3t3 t2t2 t1t1 Finite State Machine t6t6 t8t8 Outputs clock
108 t7t7 t5t5 t4t4 t3t3 t2t2 t1t1 Finite State Machine t6t6 t8t8 Outputs clock
109 Output from FSA t1t1 t2t2 t3t3 t4t4 t5t5 t6t6 t7t7 t8t8
110 Instruction Timing - ALU Instruction Select PC Memory Read Load Instr Load Inc Select Inc Load PC ALU Function Load A Load Cond.Code Reg
111 Instruction Timing - ALU Instruction Select PC Memory Read Load Instr Load Inc Select Inc Load PC ALU Function Load Cond.Code Reg Fetch Load A
112 Instruction Timing - ALU Instruction Select PC Memory Read Load Instr Load Inc Select Inc Load PC ALU Function Load Cond.Code Reg Increment Load A
113 Instruction Timing - ALU Instruction Select PC Memory Read Load Instr Load Inc Select Inc Load PC ALU Function Load Cond.Code Reg Load A Execute
114 Instruction Decoding Instruction RegisterFinite State Machine Control Signals (Load, Select, Mem-Read, etc.)
115 Instruction Decoding Instruction RegisterFinite State Machine Control Signals (Load, Select, Mem-Read, etc.) Combinational Logic
Instruction Timing - 16-bit Move Select PC Memory Read Load Instr Load Inc Select Inc Load PC Select Source-Register Load Dest-Register (Same as before)
117 Finite State Machine
118 Finite State Machine
119 Instruction Decoding and Control Clock Instruction Register Finite State Machine Control Lines Instruction Decoding Data Bus
120 The Instruction Set (1) 0 0 d d d s s s r f f f0 1 r d d d d d Move ALU Load Immediate 16-bit Increment ddd = destination register sss = source register (A, B, C, D, M 1,M 2,X or Y) r = destination register (A or D) fff = function code (add, inc, and, or, xor, not, shl) r = destination register (A or B) ddddd = value ( ) XY XY + 1
121 The Instruction Set (2) r r r r Load Store Load 16-bit Immediate Halt rr = destination register (A, B, C, D) reg [M] rr = source register (A, B, C, D) [M] reg Load the immediate value into M (i.e., M 1 and M 2 ) v v v v
122 The Instruction Set (3) d s s Goto Call 16-Bit Move Return / Branch Indirect a a a a Branch to the given address a a a a Branch to the given address Save return location in XY register PC XY d = destination register (PC or XY) ss = source register (M, XY or J)
123 The Instruction Set (4) Branch If Negative Branch If Carry Branch If Zero Branch If Not Zero a a a a Branch to the given address if S = a a a a Branch to the given address if Cy = 1 Branch to the given address if Z = 1 Branch to the given address if Z = a a a a a a a a
124 An Example Program address instr assembly comment Y=B Y B X=0 X A=¬B If sign(Y)== BNEG Else X=C X C Else: A=-7 D D=A. Loop: Loop: B=X Shift X left (circular) A=B<< X=A B=Y Shift Y left (circular) A=B<< Y=A B=Y If sign(Y)== A=¬B BNEG Else B=X X X + C A=B+C X=A. Else2: B=D D D D=B BNZ Loop If D != 0 goto Loop HALT HALT