MG4 HD4
MG4 HD4
MG4 HD4
UNIVERSITY OF NOTRE DAME DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Laboratory MG4/HD4 February 22 2003
Part MG4 (First Week) Part MG4A: Latches and Flip-Flops for Sequential Logic Design
The Design Architect schematic on the next page, labeled Experiment MG4A shows four one-bit memory configurations. The circuit of NAND gates U1 through U6 constitutes a SSI realization of a positive edge-triggered D flip-flop with an asynchronous active-low clear input and complementary outputs. This is the gate-level equivalent of the MSI 74LS74A unit shown at location 4C of the schematic, except that the latter has an active-low preset as an additional input. Cross-coupled NOR gates U7 and U8 form a Set-Reset (SR) latch with complementary outputs. A MSI 74LS73A negative edge triggered JK flip-flop with an active-low clear input and complementary outputs is at location 2C. The 74LS76A JK flip-flop, which has both clear and preset inputs, is used in parts MG4B and HD4. The voltage-level table for the SR latch shown at the right indicates that when both inputs are high, both outputs are low, contrary to their usual complementary nature. For this reason, and the possibility of oscillation on exiting this state, the designer must assure Latch with Active-High that the S and R inputs never go high (active) Set and Reset simultaneously. S R Q+ QB+ The voltage-level tables for the D and the JK flipflops are shown on Page 3. Note that these are clocked L L Q QB flip-flops, which are activated on the edge of the clock input. The other inputs must be stable for specified times L H L H before and after the activating clock transition. H L H L H H L L
CSE-221L
Laboratory MG4/HD4
February 22 2003
CSE-221L
Laboratory MG4/HD4
February 22 2003
74LS74A D Flip-Flop Positive-Edge-Triggered, with Active-Low Asynchronous Preset and Clear _CLR L L H H H H _PRE L H L H H H D X X X X L H CLK X X X
Q+ H L H Q L H
QB+ H H L QB H L
74LS73A (*No _PRE input) and 74LS76A JK Flip-Flops Negative-Edge-Triggered, with Active-Low Asynchronous Clear and Preset* _CLR L L H H H H H _PRE* L H L H H H H J X X X L L H H K X X X L H L H _CLK X X X
Q+ H L H Q L H
QB+ H H L QB H L
QB
Q Q
QB
Click on OPEN SHEET in the QuickSim Palette. A window labeled /:sheet1 containing the schematic diagram from the last page should appear. Create a Trace window for all ports in the schematic. Configure the traces to be in the following order, from top to bottom:
Q_SSI, QB_SSI, Q_D, QB_D, Q_JK, QB_JK, Q_SR, QB_SR, JSD, KR, CLK, CLRB
4.
Load the forcing waveforms for the four inputs. Use the RMB in the Trace window to activate the pop-up menu, and select Force > From File
CSE-221L
Laboratory MG4/HD4
February 22 2003
In the resulting dialog box, enter exactly the following Path name from the keyboard:
$MGC_HOME/user/logic/MG4A_forces_1000
5.
In the SETUP Palette, click on the TIMING MODE button. In the resulting dialog window, change the timing mode on all instances to Full Delays Typ, and click OK. This prepares for simulation with typical gate delays. Perform the simulation for 1000 time units. To prepare printed copy of your simulation output, use the pop-up menu in the trace window to select Setup > Window. In the resulting dialog window, enter the following:
Domain label interval Domain pixels interval Domain area height Name area width 100 100 40 70 Curve height Curve spacing Margin 30 20 10
6. 7.
Print the trace window with Begin domain 0, End domain 1030 8. Study the simulated output waveforms and discuss the results. Note in particular the difference between the positive and negative edge triggered flip-flops, and between the clocked flip-flops and the latch. Note the oscillatory behavior of the RS latch, and the conditions under which it occurs. Note that delays associated with the NAND implementation of the D flip-flop are different from those of the 74LS76A flip-flop. Which memory unit retains true complementary behavior of the Q and QB outputs for all time? Exit QuickSim without saving.
9.
CSE-221L
Laboratory MG4/HD4
February 22 2003
the counter will cycle through only the ten states 0000 through 1001. The output of the circuit is the set of four flip-flop outputs connected via a bus to a single output port labeled CNT(3:0). The output of the first flip-flop (driven by the CLK) is the counter's least significant bit, CNT(0). 1. 2. Develop a circuit to meet these specifications, using only the four 74LS76A flip-flops (in two IC packages) and three 74LS10 3-input NAND gates (in one IC package). Make a separate directory under Private/cse221 named lab4. Directly invoke Design Architect by typing da& at command line under the directory you just created. Create a schematic called MG4B to satisfy the requirements, and obtain a printer plot of your circuit. Create a bus for the CNT(3:0) port, and use [TEXT] SEQUENCE TEXT to assign appropriate numbers to the 4x1-ripper R-values. Be sure that 0 corresponds to the least significant bit of the counter. Use QuickSim to simulate your circuit. Load the force file using the following path:
$MGC_HOME/user/logic/MG4B_forces_3000
3.
Arrange the waveforms in the Trace window in the following order, from top to bottom:
CLRB, CLK, CNT(3:0), MOD10.
Use Full delay typ timing mode with run time 3000 ns to verify your counter operation. 4. To prepare printed copy of your simulation output, use the pop-up menu in the trace window to select Setup > Window. In the resulting dialog window, enter the following: Domain label interval 400 Curve height 40 Domain pixels interval 100 Curve spacing 40 Domain area height 40 Margin 10 Name area width 90 Obtain a printer plot of the Trace window for the domain 0 to 3100 ns. To observe the ripple effect, reset the Domain label interval to 50, and obtain a printer plot of the Trace window for the domain from 1380 to 1720 ns. 5. Exit QuickSim without saving, and exit Design Architect.
CSE-221L 4.
Laboratory MG4/HD4
February 22 2003
In Design Manager, select your MG4B icon, and use the RMB to invoke pop-up menu item Open > brd_arch. Note that Board Architect displays the schematic with package identifiers U1, U2, U3, and with all pin numbers in red. To retain this information in the schematic, use pull-down Miscellaneous > Merge Annotations > All Use pull-down File > Print Sheet to obtain a copy for HD4. Finally, quit using pulldown MGC > Exit, without saving.
5.
Note that the power pins Vcc and Gnd are not shown on the schematic, although they must be appropriately connected in the hardware laboratory. As shown on Page 7, the 74LS10 chip has Gnd at Pin 7 and Vcc at Pin 14, which are conventional locations. However, the 74LS76A flip-flop has unconventional power locations of Pin 5 for Vcc and Pin 13 for Gnd.
-- Go to the class directory -- Create a new directory for this VHDL session. -- Go to the new directory. -- Obtain the counter source file.
-- Create a library directory for compiled files. -- Map the logical work file to the physical file work. -- Compile the source file. -- Invoke the simulator.
2. In the resulting Load Design window, select Design Unit ripple4 and click Load. 3. In the ModelSim window, select pull-down View > All 4. In theStructure window, select Package bit_pack and scan its contents in the Source window. 5. In the Structure window, select ripple4 and scan the VHDL code in the Source window. Note that keywords are blue, comments are green, and numerical data are red. 6. In the Signals window, set up the traces and input forces as follows: Select pull-down View > Wave > Signals in Region Select clrb, then Edit > force with Value: 1, Delay For: 25, OK 6
CSE-221L
Laboratory MG4/HD4
February 22 2003
Select mod10, then Edit > force with Value: 1, Delay For: 2000, OK Select clk, then Edit > clk with Period: 100, and with defaults, OK 7. At the prompt in the ModelSim window, type run 3000 8. In the Wave window, select /ripple4/cnt, then pull-down Format > Radix > Decimal and Format > Radix > Unsigned. Scan and study the waveforms. 9. In the ModelSim window: Select File > Print Postscript >> Full Range, and finally, select File > Quit >> Yes.
Report
For Part MG4A, include the simulation traces from Part 7, and discussion from Part 8. For Part MG4B, comment on your results, including the advantages and disadvantages of a ripple counter vs. a synchronous counter, and the use of the three NAND gates for modulus variation. Include printouts of the schematic from Part 2 and the two simulation traces from Part 4. For Part MG4C, include the schematic from Part 5, and comment on the utility of Board Architect. For Part MG4D, include the waveforms from Part 9, and a listing of the source file mg4d_ctr.vhd. Comment on your initial impressions of ModelSim.
CSE-221L
Laboratory MG4/HD4
February 22 2003
_PRE _CLK
Q _Q
_PRE _CLK
Q _Q
_CLR
_CLR
1 1CLK
2 1SET
3 1CLR
4 1J
5 Vcc
6 2CLK
7 2SET
8 2CLR
CSE-221L
Vcc 14 1C 13 1Y 12
Laboratory MG4/HD4
3C 11 3B 10 3A 9 3Y 8
February 22 2003
5V
1 1A
2 1B
3 2A
4 2B
5 2C
6 2Y
7 GND