Computer Science 237 Lab 6 Due: High noon next Tuesday

Computer Science 237 Lab 6 Due: High noon next Tuesday This week I would like you to design and build a simple 8-bit random number generator using a l...
Author: Reynold Davis
4 downloads 2 Views 1MB Size
Computer Science 237 Lab 6 Due: High noon next Tuesday This week I would like you to design and build a simple 8-bit random number generator using a linear feedback shift register . We review pertinent details, here, for implementing this interesting device in logic. In lab we will learn how to use the power supplies, breadboards, and TTL chips to build our device in hardware. A

B

C

SI

March 1998

Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0

1

DM74LS164 8-Bit Serial In/Parallel Out Shift Register

DM74LS164 8-Bit Serial In/Parallel Out Shift Register

CLK

Our implementation will make use of a logical device, the serial shift register :

on the low-to-high level transition of the clock input. All inputs General This device contains 8 bits of memory that are Description used to remember the most recent sequence of values that have are diode-clamped to minimize transmission-line effects. These 8-bit shift registers feature gated serial inputs and an appeared on the pin SI (‘shift in’). Each time the clock (CLK) line rises from 0 to 1, the register moves all bits to the asynchronous clear. A low logic level at either input inhibits Features entry of the new data, and resets the first flip-flop to the low left (the value at Q0 moves to Q1, etc.), and the value at SI appears in the register at location Q0. The value once n Gated (enable/disable) serial inputs level at the next clock pulse, thus providing complete control buffered and serial inputs over incoming high logic level oncycles either input8 enables stored in the high bit, Q7, is shifted out and lost. data. AsA the clock timesn aFullybyte ofclock data read serially appears as the other input, which will then determine the state of the first n Asynchronous clear flip-flop. Data at the inputs may be changed while the block the output of the register. Serial shift registers are a serial fundamental building of all devices that communicate by n Typical clock frequency 36 MHz clock is high or low, but only information meeting the setup n Typical power dissipation 80 mW 2 receiving bits one at a time over a wire, through the air, or from a bit-serial store, like a hard disk. and hold time requirements will be entered. Clocking occurs

In our actual circuit we will use a TTL chip, theDiagram 74-164. It has the following pin Table configuration, or pinout: Connection Function Inputs

Dual-In-Line Package

Outputs

Clear

Clock

A

B

QA

QB

...

L

X

X

X

L

L

...

L

H

L

X

X

QA0

QB0

...

QH0

H

!

H

H

H

QAn

...

QGn

H

!

L

X

L

QAn

...

QGn

H

!

X

L

L

QAn

...

QGn

QH

H = High Level (steady state), L = Low Level (steady state) X = Don’t Care (any input, including transitions) ! = Transition from low to high level QA0, QB0, QH0 = The level of QA, QB, or QH, respectively, before the indicated steady-state input conditions were established. QAn, QGn = The level of QA or QG before the most recent ! transition of the clock; indicates a one-bit shift.

3

DS006398-1

Order Number 54LS164DMQB, 54LS164FMQB, 54LS164LMQB, DM54LS164J, DM54LS164W, DM74LS164M or DM74LS164N See Package Number E20A, J14A, M14A, N14A or W14B

As with all integrated circuits, this chip is powered by two pins, Vcc and GND. The pins A and B are typically wired together1 and provide ‘shift in’ bits: every bit that appears on these pins is captured when the clock goes high. Next, the outputs are labeled QA through QH. Diagram The standard for labeling pins in 7400 series of devices is, at best, Logic inconsistent; in general you need to scour the TTL product description pages to learn about these details. Here, the QA pin is the least significant bit in the stored byte. Be careful: some devices do not have Vcc and GND in the corners 4 or take ordered bits out of order. Reading the device documentation will save you time and reduce your sorrow. The CLOCK line works exactly as CLK described above: the A/B lines are strobed into the device on the rising edge of this signal. This edge-based triggering is always indicated by a little triangle at the entrance of the signal. If the TTL picture does not have that triangle, the action happens as long as the clock is high; it is level-triggered . Finally, an appropriate signal on the CLEAR will clear the internal memory to zeros. Because there is an ‘inverter bubble’ on the pin, we say the signal is active low : the clear will happen as long as the CLEAR pin is grounded.2 I leave it to you to determine if the register starts up in a cleared state. DS006398-2

