






















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
These lecture slides are from pakistani unvieristy. These are helpful in Data Communication Network course. I hope Instructor M. Mohisn Rahmattulah wont mind me making these public. I got it from my friend. Its points are: Digital, Parameters, Recursion, Function, Syntax, Routine, Readability, Simplicity, Locality, Portability, Reusability, Reconfigurability
Typology: Slides
1 / 30
This page cannot be seen from the preview
Don't miss anything!























HDL Based Digital Design using Verilog By M. Mohsin Rahmatullah @ SS-CARE School of Engineering
Task is called only from initial and alwaysblocks and other tasks in that module
Task contains any behavioral statements,including time control
Order of input, output, and inout definitionsdetermines binding of arguments
input argument may not be reg output arguments must be reg task^ task
HDL Based Digital Design using Verilog By M. Mohsin Rahmatullah @ SS-CARE School of Engineering Tasks
Syntax task_declaration ::= task task_identifier {task_item_declaration} statement or null endtask
HDL Based Digital Design using Verilog By M. Mohsin Rahmatullah @ SS-CARE School of Engineering Task Example task leading_1; input [7:0] data_word; output [2:0] position; reg [7:0] temp; reg [2:0] position; begin temp = data_word; position = 3'b111; while (!temp[7]) begin temp = temp << 1; position = position - 1; end end endtask
HDL Based Digital Design using Verilog By M. Mohsin Rahmatullah @ SS-CARE School of Engineering Functions Syntax:
function_declaration ::= function [range or type] function_identifier; function_call ::= function_identifier (expression {.. , expression})
Example:
HDL Based Digital Design using Verilog By M. Mohsin Rahmatullah @ SS-CARE School of Engineering Function Example function [2:0] leading_1; input [7:0] data_word; reg [7:0] temp; begin temp = data_word; leading_1 = 3'b111; while (!temp[7]) begin temp = temp << 1; leading_1 = leading_1 - 1; end end endfunction
HDL Based Digital Design using Verilog By M. Mohsin Rahmatullah @ SS-CARE School of Engineering Time Scales Define a time scale for the module dummy //Reference time unit is 100 nanoseconds and precision is 1 ns
HDL Based Digital Design using Verilog By M. Mohsin Rahmatullah @ SS-CARE School of Engineering Programming Language Interface (PLI)
HDL Based Digital Design using Verilog By M. Mohsin Rahmatullah @ SS-CARE School of Engineering
HDL Based Digital Design using Verilog By M. Mohsin Rahmatullah @ SS-CARE School of Engineering Reusable RTL Coding Guidelines
Readability
Simplicity
Locality
Portability
Reusability
Reconfigurability
HDL Based Digital Design using Verilog By M. Mohsin Rahmatullah @ SS-CARE School of Engineering File Header
Should be included for all source filesContents
author information revision history purpose description available parameters reset scheme and clock domain critical timing and asynchronous interface test structures
HDL Based Digital Design using Verilog By M. Mohsin Rahmatullah @ SS-CARE School of Engineering Comments and Formats
Appropriate comments
process (always block), function, Comment end statements
a fixed number between 72- Indentation 2 spaces avoid using tabs
HDL Based Digital Design using Verilog By M. Mohsin Rahmatullah @ SS-CARE School of Engineering Coding Practices
Little-endian for multi-bit bus
Do not assign signals don t-care values avoid don’t-care propagation Reset all storage elements
HDL Based Digital Design using Verilog By M. Mohsin Rahmatullah @ SS-CARE School of Engineering Coding Practices Use function to model combo logic
improve readability increase simulation and synthesis compilation time use array equivalent whenever possible
help debugging Foo u_foo(...);/single Foo u_foo1(...);//multiple Foo u_foo2(...); always@(a or b or c) begin: p_demo … end