VERILOG :4. Hierarchical Identifiers, Nets, Registers, and Strings
Verilog is one of the most widely used Hardware Description Languages (HDL) in digital system design. Whether you are building a simple counter or a complex processor, understanding the building blocks like nets, registers, strings, and hierarchical identifiers is essential.
In this blog, we’ll dive into these concepts with easy-to-follow explanations, practical examples, and diagrams to support learning.
🔹 1. Hierarchical Identifiers in Verilog
In Verilog, a hierarchical identifier allows you to reference variables, nets, or registers inside lower-level modules from a higher-level module (like the testbench).
👉 Why it matters?
It helps in debugging and monitoring signals deep inside a design without modifying the module code.
Example: Hierarchical Monitoring
✅ Here, we accessed tb.U.u0.sum and tb.U.u1.sum using hierarchical identifiers.
📷 Diagram:
-
Top module →
adder_hier -
Submodules →
u0, u1, u2, u3 -
Testbench monitors internal sums via hierarchical paths.
🔹 2. Nets in Verilog
A net represents a connection (wire) between components. Nets don’t hold values by themselves — they just connect outputs to inputs.
Common Net Types
Example: Using Different Nets
📷 Diagram:
-
Show wired-OR (multiple signals feeding into one bus with OR).
-
Show wired-AND (multiple signals feeding into AND).
🔹 3. Registers (reg) in Verilog
Unlike nets, registers (reg) hold values. They are updated inside procedural blocks (initial, always).
👉 Remember: reg does not mean hardware register; it simply means a variable that can store a value until reassigned.
Example: Register Usage
🔹 4. Strings in Verilog
Verilog allows string manipulation using arrays of 8-bit ASCII values.
Example: Strings
👉 Here, the string is stored as a packed array of 8-bit characters.
🎯 Conclusion
In this blog, we explored:
✔ Hierarchical identifiers (debugging internal signals)
✔ Nets (wire, wor, wand, tri) and their connectivity roles
✔ Registers (reg) as storage elements updated procedurally
✔ Strings as character arrays with escape sequences
With these foundations, you are ready to move toward Gate-Level Modeling and Simulation, where these primitives come together to form real digital designs.
📌 In the next blog, we’ll cover Gate-Level Modeling in Verilog with primitives and switch-level modeling.


Comments
Post a Comment