© 1998 Fairchild Semiconductor Corporation

DS006398

www.fairchildsemi.com

The 8-bit Linear Feedback Shift Register. Ideally, our 8-bit number generator would present an orbit of 256 5 random values3 before any value is repeated. The linear feedback approach takes several bits from the serial shift 1 This

is strange. You might read the device documentation to discover other ways the designers imagined this device would be used. you see both a inverter bubble and a edge-trigger triangle, the action occurs during the 1 to 0 or falling edge transition. A C 3 These values are not random, of course (the circuit is deterministic, after all), but for manyB purposes they sufficiently unpredictable. 2 If

register at positions called taps and computes a mod-2 sum (think: XOR) to generate the next bit to be shifted in. (We should begin our worrying now: if the register ever contained a zero, it would could never change. Why? Because there are no 1’s to generate a non-zero value. This configuration is said to lock up the device. Worry on.) It turns out that, starting with a non-zero value, four tap bits will support an orbit of 255 distinct values before the device again returns the first value. The location of the tap bits (as always, 0 is least significant) for registers with 8 or fewer bits is given in the following table:

n 1 5

LFSR taps 0 42

Tap n 2 6

Bits for Maximal Orbits taps n taps n taps 10 3 21 4 32 54 7 65 8 7543

Procedure. I would like you to build an 8-bit linear feedback shift register whose lock up configuration is all 1’s (as opposed to all 0’s). 1. Build a circuit that will allow you to fully control the 74-164 shift register. All inputs should be sourced by power, ground, or switches. All outputs should be visible through the LED’s. 2. Determine, as best you can, whether the device powers up in an all-zero state. If not, your final circuit should probably have a button that allows you to clear the register in case it gets locked up. 3. Clear your register and attempt to shift in a single one. You may observe that the slide switches on your bench are not debounced . Mechanical switching devices frequently make many momentary contacts before they settle into position. This might result in your device strobing in several ones before the clock switch settles. This behavior can be avoided by using debouncing circuitry present in the ‘momentary’ pushbuttons, A and B. 4. Design a network of taps that maximizes the orbit of the generator. I expect you to use one or two more chips from your initial set. If necessary, you can borrow parts from our common supply cabinet but be aware that the 7400-family of devices does not include every kind of gate you might want. It is likely (nay, certain) that the devices I have already given you are sufficient for your purposes. 5. Implement the circuit and verify that it is working correctly. When you are satisfied with your generator draw the logical network (ie. the gates, not the chips) you used, and report the first 16 decimal values your circuit generates. The first should be zero, of course. 6. Consider answering one or more of the extra credit questions, below. 7. After sending a picture of your circuit to your mother (she will be proud), tear down your circuit. 8. Turn in your written answers by noon next Tuesday. Extra credit: 1. Notice that the tap bits always include the most significant bit. For example, bit 7 is needed for an 8 bit LFSR and bit 3 is needed for a 4 bit version. Explain why this must be true. 2. It would be much nicer if we could automate the generation of CLOCK signal. This is easily accomplished by running a wire from the function generator to the CLOCK line of your 74-164. (Try it!) Indeed, the circuit can be driven quite quickly (Try it!). Unfortunately, the slowest square wave generated is 1 Hz (yeah, sure, try it.). Can you, based on a 1 Hz setting of the function generator and one or two additional chips, arrange for your circuit to deliver new random values every 5 seconds? Explain how. 3. Perhaps you want it to run more slowly. Can you generate a new random value every 10 seconds? Keep the square wave frequency at 1 Hz and try to avoid going to the parts cabinet. Explain your logic.

7

Part Number Color Code Legend

We can special order any ICs – 100 piece minimum

NEW

SALE

REFURBISHED

Integrated Circuits

CLOSEOUT

7

Call for pricing on quantities over 500 – we carry major manufacturers.

