Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Usage of always inside a function in Verilog

Status
Not open for further replies.

Bubs23

Newbie level 5
Joined
Oct 4, 2010
Messages
9
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,283
Activity points
1,326
Hi All,
I know this a very basic question i am posting.But i need correct answer for this.Can we write functions in verilog using always block.Can functions contain always block.Please explain it with an example.This is the question asked put to me in many interviews.

Thanks,
Bubs:-o
 

I think this link will help you

**broken link removed**
**broken link removed**

"A function can only be used if the module has at least one argument to be passed and requires only one argument returned from the function. A function can only be called from within an always or initial block within the module. The function is not allowed to contain either of these two statements, also any delay, event or timing control statements are forbidden. A function can use an input port they are allowed local variables as depicted in the page on syntax. Wires are not allowed and the complete function must be written using behavioral statements only. The actual manipulation of data in the function has to be placed between begin and end statements."

Alex
 

you can use more than one @() statement within an always block. more common for simulation.
 

how to declare bit vector signals in verilog?
like i need,
input [0:2] portin [0:2];
how can this declaration be done?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top