home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hacker Chronicles 2
/
HACKER2.BIN
/
643.EXAMPLE
< prev
next >
Wrap
Text File
|
1989-02-21
|
2KB
|
102 lines
; a circuit for calculating a parity bit for a 16-bit word (an xor tree)
dimension (29,37)
; chip definition -- quadruple 2-input xor gates
chip type=ttl7486 pins=14 horizontal=2 vertical=6
vcc=14
gnd=7
a1=1
b1=2
y1=3
a2=4
b2=5
y2=6
y3=8
a3=9
b3=10
y4=11
a4=12
b4=13
; power and ground are supplied here
hole (3,20)
hole (3,25)
; the 16-bit input word
hole (26,5)
hole (26,7)
hole (26,9)
hole (26,11)
hole (26,13)
hole (26,15)
hole (26,17)
hole (26,19)
hole (26,21)
hole (26,23)
hole (26,25)
hole (26,27)
hole (26,29)
hole (26,31)
hole (26,33)
hole (26,35)
; the output (parity) bit
hole (3,11)
; four instances of the above chip
chipat (6,5) name=xor0 type=ttl7486 orientation=normal
chipat (6,21) name=xor1 type=ttl7486 orientation=normal
chipat (16,5) name=xor2 type=ttl7486 orientation=normal
chipat (16,21) name=xor3 type=ttl7486 orientation=normal
; connect power and ground to all chips
priority connect (3,20) and xor0.vcc
priority connect (3,20) and xor1.vcc
priority connect (3,20) and xor2.vcc
priority connect (3,20) and xor3.vcc
priority connect (3,25) and xor0.gnd
priority connect (3,25) and xor1.gnd
priority connect (3,25) and xor2.gnd
priority connect (3,25) and xor3.gnd
; condense 16 bits into 8 bits
connect (26,5) and xor2.a1
connect (26,7) and xor2.b1
connect (26,9) and xor2.a2
connect (26,11) and xor2.b2
connect (26,13) and xor2.a3
connect (26,15) and xor2.b3
connect (26,17) and xor2.a4
connect (26,19) and xor2.b4
connect (26,21) and xor3.a1
connect (26,23) and xor3.b1
connect (26,25) and xor3.a2
connect (26,27) and xor3.b2
connect (26,29) and xor3.a3
connect (26,31) and xor3.b3
connect (26,33) and xor3.a4
connect (26,35) and xor3.b4
; condense 8 bits into 4 bits
connect xor2.y1 and xor1.a1
connect xor2.y2 and xor1.b1
connect xor2.y3 and xor1.a2
connect xor2.y4 and xor1.b2
connect xor3.y1 and xor1.a3
connect xor3.y2 and xor1.b3
connect xor3.y3 and xor1.a4
connect xor3.y4 and xor1.b4
; condense 4 bits into 2 bits
connect xor1.y1 and xor0.a1
connect xor1.y2 and xor0.b1
connect xor1.y3 and xor0.a2
connect xor1.y4 and xor0.b2
; condense 2 bits into 1 bit
connect xor0.y1 and xor0.a3
connect xor0.y2 and xor0.b3
; connect the output (parity) bit
priority connect xor0.y3 and (3,11)