IC Test Clip Series • For temporary connections to DIP package components • Heavy-duty spring loaded hinge provides positive contact • 20 AWG insulated gold contacts • Color: white Part No. 22103 22120 22162 22189

Product No. JTC16 JTC20 JTC28 JTC40

Product No. Pins 7400 14 7401 14 7402 14 7404 14 7405 14 7406 14 7407 14 7408 14 7410 14 7411 14 7413 14 7414 14 7416 14 7417 14 7420 14 7421 14 7425 14 7427 14 7428 14 7430 14 7432 14 7438 14 7440 14 7442 16 7445 16 7446 16 7447 16 7470 14 7472 14 7473 14 7474 14 7475 16 7476 16 7483 16 7485 16 7486 14 7489 16 7490 14 7492 14 7493 14 7495 14 7496 16 7497 16 74107 14 74109 16 74116 24 74121 14 74122 14 74123 16 74125 14 74126 14 74132 14 74148 16 74150 24 74151 16 74153 16 74154 24 74157 16

Order Toll-Free 24-hours a day 7-days a week!

22103

Description 1 16-pin (for 8, 14 and 16-pin ICs) ............................ $4.95 20-pin (for 18 and 20-pin ICs) .................................. 6.95 28-pin ....................................................................... 8.95 40-pin ....................................................................... 9.95

7400 Series Part No. 48979 49007 49015 49040 49074 49091 49120 49146 49189 49269 49402 49437 49630 49728 50008 50024 50083 50139 50198 50227 50235 50315 50358 50374 50403 50411 50420 50518 50526 50534 50551 50577 50593 50631 50657 50665 50681 50690 50737 50745 50770 50788 50796 49234 49251 49293 49322 49349 49357 49373 49381 49411 49496 49509 49525 49550 49568 49605

7400 Series (Continued) 10 $4.49 6.25 7.95 8.95

25 $3.95 5.59 6.49 7.95

Dual-In-Line Package Description 1 Quad 2-input NAND gate .................................. $.59 Quad 2-input NAND gate (O.C.) .......................... .49 Quad 2-input NOR gate ....................................... .59 Hex inverter ........................................................ .59 Hex inverter (O.C.) .............................................. .29 Hex inverter buffer/driver (O.C.) ......................... .45 Hex buffer/driver (O.C.) ...................................... .59 Quad 2-input AND gate ....................................... .59 Triple 3-input NAND gate .................................... .25 Triple 3-input AND gate .................................... 3.95 Dual 4-input NAND gate Schmitt trigger ............. .29 Hex inverter Schmitt trigger ................................ .45 Hex inverter buffer/driver (O.C.) ......................... .25 Hex buffer/driver (O.C. hi-voltage) ...................... .79 Dual 4-input NAND gate ...................................... .49 Dual 4-input AND gate ...................................... 2.95 Dual 4-input NOR gate with strobe ................... 1.09 Triple 3-input NOR gate ...................................... .49 Quad 2-input NOR buffer .................................... .39 8-input NAND gate .............................................. .25 Quad 2-input OR gate ......................................... .59 Quad 2-input NAND buffer (O.C.) ....................... .35 Dual 4-input NAND buffer ................................... .13 BCD-to-decimal decoder ..................................... .89 BCD-to-decimal decoder/driver (30V) ................. .99 BCD-to-7 segment decoder/driver (30V) .......... 1.29 BCD-to-7 segment decoder/driver (15V) .......... 1.09 Edge-triggered JK flip-flop .................................. .49 AND gated JK master/slave flip-flop ................... .49 Dual JK flip-flop with clear .................................. .99 Dual D flip-flop ................................................... .45 4-bit bi-stable latch ........................................... 2.95 Dual JK flip-flop with preset and clear .............. 1.19 4-bit binary full adder ......................................... .89 4-bit magnitude comp. ....................................... .39 Quad EXCLUSIVE-OR gate .................................. .79 64-bit RAM P 50ns ........................................... 2.95 Decade counter ................................................... .89 Divide-by-12 counter .........................................1.19 4-bit binary counter .......................................... 1.29 4-bit parallel-access shift register (K155N) ........ .69 5-bit parallel-in, parallel-out shift register ........... .49 Synch. 6-bit binary rate multipliers ................... 3.49 Dual JK flip-flop with clear .................................. .39 Dual positive edge triggered JK flip-flop ............. .37 Dual 4-bit latches with clear ............................... .99 Monostable multivibrator .................................... .99 Retriggerable mono. multivibrator with clear ...... .69 Dual retriggerable mono. multivibrator ............... .89 Quad bus buffer tri-state (DM8093N) ................. .99 Quad bus buffer tri-state (DM8094N) ................. .79 Quad 2-input NAND Schmitt trigger ................... .69 8 to 3 line octal priority encoder ......................... .89 16 to 1 line multiplexer ..................................... 1.95 8-input multiplexer ............................................. .29 Dual 4/1 data selector/multiplexer ...................... .25 4 to 16 line decoder/demultiplexer .................... 2.25 Quad 2/1 data selector ........................................ .39

