req lab2
req lab2
Are to provide hands-on experience in designing, implementing, and testing digital circuits based on the concepts of combinational and sequential logic.
Objective:
Combinational Logic Design and Sequential Logic Design are two fundamental categories in digital circuit design. Here's an overview of each:
● Definition: Combinational logic circuits are those in which the output depends only on the current input values, without any memory of past inputs.
● Key Characteristics:
1. No storage elements (i.e., no memory).
2. Outputs change immediately in response to inputs.
3. It is defined by Boolean expressions (AND, OR, NOT, etc.).
● Examples:
1. Adders (e.g., Half-adder, Full-adder).
2. Multiplexers.
3. Decoders.
4. Encoders.
● Design Process:
1. Define the problem.
2. Derive truth tables.
3. Minimize Boolean expressions (e.g., using Karnaugh maps).
4. Implement the logic gates.
● Definition: Sequential logic circuits are those where the output depends not only on the current inputs but also on the history of past inputs (i.e., they have memory).
● Key Characteristics:
1. Use storage elements like flip-flops or latches to remember past inputs.
2. The circuit has a "state," and the output depends on both the input and the current state.
3. Often synchronized by a clock signal.
● Examples:
1. Flip-flops (e.g., SR, D, JK, T Flip-flops).
2. Counters.
3. Shift Registers.
4. Finite State Machines (FSM).
● Design Process:
1. Identify the required states.
2. Create a state diagram.
3. Derive the state transition table.
4. Choose the appropriate flip-flops.
5. Develop the excitation equations.
6. Implement the logic gates and flip-flops.
Combinational Logic Design and Sequential Logic Design in MATLAB Simulink are fundamental for understanding digital circuit design. Below is a step-by-step guide on how to perform
both types of design in MATLAB Simulink.
Combinational logic circuits produce outputs based solely on current inputs, without memory or feedback. Common examples include logic gates, multiplexers, and decoders.
● Open MATLAB, then type simulink in the command window or click the Simulink button on the MATLAB toolbar to launch Simulink.
● In Simulink, click on File > New > Model to create a new model.
● A blank Simulink canvas will open where you can start building your combinational circuit.
● Go to the Simulink Library Browser (by clicking the "Library Browser" button or typing slLibraryBrowser in the command window).
● In the Library Browser, navigate to Simulink > Logic and Bit Operations.
○ AND, OR, NOT, XOR blocks can be found here.
● Drag the necessary logic gates (e.g., AND, OR, NOT, XOR) from the Logic and Bit Operations library onto the Simulink canvas. For a combinational circuit like a full adder, you
will need:
○ Two XOR gates (for sum computation).
○ Two AND gates (for carry computation).
○ One OR gate (to combine the intermediate carry outputs).
● Go to Sources in the Library Browser and drag Constant blocks for each input of your circuit.
○ For a full adder, you need three inputs: A, B, and C (carry in).
● Double-click on each Constant block and set its value to either 0 or 1. These will serve as the binary input values for the logic gates.
● Alternatively, you can use Step or Pulse Generator blocks for dynamic input.
● Go to Sinks in the Library Browser and drag Display blocks (or Scope blocks if you want a graphical view).
● Connect the output of the final XOR gate to a Display block for the sum output.
● Connect the output of the OR gate to another Display block for the carry output.
● Once your circuit is fully connected, click the Run button on the Simulink toolbar.
● You will see the outputs of the combinational circuit in the Display blocks.
● If you want to adjust how long the simulation runs, go to Simulation > Model Configuration Parameters and set the Stop Time accordingly.
For a full adder, the logic gates perform the following operations:
To implement this:
Additional Tips:
● You can label your inputs and outputs for clarity by double-clicking the names.
● Use Mux blocks if you want to combine multiple signals into one line.
● After running the simulation, you can double-click on the Scope blocks to view the waveform if you used dynamic inputs (like a Pulse Generator).
This setup will allow you to simulate and observe the behavior of combinational logic circuits like full adders, decoders, multiplexers, etc., using Simulink.
Combinational Logic:
Logic circuits for digital systems may be combinational or sequential. A combinational circuit consists of input variables, logic gates, and output variables.
For n input variables, there are 2n possible combinations of binary input variables .For each possible input Combination, there is one and only one possible output combination. A combinational
circuit can be described by m Boolean functions one for each output variables. Usually the input s comes from flip-flops and outputs go to flip-flops.
Design Procedure:
1. The problem is stated
2. The number of available input variables and required output variables is determined.
3. The input and output variables are assigned letter symbols.
4. The truth table that defines the required relationship between inputs and outputs is derived.
5. The simplified Boolean function for each output is obtained.
Adders:
Digital computers perform variety of information processing tasks, the one is arithmetic operations. And the most basic arithmetic operation is the addition of two binary digits. i.e, 4 basic
possible operations are: 0+0=0, 0+1=1, 1+0=1, 1+1=10
The first three operations produce a sum whose length is one digit, but when augends and addend bits are equal to 1,the binary sum consists of two digits. The higher significant bit of this result
is called a carry. A combinational circuit that performs the addition of two bits is called a halfadder. One that performs the addition of 3 bits (two significant bits & previous carry) is called a full
adder. & 2 half adder can employ as a full-adder.
Half Subtractor
Full Subtractor
Ədəbiyyat
1. Matlab Programming Fundamentals; Math Works; 2023
2. Simulink® User's Guide; Math Works; 2023
3. MIT OpenCourseWare : https://ocw.mit.edu/terms
4. Scientific Computing with MATLAB; Paul Gribble; Tue 12th Jan, 2016
5. INTRODUCTION TO MATLAB FOR ENGINEERING STUDENTS; David Houcque; Northwestern University; version 1.2, August 2005)
6. MATLAB for Engineers Applications in Control, Electrical Engineering, IT and Robotics; Karel Perutka; 2011
7. A MATLAB Exercise Book; Ludmila I. Kuncheva and Cameron C. Gray; 2020
8. Experiments with MATLAB; Cleve Moler; October 4, 2011