Operation and Timing of Sequential Logic Circuits
Summary
This activity uses Simulink and Simulink Copilot to help students explore the operation and timing of sequential logic circuits. Students begin by constructing and simulating an SR latch, then progressively use their working circuits to build a D latch, D flip-flop, and 2-bit register. Each circuit is developed into a reusable subsystem that serves as a building block for the next.
Throughout the activity, students use simulation results to compare observed circuit behavior with expected theoretical behavior. They investigate simulation errors and unexpected outputs, using Simulink Copilot to support troubleshooting and identify potential solutions. The activity emphasizes understanding circuit behavior, evaluating AI-generated recommendations, and explaining how simulation settings can influence results, rather than simply constructing functioning circuits.
Learning Goals
- Construct and simulate sequential logic circuits using logic gates and reusable subsystems.
- Identify and resolve simulation errors and unexpected circuit behavior.
- Analyze the relationship between data inputs, enable/clock signals, and outputs.
- Develop a 2-bit register using D flip-flops with a shared clock.
- Use Simulink Copilot to support troubleshooting and verify the effectiveness of suggested solutions.
- Document circuit operation, simulation results, and troubleshooting decisions using Simulink annotations.
Context for Use
This assignment is designed for an introductory Digital Systems course taken by third- and fourth-year General Engineering students concentrating in Electrical and Computer Engineering.
Students have previously studied binary arithmetic, logic gates, truth tables, Karnaugh maps, multiplexers, encoders, decoders, and sequential logic.
This is the third CAD assignment using Simulink. Students have previously simulated basic logic circuits and developed a seven-segment LED display, so they are familiar with the software and basic debugging techniques. This assignment builds on that experience by introducing more complex sequential circuits, reusable subsystems, and troubleshooting related to simulation timing.
Description and Teaching Materials
Assignment Document: Simulink Project - Sequential Logic.pdf (Acrobat (PDF) 91kB Nov9 26)
Sample Solution: Register_2Bit_wAnnotations.slx ( 82kB Nov9 26)
Teaching Notes and Tips
Instructional Goals
The primary goals of this assignment are to reinforce students' understanding of sequential logic and introduce challenges associated with timing and simulation settings in Simulink.
By progressing from an SR latch to a D latch, D flip-flop, and 2-bit register, students develop increasingly complex circuits while learning to construct reusable subsystems.
An important component of the assignment is troubleshooting. Students should recognize that a simulation running without errors does not necessarily indicate that the circuit is functioning correctly. They must examine circuit behavior and determine whether the outputs are consistent with the expected logic.
Integration of Simulink Copilot
Before the introduction of Simulink Copilot, students frequently struggled to produce functioning sequential logic circuits, particularly when encountering simulation errors or unexpected behavior.
Simulink Copilot can help students identify and resolve these issues, reducing the time spent troubleshooting software-specific problems. This allows students to focus more attention on understanding sequential logic, evaluating circuit behavior, and verifying that suggested modifications produce the expected results.
Students should be encouraged to use Copilot as a troubleshooting resource rather than accepting its recommendations without verification.
Instructor Preparation and Demonstration
Although students should have prior Simulink experience, instructors should introduce the features needed specifically for this assignment.
In particular, instructors should demonstrate:
- Creating subsystems: Begin with a blank Simulink model, add a few connected blocks, select all components to be included, right-click the selection, and choose the option to create a subsystem. Demonstrate how to open the subsystem and identify its input and output ports.
- Configuring Scope blocks: Demonstrate how to connect multiple signals to a Scope, configure its input ports, and adjust the display to compare signal behavior.
- Preserving annotations: Explain that annotations may not automatically be included when creating a subsystem unless they are selected with the circuit components. Annotations can also be copied into the subsystem afterward.
Anticipated Simulation Issues
Instructors should be familiar with two issues that may arise during the assignment.
SR Latch: Algebraic Loop
The feedback connections between the logic gates can create an algebraic loop that prevents Simulink from resolving the circuit's behavior. Introducing a delay into the feedback path can resolve this issue.
Instructors should anticipate this error and encourage students to investigate it using Simulink Copilot rather than immediately providing the solution.
D Flip-Flop: Simulation Step Size
During development of the sample solution, the D flip-flop exhibited unexpected behavior during the first few seconds of simulation. Reducing the maximum solver step size from Auto to 0.01 seconds resolved the issue.
Instructors should recognize that simulation settings can affect the apparent behavior of sequential logic circuits. The appropriate step size depends on the timing of the signals and should not be assumed to be 0.01 seconds for every model.
Students should be encouraged to investigate unexpected results and verify that changes to simulation settings resolve the observed behavior.
Documentation and Assessment
For this implementation, students document their observations, troubleshooting, and use of Simulink Copilot through annotations on the main page of their Simulink model rather than inside individual subsystems.
This approach keeps the documentation accessible without requiring instructors to navigate through each subsystem.
Instructors may consider alternative documentation requirements, including:
- Placing annotations or timing diagrams within the relevant subsystems.
- Requiring students to capture and label timing diagrams on the main page of their model.
- Having students prepare a separate report containing circuit schematics, simulation results, troubleshooting, and discussion.
These alternatives may be appropriate depending on the course objectives and desired level of technical documentation.
Potential Extensions
This assignment can be extended by having students use their 2-bit register as part of a finite state machine. Alternatively, the register can serve as a reusable component in a subsequent design project.
These extensions would allow students to apply sequential logic concepts to more complex systems while reinforcing the importance of modular circuit design.
Assessment
Grading Rubric (100 Points)
| Criterion | Points |
| Part 1 – SR Latch | 20 |
| Functional SR latch | 10 |
| Reusable subsystem with appropriate ports | 4 |
| Explanation of simulation errors and solutions | 4 |
| Annotations and documentation | 2 |
|
Part 2 – D Latch |
20 |
| Functional D latch using SR latch subsystem | 10 |
| Reusable D latch subsystem | 4 |
| Explanation of enable and output behavior | 4 |
| Annotations and documentation | 2 |
|
Part 3 – D Flip-Flop |
30 |
| Functional D flip-flop using D latch subsystems | 15 |
| Reusable D flip-flop subsystem | 5 |
| Troubleshooting and explanation of simulation behavior | 7 |
| Annotations and documentation | 3 |
|
Part 4 – 2-Bit Register |
30 |
| Functional register using two D flip-flop subsystems | 15 |
| Reusable register subsystem with shared clock | 5 |
| Explanation of input, clock, and output behavior | 7 |
| Annotations and documentation | 3 |
| Total | 100 |
References and Resources
F. Vahid and R. Lysecky, EGR 3480: Digital Systems, zyBooks, Sept. 2024, Sections 3.1–3.2. © Zyante Inc.
These sections introduce SR latches, D latches, D flip-flops, and registers, providing background on the sequential logic concepts explored in this activity.