10 $.49 .45 .49 .49 .25 .39 .49 .49 .22 3.59 .25 .39 .19 .69 .45 2.75 .99 .45 .35 .22 .49 .29 .11 .79 .89 1.19 .99 .45 .45 .89 .39 2.75 1.09 .79 .29 .69 2.75 .79 1.09 1.19 .59 .39 3.29 .35 .34 .89 .89 .59 .79 .89 .69 .59 .79 1.75 .25 .22 1.95 .35

100 $.45 .39 .45 .45 .22 .35 .45 .45 .15 3.25 .19 .35 .10 .59 .39 2.49 .89 .39 .25 .12 .45 .25 .09 .69 .79 1.09 .89 .35 .35 .79 .29 2.49 .99 .69 .22 .59 2.49 .69 .89 1.09 .39 .29 2.95 .25 .31 .79 .79 .45 .69 .79 .59 .35 .69 1.55 .15 .15 1.75 .29

Part No. 49648 49664 49672 49681 49699 49779 49795 49824 49832 49841 49883 49904 49912 49939 49955 49963 50041 50104 50171 50286 88225

Product No. Pins 74160 16 74161 16 74163 16 74164 14 74165 16 74174 16 74175 16 74179 16 74180 14 74181 24 74189 16 74191 16 74192 16 74193 16 74194 16 74195 16 74221 16 74259 16 74279 16 74367 16 SDLD001A __

Dual-In-Line Package

Description 1 Decade counter with asynch. clear ................... $.35 Synchronous 4-bit counter ................................. .39 Synchronous 4-bit counter ................................. .29 8-bit serial shift register ...................................... .35 8-bit serial shift register, parallel load ................. .49 Hex D-type flip-flop with clear ............................ .49 Quad D-type flip-flop with clear .......................... .49 4-bit parallel-access shift register ....................... .13 9-bit odd/even parity generator/checker ............. .25 Arithmetic logic unit/function generator ........... 1.95 64-bit RAM tri-state (DM8599N) ...................... 3.59 Binary up/down counter ..................................... .99 Decade up/down counter with clear .................. 3.95 Binary up/down counter with clear ................... 1.39 4-bit bi-directional shift register ....................... 1.25 4-bit parallel-access shift register ....................... .13 Dual mono. multiv. Schmitt trigger ..................... .15 8-bit addressable latch (9334) ............................ .15 Quad set-reset latch ............................................ .39 Hex buffer tri-state (DM8097N) .......................... .13 Texas Instruments TTL Data Book .................. 34.95

10 $.29 .35 .22 .29 .45 .45 .45 .11 .23 1.75 3.25 .89 3.59 1.19 .99 .11 .13 .13 .35 .11 31.49

100 $.19 .25 .12 .25 .29 .35 .35 .09 .21 1.55 2.95 .79 3.25 1.09 .79 .09 .11 .12 .29 .09 29.95

See page 62 for details Part No. Description 1 10 60 $1 $160 luee Va 84953 360 pc. 7400 series IC cabinet kit ............................................................... $129.95 $116.95 Valu

