top of page

Structural Modelling (स्ट्रक्चरल मॉडलिंग)

स्ट्रक्चरल मॉडलिंग तब उपयोग की जाती है जब डिज़ाइन बड़ा और जटिल हो जाता है, जैसे कि एक बड़ी चिप जिसमें कई ब्लॉक्स होते हैं।

 

सब कुछ एक ही जगह लिखने के बजाय हम डिज़ाइन को छोटे-छोटे मॉड्यूल्स (ब्लॉक्स) में बाँट देते हैं।

 

बड़े ब्लॉक के अंदर हम इन छोटे ब्लॉक्स को कंपोनेंट के रूप में इस्तेमाल करके इंस्टैंशिएट करते हैं।

 

फिर इन ब्लॉक्स को आपस में जोड़ते हैं। अलग-अलग ब्लॉक्स के पोर्ट्स को आपस में जोड़ने की प्रक्रिया को पोर्ट मैपिंग कहते हैं।

स्ट्रक्चरल मॉडलिंग का ब्लॉक डायग्राम

SLT1.png

पोर्ट मैप:

पोर्ट मैपिंग कोड लिखने का एक तरीका है जिसमें हम बाहरी डिज़ाइन के सिग्नल्स को अंदर वाले कंपोनेंट के पोर्ट्स से जोड़ते हैं।

 

अंदर वाला मॉड्यूल बाहरी मॉड्यूल के अंदर एनकैप्सुलेटेड माना जाता है।

 

अंदर वाले मॉड्यूल के पोर्ट्स को फॉर्मल सिग्नल्स और बाहर वाले मॉड्यूल के सिग्नल्स को एक्चुअल सिग्नल्स कहते हैं।

 

पोर्ट मैप स्टेटमेंट में फॉर्मल पोर्ट बाईं तरफ और एक्चुअल सिग्नल दाईं तरफ लिखा जाता है, जिससे पता चलता है कि कौन सा पोर्ट किस सिग्नल से जुड़ रहा है।

 

डेटा का वास्तविक फ्लो फॉर्मल पोर्ट के मोड (in, out, या inout) से तय होता है।

 

अगर पोर्ट इनपुट है तो वैल्यू बाहर से अंदर जाती है और अगर आउटपुट है तो वैल्यू अंदर से बाहर जाती है। इससे डेटा सही दिशा में फ्लो करता है।

सिंटैक्स:

formal => actual

 

AND गेट का कोड

Verilog

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

 

entity and_gate is

  port (

    A : in  STD_LOGIC;

    B : in  STD_LOGIC;

    Y : out STD_LOGIC

  );

end entity;

 

architecture rtl of and_gate is

begin

  Y <= A and B;

end architecture;

टॉप मॉड्यूल

Verilog

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

 

entity top_module is

  port (

    X1 : in  STD_LOGIC;

    X2 : in  STD_LOGIC;

    Z  : out STD_LOGIC

  );

end entity;

 

architecture structural of top_module is

begin

  -- Port Mapping

  U1: entity work.and_gate

 port map (

      A => X1,   -- formal A (अंदर का इनपुट) को बाहर वाले सिग्नल X1 से वैल्यू मिलती है

      B => X2,   -- formal B (अंदर का इनपुट) को बाहर वाले सिग्नल X2 से वैल्यू मिलती है

      Y => Z     -- formal Y (अंदर का आउटपुट) बाहर वाले सिग्नल Z को ड्राइव करता है

    );

end architecture;

STM2.png

टॉप मॉड्यूल के अंदर AND गेट एनकैप्सुलेटेड है, और पोर्ट मैप में कनेक्शन फॉर्मल से एक्चुअल की ओर लिखा गया है।

Verilog

 port map (

      A => X1,   -- formal A (inner input) gets value from outer signal X1

      B => X2,   -- formal B (inner input) gets value from outer signal X2

      Y => Z     -- formal Y (inner output) drives outer signal Z

    );

स्ट्रक्चरल मॉडलिंग का रियल-टाइम उदाहरण

ALU चिप का उदाहरण

यह कोड 4-बिट ALU के लिए है, जहाँ ALU_Sel जब 00 हो तो जोड़ (ADD) करता है, जब 01 हो तो AND ऑपरेशन करता है, जब 10 हो तो OR ऑपरेशन करता है, और किसी अन्य वैल्यू पर रिजल्ट और कैरी आउट दोनों को 0 कर देता है।

ALU का कोड

Verilog

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

 

entity alu_4bit is

  port (

    A       : in  STD_LOGIC_VECTOR(3 downto 0);

    B       : in  STD_LOGIC_VECTOR(3 downto 0);

    ALU_Sel : in  STD_LOGIC_VECTOR(1 downto 0);

    Result  : out STD_LOGIC_VECTOR(3 downto 0);

    Cout    : out STD_LOGIC

  );

end entity;

 

