تصميم الدوائر التتابعية
تغطي هذه الوحدة إجراءات تصميم الدوائر التتابعية المتزامنة باستخدام قلابات D و T، وجداول الإثارة، وتقنيات تقليل الحالات لتحسين الأجهزة.
Designing Sequential Circuits
This module covers the design procedures for synchronous sequential circuits using D and T flip-flops, excitation tables, and state reduction techniques to optimize hardware.
أهداف التعلم
- تعلم كيفية تبسيط تصميم الدائرة التتابعية لتقليل عدد البوابات المنطقية المطلوبة.
- فهم عملية التصميم لدائرة تتابعية باستخدام كتل بناء مختلفة (قلابات D، قلابات JK، قلابات T).
- تطبيق خوارزميات تقليل الحالات لتحسين تكلفة الأجهزة.
- Learn how to simplify a sequential circuit design to reduce the number of logic gates needed.
- Learn the design process for a sequential circuit using different sequential circuit building blocks (D flip-flops, JK flip-flops, T flip-flops).
- Apply state reduction algorithms to optimize hardware cost.
1 التحليل مقابل التصميم
1 Analysis vs. Design
التحليل يبدأ من الدائرة لينتهي بجدول الحالة، بينما التصميم يبدأ من المواصفات لينتهي بالدائرة.
Analysis starts with a circuit and ends with a state table, while design starts with specifications and ends with a circuit.
في الدوائر التتابعية، التحليل (Analysis) يبدأ من مخطط الدائرة (Circuit Diagram) وينتهي بجدول الحالة (State Table) أو مخطط الحالة (State Diagram).
على العكس من ذلك، التصميم (Design) يبدأ من مجموعة من المواصفات (Specifications) التي يُستخرج منها مخطط الحالة، وينتهي أخيراً بمخطط الدائرة الذي يحتوي على البوابات المنطقية والقلابات.
In sequential circuits, Analysis starts from a circuit diagram and finishes with a state table or a state diagram.
Conversely, the Design of a sequential circuit starts from a set of specifications from which a state diagram is obtained, and finally results in the circuit diagram (with logic gates and flip-flops).
التصميم هو عملية عكسية للتحليل.
يتطلب التصميم اتخاذ قرارات هندسية مثل اختيار نوع القلاب (Flip-Flop) وتقليل عدد الحالات لتقليل التكلفة، بينما التحليل هو عملية استنتاجية بحتة لفهم سلوك دائرة موجودة مسبقاً.
Design is the reverse engineering of analysis.
Design requires engineering decisions such as choosing the flip-flop type and reducing the number of states to minimize hardware cost, whereas analysis is a purely deductive process to understand the behavior of an existing circuit.
| Analysis | Design | |
|---|---|---|
| نقطة البداية Starting Point | مخطط الدائرة (Circuit Diagram) Circuit Diagram | المواصفات (Specifications) Specifications |
| النتيجة النهائية End Result | جدول/مخطط الحالة State Table/Diagram | مخطط الدائرة (Logic Gates) Circuit Diagram (Logic Gates) |
لماذا يعتبر التصميم أصعب من التحليل في الدوائر التتابعية؟ Why is design considered harder than analysis in sequential circuits?
لأن التصميم يتطلب الإبداع واتخاذ القرارات (مثل اختيار نوع القلاب وتقليل الحالات)، بينما التحليل يتبع خطوات ثابتة لاستنتاج السلوك.
Because design requires creativity and decision-making (like choosing flip-flop types and state reduction), whereas analysis follows fixed steps to deduce behavior.
2 إجراءات التصميم
2 Design Procedure
خطوات منهجية تبدأ بالمواصفات وتمر بـ مخطط الحالة وجدول الإثارة لتنتهي بالدائرة المنطقية.
Systematic steps starting with specifications, moving through state diagrams and excitation tables, ending with a logic circuit.
تتكون خطوات تصميم الدائرة التتابعية من:
- استنتاج مخطط الحالة (State Diagram) من المواصفات.
- تعيين قيم ثنائية للحالات.
- اختيار نوع القلاب (Flip-Flop).
- الحصول على جدول الحالة (State Table) باستخدام جداول الخصائص للقلاب.
- الحصول على معادلات الدخل والخرج المبسطة باستخدام خرائط كارنوف (K-Maps).
- رسم المخطط المنطقي (Logic Diagram).
The steps for designing a sequential circuit are:
- Derive a state diagram from specifications.
- Assign binary values to the states.
- Choose the type of flip-flop to use.
- Obtain the state table utilizing the characteristic tables of the flip-flop.
- Get the simplified input equations and output equations using K-Maps.
- Draw the logic diagram.
تحديد عدد القلابات يعتمد على عدد الحالات. إذا كان لدينا $N$ حالة، نحتاج إلى $n$ قلاب بحيث يكون $2^n \ge N$.
على سبيل المثال، 7 حالات تتطلب 3 قلابات.
اختيار نوع القلاب يؤثر بشكل كبير على تعقيد الدائرة التوافقية (Combinational Logic) التي تقود القلابات.
Determining the number of flip-flops depends on the number of states. For $N$ states, we need $n$ flip-flops such that $2^n \ge N$.
For example, 7 states require 3 flip-flops.
The choice of flip-flop type significantly impacts the complexity of the combinational logic driving the flip-flops.
إذا كان لديك تصميم يتطلب 9 حالات، كم عدد القلابات المطلوبة؟ If you have a design requiring 9 states, how many flip-flops are needed?
نحتاج إلى 4 قلابات، لأن 2^3 = 8 (غير كافٍ)، بينما 2^4 = 16 (يكفي لـ 9 حالات).
We need 4 flip-flops, because 2^3 = 8 (not enough), while 2^4 = 16 (enough for 9 states).
3 التصميم باستخدام قلابات D
3 Design with D Flip-Flops
قلاب D هو الأسهل في التصميم لأن معادلة الدخل تساوي مباشرة الحالة التالية.
D flip-flop is the easiest to design with because the input equation equals the next state directly.
عند التصميم باستخدام قلابات D، تكون العملية مباشرة لأن معادلة الخصائص للقلاب هي $D = Q(t+1)$.
هذا يعني أن قيمة الحالة التالية المطلوبة هي بالضبط ما يجب تطبيقه على مدخل D. يتم استخراج معادلات الدخل مباشرة من جدول الحالة باستخدام خرائط كارنوف (K-Maps) للحالة التالية.
When designing with D flip-flops, the process is straightforward because the characteristic equation of the D flip-flop is $D = Q(t+1)$.
This means the required next state value is exactly what must be applied to the D input. Input equations can be obtained directly from the state table using K-Maps for the next state columns.
بينما يقلل قلاب D من تعقيد استنتاج معادلات الدخل (لا حاجة لجدول إثارة معقد)، فإنه قد يؤدي أحياناً إلى دوائر توافقية (Combinational Logic) أكبر مقارنة بقلابات JK أو T التي تستفيد من حالات 'عدم التغيير' (No Change) لتبسيط المعادلات.
While the D flip-flop reduces the complexity of deriving input equations (no complex excitation table needed), it might sometimes result in larger combinational logic circuits compared to JK or T flip-flops, which can leverage 'No Change' or 'Toggle' behaviors to simplify logic expressions.
لماذا لا نحتاج إلى جدول إثارة منفصل عند استخدام قلاب D؟ Why don't we need a separate excitation table when using a D flip-flop?
لأن مدخل D هو نفسه الحالة التالية المطلوبة، لذا يمكن أخذ القيم مباشرة من عمود الحالة التالية في جدول الحالة.
Because the D input is identical to the desired next state, so values can be taken directly from the next state column in the state table.
4 جداول الإثارة
4 Excitation Tables
جدول يخبرك بالمدخلات المطلوبة للقلاب للانتقال من الحالة الحالية إلى الحالة التالية.
A table that tells you the required flip-flop inputs to transition from the present state to the next state.
أثناء عملية التصميم، عادة ما نعرف الانتقال المطلوب من الحالة الحالية $Q(t)$ إلى الحالة التالية $Q(t+1)$، ولكننا نحتاج إلى معرفة ظروف الدخل للقلاب التي ستسبب هذا الانتقال.
جدول الإثارة (Excitation Table) يسرد المدخلات المطلوبة لتغيير معين في الحالة. على سبيل المثال، لقلاب T، إذا كانت $Q(t)=0$ و $Q(t+1)=1$، فإن الدخل المطلوب هو $T=1$.
During the design process, we usually know the transition from present state $Q(t)$ to next state $Q(t+1)$, but we need to find the flip-flop input conditions that will cause this transition.
An Excitation Table lists the required inputs for a given change in state. For example, for a T flip-flop, if $Q(t)=0$ and $Q(t+1)=1$, the required input is $T=1$.
جداول الإثارة ضرورية جداً عند التصميم باستخدام قلابات JK و T.
في قلاب JK، تظهر حالات 'لا يهم' (Don't Care - X) بكثرة في جدول الإثارة، مما يسمح بتبسيط كبير جداً في خرائط كارنوف لمعادلات الدخل، وهو الميزة الرئيسية لاستخدام قلابات JK على الرغم من تعقيد تصميمها الأولي.
Excitation tables are absolutely essential when designing with JK and T flip-flops.
In the JK flip-flop, 'Don't Care' (X) conditions appear frequently in the excitation table, allowing for significant simplification in K-Maps for input equations. This is the main advantage of using JK flip-flops despite their initial design complexity.
في قلاب JK، إذا أردنا الانتقال من 1 إلى 0، ما هي قيم J و K المطلوبة؟ In a JK flip-flop, if we want to transition from 1 to 0, what are the required J and K values?
J = X (لا يهم)، K = 1.
J = X (Don't care), K = 1.
5 التصميم باستخدام قلابات T
5 Design with T Flip-Flops
يتم التصميم بقلاب T باستخدام جدول الإثارة حيث T=1 يعكس الحالة و T=0 يبقيها كما هي.
Designing with T flip-flops uses the excitation table where T=1 toggles the state and T=0 keeps it unchanged.
تصميم الدوائر باستخدام قلابات T يشبه قلابات D، باستثناء أنه يجب تقييم معادلات الدخل من انتقال الحالة الحالية إلى الحالة التالية المستمدة من جدول الإثارة لقلاب T.
- إذا كانت الحالة تتغير (0 إلى 1 أو 1 إلى 0)، فإن $T=1$.
- إذا كانت الحالة لا تتغير، فإن $T=0$.
مثال شائع هو تصميم العدادات (Counters).
Designing circuits with T flip-flops is the same as with D flip-flops, except that the input equations must be evaluated from the present-state to next-state transition derived from the excitation table of the T Flip-Flop.
- If the state changes (0 to 1 or 1 to 0), $T=1$.
- If the state remains the same, $T=0$.
A common example is designing counters.
قلابات T مثالية لتصميم العدادات لأن العداد بطبيعته يعتمد على عكس (Toggling) البتات.
على سبيل المثال، في عداد تصاعدي 3-بت، البت الأقل أهمية (LSB) ينعكس في كل نبضة ساعة ($T_0 = 1$)، بينما البتات الأخرى تنعكس فقط عندما تكون جميع البتات الأقل منها تساوي 1.
T flip-flops are ideal for designing counters because a counter inherently relies on toggling bits.
For instance, in a 3-bit up-counter, the Least Significant Bit (LSB) toggles every clock cycle ($T_0 = 1$), while higher bits toggle only when all lower significant bits are 1.
عند تصميم عداد 3-بت باستخدام قلابات T، ما هي معادلة الدخل للقلاب الأول (T0)؟ When designing a 3-bit counter using T flip-flops, what is the input equation for the first flip-flop (T0)?
T0 = 1 (دائماً متصل بـ VCC لأنه ينعكس في كل دورة).
T0 = 1 (Always connected to VCC because it toggles every cycle).
6 تقليل الحالات
6 State Reduction
إزالة الحالات المكررة لتقليل عدد القلابات وتكلفة الأجهزة دون تغيير سلوك الدائرة.
Removing redundant states to reduce the number of flip-flops and hardware cost without changing circuit behavior.
تهتم خوارزميات تقليل الحالات (State Reduction) بتقليل عدد الحالات في مخطط الحالة مع الحفاظ على نفس علاقة الدخل والخرج. نظراً لأن $m$ قلاب يمكن أن يمثل $2^m$ حالة، فإن تقليل الحالات قد يقلل من عدد القلابات المطلوبة (مثلاً تقليل من 5 حالات إلى 4 حالات يقلل القلابات من 3 إلى 2).
يقال إن حالتين متكافئتان (Equivalent) إذا كانتا تعطيان نفس الخرج لكل مدخل، وتنتقلان إما إلى نفس الحالة التالية أو إلى حالة متكافئة. إذا كانت حالتان متكافئتين، يمكن إزالة إحداهما.
State reduction algorithms are concerned with reducing the number of states in a state diagram while maintaining the input-output relationship. Since $m$ flip-flops can represent $2^m$ states, reducing states might reduce the required flip-flops (e.g., reducing from 5 to 4 states reduces flip-flops from 3 to 2).
Two states are said to be equivalent if, for each member of the set of inputs, they give exactly the same output and send the circuit either to the same state or to an equivalent state. If two states are equivalent, one can be removed.
من المهم ملاحظة أن تقليل عدد الحالات لا يقلل دائماً من عدد القلابات. على سبيل المثال، تقليل الحالات من 7 إلى 5 لا يزال يتطلب 3 قلابات.
ومع ذلك، فإن تقليل الحالات يبسط جدول الحالة، مما يؤدي غالباً إلى تبسيط المعادلات المنطقية التوافقية (Combinational Logic) حتى لو ظل عدد القلابات ثابتاً.
It is important to note that reducing the number of states does not necessarily reduce the number of flip-flops. For example, reducing from 7 states to 5 states still requires 3 flip-flops.
However, state reduction simplifies the state table, which often leads to simpler combinational logic equations even if the flip-flop count remains the same.
إذا تم تقليل عدد الحالات من 8 إلى 6، هل سيقل عدد القلابات؟ If the number of states is reduced from 8 to 6, will the number of flip-flops decrease?
لا، لأن كلاً من 8 و 6 حالات تتطلب 3 قلابات (2^3 = 8).
No, because both 8 and 6 states require 3 flip-flops (2^3 = 8).