74C00 Series Part No. 44222 63538 44231 44257 44441 44329 44345 44361 13469 44396 44409 44564 44572 44581 44599

Product No. Pins 74C00 14 74C02 14 74C04 14 74C14 14 74C74 14 74C174 16 74C193 16 74C221 16 74C367 16 74C373 20 74C374 20 74C922 18 74C923 20 74C925 16 74C926 18

Dual-In-Line Package Description 1 Quad 2-input NAND gate ................................................. $.49 Quad 2-input NOR gate ..................................................... .24 Hex inverter (CD4069) ....................................................... .39 Hex inverter Schmitt trigger (CD40106) ............................ .39 Dual D flip-flop ................................................................ 1.29 Hex flip-flop (CD40174/MC14174BPC) ............................. .19 Binary up/down counter w/ clear (40193) ....................... 1.49 Dual monostable multivibrator ........................................ 3.95 Hex buffer tri-state (80C97/CD4503) ................................. .49 Octal D-type flip-flop with clear tri-state .......................... 3.95 Octal D flip-flop tri-state (INS82C06N) ............................ 1.49 16-key keyboard encoder (INS8245N) ............................ 6.95 20-key keyboard encoder (INS8246N) ............................ 6.95 4-digit CTR with MUX D segment driver .......................... 6.95 4-digit CTR with MUX D segment driver .......................... 7.95

74LS00 Series Part No. 46252 46287 46308 46316 46341 46359 46367 46375 46391 46404 46439 46640 47095 47108 47378 47458 47466 47597 47693 47773 47790 47811

Product No. Pins 74LS00 14 74LS02 14 74LS03 14 74LS04 14 74LS05 14 74LS06 14 74LS07 14 74LS08 14 74LS09 14 74LS10 14 74LS11 14 74LS14 14 74LS20 14 74LS21 14 74LS27 14 74LS30 14 74LS32 14 74LS37 14 74LS38 14 74LS42 16 74LS47 16 74LS48 16

10 $.39 .22 .35 .35 1.19 .15 1.29 3.59 .45 3.59 1.25 6.25 6.25 5.95 6.95

Dual-In-Line Package Description 1 Quad 2-input NAND gate .................................. $.25 Quad 2-input NOR gate ....................................... .25 Quad 2-input NAND gate (O.C.) .......................... .25 Hex inverter ........................................................ .29 Hex inverter (O.C.) .............................................. .29 Hex inverter buffer/driver (O.C.) ......................... .49 Hex buffer/driver (O.C. hi-voltage) ...................... .89 Quad 2-input AND gate ....................................... .29 Quad 2-input AND gate (O.C.) ............................. .25 Triple 3-input NAND gate .................................... .29 Triple 3-input AND gate ..................................... .29 Hex inverter Schmitt trigger ................................ .25 Dual 4-input NAND gate ..................................... .25 Dual 4-input AND gate ........................................ .25 Triple 3-input NOR gate ...................................... .25 8-input NAND gate .............................................. .25 Quad 2-input OR gate ......................................... .25 Quad 2-input NAND buffer .................................. .39 Quad 2-input NAND buffer (O.C.) ....................... .29 BCD-to-decimal decoder ..................................... .69 BCD to 7-seg. decoder/driver (O.C.) ................... .89 BCD to 7-seg. decoder/driver ........................... 4.95

Order Toll Free 1-800-831-4242

10 $.19 .19 .19 .25 .25 .45 .79 .25 .19 .25 .25 .19 .19 .19 .19 .19 .19 .35 .25 .59 .79 4.49

100 $.15 .17 .17 .19 .19 .39 .69 .19 .15 .19 .19 .17 .17 .17 .17 .17 .17 .29 .15 .49 .69 3.95

DM74LS00 Quad 2-Input NAND Gates General Description This device contains four independent gates each of which performs the logic NAND function.

Features n Alternate Military/Aerospace device (54LS00) is available. Contact a Fairchild Semiconductor Sales Office/Distributor for specifications.

Connection Diagram Dual-In-Line Package