architecture structural of alu_4bit is

  signal add_out : STD_LOGIC_VECTOR(3 downto 0);

  signal and_out : STD_LOGIC_VECTOR(3 downto 0);

  signal or_out  : STD_LOGIC_VECTOR(3 downto 0);

  signal add_c   : STD_LOGIC;

begin

  U_ADD : entity work.adder_4bit

    port map (A => A, B => B, SUM => add_out, Cout => add_c);

 

  U_AND : entity work.and_4bit

    port map (A => A, B => B, Y => and_out);

 

  U_OR  : entity work.or_4bit

    port map (A => A, B => B, Y => or_out);

 

  -- Structural MUX via with-select

  with ALU_Sel select

    Result <= add_out when "00",

              and_out when "01",

              or_out  when "10",

              (others => '0') when others;

 

  -- Carry out only meaningful for ADD

  Cout <= add_c when ALU_Sel = "00" else '0';

end architecture;

4-बिट ऐडर (अंदर Full Adder से बना)

Verilog

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

 

entity adder_4bit is

  port (

    A    : in  STD_LOGIC_VECTOR(3 downto 0);

    B    : in  STD_LOGIC_VECTOR(3 downto 0);

    SUM  : out STD_LOGIC_VECTOR(3 downto 0);

    Cout : out STD_LOGIC

  );

end entity;

 

architecture structural of adder_4bit is

  signal c1, c2, c3 : STD_LOGIC;

begin

  FA0: entity work.full_adder

    port map (A => A(0), B => B(0), Cin => '0', SUM => SUM(0), Cout => c1);

 

  FA1: entity work.full_adder

    port map (A => A(1), B => B(1), Cin => c1,  SUM => SUM(1), Cout => c2);

 

  FA2: entity work.full_adder

    port map (A => A(2), B => B(2), Cin => c2,  SUM => SUM(2), Cout => c3);

 

  FA3: entity work.full_adder

    port map (A => A(3), B => B(3), Cin => c3,  SUM => SUM(3), Cout => Cout);

end architecture;

4-बिट AND गेट का कोड

Verilog

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

 

entity and_4bit is

  port (

    A : in  STD_LOGIC_VECTOR(3 downto 0);

    B : in  STD_LOGIC_VECTOR(3 downto 0);

    Y : out STD_LOGIC_VECTOR(3 downto 0)

  );

end entity;

 

architecture rtl of and_4bit is

begin

  Y <= A and B;

end architecture;

4-बिट OR गेट का कोड

Verilog

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

 

entity or_4bit is

  port (

    A : in  STD_LOGIC_VECTOR(3 downto 0);

    B : in  STD_LOGIC_VECTOR(3 downto 0);

    Y : out STD_LOGIC_VECTOR(3 downto 0)

  );

end entity;

 

architecture rtl of or_4bit is

begin

  Y <= A or B;

end architecture;

Elaborated डायग्राम

STM3.png

इस ब्लॉक डायग्राम में हर छोटा बॉक्स एक मॉड्यूल (जैसे AND, OR, ADD) को दर्शाता है।

 

ये मॉड्यूल्स आपस में कनेक्ट होकर एक बड़ा सिस्टम (जैसे ALU) बनाते हैं। हर मॉड्यूल के अंदर भी छोटे-छोटे कंपोनेंट हो सकते हैं, जिन्हें खोलने के लिए प्लस (+) चिन्ह दिखाया जाता है।

 

यही स्ट्रक्चरल मॉडलिंग है — जहाँ छोटे-छोटे ब्लॉक्स को जोड़कर बड़ा डिज़ाइन बनाया जाता है।

इस ALU डायग्राम में इनपुट A और B अलग-अलग ब्लॉक्स (Adder, AND, OR) को दिए जाते हैं।

 

हर ब्लॉक अपना-अपना ऑपरेशन करता है — Adder जोड़ (Addition), AND गेट AND ऑपरेशन और OR गेट OR ऑपरेशन करता है।

 

इन तीनों ब्लॉक्स के आउटपुट को एक मल्टीप्लेक्सर (MUX) से जोड़ा गया है। ALU_Sel सिग्नल तय करता है कि कौन सा आउटपुट रिज़ल्ट में जाएगा।

 

अगर ALU_Sel = 00 है तो जोड़ का रिज़ल्ट आएगा, अगर 01 है तो AND ऑपरेशन का, अगर 10 है तो OR ऑपरेशन का और किसी भी अन्य वैल्यू पर

 

आउटपुट 0 रहेगा। यही ALU का स्ट्रक्चरल मॉडलिंग आधारित काम करने का तरीका है।

STM4.png

You can see Structural modelling.

Synthesis of ALU:

STM5.png

सिमुलेशन और रिज़ल्ट

STL6.png

सिमुलेशन में रिज़ल्ट सिग्नल ANDing, ADDing और ORing दिखाता है।

Behavioral Modeling

Data flow modeling

© Copyright 2025 VLSI Mentor. All Rights Reserved.©

Connect with us

  • Instagram
  • Facebook
  • Twitter
  • LinkedIn
  • YouTube
bottom of page