Home Verilog Digital Design Digital Basics Python RF Basics

Legal Disclaimer

Chip Designing for ASIC/ FPGA Design engineers and Students
FULLCHIPDESIGN
Digital-logic Design...  Dream for many students… start learning front-end…
Topics @TYH :- 4G LTE Tutorial, GVIM editor, Smart-Phone, Cloud Computing
FCD
Custom Search

Feedback ? Send it to admin@fullchipdesign.com or join me at fullchip@gmail.com

Legal Disclaimer

Previous.
Next.
Introduction Operators Initial stms Block vs. Non Blk IF-ELSE, CASE FORLOOP File Operations Read .bin format Function Call Testbench Random Numbers Shift Micro-ops Sync RAM Mem Generate Assertions Signed RTL
Verilog Tutorial.
Digital Basics Tutorial.
/*Function declaration and calling a function is discussed in this section.*/

reg [5:0] counter_binary, counter_binary_reg, counter_gray, counter_gray_reg;
integer count, file_wr;

/*Function to get Gray code from Binary code*/

function[5:0] binary2gray ;
   input[5:0] value;
   integer i;

   begin
        binary2gray[5] = value[5];
       for (i=5; i>0; i = i - 1)
           binary2gray[i-1] = value[i] ^ value[i - 1];
   end
endfunction
//Calling a function
always @(*)
begin
   counter_binary = counter_binary_reg;
  counter_gray = binary2gray(counter_binary_reg);
end
endmodule
Verilog Function declaration and call.
Complete usage of the above verilog function declaration and call is discussed in program at following link.
Interview Questions. Main, FPGA, Digital basics  
Interview Questions. Main, FPGA, Digital basics.
A function is discussed below to convert binary number to gray code number. The name of function is quite descriptive and we will be using this function later in complete programs. Declaration of verilog functions are always associated with function calls.  
LTE - Long Term Evolution topics from here
Read .bin format.
Testbench.
Previous                         Next