DS006439-1

Order Number 54LS00DMQB, 54LS00FMQB, 54LS00LMQB, DM54LS00J, DM54LS00W, DM74LS00M or DM74LS00N See Package Number E20A, J14A, M14A, N14A or W14B

Function Table Y = AB Inputs

Output

A

B

Y

L

L

H

L

H

H

H

L

H

H

H

L

H = High Logic Level L = Low Logic Level

© 1998 Fairchild Semiconductor Corporation

DS006439

www.fairchildsemi.com

DM74LS00 Quad 2-Input NAND Gates

March 1998

DM74LS04 Hex Inverting Gates General Description This device contains six independent gates each of which performs the logic INVERT function.

Features n Alternate Military/Aerospace device (54LS04) is available. Contact a Fairchild Semiconductor Sales Office/Distributor for specifications.

Connection Diagram Dual-In-Line Package

DS006345-1

Order Number 54LS04DMQB, 54LS04FMQB, 54LS04LMQB, DM54LS04J, DM54LS04W, DM74LS04M or DM74LS04N See Package Number E20A, J14A, M14A, N14A or W14B

Function Table Y=A Input

Output

A

Y

L

H

H

L

H = High Logic Level L = Low Logic Level

© 1998 Fairchild Semiconductor Corporation

DS006345

www.fairchildsemi.com

DM74LS04 Hex Inverting Gates

March 1998

DM74LS86 Quad 2-Input Exclusive-OR Gates General Description This device contains four independent gates each of which performs the logic exclusive-OR function.

Connection Diagram Dual-In-Line Package

DS006380-1

Order Number DM54LS86J, DM54LS86W, DM74LS86M or DM74LS86N See Package Number J14A, M14A, N14A or W14B

Function Table Y = A % B = A B + AB Inputs

Output

A

B

L

L

Y L

L

H

H

H

L

H

H

H

L

H = High Logic Level L = Low Logic Level

© 1998 Fairchild Semiconductor Corporation

DS006380

www.fairchildsemi.com

DM74LS86 Quad 2-Input Exclusive-OR Gates

March 1998

DM74LS164 8-Bit Serial In/Parallel Out Shift Register General Description These 8-bit shift registers feature gated serial inputs and an asynchronous clear. A low logic level at either input inhibits entry of the new data, and resets the first flip-flop to the low level at the next clock pulse, thus providing complete control over incoming data. A high logic level on either input enables the other input, which will then determine the state of the first flip-flop. Data at the serial inputs may be changed while the clock is high or low, but only information meeting the setup and hold time requirements will be entered. Clocking occurs

Connection Diagram

on the low-to-high level transition of the clock input. All inputs are diode-clamped to minimize transmission-line effects.

Features n n n n n

Gated (enable/disable) serial inputs Fully buffered clock and serial inputs Asynchronous clear Typical clock frequency 36 MHz Typical power dissipation 80 mW

Function Table Inputs

Dual-In-Line Package

Outputs

Clear

Clock

A

B

QA

QB

...

L

X

X

X

L

L

...

L

H

L

X

X

QA0

QB0

...

QH0

H



H

H

H

QAn

...

QGn

H



L

X

L

QAn

...

QGn

H



X

L

L

QAn

...

QGn

QH

H = High Level (steady state), L = Low Level (steady state) X = Don’t Care (any input, including transitions) ↑ = Transition from low to high level QA0, QB0, QH0 = The level of QA, QB, or QH, respectively, before the indicated steady-state input conditions were established. QAn, QGn = The level of QA or QG before the most recent ↑ transition of the clock; indicates a one-bit shift.

DS006398-1

Order Number 54LS164DMQB, 54LS164FMQB, 54LS164LMQB, DM54LS164J, DM54LS164W, DM74LS164M or DM74LS164N See Package Number E20A, J14A, M14A, N14A or W14B

Logic Diagram

DS006398-2

© 1998 Fairchild Semiconductor Corporation

DS006398

www.fairchildsemi.com

DM74LS164 8-Bit Serial In/Parallel Out Shift Register

March 1998

Suggest Documents