تحليل الدوائر التتابعية
دراسة تحليل الدوائر المنطقية التتابعية، بما في ذلك استنتاج معادلات الإدخال، جداول الحالة، ومخططات الحالة، مع مقارنة بين نماذج ميلي ومور.
Sequential Circuits Analysis
Study of sequential logic circuits analysis, including deriving input equations, state tables, and state diagrams, with a comparison between Mealy and Moore models.
أهداف التعلم
- وصف الدائرة التتابعية بدلالة معادلة الحالة.
- تعلم كيفية كتابة جدول الحالة لدائرة تتابعية.
- تعلم كيفية رسم مخطط الحالة لدائرة تتابعية.
- Describe a sequential circuit in terms of a state equation.
- Learn how to write a state table for a sequential circuit.
- Learn how to draw a state diagram for a sequential circuit.
1 التحليل مقابل التصميم
1 Analysis vs. Design
التحليل يبدأ من الدائرة وينتهي بجدول/مخطط الحالة، بينما التصميم يبدأ بالمواصفات وينتهي بالدائرة.
Analysis starts with a circuit and ends with a state table/diagram, while design starts with specifications and ends with a circuit.
في الدوائر التتابعية، التحليل (Analysis) هو عملية عكسية للتصميم. يبدأ التحليل من مخطط الدائرة المنطقية (Circuit Diagram) المعطى، ويهدف إلى فهم سلوك الدائرة من خلال استنتاج جدول الحالة (State Table) أو مخطط الحالة (State Diagram).
على العكس من ذلك، التصميم (Design) يبدأ من مجموعة من المواصفات المطلوبة، ومنها يتم إنشاء مخطط الحالة، ثم جدول الحالة، وأخيراً رسم الدائرة المنطقية التي تحقق هذه المواصفات.
In sequential circuits, Analysis is the reverse process of design. The analysis of a sequential circuit starts from a given circuit diagram and finishes with a state table or a state diagram to understand its behavior.
Conversely, the Design of a sequential circuit starts from a set of specifications from which a state diagram is obtained, and finally, the circuit diagram is constructed.
فهم الفرق بين التحليل والتصميم أساسي لمهندسي الحاسوب. التحليل يستخدم لاكتشاف الأخطاء (Debugging) أو الهندسة العكسية (Reverse Engineering) للأنظمة الحالية.
يعتمد التحليل بشكل كبير على استخراج معادلات الإدخال للقلابات (Flip-Flops) واستخدام الجداول المميزة (Characteristic Tables) لتحديد الحالة التالية.
Understanding the difference between analysis and design is fundamental for computer engineers. Analysis is often used for debugging or reverse engineering existing systems.
It relies heavily on extracting the input equations for the flip-flops and using their characteristic tables to determine the next state of the system deterministically.
إذا أعطيت دائرة مجهولة الوظيفة، هل ستقوم بعملية تحليل أم تصميم لمعرفة ما تفعله؟ If you are given a circuit with an unknown function, would you perform analysis or design to figure out what it does?
سأقوم بعملية التحليل، لأنني سأبدأ من الدائرة لاستنتاج مخطط الحالة وفهم سلوكها.
I would perform analysis, because I am starting from the circuit diagram to derive the state diagram and understand its behavior.
2 الجداول المميزة للقلابات
2 Characteristic Tables of Flip-Flops
الجداول المميزة تحدد الحالة التالية للقلاب بناءً على مدخلاته الحالية.
Characteristic tables determine the next state of a flip-flop based on its current inputs.
لتحليل سلوك الدوائر التتابعية، نحتاج إلى معرفة الجداول المميزة (Characteristic Tables) للقلابات المستخدمة. هذه الجداول تعطينا الحالة التالية (Next State) بناءً على المدخلات (Inputs) الحالية.
- قلاب D: الحالة التالية تساوي المدخل D مباشرة ($Q(t+1) = D$).
- قلاب JK: يعتمد على J و K. إذا كانا 00 (لا تغيير)، 01 (تصفير Reset)، 10 (تعيين Set)، 11 (عكس Complement).
- قلاب T: إذا كان T=0 (لا تغيير)، وإذا كان T=1 (عكس الحالة).
To analyze the behavior of sequential circuits, we need the characteristic tables of the flip-flops used. These tables define the next state given the current inputs.
- D Flip-Flop: The next state is exactly the input D ($Q(t+1) = D$).
- JK Flip-Flop: Depends on J and K. 00 (No change), 01 (Reset), 10 (Set), 11 (Complement).
- T Flip-Flop: If T=0 (No change), if T=1 (Complement).
الجداول المميزة هي الجسر الرياضي بين الدائرة التوافقية (التي تولد إشارات الإدخال للقلابات) والدائرة التتابعية (التي تخزن الحالة).
بدون هذه الجداول، لا يمكننا الانتقال من معادلات الإدخال إلى جدول الحالة.
Characteristic tables act as the mathematical bridge between the combinational logic (which generates the inputs to the flip-flops) and the sequential logic (which stores the state).
Without these tables, we cannot transition from input equations to the state table.
لماذا يعتبر تحليل الدوائر التي تستخدم قلابات D أسهل من تلك التي تستخدم قلابات JK؟ Why is analyzing circuits with D flip-flops easier than those with JK flip-flops?
لأن الحالة التالية في قلاب D تساوي مباشرة معادلة الإدخال، بينما في قلاب JK يجب استخدام الجدول المميز لدمج قيم J و K مع الحالة الحالية.
Because the next state in a D flip-flop is directly equal to the input equation, whereas for a JK flip-flop, you must use the characteristic table to combine J and K values with the current state.
3 خطوات تحليل الدوائر التتابعية
3 Steps of Sequential Circuit Analysis
الخطوات الثلاث: 1. استنتاج معادلات الإدخال، 2. بناء جدول الحالة، 3. رسم مخطط الحالة.
The three steps: 1. Derive Input Equations, 2. Build State Table, 3. Draw State Diagram.
يتكون تحليل الدائرة التتابعية من ثلاث خطوات رئيسية متسلسلة:
- استنتاج معادلات الإدخال (Deriving Input Equations): كتابة المعادلات المنطقية البولينية التي تصف الإشارات الداخلة إلى كل قلاب بناءً على المدخلات الخارجية والحالة الحالية.
- الحصول على جدول الحالة (Getting the State Table): إنشاء جدول يوضح الحالة الحالية، المدخلات، الحالة التالية، والمخرجات. يتم حساب الحالة التالية باستخدام معادلات الإدخال والجداول المميزة.
- الحصول على مخطط الحالة (Obtaining the State Diagram): تحويل جدول الحالة إلى رسم بياني مرئي يوضح تسلسل الحالات والمخرجات بمرور الوقت.
The analysis of a sequential circuit consists of three main sequential steps:
- Deriving Input Equations: Writing the Boolean logic equations that describe the signals entering each flip-flop based on external inputs and the present state.
- Getting the State Table: Creating a table that shows the present state, inputs, next state, and outputs. The next state is calculated using the input equations and characteristic tables.
- Obtaining the State Diagram: Converting the state table into a visual graph that demonstrates the time sequence of inputs, outputs, and states.
هذه المنهجية تضمن تحويلاً دقيقاً من مستوى المكونات المادية (Hardware) إلى مستوى التجريد السلوكي (Behavioral Abstraction).
جدول الحالة يحتوي على $2^{m+n}$ صفاً، حيث $m$ هو عدد القلابات و $n$ هو عدد المدخلات الخارجية، مما يضمن تغطية جميع الاحتمالات الممكنة للنظام.
This methodology ensures an accurate translation from the hardware component level to behavioral abstraction.
The state table contains $2^{m+n}$ rows, where $m$ is the number of flip-flops and $n$ is the number of external inputs, ensuring all possible system states and input combinations are covered.
إذا كان لديك دائرة تحتوي على 3 قلابات ومدخلين خارجيين، كم عدد الصفوف في جدول الحالة؟ If you have a circuit with 3 flip-flops and 2 external inputs, how many rows will the state table have?
عدد الصفوف = 2^(3+2) = 2^5 = 32 صفاً.
Number of rows = 2^(3+2) = 2^5 = 32 rows.
4 نموذج ميلي مقابل نموذج مور
4 Mealy Model vs. Moore Model
في آلة ميلي، تعتمد المخرجات على الحالة والمدخلات معاً. في آلة مور، تعتمد المخرجات على الحالة فقط.
In a Mealy machine, outputs depend on both state and inputs. In a Moore machine, outputs depend ONLY on the state.
تصنف الدوائر التتابعية المتزامنة إلى نوعين رئيسيين بناءً على كيفية توليد المخرجات:
- نموذج ميلي (Mealy Model): المخرجات هي دالة في كل من الحالة الحالية (Present State) والمدخلات (Inputs). في مخطط الحالة، تُكتب المخرجات على أسهم الانتقال بصيغة (Input/Output).
- نموذج مور (Moore Model): المخرجات هي دالة في الحالة الحالية فقط (States only). في مخطط الحالة، تُكتب المخرجات داخل دوائر الحالة نفسها.
Synchronous sequential circuits are classified into two main types based on how outputs are generated:
- Mealy Model: Outputs are a function of both the present state and the inputs. In a state diagram, outputs are written on the transition arrows in the format (Input/Output).
- Moore Model: Outputs are a function of the present state only. In a state diagram, outputs are written inside the state circles.
آلة ميلي عادة ما تكون أكثر تعقيداً لأن المخرجات يمكن أن تتغير فور تغير المدخلات (غير متزامنة تماماً مع النبضة في بعض التصاميم)، ولكنها تتطلب عدد حالات أقل (مكونات مادية أقل).
آلة مور أسهل في الفهم والتنفيذ البرمجي، ومخرجاتها متزامنة تماماً مع الساعة، لكنها قد تتطلب حالات إضافية لإنجاز نفس المهمة.
A Mealy machine is generally more complex because outputs can change asynchronously if inputs change between clock edges, but it typically requires fewer states (less hardware).
A Moore machine is easier to understand and implement, and its outputs are strictly synchronous, but it may require more states to accomplish the same task.
| Mealy Machine | Moore Machine | |
|---|---|---|
| اعتماد المخرجات Output Dependency | الحالة الحالية والمدخلات Present state and inputs | الحالة الحالية فقط Present state only |
| عدد الحالات (المكونات المادية) Number of States (Hardware) | أقل عادةً Usually less | أكثر عادةً Usually more |
| التعقيد والفهم Complexity & Understanding | أكثر تعقيداً More complex | أسهل للفهم والتنفيذ Easy to understand and implement |
إذا أردت تصميم دائرة تتفاعل بأسرع وقت ممكن مع تغير المدخلات، أي النموذجين تختار؟ If you want to design a circuit that reacts as quickly as possible to input changes, which model would you choose?
نموذج ميلي، لأن المخرجات مرتبطة مباشرة بالمدخلات ويمكن أن تتغير فور تغيرها دون انتظار النبضة التالية للساعة (في الجزء التوافقي).
The Mealy model, because the outputs are directly connected to the inputs and can change immediately when inputs change, without waiting for the next clock edge (in the combinational part).