Objects
VHDL में, object वह कुछ भी हो सकता है जो एक मान रख सकता है और डिज़ाइन में इस्तेमाल किया जा सकता है।
VHDL में Objects के प्रकार
-
Signal
-
हार्डवेयर में फिजिकल वायर या कनेक्शन को दर्शाता है।
-
अपडेट में देरी होती है (इवेंट शेड्यूलिंग)।
VHDL में, signals सबसे महत्वपूर्ण प्रकार के object हैं। आप इन्हें हार्डवेयर में वायर्स की तरह सोच सकते हैं, जो किसी entity या DUT (Design Under Test) के अंदर मौजूद होते हैं। ये signals अलग-अलग components को architecture के अंदर physically जोड़ते हैं।
जब एक signal बदलता है, तो नया मान तुरंत output पर दिखाई नहीं देता; इसके बजाय, यह बहुत छोटी देरी के बाद अपडेट होता है, जिसे delta delay कहा जाता है। इसका मतलब है कि आउटपुट इनपुट परिवर्तन को simulation timeline में "एक step बाद" दिखाता है। यह delta delay केवल simulation में मौजूद होता है, वास्तविक हार्डवेयर में नहीं।
अगर समय t पर, a बदलकर '0' से '1' हो जाता है, तो आउटपुट c तुरंत अपडेट नहीं होगा। इसके बजाय, यह एक delta cycle के बाद अपडेट होता है। यह सुनिश्चित करता है कि simulator signal propagation order को सही तरीके से मॉडल करे।
क्यों delta delay चाहिए जबकि वास्तविक में नहीं होता:
Delta delay केवल simulation-specific concept है। असली हार्डवेयर में wires instantly signal propagate करते हैं (physical delay छोड़कर)। Delta delay simulator को events को सही order में अपडेट करने में मदद करता है।
उदाहरण:
अगर तीन signals हैं a, b, c और आपने लिखा है:
b <= a;
c <= b;
तो जब a '1' बनता है, simulator पहले b को delta delay के साथ update करता है, और फिर अगले delta step में c को अपडेट करता है। बिना delta delay के, updates का order ambiguous होता और race conditions आ सकती थीं।
Verilog में यह mechanism explicit नहीं होता। Verilog में continuous assignments “instantly” propagate होते हैं, लेकिन internally event scheduling चलता रहता है। VHDL में delta delay explicitly बताया गया है।
उदाहरण:
architecture dataflow of deltadelay is
signal a, b, c : std_logic;
begin
c <= a and b; -- आउटपुट c, इनपुट a और b पर निर्भर करता है
end architecture;

2.Variable
-
Processes, functions, या procedures के अंदर इस्तेमाल होता है।
-
तुरंत अपडेट होता है (कोई delay नहीं)।
Variables का उपयोग तब किया जाता है जब हम चाहते हैं कि value तुरंत update हो जाए, बिना signal के delta delay के।
Variables वास्तविक hardware connections नहीं होते, बल्कि केवल process के अंदर temporary storage की तरह होते हैं।
Sequential Process में Signals और Variables का व्यवहार
-
Signal → hardware wire या flip-flop की तरह। Synthesizer इसे hardware में implement करता है।
-
Variable → temporary scratch paper, synthesizer इसे intermediate calculations के लिए उपयोग करता है।
उदाहरण:
variable temp : integer := 0;
उदाहरण:
process(clk)
variable temp : std_logic;
begin
if rising_edge(clk) then
temp := a and b;
q <= temp;
end if;
end process;
-
Clock के rising edge पर, simulator तुरंत temp को a and b assign करता है।
-
फिर temp signal q को assign होता है।
-
Synthesizer केवल q को hardware में implement करेगा; temp vanish हो जाता है।
Combinational process में भी यही होता है। Variables तुरंत update होते हैं,
लेकिन signals delta cycle के बाद update होते हैं।
Example:
process(a, b)
variable x : std_logic;
signal y : std_logic;
begin
x := a and b;
y <= a and b;
end process;
3.Constant
Fixed value रखता है, जिसे बदला नहीं जा सकता।
-
Code को readable और reusable बनाता है।
-
Magic numbers से बचाता है।
-
Designs को parameterize करने में मदद करता है (जैसे word size, clock frequency, memory depth)।
-
Verilog में constants को parameters कहा जाता है।
उदाहरण:
constant WIDTH : integer := 8;
4.File
Simulation के दौरान external files से data read/write करने के लिए।
उदाहरण:
file data_file : text open read_mode is "input.txt";
Important Clarifications
File object हमेशा किसी file type के साथ declare किया जाता है, जैसे कि signals data type के साथ declare होते हैं।
तो summary:
-
File भी एक object है।
-
हर file object किसी file type के साथ declare होना चाहिए।
उदाहरण:
type text_file is file of string;
file log_file : text_file open write_mode is "output.txt";
text_file → file type
log_file → file object
